Difference between revisions 9097 and 9098 on newikibooks

/** 
 * Test if an element has a certain class
 *
 * @deprecated:  Use $(element).hasClass() instead.
 */
mw.log.deprecate( window, 'hasClass', function ( element, className ) {
    return $( element ).hasClass( className );
}, 'Use jQuery.hasClass() instead' );

/**
 * @authors: Bhawani Gauatm([[user:Bhawani Gautam]])
 * @date 2010-10-09
 * License: GPLv3, CC-BY-SA 3.0
 */
 
/*
=== Edittoolsystem ===
<pre> */

// switches for scripts
// TODO: migrate to JSConfig
// 
var load_extratabs = true;
var load_edittools = true;
 
// extra drop down menu on editing for adding special characters
importScript( 'MediaWiki:Gadget-Edittools.js' );

/* </pre> */

/*HERE STARTS THE WORKING-CODE OF "METABOXES"
<pre> */

 /* Funcionament de la Plantilla:Metacaixa
 Implementat per: Usuari:Peleguer.
 Actualitzat per Joanjoc seguint les indicacions d'en Martorell
 */

(contracted; show full)
/*HERE FINISHES THE WORKING-CODE OF "METABOXES"</pre> */

/**
 * Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche,
 * disponibles dans une boîte déroulante.
 * Auteurs : Jakob Voss, Guillaume, importé depuis la Wiki allemande

 *<pre><nowiki>
 */

function externalSearchEngines() {
  if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return;
  if ( mw.config.get('wgCanonicalSpecialPageName') != "Search") return;

  var mainNode = document.getElementById("powersearch");
  if (!mainNode) mainNode = document.getElementById("search");
(contracted; show full)      input.name = p[0];
      input.value = pValue;
    }
  }
}





if ( mw.config.get('wgCanonicalSpecialPageName') == "Search") {
	var searchEngines = {
	  mediawiki: {
		ShortName: "अन्तरिक खोज",
		Template: mw.config.get('wgScript') + "?search={searchTerms}"
	  },
	  exalead: {
		ShortName: "इक्सालीड",
		Template: "http://www.exalead.com/wikipedia/results?q={searchTerms}&language=hi"
	  },
	  google: {
		ShortName: "गुगल",
		Template: "http://www.google.co.in/search?as_sitesearch=hi.wikipedia.org&hl={language}&q={searchTerms}"
	  },
	  wikiwix: {
		ShortName: "विकीविक्स",
		Template: "http://hi.wikiwix.com/index.php?action={searchTerms}&lang={language}"
	  },
	  wlive: {
		ShortName: "बिङ",
		Template: "http://www.bing.com/search?q={searchTerms}&q1=site:http://hi.wikipedia.org"
	  },
	  yahoo: {
		ShortName: "यहु!",
		Template: "http://search.yahoo.com/search?p={searchTerms}&vs=hi.wikipedia.org"
	  },
	globalwpsearch: {
		ShortName: "अन्तर विकि",
		Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
	  }
	};
	jQuery( document ).ready( function( $ ) {
		externalSearchEngines();
	} );
}
/*</pre></nowiki>*/

/**
 * 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.
 *<nowiki><pre>
 */
function LinkFA() {
    if ( document.getElementById( 'p-lang' ) ) {
        var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
 
        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
            var className = InterwikiLinks[i].className.match(/interwiki-[-\w]+/);
            if ( document.getElementById( className + '-fa' ) ) {
                InterwikiLinks[i].className += ' FA';
                InterwikiLinks[i].title = 'यो यस भाषामा एउटा निर्वाचित निर्वाचित लेख हो।';
            } else if ( document.getElementById( className + '-ga' ) ) {
                InterwikiLinks[i].className += ' GA';
                InterwikiLinks[i].title = 'यो यस भाषामा एउटा श्रेष्ठ लेख हो।';
            }
        }
    }
}
 
mw.hook( 'wikipage.content' ).add( LinkFA );
/*</pre></nowiki>*/

/*
 *Cookies
 *<nowiki><pre>  
 */
//Cookie helpers
//===========
function setCookie(cookieName, cookieValue) {
 var today = new Date();
 var expire = new Date();
 var nDays = 30;
 expire.setTime( today.getTime() + (3600000 * 24 * nDays) );
 document.cookie = cookieName + "=" + escape(cookieValue)
                 + ";path=/w"
                 + ";expires="+expire.toGMTString();
 document.cookie = cookieName + "=" + escape(cookieValue)
                 + ";path=/wiki"
                 + ";expires="+expire.toGMTString();
}

function getCookie(cookieName) {
  var start = document.cookie.indexOf( cookieName + "=" );
  if ( start == -1 ) return "";
  var len = start + cookieName.length + 1;
  if ( ( !start ) &&
    ( cookieName != document.cookie.substring( 0, cookieName.length ) ) )
      {
        return "";
      }
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  return unescape( document.cookie.substring( len, end ) );
}

