This is a script I borrowed and modified. It used to work but now
doesn't seem to do anything, even on a simple test webpage I created.
The idea is to modify text within links found on a website. The test I
was running was to replace the word google with the word foo in any <a
href> link. The 2nd replacement tries to remove any reference to a
particular website (within a link).
However, it isn't working. Did I mistype something? Is there a better
approach?
// ==UserScript==
// @name Link text replacer
// @namespace here
// @description replace text in links
// @include *
// ==/UserScript==
var anchors = document.getElementsByTagName('a');
for ( var i = 0; i < anchors.length; i++ ) {
var link = anchors[i].href.replace( /google/, "foo" );
var link = anchors[i].href.replace( /trafficholder.com/, "" );
anchors[i].href = link;
}
--
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.