// ==UserScript== // @name 个性化、美化、自定义网页滚动条 // @namespace http://tampermonkey.net/ // @version 1.0.1 // @description 个性化、美化、自定义网页滚动条! // @author 戈小戈 // @match https://*/* // @match http://*/* // @icon https://s3.bmp.ovh/imgs/2021/09/a01be58228a8ea44.jpg // @license AGPL // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function changeScrollBar(){ if(!document.querySelector('style[title="gxg_custom"]')){ try { //IE下可行 var style_one = document.createStyleSheet(); style_one.title='gxg_custom'; style_one.cssText = "::-webkit-scrollbar {width : 6px; height: 1px;}::-webkit-scrollbar-thumb {border-radius : 10px;background-color: #1f9ae6;background-image: linear-gradient(0deg, #1f9ae6 0%, #00cfd8 80%, #e4e4e4 100%);}::-webkit-scrollbar-track {box-shadow : inset 0 0 10px rgba(0, 0, 0, 0.1);background : #ededed;}"; } catch (e) { //Firefox,Opera,Safari,Chrome下可行 var style_others = document.createElement("style"); style_others.type = "text/css"; style_others.title='gxg_custom'; style_others.textContent = "::-webkit-scrollbar {width : 6px; height: 1px;}::-webkit-scrollbar-thumb {border-radius : 10px;background-color: #1f9ae6;background-image: linear-gradient(0deg, #1f9ae6 0%, #00cfd8 80%, #e4e4e4 100%);}::-webkit-scrollbar-track {box-shadow : inset 0 0 10px rgba(0, 0, 0, 0.1);background : #ededed;}"; document.getElementsByTagName("head").item(0).appendChild(style_others); } } } setInterval(function(){ changeScrollBar(); }, 100); // Your code here... })();