Greasemonkey message box / redirect - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Greasemonkey message box / redirect (/showthread.php?tid=93554) Greasemonkey message box / redirect by Jimbo on 01-16-2010 at 11:14 PM Is there a way to look for a word on a page using Greasemonkey, and if that word appears anywhere on the page, either display a message box, that the user has to click OK, or just redirect to another page instantly? RE: Greasemonkey message box / redirect by andrey on 01-17-2010 at 12:21 AM
how about JS code:but that would include any other inline stuff in the source (js in <script> tags, css etc) RE: Greasemonkey message box / redirect by Jimbo on 01-17-2010 at 12:52 AM
Well, I've managed to come up with this, although it spams the alert for every instance of the word. How could I make it only alert once? js code:Also, what if the word wasnt actually hardcoded into the page source, but retrieved from a session, or something, how could I detect the word then? RE: Greasemonkey message box / redirect by stoshrocket on 01-17-2010 at 11:44 AM
To prevent alert spamming you could just build in a variable in place of the alert that is changed to 1 when a word is found, then after the search has been made, check the variable, if = 1, alert... js code: I'm, not too strong on the javascript front so the code might not be solid, but in theory it should work! As for searching the word outside of the source I have no clue... RE: Greasemonkey message box / redirect by Jimbo on 01-17-2010 at 01:38 PM
Oh yeah, don't know why I didnt think of doing that. Thanks a lot. RE: Greasemonkey message box / redirect by stoshrocket on 01-17-2010 at 03:52 PM
quote:I don't actually get what you're trying to do tbh, I understand about looking for a word in a page source, but when would you find, or even look, for a word outside of that? Example of where you're trying to find the word? RE: Greasemonkey message box / redirect by Jimbo on 01-17-2010 at 04:46 PM Well, this is for a friend of mine, and its for a game called Pokemon battle arena. He wants it to alert him when the word "shiny" is found in the page, but since this isnt hardcoded, and the URL has a random set of arguments for each pokemon encounter, I was wondering if there would be a way to scan the page body, even if the word wasnt in the source. RE: Greasemonkey message box / redirect by stoshrocket on 01-17-2010 at 05:23 PM
quote:Ah, I've just taken a look at the game. I see what you mean about it not actually being in the source, but I can see where the text is meant to appear in the source, it's just been hidden. Hmm... I'm not too sure at the moment, if I think of a method I'll let you know. RE: RE: Greasemonkey message box / redirect by Jimbo on 01-17-2010 at 05:40 PM
quote:Okay then, thank you very much. RE: Greasemonkey message box / redirect by andrey on 01-17-2010 at 06:42 PM
just to make sure i'm getting this right, this is where the "shiny whatever" will appear? RE: Greasemonkey message box / redirect by Jimbo on 01-17-2010 at 07:02 PM Yes, it will say Shiny in the section with the level and pokemon, and IIRC, it even says, "Wild Shiny Appeared". RE: Greasemonkey message box / redirect by kezz on 01-17-2010 at 10:01 PM Slightly offtopic, but Jimbo: Your site has been very well designed and implemented. Did you code it all yourself? It's very clean, efficient and problem-free. If I didn't get ridiculous pings to UK servers I'd play yours. RE: Greasemonkey message box / redirect by Jimbo on 01-17-2010 at 10:08 PM You think so? really? A friend of mine did the basic design, with the one simple theme, then I added all the content and different themes myself. I personally don't like it much, but hey, it gets the job done for what it has to do. RE: Greasemonkey message box / redirect by andrey on 01-17-2010 at 11:32 PM
Well, I've looked a bit into how the page handles those shiny things and came up with a script that should show an alert when a shiny pokemon is found. But I can't figure out how to get it working in this hackish greasemonkey piece of shit, I can't get it to replace the state_change_navi function with my modified one. But you get the idea. (this script works as a UserJS in Opera btw) RE: Greasemonkey message box / redirect by Jimbo on 01-18-2010 at 12:10 AM
Thanks andrey, I'll get my friend to download Opera and try that out later. RE: Greasemonkey message box / redirect by andrey on 01-18-2010 at 12:29 AM
didn't work? =/ RE: Greasemonkey message box / redirect by Jimbo on 01-18-2010 at 12:49 AM Yeah, I made sure he did install it correctly before reporting it didn't work |