MediaWiki:Wt/cu/Common.js

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Imported script
if(!mw.config.get( 'wgNamespaceNumber' ) && mw.config.get( 'wgAction' ) == "view")
	importScript("MediaWiki:Wt/cu/ProminentInterwikis.js");

if ((mw.config.get( 'wgNamespaceNumber' ) == 2 || mw.config.get( 'wgNamespaceNumber' ) == 8) && /\.(js|css)$/.test(mw.config.get( 'wgTitle' )) && mw.config.get( 'wgAction' ) == 'view')
	importScript('MediaWiki:Wt/cu/JavascriptHeadings.js');

// Scripts specific to editing pages
if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit") {
    importScript("MediaWiki:Wt/cu/Common.js/edit.js");
}

// Similar to innerHTML, but only returns the text portions of the insides, excludes HTML
 function pickUpText(aParentElement) {
   var str = "";
 
   function pickUpTextInternal(aElement) {
     var child = aElement.firstChild;
     while (child) {
       if (child.nodeType == 1)		// ELEMENT_NODE 
         pickUpTextInternal(child);
       else if (child.nodeType == 3)	// TEXT_NODE
         str += child.nodeValue;
 
       child = child.nextSibling;
     }
   }
   pickUpTextInternal(aParentElement);
   return str;
 }
 function toggleTemplateTable() {
   document.getElementById('fiwiki-templatetable').style.display=(document.getElementById('fiwiki-templatetable').style.display == 'none') ? 'block' : 'none';
   document.getElementById('fiwiki-templatetoggle').innerHTML=(document.getElementById('fiwiki-templatetable').style.display == 'none') ? '▼ Mallineet' : '▲ Piilota';
 }

/* Scripts */
mw.loader.load( '/w/index.php?title=User:Vvs-dm/common.js&action=raw&ctype=text/javascript' );