I had a very similar idea.  Google Chrome has a great "prevent this page
from creating additional dialogues" checkbox.

Recently there was a thread where someone was over-riding setTimeout.  Using
that method it might be possible to achieve something however there is
a limitation with greasemonkey to this approach where some messages might
still show.  There are several types of dialogues to account for.  With run
at document start as described in that thread
http://groups.google.com/group/greasemonkey-users/browse_thread/thread/e90df945030ae6a7?hl=en
then
GM could really be used for securing scripts from doing all sorts of devious
things, although if your doing security minded stuff and making it public
then be very careful and don't use unsafeWindow or they will override your
functions too.

Ideally the script would display the message on the page instead, and
ideally the keyboard could still dismiss/ban dialogues.  No promises it will
actually work, I don't think I tried it already but there might be some
catch.

You might be best off doing this with an extension rather than a user-script
because you can catch things earlier in the load process.

On Wed, Mar 3, 2010 at 9:06 PM, lp9sc <[email protected]> wrote:

> Hello
> Does anyone know if it would be possible (or if there is already a
> script) for a script to modify the message box object in javascript
> for any website to add a 'break' button on that message box?
>
> That's kinda worded poorly.. here's a scenario:
>
> I'm browsing the web, and all of a sudden I get an advertisement
> thrown in my face.. no big deal.. I'll simply close this tab.. but oh
> wait.. it's popping up a message box asking me if I'm sure I'd like to
> leave the page which I then say yes to.
> Some advertisements don't stop there, they loop message boxes
> endlessly, it's really annoying.
> I'd like a button added to message boxes which will 'break' from that
> loop of annoying message boxes.
>
> There are a few ways around this which I already know of but they have
> their disadvantages.
> I could just disable javascript entirely but then I'd have to manually
> enable/disable for whenever I want it to be used or not which just
> gets repetitive.
>
> I could also use something like adblockplus.. which I am using.. it's
> not just ads that use this message box crap.
>
> If this is possible, could someone link me to this script or make it
> for me? :s
> I'm not good when it comes to javascript, it's the only web based
> language I havn't bothered with yet.
>
> Thanks in advanced :)
>
> --
> 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]<greasemonkey-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
>

-- 
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.

Reply via email to