[Greasemonkey] Three Minor Questions
CBWhiz
cbwhiz at gmail.com
Sat Feb 4 01:05:21 EST 2006
(These were written but didn't post before I signed up, excuse the quote
marks and pushing of the questions into one)
> Hello, I'm a bit of a newbie at (advanced) greasemonkey hacking. I'd
> like to override alert(), so that when the document in question calls
> it, my code is called instead.
>
> This code:
>
> unsafeWindow.alert = function(text) { };
>
> fails, though when run in an interactive JS shell session
> (http://www.squarefree.com/shell/) (using window instead of
> unsafeWindow) it replaces alert() correctly.
>
> I belive the alert in question is called by the page's onload() handler.
>
> If somebody should show me how to do this, i'd be very appreciated.
>
> Thanks,
>
> -CBWhiz
>
----------------------------------------------------------------------------
Hello.
I'm writing a script that emulates on the following sequence:
1. User types captcha
2. User clicks button
3. page POSTs to another page
4. This page either holds 'error' or a link.
Obviously, 1 and 2 are un-automatable. 3 takes place, which leads us to 4.
This is the page I want to react on. I can sucessfully detect the
'error' condition - and on this paticular server the error is "we're not
ready yet" - in other words, pressing F5 or hitting reload in about 10
seconds corrects the error.
To automate this, i tried location.reload(). However, Firefox asks, "Are
you sure... POST data resubmitted...". I know that this is a security /
stupidity feature, but is there any way to work around it? If i could
get the current POSTed data I might be able to, but i'm not sure how i'd
go about that.
Any advice would be much appreciated.
-CBWhiz
----------------------------------------------------------------------------
I was also curios if there is anyway to stop firefox from loading "now
unused" page elements. I have a script that crawls an image gallery's
page, replacing <a href="big.jpg"><img src="small.jpg"></a> type code
with <img src="big.jpg">. Obviously, the small.jpg images are never
desired, but firefox insists on downlaoding them anyway. In fact, this
often delays Greasemonkey's injection (at least, it appears that way).
Do you now how one might solve this?
More information about the Greasemonkey
mailing list