wikibits - / MediaWiki JavaScript support functions var...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
// MediaWiki JavaScript support functions var clientPC = navigator.userAgent.toLowerCase(); // Get client info !/khtml|spoofer|netscape\/7\.0/.test(clientPC); var webkit_match = clientPC.match(/applewebkit\/(\d+)/); if (webkit_match) { clientPC.indexOf('spoofer') == -1; var is_safari_win = is_safari & clientPC.indexOf('windows') != -1; var webkit_version = parseInt(webkit_match[1]); } var is_khtml = navigator.vendor == 'KDE' || ( document.childNodes & !document.all && !navigator.taintEnabled ); // For accesskeys; note that FF3+ is included here! var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); // These aren't used here, but some custom scripts rely on them var is_ff2_win = is_ff2 & clientPC.indexOf('windows') != -1; var is_ff2_x11 = is_ff2 & clientPC.indexOf('x11') != -1; if (clientPC.indexOf('opera') != -1) { var is_opera = true; var is_opera_preseven = window.opera & !document.childNodes; var is_opera_seven = window.opera & document.childNodes; var is_opera_95 = /opera\/(9.[5-9]|[1-9][0-9])/.test( clientPC ); } // Global external objects used by this script. /*extern ta, stylepath, skin */ // add any onload functions in this hook (please don't hard-code any events in the xhtml source) var doneOnloadHook; if (!window.onloadFuncts) { var onloadFuncts = []; } function addOnloadHook(hookFunct) { // Allows add-on scripts to add onload functions if(!doneOnloadHook) { onloadFuncts[onloadFuncts.length] = hookFunct; } else { hookFunct(); // bug in MSIE script loading } } function hookEvent(hookName, hookFunct) { if (window.addEventListener) { window.addEventListener(hookName, hookFunct, false); } else if (window.attachEvent) { window.attachEvent("on" + hookName, hookFunct); } } function importScript(page) { return importScriptURI(wgScript + '? action=raw&ctype=text/javascript&title=' + encodeURIComponent(page.replace(/ /g,'_'))); } var loadedScripts = {}; // included-scripts tracker function importScriptURI(url) { if (loadedScripts[url]) { return null;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} loadedScripts[url] = true; var s = document.createElement('script'); s.setAttribute('src',url); s.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); return s; } function importStylesheet(page) { return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_'))); } function importStylesheetURI(url) { return document.createStyleSheet ? document.createStyleSheet(url) : appendCSS('@import "' + url + '";'); } function appendCSS(text) { var s = document.createElement('style'); s.type = 'text/css'; s.rel = 'stylesheet'; if (s.styleSheet) s.styleSheet.cssText = text //IE else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null document.getElementsByTagName('head')[0].appendChild(s); return s; } // special stylesheet links
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

wikibits - / MediaWiki JavaScript support functions var...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online