index.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. /* generated javascript */
  2. var skin = 'monobook';
  3. var stylepath = '/skins-1.5';
  4. /* MediaWiki:Common.js */
  5. /** Tooltips and access keys ***************************************************
  6. *
  7. * Description: Adds tooltips and access keys to links part of the MediaWiki
  8. * interface.
  9. * Maintainers: [[User:Gwicke|Gwicke]]?, [[User:Simetrical|Simetrical]]?, [[User:Ruud Koot|Ruud Koot]]
  10. */
  11. ta = new Object();
  12. ta["n-mainpage"] = new Array("z","Visit the main page");
  13. ta["n-Main-page"] = new Array("z","Visit the main page");
  14. ta["n-Featured-content"] = new Array("","Featured content — the best of Wikipedia");
  15. ta["n-help"] = new Array("","The place to find out about Wikipedia");
  16. ta["n-contact"] = new Array("","How to contact Wikipedia");
  17. ta["n-sitesupport"] = new Array("","Help keep Wikipedia running");
  18. ta["t-print"] = new Array("","Printable version of this page");
  19. ta["t-permalink"] = new Array("","Permanent link to this version of the page");
  20. ta["t-cite"] = new Array("","Cite this Wikipedia article");
  21. ta["ca-nstab-project"] = new Array("c","View the project page");
  22. ta["n-Contents"] = new Array("","Guides to browsing Wikipedia");
  23. /** Import module *************************************************************
  24. *
  25. * Description: Includes a raw wiki page as javascript or CSS,
  26. * used for including user made modules.
  27. * Maintainers: [[User:AzaToth]]
  28. */
  29. importedScripts = {}; // object keeping track of included scripts, so a script ain't included twice
  30. function importScript( page ) {
  31. if( importedScripts[page] ) {
  32. return;
  33. }
  34. importedScripts[page] = true;
  35. var url = wgScriptPath
  36. + '/index.php?title='
  37. + encodeURIComponent( page.replace( ' ', '_' ) )
  38. + '&action=raw&ctype=text/javascript';
  39. var scriptElem = document.createElement( 'script' );
  40. scriptElem.setAttribute( 'src' , url );
  41. scriptElem.setAttribute( 'type' , 'text/javascript' );
  42. document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
  43. }
  44. function importStylesheet( page ) {
  45. var sheet = '@import "'
  46. + wgScriptPath
  47. + '/index.php?title='
  48. + encodeURIComponent( page.replace( ' ', '_' ) )
  49. + '&action=raw&ctype=text/css";'
  50. var styleElem = document.createElement( 'style' );
  51. styleElem.setAttribute( 'type' , 'text/css' );
  52. styleElem.appendChild( document.createTextNode( sheet ) );
  53. document.getElementsByTagName( 'head' )[0].appendChild( styleElem );
  54. }
  55. /* Test if an element has a certain class **************************************
  56. *
  57. * Description: Uses regular expressions and caching for better performance.
  58. * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
  59. */
  60. var hasClass = (function () {
  61. var reCache = {};
  62. return function (element, className) {
  63. return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
  64. };
  65. })();
  66. /** Internet Explorer bug fix **************************************************
  67. *
  68. * Description: UNDOCUMENTED
  69. * Maintainers: [[User:Tom-]]?
  70. */
  71. if (window.showModalDialog && document.compatMode && document.compatMode == "CSS1Compat")
  72. {
  73. var oldWidth;
  74. var docEl = document.documentElement;
  75. function fixIEScroll()
  76. {
  77. if (!oldWidth || docEl.clientWidth > oldWidth)
  78. doFixIEScroll();
  79. else
  80. setTimeout(doFixIEScroll, 1);
  81. oldWidth = docEl.clientWidth;
  82. }
  83. function doFixIEScroll() {
  84. docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
  85. }
  86. document.attachEvent("onreadystatechange", fixIEScroll);
  87. attachEvent("onresize", fixIEScroll);
  88. }
  89. /** Interwiki links to featured articles ***************************************
  90. *
  91. * Description: Highlights interwiki links to featured articles (or
  92. * equivalents) by changing the bullet before the interwiki link
  93. * into a star.
  94. * Maintainers: [[User:R. Koot]]
  95. */
  96. function LinkFA()
  97. {
  98. if ( document.getElementById( "p-lang" ) ) {
  99. var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
  100. for ( var i = 0; i < InterwikiLinks.length; i++ ) {
  101. if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
  102. InterwikiLinks[i].className += " FA"
  103. InterwikiLinks[i].title = "This is a featured article in another language.";
  104. }
  105. }
  106. }
  107. }
  108. addOnloadHook( LinkFA );
  109. /** Collapsible tables *********************************************************
  110. *
  111. * Description: Allows tables to be collapsed, showing only the header. See
  112. * [[Wikipedia:NavFrame]].
  113. * Maintainers: [[User:R. Koot]]
  114. */
  115. var autoCollapse = 2;
  116. var collapseCaption = "hide";
  117. var expandCaption = "show";
  118. function collapseTable( tableIndex )
  119. {
  120. var Button = document.getElementById( "collapseButton" + tableIndex );
  121. var Table = document.getElementById( "collapsibleTable" + tableIndex );
  122. if ( !Table || !Button ) {
  123. return false;
  124. }
  125. var Rows = Table.getElementsByTagName( "tr" );
  126. if ( Button.firstChild.data == collapseCaption ) {
  127. for ( var i = 1; i < Rows.length; i++ ) {
  128. Rows[i].style.display = "none";
  129. }
  130. Button.firstChild.data = expandCaption;
  131. } else {
  132. for ( var i = 1; i < Rows.length; i++ ) {
  133. Rows[i].style.display = Rows[0].style.display;
  134. }
  135. Button.firstChild.data = collapseCaption;
  136. }
  137. }
  138. function createCollapseButtons()
  139. {
  140. var tableIndex = 0;
  141. var NavigationBoxes = new Object();
  142. var Tables = document.getElementsByTagName( "table" );
  143. for ( var i = 0; i < Tables.length; i++ ) {
  144. if ( hasClass( Tables[i], "collapsible" ) ) {
  145. NavigationBoxes[ tableIndex ] = Tables[i];
  146. Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
  147. var Button = document.createElement( "span" );
  148. var ButtonLink = document.createElement( "a" );
  149. var ButtonText = document.createTextNode( collapseCaption );
  150. Button.style.styleFloat = "right";
  151. Button.style.cssFloat = "right";
  152. Button.style.fontWeight = "normal";
  153. Button.style.textAlign = "right";
  154. Button.style.width = "6em";
  155. ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
  156. ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
  157. ButtonLink.appendChild( ButtonText );
  158. Button.appendChild( document.createTextNode( "[" ) );
  159. Button.appendChild( ButtonLink );
  160. Button.appendChild( document.createTextNode( "]" ) );
  161. var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
  162. /* only add button and increment count if there is a header row to work with */
  163. if (Header) {
  164. Header.insertBefore( Button, Header.childNodes[0] );
  165. tableIndex++;
  166. }
  167. }
  168. }
  169. for ( var i = 0; i < tableIndex; i++ ) {
  170. if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
  171. collapseTable( i );
  172. }
  173. }
  174. }
  175. addOnloadHook( createCollapseButtons );
  176. /** Dynamic Navigation Bars (experimental) *************************************
  177. *
  178. * Description: See [[Wikipedia:NavFrame]].
  179. * Maintainers: UNMAINTAINED
  180. */
  181. // set up the words in your language
  182. var NavigationBarHide = '[' + collapseCaption + ']';
  183. var NavigationBarShow = '[' + expandCaption + ']';
  184. // set up max count of Navigation Bars on page,
  185. // if there are more, all will be hidden
  186. // NavigationBarShowDefault = 0; // all bars will be hidden
  187. // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
  188. var NavigationBarShowDefault = autoCollapse;
  189. // shows and hides content and picture (if available) of navigation bars
  190. // Parameters:
  191. // indexNavigationBar: the index of navigation bar to be toggled
  192. function toggleNavigationBar(indexNavigationBar)
  193. {
  194. var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
  195. var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
  196. if (!NavFrame || !NavToggle) {
  197. return false;
  198. }
  199. // if shown now
  200. if (NavToggle.firstChild.data == NavigationBarHide) {
  201. for (
  202. var NavChild = NavFrame.firstChild;
  203. NavChild != null;
  204. NavChild = NavChild.nextSibling
  205. ) {
  206. if ( hasClass( NavChild, 'NavPic' ) ) {
  207. NavChild.style.display = 'none';
  208. }
  209. if ( hasClass( NavChild, 'NavContent') ) {
  210. NavChild.style.display = 'none';
  211. }
  212. }
  213. NavToggle.firstChild.data = NavigationBarShow;
  214. // if hidden now
  215. } else if (NavToggle.firstChild.data == NavigationBarShow) {
  216. for (
  217. var NavChild = NavFrame.firstChild;
  218. NavChild != null;
  219. NavChild = NavChild.nextSibling
  220. ) {
  221. if (hasClass(NavChild, 'NavPic')) {
  222. NavChild.style.display = 'block';
  223. }
  224. if (hasClass(NavChild, 'NavContent')) {
  225. NavChild.style.display = 'block';
  226. }
  227. }
  228. NavToggle.firstChild.data = NavigationBarHide;
  229. }
  230. }
  231. // adds show/hide-button to navigation bars
  232. function createNavigationBarToggleButton()
  233. {
  234. var indexNavigationBar = 0;
  235. // iterate over all < div >-elements
  236. var divs = document.getElementsByTagName("div");
  237. for(
  238. var i=0;
  239. NavFrame = divs[i];
  240. i++
  241. ) {
  242. // if found a navigation bar
  243. if (hasClass(NavFrame, "NavFrame")) {
  244. indexNavigationBar++;
  245. var NavToggle = document.createElement("a");
  246. NavToggle.className = 'NavToggle';
  247. NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
  248. NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
  249. var NavToggleText = document.createTextNode(NavigationBarHide);
  250. NavToggle.appendChild(NavToggleText);
  251. // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
  252. for(
  253. var j=0;
  254. j < NavFrame.childNodes.length;
  255. j++
  256. ) {
  257. if (hasClass(NavFrame.childNodes[j], "NavHead")) {
  258. NavFrame.childNodes[j].appendChild(NavToggle);
  259. }
  260. }
  261. NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
  262. }
  263. }
  264. // if more Navigation Bars found than Default: hide all
  265. if (NavigationBarShowDefault < indexNavigationBar) {
  266. for(
  267. var i=1;
  268. i<=indexNavigationBar;
  269. i++
  270. ) {
  271. toggleNavigationBar(i);
  272. }
  273. }
  274. }
  275. addOnloadHook( createNavigationBarToggleButton );
  276. /** Main Page layout fixes *********************************************************
  277. *
  278. * Description: Various layout fixes for the main page, including an
  279. * additional link to the complete list of languages available
  280. * and the renaming of the 'Article' to to 'Main Page'.
  281. * Maintainers: [[User:AzaToth]], [[User:R. Koot]]
  282. */
  283. function mainPageRenameNamespaceTab() {
  284. try {
  285. var Node = document.getElementById( 'ca-nstab-main' ).firstChild;
  286. if ( Node.textContent ) { // Per DOM Level 3
  287. Node.textContent = 'Main Page';
  288. } else if ( Node.innerText ) { // IE doesn't handle .textContent
  289. Node.innerText = 'Main Page';
  290. } else { // Fallback
  291. Node.replaceChild( Node.firstChild, document.createTextNode( 'Main Page' ) );
  292. }
  293. } catch(e) {
  294. // bailing out!
  295. }
  296. }
  297. function mainPageAppendCompleteListLink() {
  298. try {
  299. var node = document.getElementById( "p-lang" )
  300. .getElementsByTagName('div')[0]
  301. .getElementsByTagName('ul')[0];
  302. var aNode = document.createElement( 'a' );
  303. var liNode = document.createElement( 'li' );
  304. aNode.appendChild( document.createTextNode( 'Complete list' ) );
  305. aNode.setAttribute( 'href' , 'http://meta.wikimedia.org/wiki/List_of_Wikipedias' );
  306. liNode.appendChild( aNode );
  307. liNode.className = 'interwiki-completelist';
  308. node.appendChild( liNode );
  309. } catch(e) {
  310. // lets just ignore what's happened
  311. return;
  312. }
  313. }
  314. if ( wgTitle == 'Main Page' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) {
  315. addOnloadHook( mainPageRenameNamespaceTab );
  316. }
  317. if ( wgTitle == 'Main Page' && wgNamespaceNumber == 0 ) {
  318. addOnloadHook( mainPageAppendCompleteListLink );
  319. }
  320. /** Extra toolbar options ****************************************************** <nowiki>
  321. *
  322. * Description: UNDOCUMENTED
  323. * Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
  324. */
  325. //This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
  326. // This is based on the original code on Wikipedia:Tools/Editing tools
  327. // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
  328. if (mwCustomEditButtons) {
  329. mwCustomEditButtons[mwCustomEditButtons.length] = {
  330. "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
  331. "speedTip": "Redirect",
  332. "tagOpen": "#REDIRECT [[",
  333. "tagClose": "]]",
  334. "sampleText": "Insert text"};
  335. mwCustomEditButtons[mwCustomEditButtons.length] = {
  336. "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
  337. "speedTip": "Strike",
  338. "tagOpen": "<s>",
  339. "tagClose": "</s>",
  340. "sampleText": "Strike-through text"};
  341. mwCustomEditButtons[mwCustomEditButtons.length] = {
  342. "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
  343. "speedTip": "Line break",
  344. "tagOpen": "<br />",
  345. "tagClose": "",
  346. "sampleText": ""};
  347. mwCustomEditButtons[mwCustomEditButtons.length] = {
  348. "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
  349. "speedTip": "Superscript",
  350. "tagOpen": "<sup>",
  351. "tagClose": "</sup>",
  352. "sampleText": "Superscript text"};
  353. mwCustomEditButtons[mwCustomEditButtons.length] = {
  354. "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
  355. "speedTip": "Subscript",
  356. "tagOpen": "<sub>",
  357. "tagClose": "</sub>",
  358. "sampleText": "Subscript text"};
  359. mwCustomEditButtons[mwCustomEditButtons.length] = {
  360. "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
  361. "speedTip": "Small",
  362. "tagOpen": "<small>",
  363. "tagClose": "</small>",
  364. "sampleText": "Small Text"};
  365. mwCustomEditButtons[mwCustomEditButtons.length] = {
  366. "imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
  367. "speedTip": "Insert hidden Comment",
  368. "tagOpen": "<!-- ",
  369. "tagClose": " -->",
  370. "sampleText": "Comment"};
  371. mwCustomEditButtons[mwCustomEditButtons.length] = {
  372. "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
  373. "speedTip": "Insert a picture gallery",
  374. "tagOpen": "\n<gallery>\n",
  375. "tagClose": "\n</gallery>",
  376. "sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"};
  377. mwCustomEditButtons[mwCustomEditButtons.length] = {
  378. "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",
  379. "speedTip": "Insert block of quoted text",
  380. "tagOpen": "<blockquote>\n",
  381. "tagClose": "\n</blockquote>",
  382. "sampleText": "Block quote"};
  383. mwCustomEditButtons[mwCustomEditButtons.length] = {
  384. "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
  385. "speedTip": "Insert a table",
  386. "tagOpen": '{| class="wikitable"\n|-\n',
  387. "tagClose": "\n|}",
  388. "sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"};
  389. }
  390. /*</nowiki>*/
  391. /** pageview counter ***********************************************************
  392. *
  393. * Description: Please talk to de:User:LeonWeber before changing anything or
  394. * if there are any issues with that.
  395. * Maintainers: [[:de:User:LeonWeber]]?
  396. */
  397. // this should be adjusted to a good value.
  398. // BE CAREFUL, you will break zedler if it's too low!
  399. // And then DaB. will kill Leon :-(
  400. var disable_counter = 0;
  401. var counter_factor = 6000;
  402. function pgcounter_setup()
  403. {
  404. if(disable_counter == 0)
  405. {
  406. var url = window.location.href;
  407. if(Math.floor(Math.random()*counter_factor)==42) // the probability thing
  408. {
  409. if(wgIsArticle==true || wgArticleId==0) // do not count history pages etc.
  410. {
  411. var pgcountNs = wgCanonicalNamespace;
  412. if(wgCanonicalNamespace=="")
  413. {
  414. pgcountNs = "0";
  415. }
  416. var cnt_url = "http://pgcount.wikimedia.de/index.png?ns=" + pgcountNs + "&title=" + encodeURI(wgTitle) + "&factor=" + counter_factor +"&wiki=enwiki";
  417. var img = new Image();
  418. img.src = cnt_url;
  419. }
  420. }
  421. }
  422. }
  423. // Do not use aOnloadFunctions[aOnloadFunctions.length] = pgcounter_setup;, some browsers don't like that.
  424. pgcounter_setup();
  425. /** "Technical restrictions" title fix *****************************************
  426. *
  427. * Description:
  428. * Maintainers: [[User:Interiot]], [[User:Mets501]]
  429. */
  430. // For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink.
  431. // (for instance [[iPod]]'s title is updated. <nowiki>But [[C#]] is not an equivalent wikilink, so [[C Sharp]] doesn't have its main title changed)</nowiki>
  432. //
  433. // The function looks for a banner like this: <nowiki>
  434. // <div id="RealTitleBanner"> <!-- div that gets hidden -->
  435. // <span id="RealTitle">title</span>
  436. // </div>
  437. // </nowiki>An element with id=DisableRealTitle disables the function.
  438. var disableRealTitle = 0; // users can disable this by making this true from their monobook.js
  439. if (wgIsArticle) { // don't display the RealTitle when editing, since it is apparently inconsistent (doesn't show when editing sections, doesn't show when not previewing)
  440. addOnloadHook(function() {
  441. try {
  442. var realTitleBanner = document.getElementById("RealTitleBanner");
  443. if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
  444. var realTitle = document.getElementById("RealTitle");
  445. if (realTitle) {
  446. var realTitleHTML = realTitle.innerHTML;
  447. realTitleText = pickUpText(realTitle);
  448. var isPasteable = 0;
  449. //var containsHTML = /</.test(realTitleHTML); // contains ANY HTML
  450. var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
  451. // calculate whether the title is pasteable
  452. var verifyTitle = realTitleText.replace(/^ +/, ""); // trim left spaces
  453. verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
  454. // if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.
  455. if (wgNamespaceNumber != 0) {
  456. if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") {
  457. verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1);
  458. } else {
  459. realTitleText = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleText;
  460. realTitleHTML = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleHTML;
  461. }
  462. }
  463. // verify whether wgTitle matches
  464. verifyTitle = verifyTitle.replace(/^ +/, "").replace(/ +$/, ""); // trim left and right spaces
  465. verifyTitle = verifyTitle.replace(/_/g, " "); // underscores to spaces
  466. verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
  467. isPasteable = (verifyTitle == wgTitle);
  468. var h1 = document.getElementsByTagName("h1")[0];
  469. if (h1 && isPasteable) {
  470. h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
  471. if (!containsTooMuchHTML)
  472. realTitleBanner.style.display = "none";
  473. }
  474. document.title = realTitleText + " - Wikipedia, the free encyclopedia";
  475. }
  476. }
  477. } catch (e) {
  478. /* Something went wrong. */
  479. }
  480. });
  481. }
  482. // similar to innerHTML, but only returns the text portions of the insides, excludes HTML
  483. function pickUpText(aParentElement) {
  484. var str = "";
  485. function pickUpTextInternal(aElement) {
  486. var child = aElement.firstChild;
  487. while (child) {
  488. if (child.nodeType == 1) // ELEMENT_NODE
  489. pickUpTextInternal(child);
  490. else if (child.nodeType == 3) // TEXT_NODE
  491. str += child.nodeValue;
  492. child = child.nextSibling;
  493. }
  494. }
  495. pickUpTextInternal(aParentElement);
  496. return str;
  497. }
  498. //fix edit summary prompt for undo
  499. //this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the
  500. //edit summary unchanged
  501. //this was added by [[User:Deskana]], code by [[User:Tra]]
  502. addOnloadHook(function () {
  503. if (document.location.search.indexOf("undo=") != -1
  504. && document.getElementsByName('wpAutoSummary')[0]) {
  505. document.getElementsByName('wpAutoSummary')[0].value='';
  506. }
  507. })
  508. /** Add dismiss button to watchlist-message *************************************
  509. *
  510. * Description: Hide the watchlist message for one week.
  511. * Maintainers: [[User:Ruud Koot|Ruud Koot]]
  512. */
  513. function addDismissButton() {
  514. var watchlistMessage = document.getElementById("watchlist-message");
  515. if ( watchlistMessage == null ) return;
  516. if ( document.cookie.indexOf( "hidewatchlistmessage=yes" ) != -1 ) {
  517. watchlistMessage.style.display = "none";
  518. }
  519. var Button = document.createElement( "span" );
  520. var ButtonLink = document.createElement( "a" );
  521. var ButtonText = document.createTextNode( "dismiss" );
  522. ButtonLink.setAttribute( "id", "dismissButton" );
  523. ButtonLink.setAttribute( "href", "javascript:dismissWatchlistMessage();" );
  524. ButtonLink.setAttribute( "title", "Hide this message for one week" );
  525. ButtonLink.appendChild( ButtonText );
  526. Button.appendChild( document.createTextNode( "[" ) );
  527. Button.appendChild( ButtonLink );
  528. Button.appendChild( document.createTextNode( "]" ) );
  529. watchlistMessage.appendChild( Button );
  530. }
  531. function dismissWatchlistMessage() {
  532. var e = new Date();
  533. e.setTime( e.getTime() + (7*24*60*60*1000) );
  534. document.cookie = "hidewatchlistmessage=yes; expires=" + e.toGMTString() + "; path=/";
  535. var watchlistMessage = document.getElementById("watchlist-message");
  536. watchlistMessage.style.display = "none";
  537. }
  538. addOnloadHook( addDismissButton );
  539. /** Numeric sorting ***************************************************
  540. *
  541. * Description: Fixes a bug (part of [[bugzilla:8115]])
  542. * in http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/wikibits.js
  543. * regarding [[Help:Sorting|table sorting]]:
  544. * it allows sorting of numbers with more than one comma (thousands separator).
  545. * Maintainer: [[User:Patrick|Patrick]]
  546. */
  547. function ts_parseFloat(num) {
  548. if (!num) return 0;
  549. num = parseFloat(num.replace(/,/g, ""));
  550. return (isNaN(num) ? 0 : num);
  551. }
  552. /** Main Page deletion image *******************************************************
  553. *
  554. * Description: If the Main Page does not exist (i.e. it's been deleted) then insert an image
  555. * instead of showing the "page does not exist" text.
  556. * Created by: [[User:Mark]], with invaluable help from [[User:Pathoschild]]
  557. */
  558. function MainPageDeletedImage() {
  559. try {
  560. //If the article does not exist and it is the Main Page, proceed
  561. if ( document.getElementById( "noarticletext" ) && wgTitle == 'Main Page' ) {
  562. // Insert a protected commons image at the end of the document explaining it.
  563. var contentbox = document.getElementById('content');
  564. var newimg = document.createElement('img');
  565. newimg.setAttribute('src','http://upload.wikimedia.org/wikipedia/commons/9/99/WikipediaTechnical.png');
  566. contentbox.appendChild(newimg);
  567. // Hide the article-does-not-exist text
  568. var NoArticleMessage = document.getElementById('noarticletext');
  569. NoArticleMessage.style.display="none";
  570. // Hide the edit button
  571. var EditThisPageButton = document.getElementById('ca-edit');
  572. EditThisPageButton.style.display="none";
  573. }
  574. } catch(e) {
  575. // In case it does not work, do nothing
  576. return;
  577. }
  578. }
  579. addOnloadHook( MainPageDeletedImage );
  580. /* MediaWiki:Monobook.js (deprecated; migrate to Common.js!) */
  581. /* Deprecated by [[MediaWiki:Common.js]] */