- Mar 22, 2013
- 8,743
- 10,291
There is this code on a site:
Sometimes it turns into this:
When this happens, I want Greasemonkey to click a button. The best I came up with is this:
So when the word "outline" appears in the HTML of the page, the script clicks the button.
I'd have it work on a fast "setInterval", but the problem is that the word "outline" can appear on the webpage even when I don't want the button clicked (i have another script that removes the word if it appears at the wrong time and place).
This is kinda stupid though
How can I make the script check the ID (somet) and Style (outline), and if both of these conditions are true, run the code and click the button? @Gogol
HTML:
<input id="somet" name="somet" type="text">
Sometimes it turns into this:
HTML:
<input id="somet" name="somet" style="outline: 1px solid blue;" type="text">
When this happens, I want Greasemonkey to click a button. The best I came up with is this:
Code:
// ==UserScript==
// @name Click Submit
// @namespace bdfb
// @match https://www.site.org/
// @include about:config
// @version 1
// @grant none
// ==/UserScript==
var intv = setTimeout(function() {
if (/(outline)|(mediumheight)/i.test (document.body.innerHTML) ){
{
var elems = document.querySelectorAll('input[name^="Submit"]'); for (var i = 0, len = elems.length; i < len; i++){ elems[i].click(); }
}
}
}, 25000);
So when the word "outline" appears in the HTML of the page, the script clicks the button.
I'd have it work on a fast "setInterval", but the problem is that the word "outline" can appear on the webpage even when I don't want the button clicked (i have another script that removes the word if it appears at the wrong time and place).
This is kinda stupid though
How can I make the script check the ID (somet) and Style (outline), and if both of these conditions are true, run the code and click the button? @Gogol