MediaWiki:Common.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
var wnavcontrol = false;
function showNav() {
$(".noprint").show();
$('#wnavcontrol').remove();
var dshow = "<span id='wnavcontrol' onclick='hideNav()' style='float: right; font-weight: bold; color: blue'>-Wiki</span>";
$('#firstHeading').before(dshow).fadeIn();
}
function hideNav() {
$(".noprint").hide();
$('#content').css('margin-left', '0em').css('padding', '0.2em');
if (wnavcontrol) {
$('#wnavcontrol').remove();
}
var dshow = "<span id='wnavcontrol' onclick='showNav()' style='float: right; font-weight: bold; color: blue'>+Wiki</span>";
$('#firstHeading').before(dshow).fadeIn();
wnavcontrol = true;
}
onload=function(){
$('#firstHeading').wrap('<div style="width: 100%" />');
hideNav();
if (document.getElementsByClassName == undefined) {
document.getElementsByClassName = function(className) {
var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
var allElements = document.getElementsByTagName("*");
var results = [];
var element;
for (var i = 0; (element = allElements[i]) != null; i++) {
var elementClass = element.className;
if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
results.push(element);
}
return results;
}
}
makeExt('external');
function makeExt(lclass) {
links = document.getElementsByClassName(lclass);
// add onClick handler to links
for (var i = 0; (element = links[i]) != null; i++) {
element.href = "/frame/?l="+escape(element.href);
}
}
}