MediaWiki:Common.js: Difference between revisions

From NESG Wiki
Jump to navigation Jump to search
(Created page with '→‎Any JavaScript here will be loaded for all users on every page load.: <div dir="ltr"><pre style="font-family: monospace;" class="javascript source-javascript"><span class="…')
 
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. */
<div dir="ltr"><pre style="font-family: monospace;" class="javascript source-javascript"><span class="co1">//&lt;source lang="javascript"&gt;</span><br>&nbsp;<br><span class="coMULTI">/*
* Description: Redirects from /User:UserName/skin.js or .css to the user's actual skin page
* Maintainer: Cacycle
*/</span><br><span class="kw1">if</span> <span class="br0">(</span>wgArticleId <span class="sy0">==</span> 0 <span class="sy0">&amp;&amp;</span> wgUserName<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> slash <span class="sy0">=</span> wgPageName.<span class="me1">indexOf</span><span class="br0">(</span><span class="st0">'/'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> norm <span class="sy0">=</span> wgPageName.<span class="me1">substr</span><span class="br0">(</span>0<span class="sy0">,</span> slash<span class="br0">)</span> <span class="sy0">+</span> wgPageName.<span class="me1">substr</span><span class="br0">(</span>slash<span class="br0">)</span>.<span class="me1">toLowerCase</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> test <span class="sy0">=</span> <span class="st0">'User:'</span> <span class="sy0">+</span> wgUserName.<span class="me1">replace</span><span class="br0">(</span><span class="co2">/ /g</span><span class="sy0">,</span> <span class="st0">'_'</span><span class="br0">)</span> <span class="sy0">+</span> <span class="st0">'/skin.'</span><span class="sy0">;</span><br> <span class="kw2">var</span> ext <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span>norm <span class="sy0">==</span> test <span class="sy0">+</span> <span class="st0">'js'</span><span class="br0">)</span> ext <span class="sy0">=</span> <span class="st0">'js'</span><span class="sy0">;</span><br> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span>norm <span class="sy0">==</span> test <span class="sy0">+</span> <span class="st0">'css'</span><span class="br0">)</span> ext <span class="sy0">=</span> <span class="st0">'css'</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span>ext <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">)</span> window.<span class="me1">location</span>.<span class="me1">href</span> <span class="sy0">=</span> window.<span class="me1">location</span>.<span class="me1">href</span>.<span class="me1">replace</span><span class="br0">(</span><span class="co2">/\/skin.(css|js)/i</span><span class="sy0">,</span> <span class="st0">'/'</span> <span class="sy0">+</span> skin <span class="sy0">+</span> <span class="st0">'.'</span> <span class="sy0">+</span> ext<span class="br0">)</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="coMULTI">/** extract a URL parameter from the current URL **********
* From [[en:User:Lupin/autoedit.js]]
*
* paramName  : the name of the parameter to extract
*/</span><br><span class="kw2">function</span> getURLParamValue<span class="br0">(</span> paramName<span class="sy0">,</span> url<span class="br0">)</span> <br><span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="kw1">typeof</span> <span class="br0">(</span>url<span class="br0">)</span> <span class="sy0">==</span> <span class="st0">'undefined'</span> <span class="sy0">||</span> url <span class="sy0">===</span> <span class="kw2">null</span><span class="br0">)</span> url <span class="sy0">=</span> document.<span class="me1">location</span>.<span class="me1">href</span><span class="sy0">;</span><br> <span class="kw2">var</span> cmdRe<span class="sy0">=</span>RegExp<span class="br0">(</span> <span class="st0">'[&amp;?]'</span> <span class="sy0">+</span> paramName <span class="sy0">+</span> <span class="st0">'=([^&amp;#]*)'</span> <span class="br0">)</span><span class="sy0">;</span> <span class="co1">// Stop at hash</span><br> <span class="kw2">var</span> m<span class="sy0">=</span>cmdRe.<span class="me1">exec</span><span class="br0">(</span>url<span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span>m <span class="sy0">&amp;&amp;</span> m.<span class="me1">length</span> <span class="sy0">&gt;</span> 1<span class="br0">)</span> <span class="kw1">return</span> decodeURIComponent<span class="br0">(</span>m<span class="br0">[</span>1<span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">return</span> <span class="kw2">null</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="coMULTI">/** &amp;withJS= URL parameter *******
* Allow to try custom scripts from MediaWiki space
* without editing [[Special:Mypage/monobook.js]]
*/</span><br><span class="kw2">var</span> extraJS <span class="sy0">=</span> getURLParamValue<span class="br0">(</span><span class="st0">"withJS"</span><span class="br0">)</span><span class="sy0">;</span><br><span class="kw1">if</span> <span class="br0">(</span> extraJS <span class="sy0">&amp;&amp;</span> extraJS.<span class="me1">match</span><span class="br0">(</span><span class="st0">"^MediaWiki:[^&amp;&lt;&gt;=%]*<span class="es0">\.</span>js$"</span><span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> importScript<span class="br0">(</span>extraJS<span class="br0">)</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="co2">/* Import more specific scripts if necessary */</span><br>&nbsp;<br><span class="kw1">if</span> <span class="br0">(</span>wgAction <span class="sy0">==</span> <span class="st0">"edit"</span> <span class="sy0">||</span> wgAction <span class="sy0">==</span> <span class="st0">"submit"</span> <span class="sy0">||</span> wgPageName <span class="sy0">==</span> <span class="st0">"Special:Upload"</span><span class="br0">)</span> <span class="co1">//scripts specific to editing pages</span><br><span class="br0">{</span><br> importScript<span class="br0">(</span><span class="st0">"MediaWiki:Common.js/edit.js"</span><span class="br0">)</span><br><span class="br0">}</span><br><span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span>wgPageName <span class="sy0">==</span> <span class="st0">"Special:Watchlist"</span><span class="br0">)</span> <span class="co1">//watchlist scripts</span><br><span class="br0">{</span><br> importScript<span class="br0">(</span><span class="st0">"MediaWiki:Common.js/watchlist.js"</span><span class="br0">)</span><br><span class="br0">}</span><br><span class="kw1">if</span><span class="br0">(</span> wgNamespaceNumber <span class="sy0">==</span> <span class="nu0">6</span> <span class="br0">)</span> <span class="br0">{</span><br> importScript<span class="br0">(</span><span class="st0">'MediaWiki:Common.js/file.js'</span><span class="br0">)</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="coMULTI">/** For sysops and accountcreators *****************************************
*
*  Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]],
*              and accountcreator-specific CSS at [[MediaWiki:Accountcreator.css]].
*/</span><br><span class="kw1">if</span> <span class="br0">(</span> wgUserGroups <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> g <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> g <span class="sy0">&lt;</span> wgUserGroups.<span class="me1">length</span><span class="sy0">;</span> <span class="sy0">++</span>g <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> wgUserGroups<span class="br0">[</span>g<span class="br0">]</span> <span class="sy0">==</span> <span class="st0">"sysop"</span> <span class="br0">)</span> <span class="br0">{</span><br> importStylesheet<span class="br0">(</span><span class="st0">"MediaWiki:Sysop.css"</span><span class="br0">)</span><span class="sy0">;</span><br> addOnloadHook<span class="br0">(</span> <span class="kw2">function</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> <span class="sy0">!</span>window.<span class="me1">disableSysopJS</span> <span class="br0">)</span> <span class="br0">{</span><br> importScript<span class="br0">(</span><span class="st0">"MediaWiki:Sysop.js"</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span> <span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span> <br> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span> wgUserGroups<span class="br0">[</span>g<span class="br0">]</span> <span class="sy0">==</span> <span class="st0">"accountcreator"</span> <span class="br0">)</span> <span class="br0">{</span><br> importStylesheet<span class="br0">(</span><span class="st0">"MediaWiki:Accountcreator.css"</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/** WikiMiniAtlas *******************************************************
  *
  *  Description: WikiMiniAtlas is a popup click and drag world map.
  *              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
  *              The script itself is located on meta because it is used by many projects.
  *              See [[Meta:WikiMiniAtlas]] for more information.
  *  Maintainers: [[User:Dschwen]]
  */</span><br>&nbsp;<br><span class="kw1">if</span> <span class="br0">(</span>wgServer <span class="sy0">==</span> <span class="st0">"https://secure.wikimedia.org"</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> metaBase <span class="sy0">=</span> <span class="st0">"https://secure.wikimedia.org/wikipedia/meta"</span><span class="sy0">;</span><br><span class="br0">}</span> <span class="kw1">else</span> <span class="br0">{</span><br> <span class="kw2">var</span> metaBase <span class="sy0">=</span> <span class="st0">"http://meta.wikimedia.org"</span><span class="sy0">;</span><br><span class="br0">}</span><br>importScriptURI<span class="br0">(</span>metaBase<span class="sy0">+</span><span class="st0">"/w/index.php?title=MediaWiki:Wikiminiatlas.js&amp;action=raw&amp;ctype=text/javascript&amp;smaxage=21600&amp;maxage=86400"</span><span class="br0">)</span><br>&nbsp;<br><span class="co2">/* Scripts specific to Internet Explorer */</span><br>&nbsp;<br><span class="kw1">if</span> <span class="br0">(</span>navigator.<span class="me1">appName</span> <span class="sy0">==</span> <span class="st0">"Microsoft Internet Explorer"</span><span class="br0">)</span><br><span class="br0">{</span><br> <span class="coMULTI">/** Internet Explorer bug fix **************************************************
    *
    *  Description: Fixes IE horizontal scrollbar bug
    *  Maintainers: [[User:Tom-]]?
    */</span><br>&nbsp;<br> <span class="kw2">var</span> oldWidth<span class="sy0">;</span><br> <span class="kw2">var</span> docEl <span class="sy0">=</span> document.<span class="me1">documentElement</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw2">function</span> fixIEScroll<span class="br0">(</span><span class="br0">)</span><br> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>oldWidth <span class="sy0">||</span> docEl.<span class="me1">clientWidth</span> <span class="sy0">&gt;</span> oldWidth<span class="br0">)</span><br> doFixIEScroll<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">else</span><br> setTimeout<span class="br0">(</span>doFixIEScroll<span class="sy0">,</span> 1<span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> oldWidth <span class="sy0">=</span> docEl.<span class="me1">clientWidth</span><span class="sy0">;</span><br> <span class="br0">}</span><br>&nbsp;<br> <span class="kw2">function</span> doFixIEScroll<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><br> docEl.<span class="me1">style</span>.<span class="me1">overflowX</span> <span class="sy0">=</span> <span class="br0">(</span>docEl.<span class="me1">scrollWidth</span> <span class="sy0">-</span> docEl.<span class="me1">clientWidth</span> <span class="sy0">&lt;</span> <span class="nu0">4</span><span class="br0">)</span> <span class="sy0">?</span> <span class="st0">"hidden"</span> <span class="sy0">:</span> <span class="st0">""</span><span class="sy0">;</span><br> <span class="br0">}</span><br>&nbsp;<br> document.<span class="me1">attachEvent</span><span class="br0">(</span><span class="st0">"onreadystatechange"</span><span class="sy0">,</span> fixIEScroll<span class="br0">)</span><span class="sy0">;</span><br> document.<span class="me1">attachEvent</span><span class="br0">(</span><span class="st0">"onresize"</span><span class="sy0">,</span> fixIEScroll<span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br> <span class="coMULTI">/**
    * Remove need for CSS hacks regarding MSIE and IPA.
    */</span><br> <span class="kw1">if</span> <span class="br0">(</span>document.<span class="me1">createStyleSheet</span><span class="br0">)</span> <span class="br0">{</span><br> document.<span class="me1">createStyleSheet</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">addRule</span><span class="br0">(</span><span class="st0">'.IPA'</span><span class="sy0">,</span> <span class="st0">'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><br>&nbsp;<br> <span class="co1">// In print IE (7?) does not like line-height</span><br> appendCSS<span class="br0">(</span> <span class="st0">'@media print { sup, sub, p, .documentDescription { line-height: normal; }}'</span><span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="co1">// IE overflow bug</span><br> appendCSS<span class="br0">(</span><span class="st0">'div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }'</span><span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="co1">// IE zoomfix</span><br> <span class="co1">//Use to fix right floating div/table inside tables.</span><br> appendCSS<span class="br0">(</span><span class="st0">'.iezoomfix div, .iezoomfix table { zoom: 1;}'</span> <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="co1">//Import scripts specific to Internet Explorer 6</span><br> <span class="kw1">if</span> <span class="br0">(</span>navigator.<span class="me1">appVersion</span>.<span class="me1">substr</span><span class="br0">(</span><span class="nu0">22</span><span class="sy0">,</span> <span class="nu0">1</span><span class="br0">)</span> <span class="sy0">==</span> <span class="st0">"6"</span><span class="br0">)</span> <span class="br0">{</span><br> importScript<span class="br0">(</span><span class="st0">"MediaWiki:Common.js/IE60Fixes.js"</span><span class="br0">)</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/* Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/</span><br>&nbsp;<br><span class="kw2">var</span> hasClass <span class="sy0">=</span> <span class="br0">(</span><span class="kw2">function</span> <span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> reCache <span class="sy0">=</span> <span class="br0">{</span><span class="br0">}</span><span class="sy0">;</span><br> <span class="kw1">return</span> <span class="kw2">function</span> <span class="br0">(</span>element<span class="sy0">,</span> className<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">return</span> <span class="br0">(</span>reCache<span class="br0">[</span>className<span class="br0">]</span> <span class="sy0">?</span> reCache<span class="br0">[</span>className<span class="br0">]</span> <span class="sy0">:</span> <span class="br0">(</span>reCache<span class="br0">[</span>className<span class="br0">]</span> <span class="sy0">=</span> <span class="kw2">new</span> RegExp<span class="br0">(</span><span class="st0">"(?:<span class="es0">\\</span>s|^)"</span> <span class="sy0">+</span> className <span class="sy0">+</span> <span class="st0">"(?:<span class="es0">\\</span>s|$)"</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span>.<span class="me1">test</span><span class="br0">(</span>element.<span class="me1">className</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><span class="sy0">;</span><br><span class="br0">}</span><span class="br0">)</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/** Interwiki links to good articles ***************************************
*
*  Description: Highlights interwiki links to good articles (or
*              equivalents) by changing the bullet before the interwiki link
*              into a good article symbol.
*  Maintainers: [[User:R. Koot]]
*/</span><br>&nbsp;<br><span class="kw2">function</span> LinkGA<span class="br0">(</span><span class="br0">)</span> <br><span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> document.<span class="me1">getElementById</span><span class="br0">(</span> <span class="st0">"p-lang"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> InterwikiLinks <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span> <span class="st0">"p-lang"</span> <span class="br0">)</span>.<span class="me1">getElementsByTagName</span><span class="br0">(</span> <span class="st0">"li"</span> <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> InterwikiLinks.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> document.<span class="me1">getElementById</span><span class="br0">(</span> InterwikiLinks<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">className</span> <span class="sy0">+</span> <span class="st0">"-ga"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> InterwikiLinks<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">className</span> <span class="sy0">+=</span> <span class="st0">" GA"</span><br> InterwikiLinks<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">title</span> <span class="sy0">=</span> <span class="st0">"This is a good article in another language."</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br>addOnloadHook<span class="br0">(</span> LinkGA <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br><span class="coMULTI">/** Interwiki links to featured articles ***************************************
*
*  Description: Highlights interwiki links to featured articles (or
*              equivalents) by changing the bullet before the interwiki link
*              into a star.
*  Maintainers: [[User:R. Koot]]
*/</span><br>&nbsp;<br><span class="kw2">function</span> LinkFA<span class="br0">(</span><span class="br0">)</span> <br><span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> document.<span class="me1">getElementById</span><span class="br0">(</span> <span class="st0">"p-lang"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> InterwikiLinks <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span> <span class="st0">"p-lang"</span> <span class="br0">)</span>.<span class="me1">getElementsByTagName</span><span class="br0">(</span> <span class="st0">"li"</span> <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> InterwikiLinks.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> document.<span class="me1">getElementById</span><span class="br0">(</span> InterwikiLinks<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">className</span> <span class="sy0">+</span> <span class="st0">"-fa"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> InterwikiLinks<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">className</span> <span class="sy0">+=</span> <span class="st0">" FA"</span><br> InterwikiLinks<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">title</span> <span class="sy0">=</span> <span class="st0">"This is a featured article in another language."</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br>addOnloadHook<span class="br0">(</span> LinkFA <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/** Collapsible tables *********************************************************
*
*  Description: Allows tables to be collapsed, showing only the header. See
*              [[Wikipedia:NavFrame]].
*  Maintainers: [[User:R. Koot]]
*/</span><br>&nbsp;<br><span class="kw2">var</span> autoCollapse <span class="sy0">=</span> <span class="nu0">2</span><span class="sy0">;</span><br><span class="kw2">var</span> collapseCaption <span class="sy0">=</span> <span class="st0">"hide"</span><span class="sy0">;</span><br><span class="kw2">var</span> expandCaption <span class="sy0">=</span> <span class="st0">"show"</span><span class="sy0">;</span><br>&nbsp;<br><span class="kw2">function</span> collapseTable<span class="br0">(</span> tableIndex <span class="br0">)</span><br><span class="br0">{</span><br> <span class="kw2">var</span> Button <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span> <span class="st0">"collapseButton"</span> <span class="sy0">+</span> tableIndex <span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> Table <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span> <span class="st0">"collapsibleTable"</span> <span class="sy0">+</span> tableIndex <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw1">if</span> <span class="br0">(</span> <span class="sy0">!</span>Table <span class="sy0">||</span> <span class="sy0">!</span>Button <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">return</span> <span class="kw2">false</span><span class="sy0">;</span><br> <span class="br0">}</span><br>&nbsp;<br> <span class="kw2">var</span> Rows <span class="sy0">=</span> Table.<span class="me1">rows</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw1">if</span> <span class="br0">(</span> Button.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">==</span> collapseCaption <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">1</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> Rows.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span> <span class="br0">)</span> <span class="br0">{</span><br> Rows<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">"none"</span><span class="sy0">;</span><br> <span class="br0">}</span><br> Button.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">=</span> expandCaption<span class="sy0">;</span><br> <span class="br0">}</span> <span class="kw1">else</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">1</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> Rows.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span> <span class="br0">)</span> <span class="br0">{</span><br> Rows<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> Rows<span class="br0">[</span>0<span class="br0">]</span>.<span class="me1">style</span>.<span class="me1">display</span><span class="sy0">;</span><br> <span class="br0">}</span><br> Button.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">=</span> collapseCaption<span class="sy0">;</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br><span class="kw2">function</span> createCollapseButtons<span class="br0">(</span><span class="br0">)</span><br><span class="br0">{</span><br> <span class="kw2">var</span> tableIndex <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><br> <span class="kw2">var</span> NavigationBoxes <span class="sy0">=</span> <span class="kw2">new</span> Object<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> Tables <span class="sy0">=</span> document.<span class="me1">getElementsByTagName</span><span class="br0">(</span> <span class="st0">"table"</span> <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> Tables.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> hasClass<span class="br0">(</span> Tables<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">,</span> <span class="st0">"collapsible"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br>&nbsp;<br> <span class="co2">/* only add button and increment count if there is a header row to work with */</span><br> <span class="kw2">var</span> HeaderRow <span class="sy0">=</span> Tables<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">getElementsByTagName</span><span class="br0">(</span> <span class="st0">"tr"</span> <span class="br0">)</span><span class="br0">[</span>0<span class="br0">]</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>HeaderRow<span class="br0">)</span> <span class="kw1">continue</span><span class="sy0">;</span><br> <span class="kw2">var</span> Header <span class="sy0">=</span> HeaderRow.<span class="me1">getElementsByTagName</span><span class="br0">(</span> <span class="st0">"th"</span> <span class="br0">)</span><span class="br0">[</span>0<span class="br0">]</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>Header<span class="br0">)</span> <span class="kw1">continue</span><span class="sy0">;</span><br>&nbsp;<br> NavigationBoxes<span class="br0">[</span> tableIndex <span class="br0">]</span> <span class="sy0">=</span> Tables<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">;</span><br> Tables<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">setAttribute</span><span class="br0">(</span> <span class="st0">"id"</span><span class="sy0">,</span> <span class="st0">"collapsibleTable"</span> <span class="sy0">+</span> tableIndex <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw2">var</span> Button <span class="sy0">=</span> document.<span class="me1">createElement</span><span class="br0">(</span> <span class="st0">"span"</span> <span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> ButtonLink <span class="sy0">=</span> document.<span class="me1">createElement</span><span class="br0">(</span> <span class="st0">"a"</span> <span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> ButtonText <span class="sy0">=</span> document.<span class="me1">createTextNode</span><span class="br0">(</span> collapseCaption <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> Button.<span class="me1">className</span> <span class="sy0">=</span> <span class="st0">"collapseButton"</span><span class="sy0">;</span> <span class="co1">//Styles are declared in Common.css</span><br>&nbsp;<br> ButtonLink.<span class="me1">style</span>.<span class="me1">color</span> <span class="sy0">=</span> Header.<span class="me1">style</span>.<span class="me1">color</span><span class="sy0">;</span><br> ButtonLink.<span class="me1">setAttribute</span><span class="br0">(</span> <span class="st0">"id"</span><span class="sy0">,</span> <span class="st0">"collapseButton"</span> <span class="sy0">+</span> tableIndex <span class="br0">)</span><span class="sy0">;</span><br> ButtonLink.<span class="me1">setAttribute</span><span class="br0">(</span> <span class="st0">"href"</span><span class="sy0">,</span> <span class="st0">"javascript:collapseTable("</span> <span class="sy0">+</span> tableIndex <span class="sy0">+</span> <span class="st0">");"</span> <span class="br0">)</span><span class="sy0">;</span><br> ButtonLink.<span class="me1">appendChild</span><span class="br0">(</span> ButtonText <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> Button.<span class="me1">appendChild</span><span class="br0">(</span> document.<span class="me1">createTextNode</span><span class="br0">(</span> <span class="st0">"["</span> <span class="br0">)</span> <span class="br0">)</span><span class="sy0">;</span><br> Button.<span class="me1">appendChild</span><span class="br0">(</span> ButtonLink <span class="br0">)</span><span class="sy0">;</span><br> Button.<span class="me1">appendChild</span><span class="br0">(</span> document.<span class="me1">createTextNode</span><span class="br0">(</span> <span class="st0">"]"</span> <span class="br0">)</span> <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> Header.<span class="me1">insertBefore</span><span class="br0">(</span> Button<span class="sy0">,</span> Header.<span class="me1">childNodes</span><span class="br0">[</span>0<span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span><br> tableIndex<span class="sy0">++;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br>&nbsp;<br> <span class="kw1">for</span> <span class="br0">(</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> tableIndex<span class="sy0">;</span> i<span class="sy0">++</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> hasClass<span class="br0">(</span> NavigationBoxes<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">,</span> <span class="st0">"collapsed"</span> <span class="br0">)</span> <span class="sy0">||</span> <span class="br0">(</span> tableIndex <span class="sy0">&gt;=</span> autoCollapse <span class="sy0">&amp;&amp;</span> hasClass<span class="br0">(</span> NavigationBoxes<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">,</span> <span class="st0">"autocollapse"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> collapseTable<span class="br0">(</span> i <span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span> <br> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span> hasClass<span class="br0">(</span> NavigationBoxes<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">,</span> <span class="st0">"innercollapse"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> element <span class="sy0">=</span> NavigationBoxes<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">;</span><br> <span class="kw1">while</span> <span class="br0">(</span>element <span class="sy0">=</span> element.<span class="me1">parentNode</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> hasClass<span class="br0">(</span> element<span class="sy0">,</span> <span class="st0">"outercollapse"</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> collapseTable <span class="br0">(</span> i <span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">break</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br>addOnloadHook<span class="br0">(</span> createCollapseButtons <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/** Dynamic Navigation Bars (experimental) *************************************
*
*  Description: See [[Wikipedia:NavFrame]].
*  Maintainers: UNMAINTAINED
*/</span><br>&nbsp;<br><span class="co1">// set up the words in your language</span><br><span class="kw2">var</span> NavigationBarHide <span class="sy0">=</span> <span class="st0">'['</span> <span class="sy0">+</span> collapseCaption <span class="sy0">+</span> <span class="st0">']'</span><span class="sy0">;</span><br><span class="kw2">var</span> NavigationBarShow <span class="sy0">=</span> <span class="st0">'['</span> <span class="sy0">+</span> expandCaption <span class="sy0">+</span> <span class="st0">']'</span><span class="sy0">;</span><br>&nbsp;<br><span class="co1">// shows and hides content and picture (if available) of navigation bars</span><br><span class="co1">// Parameters:</span><br><span class="co1">//    indexNavigationBar: the index of navigation bar to be toggled</span><br><span class="kw2">function</span> toggleNavigationBar<span class="br0">(</span>indexNavigationBar<span class="br0">)</span><br><span class="br0">{</span><br> <span class="kw2">var</span> NavToggle <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">"NavToggle"</span> <span class="sy0">+</span> indexNavigationBar<span class="br0">)</span><span class="sy0">;</span><br> <span class="kw2">var</span> NavFrame <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">"NavFrame"</span> <span class="sy0">+</span> indexNavigationBar<span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>NavFrame <span class="sy0">||</span> <span class="sy0">!</span>NavToggle<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">return</span> <span class="kw2">false</span><span class="sy0">;</span><br> <span class="br0">}</span><br>&nbsp;<br> <span class="co1">// if shown now</span><br> <span class="kw1">if</span> <span class="br0">(</span>NavToggle.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">==</span> NavigationBarHide<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span><span class="kw2">var</span> NavChild <span class="sy0">=</span> NavFrame.<span class="me1">firstChild</span><span class="sy0">;</span> NavChild <span class="sy0">!=</span> <span class="kw2">null</span><span class="sy0">;</span> NavChild <span class="sy0">=</span> NavChild.<span class="me1">nextSibling</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>hasClass<span class="br0">(</span>NavChild<span class="sy0">,</span> <span class="st0">'NavContent'</span><span class="br0">)</span> <span class="sy0">||</span> hasClass<span class="br0">(</span>NavChild<span class="sy0">,</span> <span class="st0">'NavPic'</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span><br> NavChild.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">'none'</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> NavToggle.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">=</span> NavigationBarShow<span class="sy0">;</span><br>&nbsp;<br> <span class="co1">// if hidden now</span><br> <span class="br0">}</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span>NavToggle.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">==</span> NavigationBarShow<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span><span class="kw2">var</span> NavChild <span class="sy0">=</span> NavFrame.<span class="me1">firstChild</span><span class="sy0">;</span> NavChild <span class="sy0">!=</span> <span class="kw2">null</span><span class="sy0">;</span> NavChild <span class="sy0">=</span> NavChild.<span class="me1">nextSibling</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>hasClass<span class="br0">(</span>NavChild<span class="sy0">,</span> <span class="st0">'NavContent'</span><span class="br0">)</span> <span class="sy0">||</span> hasClass<span class="br0">(</span>NavChild<span class="sy0">,</span> <span class="st0">'NavPic'</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span><br> NavChild.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">'block'</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> NavToggle.<span class="me1">firstChild</span>.<span class="me1">data</span> <span class="sy0">=</span> NavigationBarHide<span class="sy0">;</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br><span class="co1">// adds show/hide-button to navigation bars</span><br><span class="kw2">function</span> createNavigationBarToggleButton<span class="br0">(</span><span class="br0">)</span><br><span class="br0">{</span><br> <span class="kw2">var</span> indexNavigationBar <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><br> <span class="co1">// iterate over all &lt; div &gt;-elements </span><br> <span class="kw2">var</span> divs <span class="sy0">=</span> document.<span class="me1">getElementsByTagName</span><span class="br0">(</span><span class="st0">"div"</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">for</span> <span class="br0">(</span><span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> NavFrame <span class="sy0">=</span> divs<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="co1">// if found a navigation bar</span><br> <span class="kw1">if</span> <span class="br0">(</span>hasClass<span class="br0">(</span>NavFrame<span class="sy0">,</span> <span class="st0">"NavFrame"</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span><br>&nbsp;<br> indexNavigationBar<span class="sy0">++;</span><br> <span class="kw2">var</span> NavToggle <span class="sy0">=</span> document.<span class="me1">createElement</span><span class="br0">(</span><span class="st0">"a"</span><span class="br0">)</span><span class="sy0">;</span><br> NavToggle.<span class="me1">className</span> <span class="sy0">=</span> <span class="st0">'NavToggle'</span><span class="sy0">;</span><br> NavToggle.<span class="me1">setAttribute</span><span class="br0">(</span><span class="st0">'id'</span><span class="sy0">,</span> <span class="st0">'NavToggle'</span> <span class="sy0">+</span> indexNavigationBar<span class="br0">)</span><span class="sy0">;</span><br> NavToggle.<span class="me1">setAttribute</span><span class="br0">(</span><span class="st0">'href'</span><span class="sy0">,</span> <span class="st0">'javascript:toggleNavigationBar('</span> <span class="sy0">+</span> indexNavigationBar <span class="sy0">+</span> <span class="st0">');'</span><span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="kw2">var</span> isCollapsed <span class="sy0">=</span> hasClass<span class="br0">(</span> NavFrame<span class="sy0">,</span> <span class="st0">"collapsed"</span> <span class="br0">)</span><span class="sy0">;</span><br> <span class="coMULTI">/*
            * Check if any children are already hidden.  This loop is here for backwards compatibility:
            * the old way of making NavFrames start out collapsed was to manually add style="display:none"
            * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
            * the content visible without JavaScript support), the new recommended way is to add the class
            * "collapsed" to the NavFrame itself, just like with collapsible tables.
            */</span><br> <span class="kw1">for</span> <span class="br0">(</span><span class="kw2">var</span> NavChild <span class="sy0">=</span> NavFrame.<span class="me1">firstChild</span><span class="sy0">;</span> NavChild <span class="sy0">!=</span> <span class="kw2">null</span> <span class="sy0">&amp;&amp;</span> <span class="sy0">!</span>isCollapsed<span class="sy0">;</span> NavChild <span class="sy0">=</span> NavChild.<span class="me1">nextSibling</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> hasClass<span class="br0">(</span> NavChild<span class="sy0">,</span> <span class="st0">'NavPic'</span> <span class="br0">)</span> <span class="sy0">||</span> hasClass<span class="br0">(</span> NavChild<span class="sy0">,</span> <span class="st0">'NavContent'</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> NavChild.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">==</span> <span class="st0">'none'</span> <span class="br0">)</span> <span class="br0">{</span><br> isCollapsed <span class="sy0">=</span> <span class="kw2">true</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="kw1">if</span> <span class="br0">(</span>isCollapsed<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span><span class="kw2">var</span> NavChild <span class="sy0">=</span> NavFrame.<span class="me1">firstChild</span><span class="sy0">;</span> NavChild <span class="sy0">!=</span> <span class="kw2">null</span><span class="sy0">;</span> NavChild <span class="sy0">=</span> NavChild.<span class="me1">nextSibling</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span> hasClass<span class="br0">(</span> NavChild<span class="sy0">,</span> <span class="st0">'NavPic'</span> <span class="br0">)</span> <span class="sy0">||</span> hasClass<span class="br0">(</span> NavChild<span class="sy0">,</span> <span class="st0">'NavContent'</span> <span class="br0">)</span> <span class="br0">)</span> <span class="br0">{</span><br> NavChild.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">'none'</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="kw2">var</span> NavToggleText <span class="sy0">=</span> document.<span class="me1">createTextNode</span><span class="br0">(</span>isCollapsed <span class="sy0">?</span> NavigationBarShow <span class="sy0">:</span> NavigationBarHide<span class="br0">)</span><span class="sy0">;</span><br> NavToggle.<span class="me1">appendChild</span><span class="br0">(</span>NavToggleText<span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> <span class="co1">// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)</span><br> <span class="kw1">for</span><span class="br0">(</span><span class="kw2">var</span> j<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> j <span class="sy0">&lt;</span> NavFrame.<span class="me1">childNodes</span>.<span class="me1">length</span><span class="sy0">;</span> j<span class="sy0">++</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>hasClass<span class="br0">(</span>NavFrame.<span class="me1">childNodes</span><span class="br0">[</span>j<span class="br0">]</span><span class="sy0">,</span> <span class="st0">"NavHead"</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span><br> NavFrame.<span class="me1">childNodes</span><span class="br0">[</span>j<span class="br0">]</span>.<span class="me1">appendChild</span><span class="br0">(</span>NavToggle<span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> NavFrame.<span class="me1">setAttribute</span><span class="br0">(</span><span class="st0">'id'</span><span class="sy0">,</span> <span class="st0">'NavFrame'</span> <span class="sy0">+</span> indexNavigationBar<span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>&nbsp;<br>addOnloadHook<span class="br0">(</span> createNavigationBarToggleButton <span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/** Main Page layout fixes *********************************************************
*
*  Description: Adds an additional link to the complete list of languages available.
*  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
*/</span><br>&nbsp;<br><span class="kw1">if</span> <span class="br0">(</span>wgPageName <span class="sy0">==</span> <span class="st0">'Main_Page'</span> <span class="sy0">||</span> wgPageName <span class="sy0">==</span> <span class="st0">'Talk:Main_Page'</span><span class="br0">)</span> <br> addOnloadHook<span class="br0">(</span><span class="kw2">function</span> <span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><br> addPortletLink<span class="br0">(</span><span class="st0">'p-lang'</span><span class="sy0">,</span> <span class="st0">'http://meta.wikimedia.org/wiki/List_of_Wikipedias'</span><span class="sy0">,</span><br> <span class="st0">'Complete list'</span><span class="sy0">,</span> <span class="st0">'interwiki-completelist'</span><span class="sy0">,</span> <span class="st0">'Complete list of Wikipedias'</span><span class="br0">)</span><br> <span class="kw2">var</span> nstab <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">'ca-nstab-main'</span><span class="br0">)</span><br> <span class="kw1">if</span> <span class="br0">(</span>nstab <span class="sy0">&amp;&amp;</span> wgUserLanguage<span class="sy0">==</span><span class="st0">'en'</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">while</span> <span class="br0">(</span>nstab.<span class="me1">firstChild</span><span class="br0">)</span> nstab <span class="sy0">=</span> nstab.<span class="me1">firstChild</span><br> nstab.<span class="me1">nodeValue</span> <span class="sy0">=</span> <span class="st0">'Main Page'</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">)</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/** Table sorting fixes ************************************************
  *
  *  Description: Disables code in table sorting routine to set classes on even/odd rows
  *  Maintainers: [[User:Random832]]
  */</span><br>&nbsp;<br>ts_alternate_row_colors <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br><span class="coMULTI">/***** uploadwizard_newusers ********
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
*
*  Maintainers: [[User:Krimpet]]
****/</span><br><span class="kw2">function</span> uploadwizard_newusers<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>wgNamespaceNumber <span class="sy0">==</span> <span class="nu0">4</span> <span class="sy0">&amp;&amp;</span> wgTitle <span class="sy0">==</span> <span class="st0">"Upload"</span> <span class="sy0">&amp;&amp;</span> wgAction <span class="sy0">==</span> <span class="st0">"view"</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw2">var</span> oldDiv <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">"autoconfirmedusers"</span><span class="br0">)</span><span class="sy0">,</span><br> newDiv <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">"newusers"</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span>oldDiv <span class="sy0">&amp;&amp;</span> newDiv<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="kw1">typeof</span> wgUserGroups <span class="sy0">==</span> <span class="st0">"object"</span> <span class="sy0">&amp;&amp;</span> wgUserGroups<span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">for</span> <span class="br0">(</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> wgUserGroups.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>wgUserGroups<span class="br0">[</span>i<span class="br0">]</span> <span class="sy0">==</span> <span class="st0">"autoconfirmed"</span><span class="br0">)</span> <span class="br0">{</span><br> oldDiv.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">"block"</span><span class="sy0">;</span><br> newDiv.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">"none"</span><span class="sy0">;</span><br> <span class="kw1">return</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> oldDiv.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">"none"</span><span class="sy0">;</span><br> newDiv.<span class="me1">style</span>.<span class="me1">display</span> <span class="sy0">=</span> <span class="st0">"block"</span><span class="sy0">;</span><br> <span class="kw1">return</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br><span class="br0">}</span><br>addOnloadHook<span class="br0">(</span>uploadwizard_newusers<span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br>&nbsp;<br><span class="co2">/** IPv6 AAAA connectivity testing **/</span><br>&nbsp;<br><span class="kw2">var</span> __ipv6wwwtest_factor <span class="sy0">=</span> <span class="nu0">100</span><span class="sy0">;</span><br><span class="kw2">var</span> __ipv6wwwtest_done <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><br><span class="kw1">if</span> <span class="br0">(</span><span class="br0">(</span>wgServer <span class="sy0">!=</span> <span class="st0">"https://secure.wikimedia.org"</span><span class="br0">)</span> <span class="sy0">&amp;&amp;</span> <span class="br0">(</span>Math.<span class="me1">floor</span><span class="br0">(</span>Math.<span class="me1">random</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">*</span>__ipv6wwwtest_factor<span class="br0">)</span><span class="sy0">==</span><span class="nu0">42</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span><br> importScript<span class="br0">(</span><span class="st0">"MediaWiki:Common.js/IPv6.js"</span><span class="br0">)</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="coMULTI">/** Magic editintros ****************************************************
*
*  Description: Adds editintros on disambiguation pages and BLP pages.
*  Maintainers: [[User:RockMFR]]
*/</span><br>&nbsp;<br><span class="kw2">function</span> addEditIntro<span class="br0">(</span><span class="kw3">name</span><span class="br0">)</span><br><span class="br0">{</span><br> <span class="kw2">var</span> el <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">'ca-edit'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>el<span class="br0">)</span><br> <span class="kw1">return</span><span class="sy0">;</span><br> el <span class="sy0">=</span> el.<span class="me1">getElementsByTagName</span><span class="br0">(</span><span class="st0">'a'</span><span class="br0">)</span><span class="br0">[</span>0<span class="br0">]</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span>el<span class="br0">)</span><br> el.<span class="me1">href</span> <span class="sy0">+=</span> <span class="st0">'&amp;editintro='</span> <span class="sy0">+</span> <span class="kw3">name</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br>&nbsp;<br><span class="kw1">if</span> <span class="br0">(</span>wgNamespaceNumber <span class="sy0">==</span> 0<span class="br0">)</span> <span class="br0">{</span><br> addOnloadHook<span class="br0">(</span><span class="kw2">function</span><span class="br0">(</span><span class="br0">)</span><span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">'disambigbox'</span><span class="br0">)</span><span class="br0">)</span><br> addEditIntro<span class="br0">(</span><span class="st0">'Template:Disambig_editintro'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="br0">}</span><span class="br0">)</span><span class="sy0">;</span><br>&nbsp;<br> addOnloadHook<span class="br0">(</span><span class="kw2">function</span><span class="br0">(</span><span class="br0">)</span><span class="br0">{</span><br> <span class="kw2">var</span> cats <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">(</span><span class="st0">'mw-normal-catlinks'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>cats<span class="br0">)</span><br> <span class="kw1">return</span><span class="sy0">;</span><br> cats <span class="sy0">=</span> cats.<span class="me1">getElementsByTagName</span><span class="br0">(</span><span class="st0">'a'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">for</span> <span class="br0">(</span><span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> cats.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> <span class="br0">{</span><br> <span class="kw1">if</span> <span class="br0">(</span>cats<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">title</span> <span class="sy0">==</span> <span class="st0">'Category:Living people'</span> <span class="sy0">||</span> cats<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">title</span> <span class="sy0">==</span> <span class="st0">'Category:Possibly living people'</span><span class="br0">)</span> <span class="br0">{</span><br> addEditIntro<span class="br0">(</span><span class="st0">'Template:BLP_editintro'</span><span class="br0">)</span><span class="sy0">;</span><br> <span class="kw1">break</span><span class="sy0">;</span><br> <span class="br0">}</span><br> <span class="br0">}</span><br> <span class="br0">}</span><span class="br0">)</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="coMULTI">/*
* Description: Stay on the secure server as much as possible
* Maintainers: [[User:TheDJ]]
*/</span><br><span class="kw1">if</span><span class="br0">(</span>wgServer <span class="sy0">==</span> <span class="st0">'https://secure.wikimedia.org'</span><span class="br0">)</span> <span class="br0">{</span><br> importScript<span class="br0">(</span> <span class="st0">'MediaWiki:Common.js/secure.js'</span><span class="br0">)</span><span class="sy0">;</span><br><span class="br0">}</span><br>&nbsp;<br><span class="co1">// Define ta for now. Bugzilla 23175</span><br>window.<span class="me1">ta</span> <span class="sy0">=</span> <span class="br0">[</span><span class="br0">]</span><span class="sy0">;</span><br>&nbsp;<br><span class="co1">//&lt;/source&gt;</span></pre></div>

Revision as of 20:51, 14 June 2010

/* Any JavaScript here will be loaded for all users on every page load. */