function init_throbber(){ GM_addStyle("#hiu_throbber{position:fixed;left:0;top:0;background-color:#242424;z-index:1001;" + "display:none;opacity:0;transition:opacity 0.7s ease 0s;}"); GM_addStyle("#hiu_throbber_img{position:fixed;left:calc(50% - 64px);top:calc(50% - 64px);width:128px;height:128px;z-index:1002;" + "display:none;opacity:0;transition:opacity 0.7s ease 0s;border:0;padding:0;}"); GM_addStyle(".hfr_apercu_nope{display:none !important;}"); var throbber_image_url = "http://reho.st/self/30271dc1b7cac925aeabb89fa70e1e17cf5e1840.png"; var hiu_throbber_img = new Image(); hiu_throbber_img.src = throbber_image_url; hiu_throbber_img.setAttribute("id", "hiu_throbber_img"); var hiu_throbber = document.createElement("div"); hiu_throbber.setAttribute("id", "hiu_throbber"); hiu_throbber.appendChild(hiu_throbber_img); hiu_throbber.addEventListener("transitionend", throbber_transitionend, false); document.body.appendChild(hiu_throbber); } function display_throbber(){ if(document.querySelector("div#apercu_reponse")){ document.querySelector("div#apercu_reponse").classList.add("hfr_apercu_nope"); } hiu_throbber_img.style.display = "block"; hiu_throbber.style.display = "block"; hiu_throbber.style.width = document.documentElement.scrollWidth + "px"; hiu_throbber.style.height = document.documentElement.scrollHeight + "px"; hiu_throbber_img.style.opacity = "1"; hiu_throbber.style.opacity = "0.8"; } function throbber_transitionend() { if(hiu_throbber.style.opacity === "0") { hiu_throbber_img.style.display = "none"; hiu_throbber.style.display = "none"; if(document.querySelector("div#apercu_reponse")){ document.querySelector("div#apercu_reponse").classList.remove("hfr_apercu_nope"); } } } function hide_throbber(){ hiu_throbber_img.style.opacity = "0"; hiu_throbber.style.opacity = "0"; } init_throbber();