greasemonkey

How do I open a list of pages automatically and sequentially?

断了今生、忘了曾经 提交于 2019-11-27 06:28:50
问题 I wish to load a list of webpages sequentially, with Greasemonkey. var list = array ('http://www.google.com', 'site2', 'site3', 'site4'); window.location.href = list[0]; The script should work as follows: open site 1, wait 5 seconds, open site 2, wait 5 seconds, etc. I don't know how to make the script open sites in sequence, maybe compare the actual URL to the list and move on the next one(?). 回答1: This approach, for Chrome, will also work in Greasemonkey. Put your sites in an array, like

Greasemonkey Jquery Script to Click Links

佐手、 提交于 2019-11-27 06:26:22
问题 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

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

青春壹個敷衍的年華 提交于 2019-11-27 06:10:13
问题 This question already has answers here : Redirect faster with Greasemonkey (or similar userscript engine)? (3 answers) Closed 10 months ago . 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 ? 回答1: This is simply how I would go about redirecting: //==UserScript== // @name Redirect Google // @namespace whatever.whatever... // @description Redirect Google to Yahoo! // @include

Apply a Greasemonkey/Tampermonkey/userscript to an iframe?

本秂侑毒 提交于 2019-11-27 05:16:21
The title is pretty much the question: Is it possible to add a Greasemonkey script to an iframed website? If so, how? Thank you. In Greasemonkey (And Tampermonkey and most userscript engines) a script will fire on an iframe automatically if it meets the @include , @exclude , and/or @match directives. And, a popular question is how to stop Greasemonkey from firing on iframes . So, if your script had a match like: @match https://fiddle.jshell.net/* It would fire on jsFiddle "output" pages whether or not they appeared in an iframe. If you wanted to fire on a JUST iframed content: Then you would

How do I get Greasemonkey to click on a button that only appears after a delay?

﹥>﹥吖頭↗ 提交于 2019-11-27 05:13:25
I've seen a lot of similar questions and I've tried everything I can think of to get this to work on my own. First the relevant code (¿from the target page?): document.getElementById('btn_submit').innerHTML = '<input type="hidden" value="17271" name="idofclick"> <input type="submit" value=" Click Me Now! " name="submit_com" class="padding2">'; Basically there is a timer on the page and the "click me now!" button appears after 3 secs, that's the part I want to click on. This is my code. It's not working: // ==UserScript== // @name abc // @namespace something // @description abc Scripty //

Closure in Javascript [duplicate]

烈酒焚心 提交于 2019-11-27 05:13:06
Possible Duplicate: Passing values to onclick I have 100 elements with ids divNum0 ,..., divNum99 . Each when clicked should call doTask with the right parameter. The code below unfortunately does not close i, and hence doTask is called with 100 for all the elements. function doTask(x) {alert(x);} for (var i=0; i<100; ++i) { document.getElementById('divNum'+i).addEventListener('click',function() {doTask(i);},false); } Is there someway I can make the function called with right parameters? user187291 Although the (correct) answer is the duplicate , I'd like to point out a more advanced method -

Can jQuery selectors be used with DOM mutation observers?

时间秒杀一切 提交于 2019-11-27 05:07:24
问题 HTML5 includes a concept of "mutation observers" to monitor changes to the browser's DOM. Your observer callback will be passed data which looks a lot like DOM tree snippets. I don't know if they are exactly this or how they work really. But when you are writing code to interact with a 3rd party site over which you have no control, say with a Greasemonkey script or Google Chrome user script, you have to inspect the tree of elements passed in to find which information is relevant to you. This

How to override the alert function with a userscript?

瘦欲@ 提交于 2019-11-27 04:55:04
On site there is code like that (its site on LAN) <script language="JavaScript" type="text/javascript"> alert("ble"); </script> I try to disable that alert using GM. I was trying to do this unsafeWindow.alert=function() {}; but I see the alert and get this error Error: uncaught exception: [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Documents%20and%20Settings/arokitnicki/Dane%20aplikacji/Mozilla/Firefox/Profiles/sm4bsods.default/extensions/%7Be4a8a97b-f2ed-450b-b12d-ee082ba24781%7D/components/greasemonkey.js ::

How can you determine the file size in JavaScript?

梦想与她 提交于 2019-11-27 04:52:53
I help moderate a forum online, and on this forum we restrict the size of signatures. At the moment we test this via a simple Greasemonkey script I wrote; we wrap all signatures with a <div> , the script looks for them, and then measures the div's height and width. All the script does right now is make sure the signature resides in a particular height/width. I would like to start measuring the file size of the images inside of a signature automatically so that the script can automatically flag users who are including huge images in their signature. However, I can't seem to find a way to

Watch for element creation in greasemonkey script?

只谈情不闲聊 提交于 2019-11-27 04:39:48
问题 I need to be notified when an element with class 'nav' is created as the document is loading. Googling I found MutationObservers and thought they would be perfect, but I can't seem to get it working. // ==UserScript== // @name ii-shortcuts // @namespace https://github.com/RedHatter // @include * // @version 1 // @run-at document-start // ==/UserScript== var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.target.getAttribute('class') ==