MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
David Mason (talk | contribs) No edit summary |
David Mason (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
onload=function(){ | onload=function(){ | ||
$.("firstHeading").wrap('<div style="float:left">'); | $.("#firstHeading").wrap('<div style="float:left">'); | ||
var dshow = "<span id='wnavcontrol' onclick='showNav()' style='float: right; font-weight: bold; color: blue'>Wiki+</span>"; | var dshow = "<span id='wnavcontrol' onclick='showNav()' style='float: right; font-weight: bold; color: blue'>Wiki+</span>"; | ||
$('#firstHeading').after(dshow).fadeIn(); | $('#firstHeading').after(dshow).fadeIn(); |
Revision as of 14:47, 14 April 2011
function showNav() {
$(".noprint").show();
$('#content').css('margin-left', '10em');
}
function hideNav() {
$(".noprint").hide();
$('#content').css('margin-left', '0em');
}
onload=function(){
$.("#firstHeading").wrap('<div style="float:left">');
var dshow = "<span id='wnavcontrol' onclick='showNav()' style='float: right; font-weight: bold; color: blue'>Wiki+</span>";
$('#firstHeading').after(dshow).fadeIn();
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);
}
}
}