MediaWiki:Gadget-dark-vector.js: Difference between revisions

From Inkipedia, the Splatoon wiki
(This should be it)
 
(Replaced with new code to dim bright table elements)
Line 1: Line 1:
$(".lightmode").remove()
mw.loader.using("jquery", function () {
$("[data-poll]").each(function(){
    $("td[style]").each(function () {
    $(this).html('<script type="text/javascript" language="javascript" src="https://s3.polldaddy.com/p/'+$(this).data("poll")+'.js"></script><noscript><a href="https://polldaddy.com/poll/'+$(this).data("poll")+'/"></a></noscript>')
        var _c = this.style.backgroundColor.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+)\s*)?\)$/i)
        if (_c == null) return
        _c = _c.slice(1, 5).map(function (e, i) { return parseInt(i == 3 ? parseInt(e) : (parseInt(e) - 175)) });
        if (isNaN(_c[3])) _c[3] = 1;
        this.style.backgroundColor = "rgba(" + _c.join(",") + ")";
    })
})
})

Revision as of 20:44, 4 August 2021

mw.loader.using("jquery", function () {
    $("td[style]").each(function () {
        var _c = this.style.backgroundColor.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+)\s*)?\)$/i)
        if (_c == null) return
        _c = _c.slice(1, 5).map(function (e, i) { return parseInt(i == 3 ? parseInt(e) : (parseInt(e) - 175)) });
        if (isNaN(_c[3])) _c[3] = 1;
        this.style.backgroundColor = "rgba(" + _c.join(",") + ")";
    })
})