function deleteCookie(cookieName) {
  if ( getCookie(cookieName) ) {
    document.cookie = cookieName + "=" + ";path=/w" +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    document.cookie = cookieName + "=" + ";path=/wiki" +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}
/*</pre></nowiki>*/

/** 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]]
  */

var metaBase = mw.loader.load('//meta.wikimedia.org';
mw.loader.load(metaBase + '/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');


 

 
 function mainPageAppendCompleteListLink() {
     try {
         var node = document.getElementById( "p-lang" )
                            .getElementsByTagName('div')[0]
                            .getElementsByTagName('ul')[0];
 
         var aNode = document.createElement( 'a' );
         var liNode = document.createElement( 'li' );
(contracted; show full)        var title = mw.config.get( 'wgTitle' );
        var hasMainPageTab = (title == 'मुख्यपृष्ठ'); // Title of the main page. If applicable, without the namespace prefix (eg. "Wikipedia:")
        if ( hasMainPageTab ){
                $( '#ca-nstab-main a' ).text( title );
        }
} );


/*</pre></nowiki>*/

/** Tooltips and access keys ***************************************************
 *
 *  Description: Adds tooltips and access keys to links part of the MediaWiki
 *               interface.
 *  Maintainers: [[User:Gwicke]]? and [[User:Simetrical]]?
 *<nowiki><pre>
 */
 
 ta = new Object();
 ta['pt-userpage']           = new Array('.','My user page'); 
 ta['pt-anonuserpage']       = new Array('.','The user page for the ip you\'re editing as'); 
 ta['pt-mytalk']             = new Array('n','My talk page'); 
 ta['pt-anontalk']           = new Array('n','Discussion about edits from this IP address'); 
 ta['pt-preferences']        = new Array('-','My preferences'); 
 ta['pt-watchlist']          = new Array('l','The list of pages you\'re monitoring for changes.'); 
 ta['pt-mycontris']          = new Array('y','List of my contributions'); 
 ta['pt-login']              = new Array('o','Logging in is not required, but brings many benefits.'); 
 ta['pt-logout']             = new Array('','Log out of your user account'); 
 ta['pt-anonlogin']          = new Array('o','Logging in is not required, but brings many benefits.'); 
 ta['ca-talk']               = new Array('t','Discussion about the content page'); 
 ta['ca-edit']               = new Array('e','You can edit this page. Please use the preview button before saving.'); 
 ta['ca-addsection']         = new Array('+','Start a new discussion'); 
 ta['ca-viewsource']         = new Array('e','This page is protected. You can view its source.'); 
 ta['ca-history']            = new Array('h','Past versions of this page'); 
 ta['ca-protect']            = new Array('=','Protect this page'); 
 ta['ca-unprotect']          = new Array('=','Unprotect this page');
 ta['ca-delete']             = new Array('d','Delete this page'); 
 ta['ca-undelete']           = new Array('d','Restore the edits done to this page before it was deleted'); 
 ta['ca-move']               = new Array('m','Move this page'); 
 ta['ca-nomove']             = new Array('','You don\'t have the permissions to move this page'); 
 ta['ca-watch']              = new Array('w','Add this page to your watchlist'); 
 ta['ca-unwatch']            = new Array('w','Remove this page from your watchlist'); 
 ta['search']                = new Array('f','Search Wikipedia'); 
 ta['p-logo']                = new Array('','Main page'); 
 ta['n-mainpage']            = new Array('z','Visit the main page'); 
 ta['n-Main-page']           = new Array('z','Visit the main page'); 
 ta['n-portal']              = new Array('','About the project, what you can do, where to find things');
 ta['n-Featured-content']    = new Array('','Featured content — the best of Wikipedia'); 
 ta['n-currentevents']       = new Array('','Find background information on current events'); 
 ta['n-recentchanges']       = new Array('r','List of recent changes in Wikipedia'); 
 ta['n-randompage']          = new Array('x','Load a random page'); 
 ta['n-help']                = new Array('','The place to find out about Wikipedia'); 
 ta['n-contact']             = new Array('','How to contact Wikipedia');
 ta['n-sitesupport']         = new Array('','Help keep Wikipedia running'); 
 ta['t-whatlinkshere']       = new Array('j','List of all wiki pages that link here'); 
 ta['t-recentchangeslinked'] = new Array('k','Recent changes in pages linked from this page'); 
 ta['feed-rss']              = new Array('','RSS feed for this page'); 
 ta['feed-atom']             = new Array('','Atom feed for this page'); 
 ta['t-contributions']       = new Array('','View the list of contributions of this user'); 
 ta['t-emailuser']           = new Array('','Send a mail to this user'); 
 ta['t-upload']              = new Array('u','Upload images or other media files'); 
 ta['t-specialpages']        = new Array('q','List of all special pages');
 ta['t-print']               = new Array('','Printable version of this page');
 ta['t-permalink']           = new Array('','Permanent link to this version of the page');
 ta['t-cite']                = new Array('','Cite this Wikipedia article');
 ta['ca-nstab-main']         = new Array('c','View the content page'); 
 ta['ca-nstab-user']         = new Array('c','View the user page'); 
 ta['ca-nstab-media']        = new Array('c','View the media page'); 
 ta['ca-article']            = new Array('','This is a special page; you can\'t edit the page itself.'); 
 ta['ca-nstab-project']      = new Array('c','View the project page'); 
 ta['ca-nstab-image']        = new Array('c','View the image page'); 
 ta['ca-nstab-mediawiki']    = new Array('c','View the system message'); 
 ta['ca-nstab-template']     = new Array('c','View the template'); 
 ta['ca-nstab-help']         = new Array('c','View the help page'); 
 ta['ca-nstab-category']     = new Array('c','View the category page');

/*</pre></nowiki>*/

/**
 * Collapsible tables *********************************************************
 *
 * Description: Allows tables to be collapsed, showing only the header. See
 *              [[Wikipedia:NavFrame]].
 * Maintainers: [[User:R. Koot]]
 */
 
(contracted; show full)                }
            }
            NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
        }
    }
}

mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );

/*</pre></nowiki>*/