Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
(Replaced content with "→Any JavaScript here will be loaded for all users on every page load.: →Support For Rich Upload Form: importScript("MediaWiki:UploadForm.js");") |
|||
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. */ | ||
− | /* | + | /* Browser sniffer */ |
− | + | ||
+ | var isIE = false; | ||
+ | var isOther = false; | ||
+ | var isNS4 = false; | ||
+ | var isNS6 = false; | ||
+ | if(document.getElementById) { | ||
+ | if(!document.all) { | ||
+ | isNS6=true; | ||
+ | } | ||
+ | if(document.all) { | ||
+ | isIE=true; | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | if(document.layers) { | ||
+ | isNS4=true; | ||
+ | } | ||
+ | else { | ||
+ | isOther=true; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function aL(layerID) { | ||
+ | var returnLayer; | ||
+ | if(isIE) { | ||
+ | returnLayer = eval("document.all." + layerID); | ||
+ | } | ||
+ | if(isNS6) { | ||
+ | returnLayer = eval("document.getElementById('" + layerID + "')"); | ||
+ | } | ||
+ | if(isNS4) { | ||
+ | returnLayer = eval("document." + layerID); | ||
+ | } | ||
+ | if(isOther) { | ||
+ | returnLayer = "null"; | ||
+ | alert(cgBrowserAlert); | ||
+ | } | ||
+ | return returnLayer; | ||
+ | } | ||
+ | |||
+ | function aLs(layerID) { | ||
+ | var returnLayer; | ||
+ | if(isIE) { | ||
+ | returnLayer = aL(layerID).style; | ||
+ | } | ||
+ | if(isNS6) { | ||
+ | returnLayer = aL(layerID).style; | ||
+ | } | ||
+ | if(isNS4) { | ||
+ | returnLayer = aL(layerID); | ||
+ | } | ||
+ | if(isOther) { | ||
+ | returnLayer = "null"; | ||
+ | alert(cgBrowserAlert); | ||
+ | } | ||
+ | return returnLayer; | ||
+ | } | ||
+ | |||
+ | /* Show/Hide Function */ | ||
+ | |||
+ | function ShowHide(n) { | ||
+ | ID = "hideShow" + n; | ||
+ | IE = "rowa" + n; | ||
+ | IF = "rowq" + n; | ||
+ | IG = "roww" + n; | ||
+ | aLs(ID).visibility = "visible"; | ||
+ | aLs(IE).background = "#EDEDED"; | ||
+ | aLs(IF).background = "#EDEDED"; | ||
+ | aLs(IG).background = "#E5FFE5"; | ||
+ | |||
+ | } |
Revision as of 21:13, 3 May 2012
/* Any JavaScript here will be loaded for all users on every page load. */ /* Browser sniffer */ var isIE = false; var isOther = false; var isNS4 = false; var isNS6 = false; if(document.getElementById) { if(!document.all) { isNS6=true; } if(document.all) { isIE=true; } } else { if(document.layers) { isNS4=true; } else { isOther=true; } } function aL(layerID) { var returnLayer; if(isIE) { returnLayer = eval("document.all." + layerID); } if(isNS6) { returnLayer = eval("document.getElementById('" + layerID + "')"); } if(isNS4) { returnLayer = eval("document." + layerID); } if(isOther) { returnLayer = "null"; alert(cgBrowserAlert); } return returnLayer; } function aLs(layerID) { var returnLayer; if(isIE) { returnLayer = aL(layerID).style; } if(isNS6) { returnLayer = aL(layerID).style; } if(isNS4) { returnLayer = aL(layerID); } if(isOther) { returnLayer = "null"; alert(cgBrowserAlert); } return returnLayer; } /* Show/Hide Function */ function ShowHide(n) { ID = "hideShow" + n; IE = "rowa" + n; IF = "rowq" + n; IG = "roww" + n; aLs(ID).visibility = "visible"; aLs(IE).background = "#EDEDED"; aLs(IF).background = "#EDEDED"; aLs(IG).background = "#E5FFE5"; }