(windows).mouseleave(function() {

Ask for help about NoScript, no registration needed to post
Smorgen

(windows).mouseleave(function() {

Post by Smorgen »

Hey,

I find this function highly annoying; (windows).mouseleave(function() {
How can we block this? What is does is pop up a window with register, subscribe to newsletter ect....
You can see it on http://www.geektime.com for example. Click on any article, then move your mouse to top of screen and it appears. It's very popular these days.

/Smorgen
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

If you can't just disable JS on the site, create a surrogate script that blocks the mouseleave event from being sent.

Untested, but a starting point:

replacement:

Code: Select all

window.addEventListener("mouseleave", function(e){e.stopImmediatePropagation();}, false);
sources:

Code: Select all

@.geektime.com
*Always* check the changelogs BEFORE updating that important software!
-
Smorgen

Re: (windows).mouseleave(function() {

Post by Smorgen »

It's not only that site, it's a lot of them. Can you do a *.com, *.net etc...?
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Smorgen

Re: (windows).mouseleave(function() {

Post by Smorgen »

I'm retarded when it comes to these kinds of things.....where do I add that?
Coding is like rocket science to me, it just doesn't compute....
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

Smorgen wrote:It's not only that site, it's a lot of them. Can you do a *.com, *.net etc...?
Sure.. here's a sources value for all .com & .net:

Code: Select all

@^https?://[^/:]+\.(?:com|net)[/:]
Smorgen wrote:where do I add that?
go to about:config, right-click > new > string
name: noscript.surrogate.nomouseleave.replacement
value: replacement from above
right-click > new > string
name: noscript.surrogate.nomouseleave.sources
value: sources value from above

(you can change the "nomouseleave" to be anything you want as long as it's the same in the replacement & sources pref names)
*Always* check the changelogs BEFORE updating that important software!
-
Smorgen

Re: (windows).mouseleave(function() {

Post by Smorgen »

You are a genius!!
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

Thanks for the positive feedback and glad it helped! :D
*Always* check the changelogs BEFORE updating that important software!
-
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: (windows).mouseleave(function() {

Post by Thrawn »

barbaz wrote:

Code: Select all

@^https?://[^/:]+\.(?:com|net)[/:]
Why the (?: before the TLD?
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

Thrawn wrote:Why the (?: before the TLD?
Habit of mine to use non-capturing parentheses when not needing to capture the contents.
*Always* check the changelogs BEFORE updating that important software!
-
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: (windows).mouseleave(function() {

Post by Thrawn »

Simpler approach is to use a URL Matcher:

Code: Select all

@.com .net
Last edited by barbaz on Mon Jul 27, 2015 1:10 am, edited 1 time in total.
Reason: fix typo - delete extra space
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

Er, I kind of didn't know that was possible for TLDs Image
Thanks.
*Always* check the changelogs BEFORE updating that important software!
-
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: (windows).mouseleave(function() {

Post by Thrawn »

I believe URL matchers just do a text match, so they don't care whether it's a TLD.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0
Smorgen

Re: (windows).mouseleave(function() {

Post by Smorgen »

Some sites still has the mouseleave. I checked and they are .com or .net. Strange....
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
barbaz
Senior Member
Posts: 11068
Joined: Sat Aug 03, 2013 5:45 pm

Re: (windows).mouseleave(function() {

Post by barbaz »

3 things I can think to try:
1) change the "false" to true
2) add also listener for "mouseout" event

Code: Select all

window.addEventListener("mouseleave", function(e){e.stopImmediatePropagation();}, false);window.addEventListener("mouseout", function(e){e.stopImmediatePropagation();}, false);
3) stopPropagation as well as stopImmediatePropagation (actually, I'm not sure if it's already fully covered by stopImmediatePropagation or not... but in case not...)

Code: Select all

window.addEventListener("mouseleave", function(e){e.stopImmediatePropagation();e.stopPropagation();}, false);
If none of those works, can you please provide a URL?
*Always* check the changelogs BEFORE updating that important software!
-
Smorgen

Re: (windows).mouseleave(function() {

Post by Smorgen »

It works!
It was this site; http://www.supercompressor.com/ if you want to check it yourself.

Thanks a lot!

/Smorgen
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Post Reply