I have a selector which works in GM_addStyle but not in jQuery. I want to use jQuery :contains() which is not available in CSS3.
But, it appear
Waiting for the element:
function waitForElement(id, callback, timeout){
if('undefined' == typeof timeout) timeout = 30;
timeout = timeout * 1000;
var time = 0;
var poops = setInterval(function(){
if(time >= timeout) clearInterval(poops);
if(document.getElementById(id)){
clearInterval(poops);
callback();
}
time += 100;
}, 100);
}
One way to include jQuery:
(function(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-1.11.3.min.js");
script.addEventListener('load', callback);
document.body.appendChild(script);
})
// main codez go in here
(function(){
window.alert($('a').length+" Links");
});