Skip to content Skip to sidebar Skip to footer

Greasemonkey Wait For Ajax

I have this code I want to execute it should open any links with the phrase '/ThisWord/' in it // ==UserScript== // @name Test // @namespace Test // @description Test //

Solution 1:

// ==UserScript==
// @name        Test
// @namespace   Test
// @description Test  
// @version     1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant       GM_openInTab
// @include     http://website.com/
// ==/UserScript==
setTimeout(testLinks, 10000);
function testLinks() {
    var INTERVAL = 10000;
    var delay = -INTERVAL;
    $('a[href*="/profile/"]').each(function(i, el) {
        //avoid infinite recursion, which is subject to @include rules
        if(el.href != location.href) {
            var d = (delay += INTERVAL);
            setTimeout(function() {
                GM_openInTab(el.href);
            }, d);
        }
    });
}

Post a Comment for "Greasemonkey Wait For Ajax"