Difference between revisions of "MediaWiki:Common.js"
From MoiWiki
Jump to navigationJump to search(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
+ | |||
+ | /* | ||
+ | // Removed browser-specific size fiddling for now. | ||
+ | |||
function getInternetExplorerVersion() | function getInternetExplorerVersion() | ||
{ | { | ||
Line 12: | Line 17: | ||
} | } | ||
+ | // For IE8 increase base text size. | ||
if ( getInternetExplorerVersion() == 8 ) | if ( getInternetExplorerVersion() == 8 ) | ||
{ | { | ||
var sheet = document.createStyleSheet(); | var sheet = document.createStyleSheet(); | ||
− | sheet.addRule( ' | + | sheet.addRule( 'body', 'font-size:small;' ); |
+ | } | ||
+ | |||
+ | // On firefox the whole site is a little small, move it up in size. | ||
+ | if ( navigator && navigator.userAgent ) | ||
+ | { | ||
+ | var ua = navigator.userAgent.toLowerCase(); | ||
+ | if ( ua.indexOf( 'gecko' ) != -1 ) | ||
+ | { | ||
+ | if ( document.styleSheets ) | ||
+ | { | ||
+ | var sheet = document.styleSheets[0]; | ||
+ | |||
+ | if ( sheet.cssRules && sheet.insertRule ) | ||
+ | { | ||
+ | // Adjust size up by setting a rule for font-size:small on body, normally it is | ||
+ | // set to x-small. | ||
+ | sheet.insertRule( "body{ font-size:small; }", sheet.cssRules.length ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
} | } | ||
+ | */ |
Latest revision as of 17:30, 6 March 2011
/* Any JavaScript here will be loaded for all users on every page load. */ /* // Removed browser-specific size fiddling for now. function getInternetExplorerVersion() { var rv = -1; if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } return rv; } // For IE8 increase base text size. if ( getInternetExplorerVersion() == 8 ) { var sheet = document.createStyleSheet(); sheet.addRule( 'body', 'font-size:small;' ); } // On firefox the whole site is a little small, move it up in size. if ( navigator && navigator.userAgent ) { var ua = navigator.userAgent.toLowerCase(); if ( ua.indexOf( 'gecko' ) != -1 ) { if ( document.styleSheets ) { var sheet = document.styleSheets[0]; if ( sheet.cssRules && sheet.insertRule ) { // Adjust size up by setting a rule for font-size:small on body, normally it is // set to x-small. sheet.insertRule( "body{ font-size:small; }", sheet.cssRules.length ); } } } } */