JavaScript setTimeout cleared on Facebook in KRL app

I use setTimeout , which calls itself each time to constantly check the contents of different pages, since each page is loaded via ajax. It seems that JS Facebook works through all possible setTimeout links and calls clearTimeout for every render of my application is useless.

Is there a way to prevent the spread of my setTimeout as a helpless little bug from Facebook JS?

Here is my code so you can see what happens and test your solution if you want:

ruleset a60x542 { meta { name "shun-the-facebook-likes" description << shun-the-facebook-likes >> author "Mike Grace" logging off } dispatch { domain "facebook.com" } rule find_the_likes { select when pageview "facebook\.com" { emit <| KOBJ.a60x542.removeLikes = function() { $K(".uiUfiLike, .like_link, .cmnt_like_link").remove(); var timeout = window.setTimeout(function() { KOBJ.a60x542.removeLikes(); }, 4000); console.log(timeout); } // removeLikes() KOBJ.a60x542.removeLikes(); |>; } } } 
+4
source share
2 answers

Are you sure FAcebooks clears your timeouts?

Does your console.log work?

You can use setInterval to execute your function.

0
source

Try this, a solution that worked for me:

 function fooBar(){ // your code goes here console.log("see me every second"); setTimeout(fooBar, 1000); } setTimeout(fooBar, 1000); 
0
source

Source: https://habr.com/ru/post/1339165/


All Articles