User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » greasemonkey script - how difficult? Page [1]  
dFshadow
All American
9507 Posts
user info
edit post

i need a quick script for a forum in firefox that basically loads the page,

finds in the source of the page a URL with the words pid=000000 and returns whatever the string 000000 has in it and forms a button or link with a new modified URL using that number

how hard would that be?

3/12/2008 7:30:00 AM

qntmfred
retired
40555 Posts
user info
edit post

very easy
something to the effect of

var hyperlinks = document.getElementsByTagName('a');
for (var i = 0; i < hyperlinks.length; i++)
{
if (hyperlinks[i].href.match(/pid=(.*)/) != null)
{
var newlink = document.createElement('a');
newlink.href = 'http://somewebsite.com/index.php?pid=' + hyperlinks[i].href.match(/pid=(.*)/)[1];
newlink.innerHTML = 'link text';
document.getElementById('whereyouwanttoputit').appendChild(newlink);
break;
}
}


[Edited on March 12, 2008 at 8:34 AM. Reason : ought to do it]

3/12/2008 8:14:25 AM

dFshadow
All American
9507 Posts
user info
edit post

thanks i'll try that

3/12/2008 3:28:41 PM

 Message Boards » Tech Talk » greasemonkey script - how difficult? Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.