Difference between revisions of "MediaWiki:Common.js"

From Biowikifarm Metawiki
Jump to: navigation, search
m (1 revision)
m
Line 57: Line 57:
 
// jkey source
 
// jkey source
 
importScript("MediaWiki:JKey.js");
 
importScript("MediaWiki:JKey.js");
 
+
//moveable TOCs
 +
importScript("MediaWiki:MoveTOC.js");
 +
$j(document).ready(function() {
 +
  initmovingTOC(); // TOC CSS position fixed or static → MediaWiki:Gadget-moveTOC.js
 +
});
 
// </source>
 
// </source>

Revision as of 12:48, 14 September 2010

// <source lang="javascript">
// This JavaScript will be loaded for all users on every page load.
// Except for additions at the end, imported from en.wikipedia.org and modified (parts removed).
// for authors see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history
// NEW: targetHighlighting (Hagedorn) and collapsibleTables (wikipedia) moved to jKey.js!


/* Import more specific scripts if necessary */
if (wgAction == "edit" || wgAction == "submit" || wgPageName == "Special:Upload") { //scripts specific to editing pages
    importScript("MediaWiki:Common.js/edit.js");
}


/* Scripts specific to Internet Explorer */
if (navigator.appName == "Microsoft Internet Explorer") {
    /** Internet Explorer bug fix **************************************************
     *  Description: Fixes IE horizontal scrollbar bug
     *  Maintainers: [[User:Tom-]]?
     */
    var oldWidth;
    var docEl = document.documentElement;

    function fixIEScroll() {
        if (!oldWidth || docEl.clientWidth > oldWidth)
            doFixIEScroll();
        else
            setTimeout(doFixIEScroll, 1);
        oldWidth = docEl.clientWidth;
    }
    
    function doFixIEScroll() {
      docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
    }
    
    document.attachEvent("onreadystatechange", fixIEScroll);
    document.attachEvent("onresize", fixIEScroll);
    
    // In print IE (7?) does not like line-height
    appendCSS( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}');
    
    //Import scripts specific to Internet Explorer 6
    // THIS IS A PNG transparency FIX, here commented out:
    // if (navigator.appVersion.substr(22, 1) == "6") {
    //    importScript("MediaWiki:Common.js/IE60Fixes.js");
    // }
} // END "Microsoft Internet Explorer"



/** Table sorting fixes
  *  Description: Disables code in table sorting routine to set classes on even/odd rows
  */
ts_alternate_row_colors = false;



// jkey source
importScript("MediaWiki:JKey.js");
//moveable TOCs
importScript("MediaWiki:MoveTOC.js");
$j(document).ready(function() {
  initmovingTOC(); // TOC CSS position fixed or static → MediaWiki:Gadget-moveTOC.js
});
// </source>