Guest User

Untitled

a guest
Jan 27th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. // ==UserScript==
  2. // @name MikroBox
  3. // @namespace MikroBox
  4. // @include https://www.wykop.pl/mikroblog/*
  5. // @include https://www.wykop.pl/tag/*
  6. // @author P0lip
  7. // @version 1
  8. // @grant none
  9. // ==/UserScript==
  10. (function(){
  11. "use strict";
  12.  
  13. const target = document.getElementById("newEntriesCounter");
  14.  
  15. const observer = new MutationObserver(function(mutations){
  16. mutations.forEach(function(){
  17. let click = target.querySelector("a.dark");
  18. if(click)
  19. click.click();
  20. });
  21. });
  22.  
  23. if(target)
  24. observer.observe(target, { childList: true });
  25. Array.prototype.forEach.call(document.getElementsByName("btnReply"), function(elem){
  26. elem.addEventListener("click", function(){
  27. observer.disconnect();
  28. });
  29. });
  30.  
  31.  
  32. })();
Advertisement
Add Comment
Please, Sign In to add comment