diff --git a/Betterculus.user.js b/Betterculus.user.js index c0978816248df485cb8e720a16d22ac66d9ec2a9..4ba710fd884ad518d33bc7fec01059ff4367deb8 100755 --- a/Betterculus.user.js +++ b/Betterculus.user.js @@ -9,23 +9,42 @@ // @description Filters and UI changes to metaculus.com // ==/UserScript== -function lessLines() { - var elsToRemoveBorder = ['a.header__logo', 'div.main-wrapper', 'header', 'div.section-box', 'h2.section__header--partial'] +function lessLinesCSS() { + let cssText = ` + a.header__logo, div.main-wrapper, header, div.section-box, h2.section__header--partial { + border: none; + } + + /* The 20px gap looks too big after lines are removed, reduce it */ + section.ng-scope { + margin-top: 10px; + } - for (el of elsToRemoveBorder) { - document.querySelector(el).style.border = 'none'; + /* triples lines around Top Questions/My Predictions/... */ + nav.section__nav { + backgroundImage: none; } - console.log(document.querySelector('section.ng-scope')) - // The 20px gap looks too big after lines are removed, reduce it - document.querySelector('section.ng-scope').style.marginTop = '10px'; + h2.section__header--partial::before, h2.section__header--partial::after { + background-image: none !important; + } + `; + return cssText; +} - // triples lines around Top Questions/My Predictions/... - document.querySelector('nav.section__nav').style.backgroundImage = 'none'; - // ::before and after can't be directly manipulated in JS like above, instead add CSS rules directly to affect them - document.styleSheets[0].addRule('h2.section__header--partial::before', 'background-image: none !important'); - document.styleSheets[0].addRule('h2.section__header--partial::after', 'background-image: none !important'); +function fontChangeCSS() { + let cssText = ` + `; } -lessLines(); +var styleText = ''; +styleText += lessLinesCSS(); + +var styleEl = document.createElement('style'); +styleEl.type = 'text/css'; +styleEl.innerHTML = styleText; +document.head.appendChild(styleEl); + + +