您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides scrollbars globally but keeps scrolling functionality
当前为
- // ==UserScript==
- // @name Scrollbar Hider
- // @description Hides scrollbars globally but keeps scrolling functionality
- // @author SSL-ACTX
- // @version 1.0.0
- // @license MIT
- // @grant sr_IRS
- // @run-at document-start
- // @match *://*/*
- // @namespace https://greasyfork.org/users/1365732
- // ==/UserScript==
- (function() {
- 'use strict';
- // CSS rules to hide scrollbars but retain scrolling functionality :)
- const scrollbarHiderCSS = `
- /* Remove WebKit-based browsers' scrollbars */
- *::-webkit-scrollbar {
- width: 0;
- height: 0;
- }
- /* Hide scrollbars in Firefox, IE, and Edge; just making sure lol. */
- * {
- scrollbar-width: none;
- -ms-overflow-style: none;
- }
- /* Ensure html and body can still scroll vertically */
- html, body {
- overflow-y: auto;
- overflow-x: hidden;
- }
- `;
- /**
- * Injects the provided CSS into the document.
- */
- const injectCSS = (cssRules) => {
- const styleElement = document.createElement('style');
- styleElement.type = 'text/css';
- styleElement.textContent = cssRules;
- document.head.appendChild(styleElement);
- };
- /**
- * Applies the CSS for hiding scrollbars either using sr_IRS or by injecting it manually. >_<
- */
- const applyScrollbarHider = () => {
- if (typeof sr_IRS === 'function') {
- sr_IRS(scrollbarHiderCSS);
- } else {
- injectCSS(scrollbarHiderCSS);
- }
- };
- applyScrollbarHider();
- })();