I'm having some trouble calling my script after a page makes an AJAX
call to load a new page.

Basically, I'm trying to create a script for http://4walled.org/ that
changes a portion of the links on the search page from "edit.php?
filename=" to simply "src/", so the links link straight to the image
instead of the meaningless "edit" page, with the direct link on it.

The script works just fine on the first set of images, but when you
scroll to the bottom of the page the site makes a jQuery call to load
a new page dynamically. The result, the first set of links are just
fine with "http://4walled.org/src/image.jpg";, but the dynamically
loaded links are still linking to "http://4walled.org/edit.php?
filename=image.jpg". I know I need to call the script again after the
AJAX call, but I'm not sure exactly how.

Here it is so far (sorry if the code's sloppy):


// ==UserScript==
// @name         4walled Direct Links
// @namespace    about:blank
// @description  Changes links in the 4walled gallery to direct links.
By PhillySaxon.
// @include      http://4walled.org/*
// ==/UserScript==

function convertLinks() {
        var allLinks = document.getElementsByTagName('a')

        for(var i=0; i < allLinks.length; i++) {
        if (allLinks[i].href.match('/?edit')){
                        allLinks[i].href = 
allLinks[i].href.replace('/edit.php?filename=','/
src/');
                        allLinks[i].href = allLinks[i].href += '';}
        }
}

convertLinks();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to