Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4. function init_throbber(){
  5.   GM_addStyle("#hiu_throbber{position:fixed;left:0;top:0;background-color:#242424;z-index:1001;" +
  6.               "display:none;opacity:0;transition:opacity 0.7s ease 0s;}");
  7.   GM_addStyle("#hiu_throbber_img{position:fixed;left:calc(50% - 64px);top:calc(50% - 64px);width:128px;height:128px;z-index:1002;" +
  8.               "display:none;opacity:0;transition:opacity 0.7s ease 0s;border:0;padding:0;}");
  9.   GM_addStyle(".hfr_apercu_nope{display:none !important;}");
  10.   var throbber_image_url = "http://reho.st/self/30271dc1b7cac925aeabb89fa70e1e17cf5e1840.png";
  11.   var hiu_throbber_img = new Image();
  12.   hiu_throbber_img.src = throbber_image_url;
  13.   hiu_throbber_img.setAttribute("id", "hiu_throbber_img");
  14.   var hiu_throbber = document.createElement("div");
  15.   hiu_throbber.setAttribute("id", "hiu_throbber");
  16.   hiu_throbber.appendChild(hiu_throbber_img);
  17.   hiu_throbber.addEventListener("transitionend", throbber_transitionend, false);
  18.   document.body.appendChild(hiu_throbber);
  19. }
  20.  
  21. function display_throbber(){
  22.   if(document.querySelector("div#apercu_reponse")){
  23.     document.querySelector("div#apercu_reponse").classList.add("hfr_apercu_nope");
  24.   }
  25.   hiu_throbber_img.style.display = "block";
  26.   hiu_throbber.style.display = "block";
  27.   hiu_throbber.style.width = document.documentElement.scrollWidth + "px";
  28.   hiu_throbber.style.height = document.documentElement.scrollHeight + "px";
  29.   hiu_throbber_img.style.opacity = "1";
  30.   hiu_throbber.style.opacity = "0.8";
  31. }
  32.  
  33. function throbber_transitionend() {
  34.   if(hiu_throbber.style.opacity === "0") {
  35.     hiu_throbber_img.style.display = "none";
  36.     hiu_throbber.style.display = "none";
  37.     if(document.querySelector("div#apercu_reponse")){
  38.       document.querySelector("div#apercu_reponse").classList.remove("hfr_apercu_nope");
  39.     }
  40.   }
  41. }
  42.  
  43. function hide_throbber(){
  44.   hiu_throbber_img.style.opacity = "0";
  45.   hiu_throbber.style.opacity = "0";
  46. }
  47.  
  48. init_throbber();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement