greasemonkey

window.load doesn't fire always on chrome?

前提是你 提交于 2019-11-28 12:45:30
I have this userscript: // ==UserScript== // @name test // @namespace test // @description show's an alert on load // @include http://* // @include https://* // ==/UserScript== window.addEventListener('load', function(){alert("loaded");}, false); This works fine on Firefox on all pages but doesn't work at all on Chrome at some occasions. One example is this website: http://lexin.nada.kth.se/lexin/ Entering the link in the address and hitting enter, loads the page normally but no alert is popped up. If you press F5 to refresh the page, the popup appears. Is there some explanation to this weird

How can I automatically select specific radio buttons with Greasemonkey?

一曲冷凌霜 提交于 2019-11-28 11:49:31
I want to automatically answer questions with Greasemonkey. I have the questions and answers, but how can select them? Here's the HTML: <div class="vito_form_q"> <div class="vito_form_title_min_no"> <span id="ContentPlaceHolder1_lblquestionNo">8</span> </div> <div class="vito_form_title_min"> <span id="ContentPlaceHolder1_lblquestion">Which sport is not playing with the ball?</span> </div> <div class="clearfloat"></div> <div class="meter orange nostripes"><span style="width: 100%"></span></div> <div class="quest"> <table id="rbAnswer" class="q1"> <tr><td> <input id="rbAnswer_0" type="radio"

Greasemonkey Jquery Script to Click Links

房东的猫 提交于 2019-11-28 11:45:45
I'm trying to do my first greasemonkey script. I'm fairly new to jquery and javascript, so be easy on me. Here is what I have so far. // ==UserScript== // @name load all page comments // @require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js // @namespace none // @include http://www.reddit.com/* // ==/UserScript== setInterval( function () { window.alert("Hello World!"); $("a:contains('load more comments')").click(); }, 10000); The goal here is to click on all of the "load more comments" page on a sample reddit page like this, and to loop doing it every ten seconds. http://www

How to relink/delink image URLs to point to the full image?

南笙酒味 提交于 2019-11-28 11:38:19
问题 I'm trying to change the URL's of a webpage on the fly using Greasemonkey. The target page has links like: <a name="217258323" href="http://foobar.net/photo/217258323/?pgid=&gid=4933418&page=0"> <img style="border:1px solid #fff;padding:5px;background:#fff;" height="120" width="160" alt="Gallery pic 1 of 20 pics" border="0" src="http://i.foo.net/images/thumb/52/217/217258323.jpg"> </a> I want to change them like: <a name="217258323" href="http://i.foo.net/images/full/52/217/217258323.jpg">

How can I redirect some page with javascript in Greasemonkey? [duplicate]

泄露秘密 提交于 2019-11-28 11:18:17
This question already has an answer here: Redirect faster with Greasemonkey (or similar userscript engine)? 3 answers Hey, I want to redirect a page when it finish loading... For example, when google.com finish loading, I want to send a javascript to search something... How can I do it ? This is simply how I would go about redirecting: //==UserScript== // @name Redirect Google // @namespace whatever.whatever... // @description Redirect Google to Yahoo! // @include http://www.google.com // @include http://www.google.com/* // @include http://*.google.com/* //==/UserScript== window.location =

execute function only once

你。 提交于 2019-11-28 10:40:45
问题 I'm writing a greasemonkey script and want to call the start function only once after the page loads - it's for facebook. First I started with following code: function start(){ alert("hello"); } start(); The start() function was executed more then once. So I changed the code to following: jQuery.noConflict(); window.stoop = 0; jQuery(document).ready(function(){ if(window.stoop == 0){ start(); } window.stoop = 55; //or window.stoop++; }); function start(){ alert("hello"); } The problem is that

Greasemonkey: Highlight many words in a HTML-File

心已入冬 提交于 2019-11-28 10:39:08
问题 I want to use Greasemonkey to highlight two words e.g. "Basel, Bern". If I use only Basel the version below works. Not very well but well enough. But when I use two words the highlighting doesn't work. // ==UserScript== // @name highlight-some-words // @description highlight some words in html // @grant none // ==/UserScript== document.body.innerHTML= document.body.innerHTML.replace(/Basel|Bern/g, function(m){ return '<span style="background-color:lightgreen">'+m+'</span>' }); EDIT:

Matching multiline Patterns

匆匆过客 提交于 2019-11-28 10:08:09
问题 I want to use greasemonkey to scrape wiki data from Last.fm (this is not possible with their REST api). I can grab the page fine with GM_xmlhttpRequest(), and it is returning properly. I do not want to use a DOM processor to process the whole page, since I only want a small chunk, so I'm using regular expressions. The wiki data is in the page like: <div id="wiki"> description description ... </div> So I wrote: /\<div id="wiki"\>(.+)\<\/div\>/m.exec(data)[1]; When I test this in error console

tampermonkey script stops working if I change the page

邮差的信 提交于 2019-11-28 10:04:01
问题 I am using Tampermonkey to save time on frequent tasks. The goal is to get content of an element on www.example1.com, navigate to another page, and do stuff there. The starting page is www.example1.com as seen from match . This is the code I am using: //@match http://example1.com var item = document.getElementById("myId").textContent; window.open("http://example2.com","_self"); setTimeOut(function( //perform clicks on this page ){},3000); None of the code after changing URLs ever gets

Understanding how Greasemonkey runs user scripts

懵懂的女人 提交于 2019-11-28 09:54:07
I'm learning Greasemonkey with the hopes of making some improvements to a webpage. I think I have a good grasp of JavaScript, but I don't understand at what point in the rendering of the document the Greasemonkey user script is executed. For instance, what if there is JavaScript natively inside the document that inserts some elements to the page. I want my Greasemonkey script to run only after that JS completes. Let's say this is the document that I'm trying to modify with Greasemonkey <html> <script> //insert a button with id="mybutton" </script> </html> I want the <script> code to complete