|
|
| വരി 1: |
വരി 1: |
| /**
| |
| * 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;
| |
|
| |
|
| |
| var mainNode = document.getElementById("powersearch");
| |
| if (!mainNode) mainNode = document.getElementById("search");
| |
| if (!mainNode) return;
| |
|
| |
| var beforeNode = document.getElementById("mw-search-top-table");
| |
| if (!beforeNode) return;
| |
| beforeNode = beforeNode.nextSibling;
| |
| if (!beforeNode) return;
| |
|
| |
| var firstEngine = "mediawiki";
| |
|
| |
| var choices = document.createElement("div");
| |
| choices.setAttribute("id","searchengineChoices");
| |
| choices.style.textAlign = "center";
| |
|
| |
| var lsearchbox = document.getElementById("searchText");
| |
| var initValue = lsearchbox.value;
| |
|
| |
| var space = "";
| |
|
| |
| for (var id in searchEngines) {
| |
| var engine = searchEngines[id];
| |
| if(engine.ShortName)
| |
| {
| |
| if (space) choices.appendChild(space);
| |
| space = document.createTextNode(" ");
| |
|
| |
| var attr = {
| |
| type: "radio",
| |
| name: "searchengineselect",
| |
| value: id,
| |
| onFocus: "changeSearchEngine(this.value)",
| |
| id: "searchengineRadio-"+id
| |
| };
| |
|
| |
| var html = "<input";
| |
| for (var a in attr) html += " " + a + "='" + attr[a] + "'";
| |
| html += " />";
| |
| var span = document.createElement("span");
| |
| span.innerHTML = html;
| |
|
| |
| choices.appendChild( span );
| |
| var label
| |
| if (engine.Template.indexOf('http') == 0) {
| |
| label = document.createElement("a");
| |
| label.href = engine.Template.replace("{searchTerms}", initValue).replace("{language}", "fr");
| |
| } else {
| |
| label = document.createElement("label");
| |
| }
| |
|
| |
| label.appendChild( document.createTextNode( engine.ShortName ) );
| |
| choices.appendChild( label );
| |
| }
| |
| }
| |
| mainNode.insertBefore(choices, beforeNode);
| |
|
| |
| var input = document.createElement("input");
| |
| input.id = "searchengineextraparam";
| |
| input.type = "hidden";
| |
|
| |
| mainNode.insertBefore(input, beforeNode);
| |
|
| |
| changeSearchEngine(firstEngine, initValue);
| |
| }
| |
|
| |
| function changeSearchEngine(selectedId, searchTerms) {
| |
|
| |
| var currentId = document.getElementById("searchengineChoices").currentChoice;
| |
| if (selectedId == currentId) return;
| |
|
| |
| document.getElementById("searchengineChoices").currentChoice = selectedId;
| |
| var radio = document.getElementById('searchengineRadio-' + selectedId);
| |
| radio.checked = "checked";
| |
|
| |
| var engine = searchEngines[selectedId];
| |
| var p = engine.Template.indexOf('?');
| |
| var params = engine.Template.substr(p+1);
| |
|
| |
| var form;
| |
| if (document.forms["search"]) {
| |
| form = document.forms["search"];
| |
| } else {
| |
| form = document.getElementById("powersearch");
| |
| }
| |
| form.setAttribute("action", engine.Template.substr(0,p));
| |
|
| |
| var l = ("" + params).split("&");
| |
| for (var idx = 0;idx < l.length;idx++) {
| |
| var p = l[idx].split("=");
| |
| var pValue = p[1];
| |
|
| |
| if (pValue == "{language}") {
| |
| } else if (pValue == "{searchTerms}") {
| |
| var input;
| |
| input = document.getElementById("searchText");
| |
|
| |
| input.name = p[0];
| |
| } else {
| |
| var input = document.getElementById("searchengineextraparam");
| |
|
| |
| input.name = p[0];
| |
| input.value = pValue;
| |
| }
| |
| }
| |
| }
| |
|
| |
| if (wgCanonicalSpecialPageName == "Search") {
| |
| var searchEngines = {
| |
| mediawiki: {
| |
| ShortName: "ആഭ്യന്തര അന്വേഷണം",
| |
| Template: "/w/index.php?search={searchTerms}"
| |
| },
| |
| wikiwix: {
| |
| ShortName: "വിക്കിവിക്സ്",
| |
| Template: "http://ml.wikiwix.com/index.php?action={searchTerms}&lang={language}"
| |
| },
| |
| google: {
| |
| ShortName: "ഗൂഗിൾ",
| |
| Template: "http://www.google.com/search?as_sitesearch=ml.wikipedia.org&hl={language}&q={searchTerms}"
| |
| },
| |
| wlive: {
| |
| ShortName: "വിൻഡോസ് ലൈവ്",
| |
| Template: "http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://ml.wikipedia.org"
| |
| },
| |
| yahoo: {
| |
| ShortName: "യാഹൂ!",
| |
| Template: "http://search.yahoo.com/search?p={searchTerms}&vs=ml.wikipedia.org"
| |
| },
| |
| exalead: {
| |
| ShortName: "എക്സാലീഡ്",
| |
| Template: "http://www.exalead.com/wikipedia/results?q={searchTerms}&language=ml"
| |
| },
| |
| globalwpsearch: {
| |
| ShortName: "ഗ്ലോബൽ ഡബ്ല്യൂപി",
| |
| Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
| |
| }
| |
| };
| |
| addOnloadHook(externalSearchEngines);
| |
| }
| |
|
| |
| /**തിരഞ്ഞെടുത്ത ലേഖനങ്ങളിലേയ്ക്ക് ഇന്റര് വിക്കി ലിങ്കുകള് നല്കാന്**************
| |
| * തിരഞ്ഞെടുത്ത ലേഖനങ്ങളിലേയ്ക്ക് ഇന്റര് വിക്കി ലിങ്കുകള് നല്കാനായി ഈ സ്ക്രിപ്റ്റ് ഉപയോഗിയ്ക്കാം മറ്റു ഭാഷകളില് എന്നു
| |
| * കാണുന്ന സെക്ഷനിലെ ബുള്ളറ്റുകള് ഈ ഫങ്ക്ഷന് മാറ്റിയെഴുതും. ആംഗലേയ വിക്കിയില് നിന്നും കൊണ്ടുവന്നത്
| |
| */
| |
| function LinkFA()
| |
| {
| |
| if ( document.getElementById( "p-lang" ) ) {
| |
| var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
| |
|
| |
| for ( var i = 0; i < InterwikiLinks.length; i++ ) {
| |
| if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
| |
| InterwikiLinks[i].className += " FA"
| |
| InterwikiLinks[i].title = "മറ്റൊരു ഭാഷയില് ഈ ലേഖനം തിരഞ്ഞെടുക്കപ്പെട്ടതാണ്.";
| |
| }
| |
| }
| |
| }
| |
| }
| |
|
| |
| addOnloadHook( LinkFA );
| |
|
| |
| /** Main Page layout fixes ********************************************************* | | /** Main Page layout fixes ********************************************************* |
| * | | * |
| വരി 221: |
വരി 49: |
| addOnloadHook( mainPageAppendCompleteListLink ); | | addOnloadHook( mainPageAppendCompleteListLink ); |
| } | | } |
| -
| | |
| /**<pre><nowiki>*/ | | /**<pre><nowiki>*/ |
| /** Extra toolbar options ****************************************************** | | /** Extra toolbar options ****************************************************** |
| വരി 1,149: |
വരി 977: |
| </pre></nowiki> | | </pre></nowiki> |
| */ | | */ |
|
| |
| /*
| |
| ==addLoadEvent==
| |
| <pre> */
| |
| function addLoadEvent(func)
| |
| {
| |
| addOnloadHook( func );
| |
| }
| |
|
| |
| /* </pre> */
| |
|
| |
|
| |
| /*
| |
| == Dynamic Navigation Bars (experimental) ==
| |
| <pre> */
| |
| // BEGIN Dynamic Navigation Bars (experimental)
| |
| // FIXME: currently only works for one nav bar on a page at a time
| |
| // ===============================================
| |
|
| |
| // set up the words in your language
| |
| var NavigationBarHide = '[മറയ്ക്കുക]';
| |
| var NavigationBarShow = '[പ്രദര്ശിപ്പിക്കുക]';
| |
|
| |
| // set up max count of Navigation Bars on page,
| |
| // if there are more, all will be hidden
| |
| // NavigationBarShowDefault = 0; // all bars will be hidden
| |
| // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
| |
| var NavigationBarShowDefault = 1;
| |
| //Honor the User Preferences
| |
| if ( getCookie('WikipediaPreferencesShowNav') != 'true' ) {
| |
| NavigationBarShowDefault = 0;
| |
| } else {
| |
| if ( wgNamespaceNumber == 0 ) NavigationBarShowDefault = 999 ;
| |
| }
| |
| /* </pre> */
| |
|
| |
|
| |
| /*
| |
| === toggleNavigationBar ===*
| |
| <pre> */
| |
| // shows and hides content and picture (if available) of navigation bars
| |
| // Parameters:
| |
| // indexNavigationBar: the index of navigation bar to be toggled
| |
| function toggleNavigationBar(indexNavigationBar)
| |
| {
| |
| var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
| |
| var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
| |
|
| |
| if (!NavFrame || !NavToggle) {
| |
| return false;
| |
| }
| |
|
| |
| // if shown now
| |
| if (NavToggle.firstChild.data == NavigationBarHide) {
| |
| for (
| |
| var NavChild = NavFrame.firstChild;
| |
| NavChild;
| |
| NavChild = NavChild.nextSibling
| |
| ) {
| |
| if (NavChild.className == 'NavPic') {
| |
| NavChild.style.display = 'none';
| |
| }
| |
| if (NavChild.className == 'NavContent') {
| |
| NavChild.style.display = 'none';
| |
| }
| |
| }
| |
| NavToggle.firstChild.data = NavigationBarShow;
| |
|
| |
| // if hidden now
| |
| } else if (NavToggle.firstChild.data == NavigationBarShow) {
| |
| for (
| |
| var NavChild = NavFrame.firstChild;
| |
| NavChild;
| |
| NavChild = NavChild.nextSibling
| |
| ) {
| |
| if (NavChild.className == 'NavPic') {
| |
| NavChild.style.display = 'block';
| |
| }
| |
| if (NavChild.className == 'NavContent') {
| |
| NavChild.style.display = 'block';
| |
| }
| |
| }
| |
| NavToggle.firstChild.data = NavigationBarHide;
| |
| }
| |
| }
| |
| /* </pre> */
| |
|
| |
|
| |
| /*
| |
| === createNavigationBarToggleButton ===
| |
| <pre> */
| |
| // adds show/hide-button to navigation bars
| |
| function createNavigationBarToggleButton()
| |
| {
| |
| var indexNavigationBar = 0;
| |
| // iterate over all < div >-elements
| |
| for(
| |
| var i=0;
| |
| NavFrame = document.getElementsByTagName("div")[i];
| |
| i++
| |
| ) {
| |
| // if found a navigation bar
| |
| if (NavFrame.className == "NavFrame") {
| |
|
| |
| indexNavigationBar++;
| |
| var NavToggle = document.createElement("a");
| |
| NavToggle.className = 'NavToggle';
| |
| NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
| |
| NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
| |
|
| |
| var NavToggleText = document.createTextNode(NavigationBarHide);
| |
| NavToggle.appendChild(NavToggleText);
| |
| // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
| |
| for(
| |
| var j=0;
| |
| j < NavFrame.childNodes.length;
| |
| j++
| |
| ) {
| |
| if (NavFrame.childNodes[j].className == "NavHead") {
| |
| NavFrame.childNodes[j].appendChild(NavToggle);
| |
| }
| |
| }
| |
| NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
| |
| }
| |
| }
| |
| // if more Navigation Bars found than Default: hide all
| |
| if (NavigationBarShowDefault < indexNavigationBar) {
| |
| for(
| |
| var i=1;
| |
| i<=indexNavigationBar;
| |
| i++
| |
| ) {
| |
| toggleNavigationBar(i);
| |
| }
| |
| }
| |
|
| |
| }
| |
|
| |
| addLoadEvent(createNavigationBarToggleButton);
| |
|
| |
| // END Dynamic Navigation Bars
| |
| // ======================
| |
| /* </pre> */
| |
|
| |
|
| |
| /*
| |
| ==Cookies==
| |
| <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> */
| |
|
| |
|
| |
| /*
| |
| == Interproject links ==
| |
| <pre> */
| |
| function Projectlinks() {
| |
| var elements = new Array();
| |
| var spans = document.getElementsByTagName('span');
| |
|
| |
| // filter for projectlinks
| |
| for (var i=0, j=0; i<spans.length; i++) {
| |
| if (spans[i].className == 'interProject') {
| |
| elements[j] = spans[i].getElementsByTagName('a')[0];
| |
| j++;
| |
| }
| |
| }
| |
|
| |
|
| |
| if (j) {
| |
| // create navbox
| |
| var plheader = document.createElement('h5');
| |
| plheader.appendChild(document.createTextNode('In other projects'));
| |
| var plbox = document.createElement('div');
| |
| plbox.setAttribute('class','pBody');
| |
| plbox.setAttribute('style','margin-top:0.7em;');
| |
| var pllist = document.createElement('ul');
| |
|
| |
| // append
| |
| for (var i=0; i<elements.length; i++) {
| |
| var plitem = document.createElement('li');
| |
| plitem.appendChild(elements[i]);
| |
| pllist.appendChild(plitem);
| |
| }
| |
| plbox.appendChild(plheader);
| |
| plbox.appendChild(pllist);
| |
| document.getElementById("p-tb").appendChild(plbox);
| |
| }
| |
| }
| |
|
| |
| addLoadEvent(Projectlinks);
| |
| /* </pre> */
| |
|
| |
|
| |
| /*
| |
| ==addCharSubsetMenu==
| |
| <pre> */
| |
|
| |
| /* add menu for selecting subsets of secial characters */
| |
| /***** must match MediaWiki:Edittools *****/
| |
| function addCharSubsetMenu() {
| |
| var edittools = document.getElementById('editpage-specialchars');
| |
|
| |
| if (edittools) {
| |
| var menu = "<select id=\"charSubsetControl\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
| |
| menu += "<option>ഫലകങ്ങള്</option>";
| |
| menu += "<option>വിക്കിവിന്യാസങ്ങള്</option>";
| |
| menu += "<option>അനുമതിപത്രങ്ങള്</option>";
| |
| menu += "<option>മലയാളം</option>";
| |
| menu += "<option>കൊറിയന്</option>";
| |
| menu += "<option>ലത്തീന്</option>";
| |
| menu += "<option>ഐ.പി.എ.</option>";
| |
| menu += "<option>പലവക</option>";
| |
| menu += "<option>അറബി</option>";
| |
| menu += "<option>ദേവനാഗരി</option>";
| |
| menu += "<option>ഹിബ്രു</option>";
| |
| menu += "<option>പഴയ ഇംഗ്ലീഷ്</option>";
| |
| menu += "</select>";
| |
| edittools.innerHTML = menu + edittools.innerHTML;
| |
|
| |
| /* default subset from cookie */
| |
| var s = parseInt( getCookie('edittoolscharsubset') );
| |
| if ( isNaN(s) ) s = 0;
| |
|
| |
| /* update dropdown control to value of cookie */
| |
| document.getElementById('charSubsetControl').selectedIndex = s;
| |
|
| |
| /* display the subset indicated by the cookie */
| |
| chooseCharSubset( s );
| |
| }
| |
| }
| |
| /* </pre> */
| |
|
| |
| /*
| |
| ===chooseCharSubsetMenu===
| |
| <pre> */
| |
| /* select subsection of special characters */
| |
| function chooseCharSubset(s) {
| |
| var l = document.getElementById('editpage-specialchars').getElementsByTagName('p');
| |
| for (var i = 0; i < l.length ; i++) {
| |
| l[i].style.display = i == s ? 'inline' : 'none';
| |
| l[i].style.visibility = i == s ? 'visible' : 'hidden';
| |
| }
| |
| setCookie('edittoolscharsubset', s);
| |
| }
| |
|
| |
|
| |
| /* </pre> */
| |
|
| |
| /*
| |
| == customizeWikipedia ==
| |
| <pre> */
| |
|
| |
| function customizeWikipedia() {
| |
| addCharSubsetMenu();
| |
| }
| |
|
| |
| addLoadEvent(customizeWikipedia);
| |
|
| |
| /* </pre> */
| |
|
| |
|
| |
| /*HERE STARTS THE WORKING-CODE OF "METABOXES"*/
| |
|
| |
| /* Funcionament de la Plantilla:Metacaixa
| |
| Implementat per: Usuari:Peleguer.
| |
| Actualitzat per Joanjoc seguint les indicacions d'en Martorell
| |
| */
| |
|
| |
| function MetaCaixaInit(){
| |
| //S'executa al carregar-se la pàgina, si hi ha metacaixes,
| |
| // s'assignen els esdeveniments als botons
| |
| //alert("MetaCaixaInit");
| |
|
| |
| var i=0 //Inicialitzem comptador de caixes
| |
| for (i=0;i<=9;i++){
| |
| var vMc = document.getElementById("mc"+i);
| |
| if (!vMc) break;
| |
| //alert("MetaCaixaInit, trobada Metacaixa mc"+i);
| |
|
| |
| var j=1 //Inicialitzem comptador de botons dins de la caixa
| |
| var vPsIni = 0 //Pestanya visible inicial
| |
| for (j=1;j<=9;j++){
| |
| var vBt = document.getElementById("mc"+i+"bt"+j);
| |
| if (!vBt) break;
| |
| //alert("MetaCaixaInit, trobat botó mc"+i+"bt"+j);
| |
| vBt.onclick = MetaCaixaMostraPestanya; //A cada botó assignem l'esdeveniment onclick
| |
| //alert (vBt.className);
| |
| if (vBt.className=="mcBotoSel") vPsIni=j; //Si tenim un botó seleccionat, en guardem l'index
| |
| }
| |
| //alert ("mc="+i+", ps="+j+", psini="+vPsIni );
| |
| if (vPsIni == 0) { //Si no tenim cap botó seleccionat, n'agafem un aleatòriament
| |
| vPsIni = 1+Math.floor((j-1)*Math.random()) ;
| |
| //alert ("Activant Pestanya a l'atzar; _mc"+i+"bt"+vPsIni +"_");
| |
| document.getElementById("mc"+i+"ps"+vPsIni).style.display = "block";
| |
| document.getElementById("mc"+i+"ps"+vPsIni).style.visibility = "visible";
| |
| document.getElementById("mc"+i+"bt"+vPsIni).className="mcBotoSel";
| |
| }
| |
| }
| |
| }
| |
|
| |
| function MetaCaixaMostraPestanya(){
| |
| //S'executa al clicar una pestanya,
| |
| //aquella es fa visible i les altres s'oculten
| |
| var vMcNom = this.id.substr(0,3); //A partir del nom del botó, deduïm el nom de la caixa
| |
| var vIndex = this.id.substr(5,1); //I l'index
| |
|
| |
| var i=1
| |
| for (i=1;i<=9;i++){ //busquem totes les pestanyes d'aquella caixa
| |
| //alert(vMcNom+"ps"+i);
| |
| var vPsElem = document.getElementById(vMcNom+"ps"+i);
| |
| if (!vPsElem) break;
| |
| if (vIndex==i){ //Si és la pestanya bona la mostrem i canviem la classe de botó
| |
| vPsElem.style.display = "block";
| |
| vPsElem.style.visibility = "visible";
| |
| document.getElementById(vMcNom+"bt"+i).className="mcBotoSel";
| |
| } else { //Sinó, l'ocultem i canviem la classe de botó
| |
| vPsElem.style.display = "none";
| |
| vPsElem.style.visibility = "hidden";
| |
| document.getElementById(vMcNom+"bt"+i).className="mcBoto";
| |
| }
| |
| }
| |
| return false; //evitem la recàrrega de la pàgina
| |
| }
| |
|
| |
| addOnloadHook(MetaCaixaInit);
| |
|
| |
| /*HERE FINISHES THE WORKING-CODE OF "METABOXES"*/
| |
|
| |
| /** 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]]
| |
| */
| |
|
| |
| if (wgServer == "https://secure.wikimedia.org") {
| |
| var metaBase = "https://secure.wikimedia.org/wikipedia/meta";
| |
| } else {
| |
| var metaBase = "http://meta.wikimedia.org";
| |
| }
| |
| importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400")
| |
|
| |
| /** Collapsible tables *********************************************************
| |
| *
| |
| * Description: Allows tables to be collapsed, showing only the header. See
| |
| * [[Wikipedia:NavFrame]].
| |
| * Maintainers: [[User:R. Koot]]
| |
| */
| |
|
| |
| var autoCollapse = 2;
| |
| var collapseCaption = "മറയ്ക്കുക";
| |
| var expandCaption = "പ്രദര്ശിപ്പിക്കുക";
| |
|
| |
| function collapseTable( tableIndex )
| |
| {
| |
| var Button = document.getElementById( "collapseButton" + tableIndex );
| |
| var Table = document.getElementById( "collapsibleTable" + tableIndex );
| |
|
| |
| if ( !Table || !Button ) {
| |
| return false;
| |
| }
| |
|
| |
| var Rows = Table.rows;
| |
|
| |
| if ( Button.firstChild.data == collapseCaption ) {
| |
| for ( var i = 1; i < Rows.length; i++ ) {
| |
| Rows[i].style.display = "none";
| |
| }
| |
| Button.firstChild.data = expandCaption;
| |
| } else {
| |
| for ( var i = 1; i < Rows.length; i++ ) {
| |
| Rows[i].style.display = Rows[0].style.display;
| |
| }
| |
| Button.firstChild.data = collapseCaption;
| |
| }
| |
| }
| |
|
| |
| function createCollapseButtons()
| |
| {
| |
| var tableIndex = 0;
| |
| var NavigationBoxes = new Object();
| |
| var Tables = document.getElementsByTagName( "table" );
| |
|
| |
| for ( var i = 0; i < Tables.length; i++ ) {
| |
| if ( hasClass( Tables[i], "collapsible" ) ) {
| |
|
| |
| /* only add button and increment count if there is a header row to work with */
| |
| var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
| |
| if (!HeaderRow) continue;
| |
| var Header = HeaderRow.getElementsByTagName( "th" )[0];
| |
| if (!Header) continue;
| |
|
| |
| NavigationBoxes[ tableIndex ] = Tables[i];
| |
| Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
| |
|
| |
| var Button = document.createElement( "span" );
| |
| var ButtonLink = document.createElement( "a" );
| |
| var ButtonText = document.createTextNode( collapseCaption );
| |
|
| |
| Button.className = "collapseButton"; //Styles are declared in Common.css
| |
|
| |
| ButtonLink.style.color = Header.style.color;
| |
| ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
| |
| ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
| |
| ButtonLink.appendChild( ButtonText );
| |
|
| |
| Button.appendChild( document.createTextNode( "[" ) );
| |
| Button.appendChild( ButtonLink );
| |
| Button.appendChild( document.createTextNode( "]" ) );
| |
|
| |
| Header.insertBefore( Button, Header.childNodes[0] );
| |
| tableIndex++;
| |
| }
| |
| }
| |
|
| |
| for ( var i = 0; i < tableIndex; i++ ) {
| |
| if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
| |
| collapseTable( i );
| |
| }
| |
| else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
| |
| var element = NavigationBoxes[i];
| |
| while (element = element.parentNode) {
| |
| if ( hasClass( element, "outercollapse" ) ) {
| |
| collapseTable ( i );
| |
| break;
| |
| }
| |
| }
| |
| }
| |
| }
| |
| }
| |
|
| |
| addOnloadHook( createCollapseButtons );
| |
|
| |
| var hasClass = (function () {
| |
| var reCache = {};
| |
| return function (element, className) {
| |
| return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
| |
| };
| |
| })();
| |
|
| |
|
| |
| /**submit in tools extension ല് നിന്നും എടുത്തത്. 28/10/08 ഉള്പ്പെടുത്തി.
| |
| */
| |
|
| |
| /* Any JavaScript here will be loaded for all users on every page load. */
| |
|
| |
| if ( /^MediaWiki(\/.+)?$/.test( wgPageName ) && wgAction == 'view' ) {
| |
| addOnloadHook(function(){
| |
| document.body.className+=" mainpage";
| |
| })
| |
| }
| |
|
| |
| /* Force preview for anons */
| |
| /* by Marc Mongenet, 2006, fr.wikipedia */
| |
| function forcePreview() {
| |
| if( wgUserName != null || wgAction != 'edit' )
| |
| return;
| |
| saveButton = document.getElementById('wpSave');
| |
| if( !saveButton )
| |
| return;
| |
| saveButton.disabled = true;
| |
| saveButton.value = 'Save page (use preview first)';
| |
| saveButton.style.fontWeight = 'normal';
| |
| document.getElementById('wpPreview').style.fontWeight = 'bold';
| |
| }
| |
| addOnloadHook(forcePreview);
| |
| /* End of forcePreview */
| |
|
| |
| /** includePage ************
| |
| * force the loading of another JavaScript file
| |
| * @todo Is this still needed? We have importScript and importScriptURI in wikibits.js
| |
| * Maintainer: [[Commons:User:Dschwen]]
| |
| */
| |
| function includePage( name ){
| |
| document.write('<script type="text/javascript" src="' + wgScript + '?title='
| |
| + name + '&action=raw&ctype=text/javascript"><\/script>'
| |
| );
| |
| }
| |
| /* End of includePage */
| |
|
| |
| /* Including extra .js pages */
| |
|
| |
| // 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
| |
| includePage( 'MediaWiki:Edittools.js' );
| |
|
| |
| // Editpage scripts
| |
| if( wgAction == 'edit' || wgAction == 'submit' )
| |
| importScript('MediaWiki:Editpage.js')
| |
|
| |
| /* End of extra pages */
| |
|
| |
| /* Test if an element has a certain class **************************************
| |
| *
| |
| * From English Wikipedia, 2008-09-15
| |
| *
| |
| * Description: Uses regular expressions and caching for better performance.
| |
| * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
| |
| */
| |
| var hasClass = (function() {
| |
| var reCache = {};
| |
| return function ( element, className ) {
| |
| return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
| |
| };
| |
| })();
| |
|
| |
| /** Collapsible tables *********************************************************
| |
| *
| |
| * From English Wikipedia, 2008-09-15
| |
| *
| |
| * Description: Allows tables to be collapsed, showing only the header. See
| |
| * [[Wikipedia:NavFrame]].
| |
| * Maintainers: [[User:R. Koot]]
| |
| */
| |
| var autoCollapse = 2;
| |
| var collapseCaption = 'hide';
| |
| var expandCaption = 'show';
| |
|
| |
| function collapseTable( tableIndex ){
| |
| var Button = document.getElementById( 'collapseButton' + tableIndex );
| |
| var Table = document.getElementById( 'collapsibleTable' + tableIndex );
| |
|
| |
| if ( !Table || !Button ) {
| |
| return false;
| |
| }
| |
|
| |
| var Rows = Table.rows;
| |
|
| |
| if ( Button.firstChild.data == collapseCaption ) {
| |
| for ( var i = 1; i < Rows.length; i++ ) {
| |
| Rows[i].style.display = 'none';
| |
| }
| |
| Button.firstChild.data = expandCaption;
| |
| } else {
| |
| for ( var i = 1; i < Rows.length; i++ ) {
| |
| Rows[i].style.display = Rows[0].style.display;
| |
| }
| |
| Button.firstChild.data = collapseCaption;
| |
| }
| |
| }
| |
|
| |
| function createCollapseButtons(){
| |
| var tableIndex = 0;
| |
| var NavigationBoxes = new Object();
| |
| var Tables = document.getElementsByTagName( 'table' );
| |
|
| |
| for ( var i = 0; i < Tables.length; i++ ) {
| |
| if ( hasClass( Tables[i], 'collapsible' ) ) {
| |
| /* only add button and increment count if there is a header row to work with */
| |
| var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
| |
| if( !HeaderRow )
| |
| continue;
| |
| var Header = HeaderRow.getElementsByTagName( 'th' )[0];
| |
| if( !Header )
| |
| continue;
| |
|
| |
| NavigationBoxes[tableIndex] = Tables[i];
| |
| Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
| |
|
| |
| var Button = document.createElement( 'span' );
| |
| var ButtonLink = document.createElement( 'a' );
| |
| var ButtonText = document.createTextNode( collapseCaption );
| |
|
| |
| Button.style.styleFloat = 'right';
| |
| Button.style.cssFloat = 'right';
| |
| Button.style.fontWeight = 'normal';
| |
| Button.style.textAlign = 'right';
| |
| Button.style.width = '6em';
| |
|
| |
| ButtonLink.style.color = Header.style.color;
| |
| ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
| |
| ButtonLink.setAttribute( 'href', "javascript:collapseTable(" + tableIndex + ");" );
| |
| ButtonLink.appendChild( ButtonText );
| |
|
| |
| Button.appendChild( document.createTextNode( "[" ) );
| |
| Button.appendChild( ButtonLink );
| |
| Button.appendChild( document.createTextNode( "]" ) );
| |
|
| |
| Header.insertBefore( Button, Header.childNodes[0] );
| |
| tableIndex++;
| |
| }
| |
| }
| |
|
| |
| for ( var i = 0; i < tableIndex; i++ ) {
| |
| if ( hasClass( NavigationBoxes[i], 'collapsed' ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], 'autocollapse' ) ) ) {
| |
| collapseTable( i );
| |
| }
| |
| }
| |
| }
| |
|
| |
| addOnloadHook( createCollapseButtons );
| |
|
| |
|
| |
| /** Dynamic Navigation Bars (experimental) *************************************
| |
| *
| |
| * From English Wikipedia, 2008-09-15
| |
| *
| |
| * Description: See [[Wikipedia:NavFrame]].
| |
| * Maintainers: UNMAINTAINED
| |
| */
| |
|
| |
| // set up the words in your language
| |
| var NavigationBarHide = '[' + collapseCaption + ']';
| |
| var NavigationBarShow = '[' + expandCaption + ']';
| |
|
| |
| // shows and hides content and picture (if available) of navigation bars
| |
| // Parameters:
| |
| // indexNavigationBar: the index of navigation bar to be toggled
| |
| function toggleNavigationBar( indexNavigationBar ){
| |
| var NavToggle = document.getElementById('NavToggle' + indexNavigationBar);
| |
| var NavFrame = document.getElementById('NavFrame' + indexNavigationBar);
| |
|
| |
| if( !NavFrame || !NavToggle ) {
| |
| return false;
| |
| }
| |
|
| |
| // if shown now
| |
| if( NavToggle.firstChild.data == NavigationBarHide ) {
| |
| for( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
| |
| if ( hasClass( NavChild, 'NavPic' ) ) {
| |
| NavChild.style.display = 'none';
| |
| }
| |
| if ( hasClass( NavChild, 'NavContent') ) {
| |
| NavChild.style.display = 'none';
| |
| }
| |
| }
| |
| NavToggle.firstChild.data = NavigationBarShow;
| |
|
| |
| // if hidden now
| |
| } else if( NavToggle.firstChild.data == NavigationBarShow) {
| |
| for( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
| |
| if( hasClass( NavChild, 'NavPic' ) ) {
| |
| NavChild.style.display = 'block';
| |
| }
| |
| if( hasClass( NavChild, 'NavContent' ) ) {
| |
| NavChild.style.display = 'block';
| |
| }
| |
| }
| |
| NavToggle.firstChild.data = NavigationBarHide;
| |
| }
| |
| }
| |
|
| |
| // adds show/hide-button to navigation bars
| |
| function createNavigationBarToggleButton(){
| |
| var indexNavigationBar = 0;
| |
| // iterate over all < div >-elements
| |
| var divs = document.getElementsByTagName('div');
| |
| for( var i = 0; NavFrame = divs[i]; i++ ) {
| |
| // if found a navigation bar
| |
| if( hasClass( NavFrame, 'NavFrame' ) ) {
| |
| indexNavigationBar++;
| |
| var NavToggle = document.createElement("a");
| |
| NavToggle.className = 'NavToggle';
| |
| NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
| |
| NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
| |
|
| |
| var NavToggleText = document.createTextNode(NavigationBarHide);
| |
| for( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
| |
| if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
| |
| if( NavChild.style.display == 'none' ) {
| |
| NavToggleText = document.createTextNode(NavigationBarShow);
| |
| break;
| |
| }
| |
| }
| |
| }
| |
|
| |
| NavToggle.appendChild(NavToggleText);
| |
| // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
| |
| for( var j=0; j < NavFrame.childNodes.length; j++) {
| |
| if( hasClass( NavFrame.childNodes[j], 'NavHead' ) ) {
| |
| NavFrame.childNodes[j].appendChild(NavToggle);
| |
| }
| |
| }
| |
| NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
| |
| }
| |
| }
| |
| }
| |
| addOnloadHook( createNavigationBarToggleButton );
| |