MediaWiki:Gadget-dark-vector.js
From Inkipedia, the Splatoon wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
mw.loader.using("jquery", function () { //Sometimes JQuery just doesn't load fast enough iirc, so let's just wait for it $("td[style]").each(function () { //Go over each td with the style attribute var _c = this.style.backgroundColor.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+)\s*)?\)$/i); //Match the backgroundColor: https://stackoverflow.com/a/11068286/10211613 if (_c == null) return; //If no background color found, skip _c = _c.slice(1, 5).map(function (e, i) { return parseInt(i == 3 ? parseInt(e) : (parseInt(e) - 175)) }); //Get array elements 1-4, then parse them as an int, and subtract 175 from them, except if it's the alpha (index: 3) if (isNaN(_c[3])) _c[3] = 1; //If no alpha was defined (example: rgb()), set it to 1 this.style.backgroundColor = "rgba(" + _c.join(",") + ")"; //Set the new background color }) })