Firefox 57+ autohide scrollbars

Autohide scrollbars solution for Firefox 57+ WebExtensions obstacles. Tips for tweaks are appreciated :) source: https://www.reddit.com/r/firefox/comments/6v6otw/webex_replacement_for_hidescrollbars/

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Firefox 57+ autohide scrollbars
// @namespace
// @match *://*/*
// @grant none
// @version 0.111
// @description Autohide scrollbars solution for Firefox 57+ WebExtensions obstacles. Tips for tweaks are appreciated :) source: https://www.reddit.com/r/firefox/comments/6v6otw/webex_replacement_for_hidescrollbars/
// @namespace https://greasyfork.org/users/8770
// ==/UserScript==

var HSB_timer;
function HSB_hideScrollbar(){
  var s = document.getElementById('HSB_css');
  if (!s) {
    s = document.createElement('style');
    s.id = 'HSB_css';
    document.body.appendChild(s);
  }
  s.appendChild(document.createTextNode('html, body {overflow-y: hidden !important;}'));
}
function HSB_showScrollbar(){
  var s = document.getElementById('HSB_css');
  if (s && s.childNodes.length > 0) s.firstChild.remove();
  if (HSB_timer) window.clearTimeout(HSB_timer);
  HSB_timer = window.setTimeout(HSB_hideScrollbar, 1000);
}
document.addEventListener("wheel", HSB_showScrollbar, false);
HSB_hideScrollbar();