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/

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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();