MediaWiki:Common.js/User:Bawolff/sandbox/alt citations
Appearance
/* See User:Bawolff/sandbox/alt citations Basically converts inline ref style citations, to non-inline wikinews citations one hit button in sidebar Depends on MediaWiki:Common.css/User:Bawolff/sandbox/alt citations
- /
//
//Function that switches source style
function toggleSources() {
var container = document.getElementById("no-source-toggle");
if (!container || !container.className) {
throw new Error("Can't find the container div for the inline source toggle");
}
if (container.className === "no-inline-sources") {
container.className = "show-inline-sources";
} else if (container.className === "show-inline-sources") {
container.className = "no-inline-sources";
} else {
throw new Error("inline source toggle container has invalid class");
}
return (void 0);
}
//Add toggle button to toolbar if container div detected
toggleSources.init = function() {
if (document.getElementById("no-source-toggle")) {
mw.util.addPortletLink("p-tb", "javascript:toggleSources();", "Toggle inline sources", "t-toggle-inline-source-button", "Show or hide inline source information");
}
}
$(toggleSources.init);
//