MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
var w = document.write; | |||
document.write = function (content) { | |||
container.innerHTML = content; | |||
document.write = w; | |||
}; | |||
Revision as of 18:08, 19 February 2022
/* Any JavaScript here will be loaded for all users on every page load. */ var w = document.write; document.write = function (content) { container.innerHTML = content; document.write = w; }; function getCookieValue(a) { var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; } $(function () { $("#mw-navigation .mw-portlet-tb ul") .append('<li><a href="https://twitter.com/DMOWiki" target="_blank"><img src="https://dmowiki.com/images/9/92/Twitter_Icon.png" title="DMO Wiki at Twitter" alt="Twitter" /> @DMOWiki</a></li>') .append('<li><a href="/" class="js-toggle-dark-mode">Toggle dark mode</a></li>') ; $('.js-toggle-dark-mode').on('click', function (e) { e.preventDefault(); var useTheme = getCookieValue('usetheme'); var cookieValue = "usetheme=dark-orange; expires=Sun, 25 Aug 2030 00:00:00 GMT"; if (useTheme.length > 0) { cookieValue = "usetheme=; expires=Thu, 01 Jan 1970 00:00:00 GMT"; } document.cookie = cookieValue + "; secure"; window.location.reload(); }); $("h3#p-navigation-label").css({ 'display': 'block', 'padding': '0px 1.75em 0.25em 0.25em', 'border': 'medium none', }); $("#mw-panel div.portal div.body").css({ "margin": "0px 0px 0px 1.25em", "background-image": "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAAABCAAAAAAphRnkAAAAJ0lEQVQIW7XFsQEAIAyAMPD/b7uLWz8wS5youFW1UREfiIpH1Q2VBz7fGPS1dOGeAAAAAElFTkSuQmCC')", }); if($('body').hasClass('skin-vector') || $('body').hasClass('skin-vector-legacy')) { if('dmowiki' in window && 'loadOnPageLoad' in window.dmowiki) { var string = atob(window.dmowiki.loadOnPageLoad); string = string.replace('"></script>', '?&callback=isNaN"></script>'); $('#p-Advertisements div.vector-menu-content').append(string); } //$('iframe').appendTo('#p-Advertisements div.vector-menu-content')') } });