(function () { const colorKeys = [ "ThreeDFace", "ThreeDShadow", "ThreeDDarkShadow", "ThreeDLightShadow", "ThreeDHighlight", "ButtonText", ]; const colors = (() => { const colors = {}; const elem = document.createElement("div"); document.body.appendChild(elem); for (const key of colorKeys) { elem.style.color = key; colors[key] = window.getComputedStyle(elem).color; } document.body.removeChild(elem); return colors; })(); const css = `@media all and (-moz-overlay-scrollbars) { scrollbar[root="true"] { position: relative; z-index: 2147483647; } scrollbar:not([active="true"]), scrollbar[disabled="true"] { visibility: hidden; } } scrollbar { color-scheme: light !important; -moz-default-appearance: none; -moz-binding: url("chrome://global/content/bindings/scrollbar.xml#scrollbar"); cursor: default; min-width: 16px !important; background-color: ${colors.ThreeDHighlight} !important; opacity: 1 !important; } thumb { color-scheme: light !important; -moz-default-appearance: none !important; position: relative !important; background-color: ${colors.ThreeDFace} !important; min-height: 8px !important; pointer-events: auto !important; border: 0 !important; box-shadow: inset -1px -1px 0 ${colors.ThreeDDarkShadow}, inset 1px 1px 0 ${colors.ThreeDLightShadow}, inset -2px -2px 0 ${colors.ThreeDShadow}, inset 2px 2px 0 ${colors.ThreeDHighlight} !important; } thumb[orient="horizontal"] { -moz-default-appearance: none; min-height: 16px !important; min-width: 8px !important; max-width: 100% !important; background-repeat: no-repeat !important; } scrollbarbutton { color-scheme: light !important; min-width: 16px !important; min-height: 16px !important; -moz-default-appearance: none !important; background-color: ${colors.ThreeDFace} !important; box-shadow: inset -1px -1px 0 ${colors.ThreeDDarkShadow}, inset 1px 1px 0 ${colors.ThreeDLightShadow}, inset -2px -2px 0 ${colors.ThreeDShadow}, inset 2px 2px 0 ${colors.ThreeDHighlight} !important; } scrollbarbutton:not([disabled="true"]):hover:active { background-color: ${colors.ThreeDFace} !important; border: 1px solid ${colors.ThreeDShadow} !important; box-shadow: none !important; } slider, slider[orient="vertical"] { color-scheme: light !important; -moz-default-appearance: none; background-color: ${colors.ThreeDHighlight} !important; background-repeat: repeat !important; background-image: url('data:image/svg+xml,') !important; } scrollcorner { color-scheme: light !important; -moz-default-appearance: none !important; -moz-binding: url(chrome://global/content/bindings/scrollbar.xml#scrollbar-base); width: 16px; cursor: default; background-color: ${colors.ThreeDFace} !important; } scrollbarbutton[type="increment"] { -moz-default-appearance: none; background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbar[orient="vertical"] > scrollbarbutton[type="increment"] { -moz-default-appearance: none; background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbarbutton[type="decrement"] { -moz-default-appearance: none; background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] { -moz-default-appearance: none; background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbarbutton[type="increment"][disabled="true"] { background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbar[orient="vertical"] > scrollbarbutton[type="increment"][disabled="true"] { background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbarbutton[type="decrement"][disabled="true"] { background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center center !important; } scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"][disabled="true"] { background-repeat: no-repeat !important; background-image: url('data:image/svg+xml,') !important; background-position: center !important; }`; const sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService( Ci.nsIStyleSheetService, ); const uri = Services.io.newURI( "data:text/css;charset=UTF=8," + encodeURIComponent(css), ); sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET); })();