Advertisement
Guest User

Untitled

a guest
Nov 12th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        MikroBox
  3. // @namespace   MikroBox
  4. // @include     http://www.wykop.pl/mikroblog/*
  5. // @include     http://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
Advertisement