freddyw Posted May 26, 2010 Share Posted May 26, 2010 Hey people. Here's something I'm trying to do and really cant figure out how to go about it. So I have a webpage and inside the webpage this piece of code appears several times <span class="icon private"></span> <div class="meta"><span>190 Images</span></div> The amount of times that piece of code appears is never certain. Nor is the number (or integer if we must) that is inside it. What I'm trying to create is a Greasemonkey script that will take the number from inside that snippet of code each time it appears and add them up and produce a total. Any thoughts are greatly appreciated. Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted May 27, 2010 Share Posted May 27, 2010 What I'm trying to create is a Greasemonkey script that will take the number from inside that snippet of code each time it appears and add them up and produce a total. Here is a thought try a combination of grease monkey + jquery (or another framework) http://www.google.com/#q=jquery+greasemonkey That what it will be easy to search for that code sniplet and filter out the number. Quote Link to comment Share on other sites More sharing options...
spambadger Posted May 28, 2010 Share Posted May 28, 2010 Can you do something like var tmp = 0; $('.meta span').each( function(){ tmp += parseInt($(this).text()); } ); alert(tmp); I've not used greasemonkey though, so I've no idea if that will work as is... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.