MediaWiki:Common.js

MediaWiki系统消息页面

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
/* 
Reference: https://wiki.hydcraft.cn/MediaWiki:Common.js
Cite under CC BY-SA 4.0 DEED License
*/
function addCssFile(cssUrl) {
    var link = document.createElement("link");
    link.rel = "stylesheet";
    link.href = cssUrl;
    document.head.appendChild(link);
}

function addJsFile(jsUrl) {
    var script = document.createElement("script");
    script.src = jsUrl;
    document.head.appendChild(script);
}

const pageScripts = {
    'SJMC_SMP_2': 'MediaWiki:SJMC_SMP_2.js'
};

const currentPageName = mw.config.get('wgPageName');
const scriptToImport = pageScripts[currentPageName];

if (scriptToImport) {
    importScript(scriptToImport);
}

$(document).ready(function () {
	$('.dropdown-toggle').focusout(function () {
	    $('.dropdown-menu').show();
	});
});

function waitForMathJax($content) {
  if (typeof MathJax === 'undefined') {
    setTimeout(function () { waitForMathJax($content); }, 1000);
  } else {
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
  }
}

mw.hook('wikipage.content').add(waitForMathJax);