User:Vagengeym/vector-2022.js

// var darkThemeIntervalId = false; // Need to use interval to add switch when sticky header is loaded.

function addDarkTheme { var themeSwitch = 'on' === mw.storage.get('darktheme'); // Check dark theme status on load. if (themeSwitch) {lightsOff} else false; // Turning on/off dependent on saved status. mw.util.addPortletLink('p-personal', '#', 'Dark Theme', 'pt-darktheme', , , '#pt-mytalk'); // Adding switch to the menu. mw.util.addPortletLink('p-personal-sticky-header', '#', 'Dark Theme', 'pt-darktheme-sticky', , , '#pt-userpage-sticky-header'); // Adding switch to the sticky header menu. mw.util.addCSS(".mw-ui-icon-vector-gadget-pt-darktheme:before {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAAAsSAAALEgHS3X78AAARFElEQVR42u2dCZCcRRXH32YT5D4TLiMISAEhlECCyJkCgxCUSCkgiJEgiaByFUGrOJSkUoqloAIFoYKkkAgqFKAWUCAiIFQUFEJEIGIVl3IfciYhm9nxtfN1TU9vf7Mze8x+X/fvV/WvGXaXzczs9/793uv+ukUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAJXapRqtGqbu973dn3ACASbLB3tfn/dPHRAcQV8Obr26gOV52lWqC6U/WA6neq+ao9vN8FAAWnO5DOGzZQ7ZcF+3WqJ1QrVdV+dK1qE0wAoNgjfXdghJ+kOlv1W9XLOQHeq+pRrVatyWT/uzf7meWq8ZgAQLGDfj3VNNUlqiedAHbVk6mSfb/X+bnegFZl33swJ7MAgA6n+G5NP0b1KdVlqmdaDPiq9zwvM7Df/yB7PNt5DQDQIboCQber1Bp1y73ArWTpe7sBn2cC9neax3+p1uLPATAygW+ef051axbkfh1fCaTw1UHK/z2foBcA0NnA30x1huqxQHo/HEEfMgCbBXyJMgCgM4G/pWqu6iUnIG2X3k/vq8Oo3uzfNc9nYgAAQ48f+BeqXvdG+zXDPNo3ywDsv3UY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Puh0b2AP1e1eOooRdKa7b9J9c3bgGGp9GInegGsER0jtUEu3LMAIhu7IcTfwzX37P5H6xh3U+lCIssDwZdXfczICji5vb7T3a3yT9l+l+hiBD0UuC0wNeoLUVp9VvfS1l6yg39F+jRf45tRfs0/frt7nTboPhTYCc4EepbrXu+B7yApyR3v3mPBXVD9Sbe99vnT3oVRGYNhfda3Ubzl2s4JKImYQyn780d5oqepU1TgCH2Izgm2ldurMUul7lr1vBjHsR9Bq0JtVlr9QHeql9qT6EE2zcJRXHkxRXS71G478I6pCZUJvCQO+4pQ97s+uVP1B9XVp7OgT+BAtXYGsYD3VZ1QLVE8HgqriGEKlYI3E3kAjzwZ8T+Dn382C/gxp7OZbk6SrD0llBf4Fv7bqQNVc1T1ez8BvJIZMYTjKh96cQHfT+dVeA8/9f42p/Vw1Q/WRnDKJ0R6S7xWERj+TGptdbC5S3a16rZ9AXZMFY4+TdldyTKKZ7P+zxgvynpxAtzLHaz0ltXX5p6kmZaZG0AO0kRnkrWffOMsQTlddKbUpxhdVqzqc+hsTMIdpPCq1/RLMCcxmytNssT2mSbZD0AMMoGfQrDZeNwu8qapZWTAac7hFtUS1PDMJU06syMxitZMh2NHdjN4rszr9DdWzqodVd0jtOLWLVWeqPq+arBor+VNz1sSYugMYYkNoN7jWUq0jtd2NtlHtqJogtdNwJmWPE1W7qLaT2vz7+lnqPqrF1zSaER5g5I2h2zGHriH+/d1OoHPnHUAJTcLVKEf+9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADi5n9FP1i+fhD+KgAAAABJRU5ErkJggg==\')}");

// Toggling on/off functions on click. $('#pt-darktheme, #pt-darktheme-sticky').on('click', function(e) {               e.preventDefault;        themeSwitch = !themeSwitch;        if (themeSwitch) {            lightsOff;        } else {            lightsOn;        }    });

// Adds dark theme css. function lightsOff { $('head').append(mw.loader.load('https://en.wikipedia.org/wiki/User:Vagengeym/darktheme.css?action=raw&ctype=text/css', 'text/css')); mw.storage.set('darktheme', 'on'); }

// Deletes dark theme css. function lightsOn { h = document.head.getElementsByTagName("link"); h[h.length - 1].remove; mw.storage.set('darktheme', 'off'); return true; }

clearInterval(darkThemeIntervalId); }

// Loads dark theme function. function nIntervalF { if (darkThemeIntervalId === false) { darkThemeIntervalId = setInterval(window.addDarkTheme, 100); } }

nIntervalF; //