MediaWiki:Common.js: differenze tra le versioni

Da The Crowdsourced Resource-Based Economy Knowledgebase.
(These may be strict)
 
Riga 1: Riga 1:
/**
+
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
+
 
* loaded for all users on every wiki page. If possible create a gadget that is
+
/* Serve per "sabotare" www.wikipedia.it e tutti gli altri siti che ci includono in frame. "Salta fuori" dai frame.
* enabled by default instead of adding it here (since gadgets are fully
+
    Va alla pagina del toolserver il cui contenuto è preso dalla pagina [[Utente:Pietrodn/www.wikipedia.it]], modificabile solo dagli admin.
* optimized ResourceLoader modules with possibility to add dependencies etc.)
+
    Poi reindirizza a http://it.wikipedia.org */
*
+
if (mw.config.get('wgIsMainPage') && top != self)
* Since Common.js isn't a gadget, there is no place to declare its
+
    top.location.replace('http://toolserver.org/~pietrodn/wikipedia_redirect.php');
* dependencies, so we have to lazy load them with mw.loader.using on demand and
+
 
* then execute the rest in the callback. In most cases these dependencies will
+
/*
  * be loaded (or loading) already and the callback will not be delayed. In case a
+
  * Redirect bad mirrors to it.wikipedia.org
  * dependency hasn't arrived yet it'll make sure those are loaded before this.
+
  * [[m:User:Hoo man]]
 
  */
 
  */
/*global mw, $, importStylesheet, importScript */
+
( function( mw ) {
/*jshint curly:false eqnull:true, strict:false, browser:true, */
+
var i, isBad,
mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () {
+
badMirrors = [
/* Begin of mw.loader.using callback */
+
'wikipedia.sapere.alice.it',
 +
'wikipedia.deejay.it',
 +
'wikipedia.kataweb.it',
 +
                '212.48.3.33',
 +
                'wikipedia.virgilio.it',
 +
                '213.92.16.218',
 +
];
 +
for( i = 0; i < badMirrors.length; i++ ) {
 +
if ( document.location.href.indexOf( badMirrors[ i ] ) !== -1 ) {
 +
isBad = true;
 +
break;
 +
}
 +
}
 +
if ( isBad ) {
 +
// redirect users to the same page on itwiki
 +
document.location.href = '//it.wikipedia.org/wiki/' + mw.config.get( 'wgPageName' );
 +
/*
 +
// redirect users to a landing page
 +
document.location.href = '//it.wikipedia.org/wiki/FooBar';
 +
*/
 +
}
 +
} )( mediaWiki );
  
/**
+
//DEPRECATO
* Main Page layout fixes
+
function addLoadEvent(func)
*
+
{
* Description: Adds an additional link to the complete list of languages available.
+
  if (window.addEventListener)  
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
+
    window.addEventListener("load", func, false);
*/
+
  else if (window.attachEvent)  
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
+
    window.attachEvent("onload", func);
    $( document ).ready( function () {
+
        mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
+
            'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
+
    } );
+
 
}
 
}
  
/**
+
 
* Redirect User:Name/skin.js and skin.css to the current skin's pages
+
/*** Collegamento diretto alla pagina di upload di Commons nel portlet Strumenti */
* (unless the 'skin' page really exists)
+
$(function(){
* @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
+
    mw.util.addPortletLink('p-tb', '//commons.wikimedia.org/wiki/Commons:Upload/it',
* @rev: 2
+
              'Carica su Commons', 't-uploadcommons', 'Carica file multimediali su Wikimedia Commons', 'm', '#t-specialpages');
*/
+
});
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
+
 
    var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
+
 
    /* Make sure there was a part before and after the slash
+
/*** Evidenzia i link agli articoli di qualità su altre wiki */
      and that the latter is 'skin.js' or 'skin.css' */
+
function LinkAdQ()
     if ( titleParts.length == 2 ) {
+
{
         var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
+
     if ( document.getElementById( "p-lang" ) ) {
         if ( titleParts.slice( -1 ) == 'skin.js' ) {
+
         var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
+
 
        } else if ( titleParts.slice( -1 ) == 'skin.css' ) {
+
         for ( var i = 0; i < InterwikiLinks.length; i++ ) {
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
+
            if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
 +
                InterwikiLinks[i].className += " FA";
 +
                InterwikiLinks[i].title = "La voce è in vetrina in questa lingua.";
 +
} else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
 +
                InterwikiLinks[i].className += " GA"
 +
                InterwikiLinks[i].title = "La voce è di qualità in questa lingua.";
 +
            }
 
         }
 
         }
 
     }
 
     }
 
}
 
}
  
/**
+
$( LinkAdQ );
* Map addPortletLink to mw.util
+
*
+
* @deprecated: Use mw.util.addPortletLink instead.
+
*/
+
window.addPortletLink = function () {
+
    return mw.util.addPortletLink.apply( mw.util, arguments );
+
};
+
  
/**
 
* Extract a URL parameter from the current URL
 
*
 
* @deprecated: Use mw.util.getParamValue with proper escaping
 
*/
 
window.getURLParamValue = function () {
 
    return mw.util.getParamValue.apply( mw.util, arguments );
 
};
 
  
/**  
+
/*
* Test if an element has a certain class
+
Correzione della posizione del link [modifica] delle sezioni.
  *
+
   
  * @deprecated:  Use $(element).hasClass() instead.
+
Copyright 2006, Marc Mongenet
  */
+
   
window.hasClass = function ( element, className ) {
+
This program is free software; you can redistribute it and/or
     return $( element ).hasClass( className );
+
modify it under the terms of the GNU General Public License
};
+
as published by the Free Software Foundation; either version 2
 +
of the License, or (at your option) any later version.
 +
 +
This program is distributed in the hope that it will be useful,
 +
but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +
GNU General Public License for more details.
 +
   
 +
See http://www.gnu.org/licenses/gpl.html
 +
 +
The function looks for <span class="editsection">, and move them
 +
at the end of their parent and display them inline in small font.
 +
var oldEditsectionLinks=true disables the function.
 +
*/
 +
 +
$(function(){
 +
     try {
 +
        if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
 +
        var spans = document.getElementsByTagName("span");
 +
        for (var s = 0; s < spans.length; ++s) {
 +
            var span = spans[s];
 +
            if (span.className == "editsection") {
 +
                span.style.fontSize = "x-small";
 +
                span.style.fontWeight = "normal";
 +
                span.style.cssFloat = span.style.styleFloat = "none";
 +
                span.parentNode.appendChild(document.createTextNode(" "));
 +
                span.parentNode.appendChild(span);
 +
            }
 +
        }
 +
    } catch (e) { /* something went wrong */ }
 +
});
  
/**
+
/*  
  * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
+
  * Modifica il testo della linguetta "Voce" in "Pagina principale"
  * @rev 5
+
  * e aggiunge il link alla lista completa di tutte le pagine
 
  */
 
  */
// CSS
+
if (mw.config.get('wgIsMainPage') || mw.config.get('wgPageName') === "Discussione:Pagina_principale")
var extraCSS = mw.util.getParamValue( 'withCSS' );
+
$(function() {
if ( extraCSS ) {
+
  if (mw.config.get('wgUserLanguage') === 'it')
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
+
    $('#ca-nstab-main a').text('Pagina principale');
importStylesheet( extraCSS );
+
 
} else {
+
  mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/Lista_di_Wikipedie',
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
+
                'Lista completa', 'interwiki-completelist', 'Lista completa delle Wikipedie');
}
+
});
}
+
  
// JS
+
/** "Technical restrictions" title fix *****************************************
var extraJS = mw.util.getParamValue( 'withJS' );
+
  *
if ( extraJS ) {
+
  *  Descrizionen: Codice per [[Template:Titolo errato]]
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
+
  *  Copiato inizialmente da [[:en:MediaWiki:Common.js]]
importScript( extraJS );
+
  */
} else {
+
// The function looks for a banner like this: <nowiki>
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
+
// <div id="RealTitleBanner">    <!-- div that gets hidden -->
}
+
//  <span id="RealTitle">title</span>
 +
// </div>
 +
// </nowiki>An element with id=DisableRealTitle disables the function.
 +
var disableRealTitle = 0;    // users can disable this by making this true from their user script
 +
function correctTitle() {
 +
  try {
 +
    var realTitleBanner = document.getElementById("RealTitleBanner");
 +
    if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
 +
      var realTitle = document.getElementById("RealTitle");
 +
      if (realTitle) {
 +
        var realTitleHTML = realTitle.innerHTML;
 +
        var realTitleText = $(realTitle).text();
 +
 
 +
        var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big|a)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
 +
 
 +
        var h1 = document.getElementsByTagName("h1")[0];
 +
        if (h1) {
 +
          h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
 +
 
 +
          realTitleBanner.style.display = "none";
 +
        }
 +
        document.title = realTitleText + " - Wikipedia";
 +
      }
 +
    }
 +
  } catch (e) {
 +
    /* Something went wrong. */
 +
  }
 
}
 
}
  
/**
+
$(correctTitle);
* Import more specific scripts if necessary
+
*/
+
/** WikiMiniAtlas *******************************************************
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
+
  *
    /* scripts specific to editing pages */
+
  *  Description: WikiMiniAtlas is a popup click and drag world map.
    importScript( 'MediaWiki:Common.js/edit.js' );
+
  *               This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
} else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {
+
  *               The script itself is located on meta because it is used by many projects.
    /* watchlist scripts */
+
  *              See [[Meta:WikiMiniAtlas]] for more information.  
    importScript( 'MediaWiki:Common.js/watchlist.js' );
+
  */
}
+
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
+
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
    /* file description page scripts */
+
 
    importScript( 'MediaWiki:Common.js/file.js' );
+
 
}
+
//============================================================
 +
// Menu caratteri speciali
 +
//============================================================
  
 
/**
 
/**
  * Load scripts specific to Internet Explorer
+
  * Aggiunge il menu a tendina per selezionare un sottoinsieme di caratteri speciali
 +
* Attenzione:        l'ordine della lista deve corrispondere a quello di MediaWiki:Edittools !
 
  */
 
  */
if ( $.client.profile().name === 'msie' ) {
+
/* select subsection of special characters */
     importScript( 'MediaWiki:Common.js/IEFixes.js' );
+
function scegliSubsetCaratteri(s) {
 +
  var l = document.getElementById('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';
 +
  }
 
}
 
}
  
/**
+
function aggiungiMenuSubsetCaratteri() {
* Fix for Windows XP Unicode font rendering
+
  var specialchars = document.getElementById('specialchars');
  */
+
   
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) {
+
  if (specialchars) {
     mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' +  
+
    var menu = "<select style=\"display:inline\" onChange=\"scegliSubsetCaratteri(selectedIndex)\">";
                '.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' );
+
    menu += "<option>Latino esteso</option>";
 +
    menu += "<option>Wiki</option>";
 +
    menu += "<option>Greco antico</option>";
 +
    menu += "<option>Greco moderno</option>";
 +
     menu += "<option>Cirillico</option>";
 +
    menu += "<option>Arabo</option>";
 +
    menu += "<option>Ebraico e yiddish</option>";
 +
    menu += "<option>Armeno</option>";
 +
    menu += "<option>Geroglifico</option>";
 +
    menu += "<option>Vietnamita</option>";
 +
    menu += "<option>IPA</option>";
 +
    menu += "<option>Matematica</option>";
 +
    menu += "</select>";
 +
    specialchars.innerHTML = menu + specialchars.innerHTML;
 +
 +
    /* default subset - try to use a cookie some day */
 +
    scegliSubsetCaratteri(0);
 +
  }
 
}
 
}
 +
 
 +
$(aggiungiMenuSubsetCaratteri);
  
/**
+
// END Menu caratteri speciali
* WikiMiniAtlas
+
 
*
+
/*** RICERCA ***/
* 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.
+
*  Descrizione: Cambia Speciale:Ricerca per usare un menu' a
* Maintainers: [[User:Dschwen]]
+
* tendina, con come default il motore interno di MediaWiki
*/
+
*
( function () {
+
* Creato e gestito da: [[:en:User:Gracenotes]]
    var require_wikiminiatlas = false;
+
* Importato in it.wiki da: [[Utente:Jalo]]
    var coord_filter = /geohack/;
+
*/
    $( document ).ready( function() {
+
         $( 'a.external.text' ).each( function( key, link ) {
+
if (mw.config.get('wgPageName') == "Speciale:Ricerca")
            if ( link.href && coord_filter.exec( link.href ) ) {
+
$(function() {
                require_wikiminiatlas = true;
+
        var searchEngines = [];
                // break from loop
+
        var createOption = function(site, action, mainQ, addQ, addV) {
                return false;
+
                var opt = document.createElement('option');
            }
+
                opt.appendChild(document.createTextNode(site));
         } );
+
                searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
        if ( $( 'div.kmldata' ).length ) {
+
                return opt;
            require_wikiminiatlas = true;
+
        };
 +
        var searchForm = document.forms['powersearch'] || document.forms['search'];
 +
        var searchBox = searchForm.lsearchbox || searchForm.search;
 +
 
 +
        var selectBox = document.createElement('select');
 +
        selectBox.id = 'searchEngine';
 +
        searchForm.onsubmit = function() {
 +
                var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
 +
                searchForm.action = optSelected[0];
 +
                searchBox.name = optSelected[1];
 +
                searchForm.title.value = optSelected[3];
 +
                searchForm.title.name = optSelected[2];
 +
         };
 +
 
 +
        selectBox.appendChild(createOption('MediaWiki', mw.config.get('wgScriptPath') + '/index.php', 'search', 'title', 'Speciale:Ricerca'));
 +
        selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'it.wikipedia.org'));
 +
        selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'it.wikipedia.org'));
 +
        selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://it.wikipedia.org'));
 +
        selectBox.appendChild(createOption('Wikiwix', 'http://it.wikiwix.com/', 'action', 'lang', 'it'));
 +
        selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'it'));
 +
        searchBox.style.marginLeft = '0px';
 +
 +
        // 'searchText' is the firt search text. 'powerSearchText' is the second, used only if the first is not existent (e.g.: not yet done any search)
 +
        buttonSearch = document.getElementById('searchText') || document.getElementById('powerSearchText');
 +
 
 +
         buttonSearch.parentNode.insertBefore(selectBox, buttonSearch.nextSibling);
 +
});
 +
 
 +
// Serve per far funzionare il Cassetto2 con IE6.
 +
if (window.attachEvent && !window.XMLHttpRequest) window.attachEvent("onload", function() {
 +
        var x = mw.util.$content.get(0).getElementsByTagName("div");
 +
        for (var i=0; i<x.length; i++) {
 +
                if (x[i].className != "HopFrame") continue;
 +
                var y=x[i].getElementsByTagName("div"); var j;
 +
                for (j=0; j<y.length; j++)
 +
                        if (y[j].className == "HopContent") {x[i].hopContent = y[j]; break;}
 +
                if (j<y.length) {
 +
                        x[i].onmouseover=function() { this.hopContent.style.display="block"; };
 +
                        x[i].onmouseout=function() { this.hopContent.style.display="none"; };
 +
                }
 
         }
 
         }
        if ( require_wikiminiatlas ) {
+
});
            mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
+
        }
+
    } );
+
} )();
+
  
/**
+
// BEGIN Dynamic Navigation Bars
* Interwiki links to featured articles ***************************************
+
 
 +
 
 +
/* Test if an element has a certain class **************************************
 
  *
 
  *
  * Description: Highlights interwiki links to featured articles (or
+
  * Description: Uses regular expressions and caching for better performance.
*              equivalents) by changing the bullet before the interwiki link
+
  * Maintainers: User:Mike Dillon, User:R. Koot, User:SG
*              into a star.
+
  * Maintainers: [[User:R. Koot]]
+
 
  */
 
  */
function LinkFA() {
+
var hasClass = (function () {
     if ( document.getElementById( 'p-lang' ) ) {
+
     var reCache = {};
         var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
+
    return function (element, className) {
 +
         return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
 +
    };
 +
})();
 +
 
 +
 
 +
// set up the words in your language
 +
var NavigationBarHide = '▲ nascondi';
 +
var NavigationBarShow = '▼ mostra';
 +
 
 +
// 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 = 0;
 +
 
  
        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
+
// shows and hides content and picture (if available) of navigation bars
            if ( document.getElementById( InterwikiLinks[i].className + '-fa' ) ) {
+
// Parameters:
                InterwikiLinks[i].className += ' FA';
+
//    indexNavigationBar: the index of navigation bar to be toggled
                InterwikiLinks[i].title = 'This is a featured article in another language.';
+
function toggleNavigationBar(indexNavigationBar)
            } else if ( document.getElementById( InterwikiLinks[i].className + '-ga' ) ) {
+
{
                InterwikiLinks[i].className += ' GA';
+
  var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
                InterwikiLinks[i].title = 'This is a good article in another language.';
+
  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';
 +
          }
 +
          if (hasClass(NavChild, 'NavToggle')) {
 +
              NavChild.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';
 +
          }
 +
          if (hasClass(NavChild, 'NavToggle')) {
 +
              NavChild.firstChild.data = NavigationBarHide;
 +
          }
 +
      }
 +
  }
 
}
 
}
  
$( LinkFA );
+
// 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 (hasClass(NavFrame, 'NavFrame')) {
  
/**
+
          indexNavigationBar++;
* Collapsible tables *********************************************************
+
          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);
 +
 
 +
          // add NavToggle-Button as first div-element
 +
          // in < div class="NavFrame" >
 +
          NavFrame.insertBefore(
 +
              NavToggle,
 +
              NavFrame.firstChild
 +
          );
 +
          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);
 +
      }
 +
  }
 +
 
 +
}
 +
 
 +
$(createNavigationBarToggleButton);
 +
 
 +
// END Dynamic Navigation Bars
 +
 
 +
 
 +
/** Collapsible tables *********************************************************
 
  *
 
  *
  * Description: Allows tables to be collapsed, showing only the header. See
+
  * Taken from //en.wikipedia.org/wiki/MediaWiki:Common.js
  *             [[Wikipedia:NavFrame]].
+
Description: Allows tables to be collapsed, showing only the header. See
  * Maintainers: [[User:R. Koot]]
+
  *               Wikipedia:NavFrame.
 +
  * Maintainers: User:R. Koot
 
  */
 
  */
  
 
var autoCollapse = 2;
 
var autoCollapse = 2;
var collapseCaption = 'hide';
+
var collapseCaption = "nascondi";
var expandCaption = 'show';
+
var expandCaption = "mostra";
  
window.collapseTable = function ( tableIndex ) {
+
function collapseTable( tableIndex )
     var Button = document.getElementById( 'collapseButton' + tableIndex );
+
{
     var Table = document.getElementById( 'collapsibleTable' + tableIndex );
+
     var Button = document.getElementById( "collapseButton" + tableIndex );
 +
     var Table = document.getElementById( "collapsibleTable" + tableIndex );
  
 
     if ( !Table || !Button ) {
 
     if ( !Table || !Button ) {
Riga 205: Riga 431:
 
     }
 
     }
  
     var Rows = Table.rows;
+
     var Rows = Table.getElementsByTagName( "tr" );  
    var i;
+
  
     if ( Button.firstChild.data === collapseCaption ) {
+
     if ( Button.firstChild.data == collapseCaption ) {
         for ( i = 1; i < Rows.length; i++ ) {
+
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = 'none';
+
             Rows[i].style.display = "none";
 
         }
 
         }
 
         Button.firstChild.data = expandCaption;
 
         Button.firstChild.data = expandCaption;
 
     } else {
 
     } else {
         for ( i = 1; i < Rows.length; i++ ) {
+
         for ( var i = 1; i < Rows.length; i++ ) {
 
             Rows[i].style.display = Rows[0].style.display;
 
             Rows[i].style.display = Rows[0].style.display;
 
         }
 
         }
 
         Button.firstChild.data = collapseCaption;
 
         Button.firstChild.data = collapseCaption;
 
     }
 
     }
};
+
}
  
function createCollapseButtons() {
+
function createCollapseButtons()
 +
{
 
     var tableIndex = 0;
 
     var tableIndex = 0;
     var NavigationBoxes = {};
+
     var NavigationBoxes = new Object();
     var Tables = document.getElementsByTagName( 'table' );
+
     var Tables = document.getElementsByTagName( "table" );
    var i;
+
 
+
    function handleButtonLink( index, e ) {
+
        window.collapseTable( index );
+
        e.preventDefault();
+
    }
+
 
+
    for ( i = 0; i < Tables.length; i++ ) {
+
        if ( $( Tables[i] ).hasClass( '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;
+
  
 +
    for ( var i = 0; i < Tables.length; i++ ) {
 +
        if ( hasClass( Tables[i], "collapsible" ) ) {
 
             NavigationBoxes[ tableIndex ] = Tables[i];
 
             NavigationBoxes[ tableIndex ] = Tables[i];
             Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
+
             Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
  
             var Button    = document.createElement( 'span' );
+
             var Button    = document.createElement( "span" );
             var ButtonLink = document.createElement( 'a' );
+
             var ButtonLink = document.createElement( "a" );
 
             var ButtonText = document.createTextNode( collapseCaption );
 
             var ButtonText = document.createTextNode( collapseCaption );
  
             Button.className = 'collapseButton'; /* Styles are declared in Common.css */
+
             Button.style.styleFloat = "right";
 +
            Button.style.cssFloat = "right";
 +
            Button.style.fontWeight = "normal";
 +
            Button.style.textAlign = "right";
 +
            Button.style.width = "7em";
  
            ButtonLink.style.color = Header.style.color;
+
             ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
             ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
+
             ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
             ButtonLink.setAttribute( 'href', '#' );
+
            $( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) );
+
 
             ButtonLink.appendChild( ButtonText );
 
             ButtonLink.appendChild( ButtonText );
  
             Button.appendChild( document.createTextNode( '[' ) );
+
             Button.appendChild( document.createTextNode( "[" ) );
 
             Button.appendChild( ButtonLink );
 
             Button.appendChild( ButtonLink );
             Button.appendChild( document.createTextNode( ']' ) );
+
             Button.appendChild( document.createTextNode( "]" ) );
  
             Header.insertBefore( Button, Header.firstChild );
+
             var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
            tableIndex++;
+
            /* only add button and increment count if there is a header row to work with */
 +
            if (Header) {
 +
                Header.insertBefore( Button, Header.childNodes[0] );
 +
                tableIndex++;
 +
            }
 
         }
 
         }
 
     }
 
     }
  
     for ( i = 0;  i < tableIndex; i++ ) {
+
     for ( var i = 0;  i < tableIndex; i++ ) {
         if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
+
         if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
             window.collapseTable( i );
+
             collapseTable( i );
        }
+
        else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
+
            var element = NavigationBoxes[i];
+
            while ((element = element.parentNode)) {
+
                if ( $( element ).hasClass( 'outercollapse' ) ) {
+
                    window.collapseTable ( i );
+
                    break;
+
                }
+
            }
+
 
         }
 
         }
 
     }
 
     }
Riga 283: Riga 493:
 
$( createCollapseButtons );
 
$( createCollapseButtons );
  
/**
+
//END Collapsible tables
* Dynamic Navigation Bars (experimental)
+
*
+
* Description: See [[Wikipedia:NavFrame]].
+
* Maintainers: UNMAINTAINED
+
*/
+
  
/* set up the words in your language */
+
//HIDDENCAT (mostra le categorie nascoste). Scippato ai francesi
var NavigationBarHide = '[' + collapseCaption + ']';
+
//@ deprecated
var NavigationBarShow = '[' + expandCaption + ']';
+
function addClass(node, className) {
 
+
     if (hasClass(node, className)) {
/**
+
* Shows and hides content and picture (if available) of navigation bars
+
* Parameters:
+
*    indexNavigationBar: the index of navigation bar to be toggled
+
**/
+
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
+
     var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
+
    var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
+
    var NavChild;
+
 
+
    if ( !NavFrame || !NavToggle ) {
+
 
         return false;
 
         return false;
 
     }
 
     }
 +
    node.className += ' '+ className;
 +
    return true;
 +
}
  
    /* if shown now */
+
function eregReplace(search, replace, subject) {
    if ( NavToggle.firstChild.data === NavigationBarHide ) {
+
    return subject.replace(new RegExp(search,'g'), replace);
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
}
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
+
                NavChild.style.display = 'none';
+
            }
+
        }
+
    NavToggle.firstChild.data = NavigationBarShow;
+
  
    /* if hidden now */
+
//@ deprecated
    } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
+
function removeClass(node, className) {
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
  if (!hasClass(node, className)) {
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
+
    return false;
                NavChild.style.display = 'block';
+
  }
            }
+
  node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
        }
+
  return true;
        NavToggle.firstChild.data = NavigationBarHide;
+
}
    }
+
  
    event.preventDefault();
+
function hiddencat()
};
+
{
 +
var cl = document.getElementById('catlinks');          if(!cl) return;
 +
var hc = document.getElementById('mw-hidden-catlinks'); if(!hc) return;
 +
var nc = document.getElementById('mw-normal-catlinks');
 +
if(!nc)
 +
{
 +
  removeClass(cl, 'catlinks-allhidden');
 +
  addClass(cl, 'catlinks-allhidden-mostra');
 +
  var ahc = '<div id="mw-normal-catlinks"><a href="/wiki/Categoria:Categorie" title="Categoria:Categorie">Categorie</a>&nbsp;:&#32;<span dir="ltr"><a onclick="javascript:toggleHiddenCats();" id="mw-hidden-cats-link" style="cursor:pointer; color:#002BB8;" title="Questa voce contiene categorie nascoste">[altre]</a></span></div>';
 +
  document.getElementById('catlinks').innerHTML = ahc + cl.innerHTML;
 +
}
 +
else if( hasClass(hc, 'mw-hidden-cats-hidden') )
 +
{
 +
  var ahc = ' | <a onclick="javascript:toggleHiddenCats();" id="mw-hidden-cats-link" style="cursor:pointer; color:#002BB8;" title="Questa voce contiene categorie nascoste">[altre]</a>';
 +
  document.getElementById('mw-normal-catlinks').innerHTML += ahc;
 +
}
 +
}
 +
function toggleHiddenCats()
 +
{
 +
var hc = document.getElementById('mw-hidden-catlinks');
 +
if( hasClass(hc, 'mw-hidden-cats-hidden') )
 +
{
 +
  removeClass(hc, 'mw-hidden-cats-hidden');
 +
  addClass(hc, 'mw-hidden-cat-user-shown');
  
/* adds show/hide-button to navigation bars */
+
  //L'elemento <span /> crea problemi a HotCat
function createNavigationBarToggleButton() {
+
  document.getElementById('mw-hidden-cats-link').innerHTML = '[nascondi]';  
    var indexNavigationBar = 0;
+
  //document.getElementById('mw-hidden-cats-link').innerHTML = '[<span style="font-style:italic;">nascondi</span>]';
    var NavFrame;
+
}
    var NavChild;
+
else
    /* iterate over all < div >-elements */
+
{
    var divs = document.getElementsByTagName( 'div' );
+
  removeClass(hc, 'mw-hidden-cat-user-shown');
    for ( var i = 0; (NavFrame = divs[i]); i++ ) {
+
  addClass(hc, 'mw-hidden-cats-hidden');
        /* if found a navigation bar */
+
        if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
+
  
            indexNavigationBar++;
+
  //Vedi commento sopra
            var NavToggle = document.createElement( 'a' );
+
  document.getElementById('mw-hidden-cats-link').innerHTML = '[altre]';
            NavToggle.className = 'NavToggle';
+
  //document.getElementById('mw-hidden-cats-link').innerHTML = '[<span style="font-style:italic;">altre</span>]';
            NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
+
}
            NavToggle.setAttribute( 'href', '#' );
+
}
            $( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
+
 +
$(hiddencat);
  
            var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
+
/* Layout pagina di modifica */
            /**
+
$( function ()
            * 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"
+
  if (mw.config.get('wgAction') == "edit")
            * 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
+
    /* Allarga l'edittools a tutta pagina */
            * "collapsed" to the NavFrame itself, just like with collapsible tables.
+
    $('#Standard').css( 'width', '100%' );
            */
+
  }
            for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
+
});
                if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
+
                    if ( NavChild.style.display === 'none' ) {
+
                        isCollapsed = true;
+
                    }
+
                }
+
            }
+
            if ( isCollapsed ) {
+
                for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
                    if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
+
                        NavChild.style.display = 'none';
+
                    }
+
                }
+
            }
+
            var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
+
            NavToggle.appendChild( NavToggleText );
+
  
            /* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
+
/* Avvisa quando si tenta di creare una voce con titolo non valido  ("Scrivi qui il titolo")*/
            for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
+
$ ( function ()
                if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
+
{
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
+
  if (mw.config.get('wgTitle') == "Scrivi qui il titolo" && mw.config.get('wgAction') == "edit")
                    NavFrame.childNodes[j].appendChild( NavToggle );
+
  {
                }
+
    dopoDi = document.getElementById("contentSub");
            }
+
if (!dopoDi) return;
            NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
+
    var daInserire = document.createElement('div');
        }
+
    daInserire.innerHTML = "<b>Stai creando una voce senza specificarne un titolo valido. Per favore, torna indietro e inserisci un titolo valido.</b>";
    }
+
daInserire.className = "toccolours itwiki_template_avviso rad";
}
+
daInserire.style.marginBottom = "0.5em";
 +
daInserire.style.background = "#FC9";
 +
daInserire.style.borderColor = "red";
 +
daInserire.style.textAlign = "center";
 +
        daInserire.style.fontSize = "120%";
 +
dopoDi.parentNode.insertBefore(daInserire, dopoDi.nextSibling);
 +
  }
 +
});
  
$( createNavigationBarToggleButton );
+
/* Avvisa quando si tenta di creare una discussione al bar con titolo non valido  ("Scrivi qui il titolo")*/
 +
$ ( function ()
 +
{
 +
  if (mw.config.get('wgTitle') == "Wikipedia:Bar/Discussioni/SCRIVI QUI SOLO IL TITOLO" && mw.config.get('wgAction') == "edit")
 +
  {
 +
    dopoDi = document.getElementById("contentSub");
 +
if (!dopoDi) return;
 +
    var daInserire = document.createElement('div');
 +
    daInserire.innerHTML = "<b>Stai creando una discussione del bar senza specificarne un titolo valido. Per favore, torna indietro e inserisci un titolo valido.</b>";
 +
daInserire.className = "toccolours itwiki_template_avviso rad";
 +
daInserire.style.marginBottom = "0.5em";
 +
daInserire.style.background = "#FC9";
 +
daInserire.style.borderColor = "red";
 +
daInserire.style.textAlign = "center";
 +
        daInserire.style.fontSize = "120%";
 +
dopoDi.parentNode.insertBefore(daInserire, dopoDi.nextSibling);
 +
  }
 +
});
  
/**
+
/** extract a URL parameter from the current URL **********
* Uploadwizard_newusers
+
  * From [[en:User:Lupin/autoedit.js]] and [[en:MediaWiki:Common.js]]
  * Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
+
 
  *
 
  *
  * Maintainers: [[User:Krimpet]]
+
  * paramName  : the name of the parameter to extract
 
  */
 
  */
function uploadwizard_newusers() {
+
//DEPRECATO
    if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) {
+
function getURLParamValue(param, url) {
        var oldDiv = document.getElementById( 'autoconfirmedusers' ),
+
  return mw.util.getParamValue(param, url);
            newDiv = document.getElementById( 'newusers' );
+
}
        if ( oldDiv && newDiv ) {
+
            var userGroups = mw.config.get( 'wgUserGroups' );
+
/** &withJS= URL parameter *******
            if ( userGroups ) {
+
* Allow to try custom scripts from MediaWiki space
                for ( var i = 0; i < userGroups.length; i++ ) {
+
* without editing [[Special:Mypage/monobook.js]]
                    if ( userGroups[i] === 'autoconfirmed' ) {
+
*/
                        oldDiv.style.display = 'block';
+
var extraJS = getURLParamValue("withJS");
                        newDiv.style.display = 'none';
+
if ( extraJS && extraJS.match("^MediaWiki:[^&<>=%]*\\.js$") ) {
                        return;
+
  importScript(extraJS);
                    }
+
                }
+
            }
+
            oldDiv.style.display = 'none';
+
            newDiv.style.display = 'block';
+
            return;
+
        }
+
    }
+
 
}
 
}
  
$(uploadwizard_newusers);
 
  
/**
+
/*** Codice per il Template:Galleria ***/
* Magic editintros ****************************************************
+
function toggleImage(group, remindex, shwindex) {
*
+
  document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
* Description: Adds editintros on disambiguation pages and BLP pages.
+
  document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
* Maintainers: [[User:RockMFR]]
+
*/
+
function addEditIntro( name ) {
+
    $( '.editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
+
        el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
+
    } );
+
 
}
 
}
 +
function ImageGroup(){
 +
if (document.URL.match(/printable/g)) return;
 +
var bc=mw.util.$content.get(0);
 +
var divs=bc.getElementsByTagName("div");
 +
var i = 0, j = 0;
 +
var units, search;
 +
var currentimage;
 +
var UnitNode;
 +
for (i = 0; i < divs.length ; i++) {
 +
if (divs[i].className != "ImageGroup") continue;
 +
UnitNode=undefined;
 +
search=divs[i].getElementsByTagName("div");
 +
for (j = 0; j < search.length ; j++) {
 +
if (search[j].className != "ImageGroupUnits") continue;
 +
UnitNode=search[j];
 +
break;
 +
}
 +
if (UnitNode===undefined) continue;
 +
units=Array();
 +
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
 +
var temp = UnitNode.childNodes[j];
 +
if (temp.className=="center") units.push(temp);
 +
}
 +
for (j = 0 ; j < units.length ; j++) {
 +
currentimage=units[j];
 +
currentimage.id="ImageGroupsGr"+i+"Im"+j;
 +
var imghead = document.createElement("div");
 +
var leftlink;
 +
var rightlink;
 +
if (j != 0) {
 +
leftlink = document.createElement("a");
 +
leftlink.href = "javascript:toggleImage("+i+","+j+","+(j-1)+");";
 +
leftlink.innerHTML="◀";
 +
} else {
 +
leftlink = document.createElement("span");
 +
leftlink.innerHTML="&nbsp;";
 +
}
 +
if (j != units.length - 1) {
 +
rightlink = document.createElement("a");
 +
rightlink.href = "javascript:toggleImage("+i+","+j+","+(j+1)+");";
 +
rightlink.innerHTML="▶";
 +
} else {
 +
rightlink = document.createElement("span");
 +
rightlink.innerHTML="&nbsp;";
 +
}
 +
var comment = document.createElement("tt");
 +
comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
 +
imghead.style.fontSize="110%";
 +
imghead.style.fontweight="bold";
 +
imghead.appendChild(leftlink);
 +
imghead.appendChild(comment);
 +
imghead.appendChild(rightlink);
 +
currentimage.insertBefore(imghead,currentimage.childNodes[0]);
 +
if (j != 0) currentimage.style.display="none";
 +
}
 +
}
 +
}
 +
$(ImageGroup);
  
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
 
    $( function () {
 
        if ( document.getElementById( 'disambigbox' ) ) {
 
            addEditIntro( 'Template:Disambig_editintro' );
 
        }
 
    } );
 
  
     $( function () {
+
// Toglie "Soggetto/Intestazione" nelle creazioni delle discussioni al Bar
        var cats = document.getElementById( 'mw-normal-catlinks' );
+
if (mw.config.get('wgNamespaceNumber') == 4 &&
         if ( !cats ) {
+
     mw.config.get('wgPageName').indexOf("Wikipedia:Bar/") == 0 &&
            return;
+
    mw.config.get('wgAction') == "edit" &&
 +
    document.URL.indexOf("&section=new&preload=") != -1)
 +
$( function ()
 +
{
 +
  document.getElementById('wpSummaryLabel').style.display="none";
 +
  document.getElementById('wpSummary').style.display="none";
 +
});
 +
 
 +
 
 +
 
 +
//Cambia posizione e link del link "modifica" delle sezioni
 +
//Fatto in Common.css, questo è un fix per IE7
 +
if ($.client.profile().name == 'msie' && $.client.profile().versionNumber < 8)
 +
$(function(){
 +
    $('.editsection').each(function(i, e){$(e).parent().append(e)});
 +
});
 +
 
 +
 
 +
/** Workaround temporaneo *************
 +
* Workaround per il vecchio codice che usa document.write(): a partire da MediaWiki 1.17 non è più possibile usarlo.
 +
* Questo codice sostituisce le funzioni document.write() e document.writeln() con funzioni personalizzate.
 +
* Quando possibile, traduce in una chiamata a importScriptURI(); in tutti gli altri casi, ritorna senza far nulla.
 +
* E' codice poco robusto e che va rimosso al più presto, dopo aver aggiornato i vecchi codici.
 +
*/
 +
if (mw.config.get('wgVersion') >= "1.17"){
 +
  try{
 +
    document.write = document.writeln = function(str){
 +
      var start, end;
 +
      try{
 +
         if (str.indexOf("<script") != -1){
 +
          start = str.indexOf("src");
 +
          start = str.indexOf("\"", start+1) + 1;
 +
          end = str.indexOf("\"", start);
 +
          importScriptURI(str.substring(start, end));
 +
        } else {
 +
          //Ignora la chiamata
 
         }
 
         }
        cats = cats.getElementsByTagName( 'a' );
+
      } catch (e) { /* Ignora */ }
        for ( var i = 0; i < cats.length; i++ ) {
+
    };
            if ( cats[i].title === 'Category:Living people' || cats[i].title === 'Category:Possibly living people' ) {
+
  } catch (e) { /* Ignora */ }
                addEditIntro( 'Template:BLP_editintro' );
+
                break;
+
            }
+
        }
+
    } );
+
 
}
 
}
  
/**
+
/** OpenStreetMap nel template Coord **/
* Description: Stay on the secure server as much as possible
+
   
  * Maintainers: [[User:TheDJ]]
+
// Verwendung von OpenStreetMap in Wikipedia.
*/
+
// (c) 2008 by Magnus Manske
if ( document.location && document.location.protocol  && document.location.protocol === 'https:' ) {
+
// Released under GPL
     /* New secure servers */
+
// Modified version in order to makes it work with moveCoord() above
     importScript( 'MediaWiki:Common.js/secure new.js' );
+
// From fr:mediawiki:common.js
 +
// modified to makes it work for IT : Otourly
 +
 
 +
if(typeof(MoveResizeAbsolute_AddMoveArea)!="function") importScriptURI('//it.wikipedia.org/w/index.php?title=MediaWiki:Gadget-MoveResizeAbsolute.js&action=raw&ctype=text/javascript');
 +
 +
function openStreetMap_Init () {
 +
  var c = document.getElementById ( 'coordinates' ) ;
 +
  if ( !c ) return ;
 +
 +
  var a = c.getElementsByTagName ( 'a' ) ;
 +
  var geohack = false;
 +
  for ( var i = 0 ; i < a.length ; i++ ) {
 +
     var h = a[i].href ;
 +
    if ( !h.match(/geohack/) ) continue ;
 +
     geohack = true ;
 +
    break ;
 +
  }
 +
  if ( !geohack ) return ;
 +
 +
  var na = document.createElement ( 'a' ) ;
 +
  na.href = 'javascript:openStreetMap_Toggle();' ;
 +
  na.title = 'Mostrare / nascondere la mappa' ;
 +
  na.appendChild ( document.createTextNode ( 'Mappa' ) ) ;
 +
  c.appendChild ( document.createTextNode ( ' (' ) ) ;
 +
  c.appendChild ( na ) ;
 +
  c.appendChild ( document.createTextNode ( ')  ' ) ) ;
 
}
 
}
 +
 +
function openStreetMap_Toggle () {
 +
  var c = document.getElementById ( 'coordinates' ) ;
 +
  if ( !c) return ;
 +
  var osm = document.getElementById ( 'OpenStreetMap' ) ;
 +
 +
  if (osm) {
 +
    if ( osm.style.display == 'none' ) {
 +
      osm.style.display = 'block' ;
 +
    } else {
 +
      osm.style.display = 'none' ;
 +
    }
 +
    return;
 +
  }
 +
 +
  var found_link = false ;
 +
  var a = c.getElementsByTagName ( 'a' ) ;
 +
  var h;
 +
  for ( var i = 0 ; i < a.length ; i++ ) {
 +
    h = a[i].href ;
 +
    if ( !h.match(/geohack/) ) continue ;
 +
    found_link = true ;
 +
    break ;
 +
  }
 +
  if ( !found_link ) return ; // No geohack link found
 +
 +
  h = h.split('params=')[1] ;
 +
 +
  var LarghezzaSchermo = MoveResizeAbsolute_GetScreenWidth();
 +
  var AlterigiaSchermo = MoveResizeAbsolute_GetScreenHeight();
 +
 +
  var OSMDiv = document.createElement('div');
 +
  OSMDiv.id = 'OpenStreetMap' ;
 +
  OSMDiv.style.position = "absolute";
 +
  OSMDiv.style.zIndex = 5000;
 +
  OSMDiv.style.top = (AlterigiaSchermo*10/100) + "px";
 +
  OSMDiv.style.left = (LarghezzaSchermo*15/100) + "px";
 +
  OSMDiv.style.width = "70%";
 +
  OSMDiv.style.height = (AlterigiaSchermo*80/100) + "px";
 +
  OSMDiv.style.border = "2px solid black";
 +
  OSMDiv.style.backgroundColor = "white";
 +
  OSMDiv.style.overflow = "hidden";
 +
 +
  var MoveArea = document.createElement('div');
 +
  MoveArea.style.position = "relative";
 +
  MoveArea.style.top = "0";
 +
  MoveArea.style.width = "100%";
 +
  MoveArea.style.height = "50px";
 +
  MoveArea.title = "Clicca e trascina per ridimensionare la mappa";
 +
 +
  var CloseLink = document.createElement('a');
 +
  CloseLink.setAttribute("style", "float:right;margin:10px;");
 +
  CloseLink.innerHTML = "Nascondere";
 +
  CloseLink.title = "Clicca per nascondere";
 +
  CloseLink.href = "javascript:openStreetMap_Toggle();";
 +
  MoveArea.appendChild(CloseLink);
 +
 +
  var iFrame = document.createElement ( 'iframe' ) ;
 +
  var url = '//toolserver.org/~kolossos/openlayers/kml-on-ol.php?' + 'lang=' + mw.config.get('wgUserLanguage') + '&params=' + h + '&title=' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) ) + ( window.location.protocol == 'https:' ? '&secure=1' : '' ) ;
 +
  iFrame.style.width = '100%' ;
 +
  iFrame.style.height = ((AlterigiaSchermo*80/100)-100) + 'px' ;
 +
  iFrame.style.clear = 'both' ;
 +
  iFrame.src = url ;
 +
 +
  var ResizeArea = document.createElement('div');
 +
  ResizeArea.style.position = "relative";
 +
  ResizeArea.style.top = "0";
 +
  ResizeArea.style.width = "100%";
 +
  ResizeArea.style.height = "50px";
 +
  ResizeArea.title = "Clicca e trascina per ridimensionare la mappa";
 +
 +
  OSMDiv.appendChild(MoveArea);
 +
  OSMDiv.appendChild(iFrame);
 +
  OSMDiv.appendChild(ResizeArea);
 +
 +
  document.body.appendChild ( OSMDiv ) ;
 +
 +
  var ElementsToMove = new Array(OSMDiv);
 +
  var ElementsToResize = new Array(OSMDiv, iFrame);
 +
  var ElementsMinWidth = new Array(150, 150);
 +
  var ElementsMinHeights = new Array(200, 100);
 +
 +
  MoveResizeAbsolute_AddMoveArea(MoveArea, ElementsToMove);
 +
  MoveResizeAbsolute_AddResizeArea(ResizeArea, ElementsToResize, ElementsMinWidth, ElementsMinHeights);
 +
}
 +
 +
addOnloadHook(openStreetMap_Init);
 +
 +
// Autofocus nel campo "ricerca" della homepage
 +
$(function() {
 +
  if (mw.config.get('wgIsMainPage') && mw.config.get('wgAction') === 'view')
 +
    $('#searchInput').focus();
 +
});
  
/* End of mw.loader.using callback */
+
//REFERENCE TOOLTIP
} );
+
mw.loader.load("//it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/ReferenceTooltip.js&action=raw&ctype=text/javascript");
/* DO NOT ADD CODE BELOW THIS LINE */
+

Versione delle 18:36, 13 mar 2013

/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
 
/* Serve per "sabotare" www.wikipedia.it e tutti gli altri siti che ci includono in frame. "Salta fuori" dai frame.
    Va alla pagina del toolserver il cui contenuto è preso dalla pagina [[Utente:Pietrodn/www.wikipedia.it]], modificabile solo dagli admin.
    Poi reindirizza a http://it.wikipedia.org */
if (mw.config.get('wgIsMainPage') && top != self)
    top.location.replace('http://toolserver.org/~pietrodn/wikipedia_redirect.php');
 
/*
 * Redirect bad mirrors to it.wikipedia.org
 * [[m:User:Hoo man]]
 */
( function( mw ) {
	var i, isBad,
		badMirrors = [
		'wikipedia.sapere.alice.it',
		'wikipedia.deejay.it',
		'wikipedia.kataweb.it',
                '212.48.3.33',
                'wikipedia.virgilio.it',
                '213.92.16.218',
		];
	for( i = 0; i < badMirrors.length; i++ ) {
		if ( document.location.href.indexOf( badMirrors[ i ] ) !== -1 ) {
			isBad = true;
			break;
		}
	}
	if ( isBad ) {
		// redirect users to the same page on itwiki
		document.location.href = '//it.wikipedia.org/wiki/' + mw.config.get( 'wgPageName' );
		/*
		// redirect users to a landing page
		document.location.href = '//it.wikipedia.org/wiki/FooBar';
		*/
	}
} )( mediaWiki );
 
//DEPRECATO
function addLoadEvent(func) 
{
  if (window.addEventListener) 
    window.addEventListener("load", func, false);
  else if (window.attachEvent) 
    window.attachEvent("onload", func);
}
 
 
/*** Collegamento diretto alla pagina di upload di Commons nel portlet Strumenti */
$(function(){
    mw.util.addPortletLink('p-tb', '//commons.wikimedia.org/wiki/Commons:Upload/it',
              'Carica su Commons', 't-uploadcommons', 'Carica file multimediali su Wikimedia Commons', 'm', '#t-specialpages');
});
 
 
/*** Evidenzia i link agli articoli di qualità su altre wiki */
function LinkAdQ() 
{
    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 = "La voce è in vetrina in questa lingua.";
} else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
                InterwikiLinks[i].className += " GA"
                InterwikiLinks[i].title = "La voce è di qualità in questa lingua.";
            }
        }
    }
}
 
$( LinkAdQ );
 
 
/*
Correzione della posizione del link [modifica] delle sezioni.
 
Copyright 2006, Marc Mongenet
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
See http://www.gnu.org/licenses/gpl.html
 
The function looks for <span class="editsection">, and move them
at the end of their parent and display them inline in small font.
var oldEditsectionLinks=true disables the function.
*/
 
$(function(){
    try {
        if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
        var spans = document.getElementsByTagName("span");
        for (var s = 0; s < spans.length; ++s) {
            var span = spans[s];
            if (span.className == "editsection") {
                span.style.fontSize = "x-small";
                span.style.fontWeight = "normal";
                span.style.cssFloat = span.style.styleFloat = "none";
                span.parentNode.appendChild(document.createTextNode(" "));
                span.parentNode.appendChild(span);
            }
        }
    } catch (e) { /* something went wrong */ }
});
 
/* 
 * Modifica il testo della linguetta "Voce" in "Pagina principale" 
 * e aggiunge il link alla lista completa di tutte le pagine
 */
if (mw.config.get('wgIsMainPage') || mw.config.get('wgPageName') === "Discussione:Pagina_principale")
$(function() {
  if (mw.config.get('wgUserLanguage') === 'it')
    $('#ca-nstab-main a').text('Pagina principale');
 
  mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/Lista_di_Wikipedie',
                 'Lista completa', 'interwiki-completelist', 'Lista completa delle Wikipedie');
});
 
 /** "Technical restrictions" title fix *****************************************
  *
  *  Descrizionen: Codice per [[Template:Titolo errato]]
  *  Copiato inizialmente da [[:en:MediaWiki:Common.js]]
  */
 // The function looks for a banner like this: <nowiki>
 // <div id="RealTitleBanner">    <!-- div that gets hidden -->
 //   <span id="RealTitle">title</span>
 // </div>
 // </nowiki>An element with id=DisableRealTitle disables the function.
var disableRealTitle = 0;    // users can disable this by making this true from their user script
function correctTitle() {
  try {
    var realTitleBanner = document.getElementById("RealTitleBanner");
    if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
      var realTitle = document.getElementById("RealTitle");
      if (realTitle) {
        var realTitleHTML = realTitle.innerHTML;
        var realTitleText = $(realTitle).text();
 
        var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big|a)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
 
        var h1 = document.getElementsByTagName("h1")[0];
        if (h1) {
          h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
 
          realTitleBanner.style.display = "none";
        }
        document.title = realTitleText + " - Wikipedia";
      }
    }
  } catch (e) {
    /* Something went wrong. */
  }
}
 
$(correctTitle);
 
/** 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. 
  */
 
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
 
//============================================================
// Menu caratteri speciali
//============================================================
 
/**
 * Aggiunge il menu a tendina per selezionare un sottoinsieme di caratteri speciali
 * Attenzione:        l'ordine della lista deve corrispondere a quello di MediaWiki:Edittools !
 */
/* select subsection of special characters */
function scegliSubsetCaratteri(s) {
  var l = document.getElementById('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';
  }
}
 
function aggiungiMenuSubsetCaratteri() {
  var specialchars = document.getElementById('specialchars');
 
  if (specialchars) {
    var menu = "<select style=\"display:inline\" onChange=\"scegliSubsetCaratteri(selectedIndex)\">";
    menu += "<option>Latino esteso</option>";
    menu += "<option>Wiki</option>";
    menu += "<option>Greco antico</option>";
    menu += "<option>Greco moderno</option>";
    menu += "<option>Cirillico</option>";
    menu += "<option>Arabo</option>";
    menu += "<option>Ebraico e yiddish</option>";
    menu += "<option>Armeno</option>";
    menu += "<option>Geroglifico</option>";
    menu += "<option>Vietnamita</option>";
    menu += "<option>IPA</option>";
    menu += "<option>Matematica</option>";
    menu += "</select>";
    specialchars.innerHTML = menu + specialchars.innerHTML;
 
    /* default subset - try to use a cookie some day */
    scegliSubsetCaratteri(0);
  }
}
 
$(aggiungiMenuSubsetCaratteri);
 
// END Menu caratteri speciali
 
/*** RICERCA ***/
/** 
*******************************************************
*
*  Descrizione: Cambia Speciale:Ricerca per usare un menu' a
*  tendina, con come default il motore interno di MediaWiki
*
*  Creato e gestito da: [[:en:User:Gracenotes]]
*  Importato in it.wiki da: [[Utente:Jalo]]
*/
 
if (mw.config.get('wgPageName') == "Speciale:Ricerca")
$(function() {
        var searchEngines = [];
        var createOption = function(site, action, mainQ, addQ, addV) {
                var opt = document.createElement('option');
                opt.appendChild(document.createTextNode(site));
                searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
                return opt;
        };
        var searchForm = document.forms['powersearch'] || document.forms['search'];
        var searchBox = searchForm.lsearchbox || searchForm.search;
 
        var selectBox = document.createElement('select');
        selectBox.id = 'searchEngine';
        searchForm.onsubmit = function() {
                var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
                searchForm.action = optSelected[0];
                searchBox.name = optSelected[1];
                searchForm.title.value = optSelected[3];
                searchForm.title.name = optSelected[2];
        };
 
        selectBox.appendChild(createOption('MediaWiki', mw.config.get('wgScriptPath') + '/index.php', 'search', 'title', 'Speciale:Ricerca'));
        selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'it.wikipedia.org'));
        selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'it.wikipedia.org'));
        selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://it.wikipedia.org'));
        selectBox.appendChild(createOption('Wikiwix', 'http://it.wikiwix.com/', 'action', 'lang', 'it'));
        selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'it'));
        searchBox.style.marginLeft = '0px';
 
        // 'searchText' is the firt search text. 'powerSearchText' is the second, used only if the first is not existent (e.g.: not yet done any search)
        buttonSearch = document.getElementById('searchText') || document.getElementById('powerSearchText');
 
        buttonSearch.parentNode.insertBefore(selectBox, buttonSearch.nextSibling);
});
 
// Serve per far funzionare il Cassetto2 con IE6.
if (window.attachEvent && !window.XMLHttpRequest) window.attachEvent("onload", function() {
        var x = mw.util.$content.get(0).getElementsByTagName("div");
        for (var i=0; i<x.length; i++) {
                if (x[i].className != "HopFrame") continue;
                var y=x[i].getElementsByTagName("div"); var j;
                for (j=0; j<y.length; j++)
                        if (y[j].className == "HopContent") {x[i].hopContent = y[j]; break;}
                if (j<y.length) {
                        x[i].onmouseover=function() { this.hopContent.style.display="block"; };
                        x[i].onmouseout=function() { this.hopContent.style.display="none"; };
                }
        }
});
 
// BEGIN Dynamic Navigation Bars
 
 
/* 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
 */
var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();
 
 
// set up the words in your language
var NavigationBarHide = '▲ nascondi';
var NavigationBarShow = '▼ mostra';
 
// 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 = 0;
 
 
// 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';
           }
           if (hasClass(NavChild, 'NavToggle')) {
               NavChild.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';
           }
           if (hasClass(NavChild, 'NavToggle')) {
               NavChild.firstChild.data = NavigationBarHide;
           }
       }
   }
}
 
// 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 (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);
           NavToggle.appendChild(NavToggleText);
 
           // add NavToggle-Button as first div-element 
           // in < div class="NavFrame" >
           NavFrame.insertBefore(
               NavToggle,
               NavFrame.firstChild
           );
           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);
       }
   }
 
}
 
$(createNavigationBarToggleButton);
 
// END Dynamic Navigation Bars
 
 
/** Collapsible tables *********************************************************
 *
 *  Taken from //en.wikipedia.org/wiki/MediaWiki:Common.js
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               Wikipedia:NavFrame.
 *  Maintainers: User:R. Koot
 */
 
var autoCollapse = 2;
var collapseCaption = "nascondi";
var expandCaption = "mostra";
 
function collapseTable( tableIndex )
{
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );
 
    if ( !Table || !Button ) {
        return false;
    }
 
    var Rows = Table.getElementsByTagName( "tr" ); 
 
    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" ) ) {
            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 = "7em";
 
            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( "]" ) );
 
            var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
            /* only add button and increment count if there is a header row to work with */
            if (Header) {
                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 );
        }
    }
}
 
$( createCollapseButtons );
 
//END Collapsible tables
 
//HIDDENCAT (mostra le categorie nascoste). Scippato ai francesi
//@ deprecated
function addClass(node, className) {
    if (hasClass(node, className)) {
        return false;
    }
    node.className += ' '+ className;
    return true;
}
 
function eregReplace(search, replace, subject) {
    return subject.replace(new RegExp(search,'g'), replace);
}
 
//@ deprecated
function removeClass(node, className) {
  if (!hasClass(node, className)) {
    return false;
  }
  node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
  return true;
}
 
function hiddencat()
{
 var cl = document.getElementById('catlinks');           if(!cl) return;
 var hc = document.getElementById('mw-hidden-catlinks'); if(!hc) return;
 var nc = document.getElementById('mw-normal-catlinks');
 if(!nc)
 {
  removeClass(cl, 'catlinks-allhidden');
  addClass(cl, 'catlinks-allhidden-mostra');
  var ahc = '<div id="mw-normal-catlinks"><a href="/wiki/Categoria:Categorie" title="Categoria:Categorie">Categorie</a>&nbsp;:&#32;<span dir="ltr"><a onclick="javascript:toggleHiddenCats();" id="mw-hidden-cats-link" style="cursor:pointer; color:#002BB8;" title="Questa voce contiene categorie nascoste">[altre]</a></span></div>';
  document.getElementById('catlinks').innerHTML = ahc + cl.innerHTML;
 }
 else if( hasClass(hc, 'mw-hidden-cats-hidden') )
 {
  var ahc = ' | <a onclick="javascript:toggleHiddenCats();" id="mw-hidden-cats-link" style="cursor:pointer; color:#002BB8;" title="Questa voce contiene categorie nascoste">[altre]</a>';
  document.getElementById('mw-normal-catlinks').innerHTML += ahc;
 }
}
function toggleHiddenCats()
{
 var hc = document.getElementById('mw-hidden-catlinks');
 if( hasClass(hc, 'mw-hidden-cats-hidden') )
 {
  removeClass(hc, 'mw-hidden-cats-hidden');
  addClass(hc, 'mw-hidden-cat-user-shown');
 
  //L'elemento <span /> crea problemi a HotCat
  document.getElementById('mw-hidden-cats-link').innerHTML = '[nascondi]'; 
  //document.getElementById('mw-hidden-cats-link').innerHTML = '[<span style="font-style:italic;">nascondi</span>]';
 }
 else
 {
  removeClass(hc, 'mw-hidden-cat-user-shown');
  addClass(hc, 'mw-hidden-cats-hidden');
 
  //Vedi commento sopra
  document.getElementById('mw-hidden-cats-link').innerHTML = '[altre]';
  //document.getElementById('mw-hidden-cats-link').innerHTML = '[<span style="font-style:italic;">altre</span>]';
 }
}
 
$(hiddencat);
 
/* Layout pagina di modifica */
$( function ()
{
  if (mw.config.get('wgAction') == "edit")
  {
    /* Allarga l'edittools a tutta pagina */
    $('#Standard').css( 'width', '100%' );
  }
});
 
/* Avvisa quando si tenta di creare una voce con titolo non valido  ("Scrivi qui il titolo")*/
$ ( function ()
{
  if (mw.config.get('wgTitle') == "Scrivi qui il titolo" && mw.config.get('wgAction') == "edit")
  {
    dopoDi = document.getElementById("contentSub");
	if (!dopoDi) return;
    var daInserire = document.createElement('div');
    daInserire.innerHTML = "<b>Stai creando una voce senza specificarne un titolo valido. Per favore, torna indietro e inserisci un titolo valido.</b>";
	daInserire.className = "toccolours itwiki_template_avviso rad";
	daInserire.style.marginBottom = "0.5em";
	daInserire.style.background = "#FC9";
	daInserire.style.borderColor = "red";
	daInserire.style.textAlign = "center";
        daInserire.style.fontSize = "120%";
	dopoDi.parentNode.insertBefore(daInserire, dopoDi.nextSibling);
  }
});
 
/* Avvisa quando si tenta di creare una discussione al bar con titolo non valido  ("Scrivi qui il titolo")*/
$ ( function ()
{
  if (mw.config.get('wgTitle') == "Wikipedia:Bar/Discussioni/SCRIVI QUI SOLO IL TITOLO" && mw.config.get('wgAction') == "edit")
  {
    dopoDi = document.getElementById("contentSub");
	if (!dopoDi) return;
    var daInserire = document.createElement('div');
    daInserire.innerHTML = "<b>Stai creando una discussione del bar senza specificarne un titolo valido. Per favore, torna indietro e inserisci un titolo valido.</b>";
	daInserire.className = "toccolours itwiki_template_avviso rad";
	daInserire.style.marginBottom = "0.5em";
	daInserire.style.background = "#FC9";
	daInserire.style.borderColor = "red";
	daInserire.style.textAlign = "center";
        daInserire.style.fontSize = "120%";
	dopoDi.parentNode.insertBefore(daInserire, dopoDi.nextSibling);
  }
});
 
/** extract a URL parameter from the current URL **********
 * From [[en:User:Lupin/autoedit.js]] and [[en:MediaWiki:Common.js]]
 *
 * paramName  : the name of the parameter to extract
 */
//DEPRECATO
function getURLParamValue(param, url) {
  return mw.util.getParamValue(param, url);
}
 
/** &withJS= URL parameter *******
 * Allow to try custom scripts from MediaWiki space 
 * without editing [[Special:Mypage/monobook.js]]
 */
var extraJS = getURLParamValue("withJS");
if ( extraJS && extraJS.match("^MediaWiki:[^&<>=%]*\\.js$") ) {
  importScript(extraJS);
}
 
 
/*** Codice per il Template:Galleria ***/
function toggleImage(group, remindex, shwindex) {
  document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
  document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
}
function ImageGroup(){
	if (document.URL.match(/printable/g)) return;
	var bc=mw.util.$content.get(0);
	var divs=bc.getElementsByTagName("div");
	var i = 0, j = 0;
	var units, search;
	var currentimage;
	var UnitNode;
	for (i = 0; i < divs.length ; i++) {
		if (divs[i].className != "ImageGroup") continue;
		UnitNode=undefined;
		search=divs[i].getElementsByTagName("div");
		for (j = 0; j < search.length ; j++) {
			if (search[j].className != "ImageGroupUnits") continue;
			UnitNode=search[j];
			break;
		}
		if (UnitNode===undefined) continue;
		units=Array();
		for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
			var temp = UnitNode.childNodes[j];
			if (temp.className=="center") units.push(temp);
		}
		for (j = 0 ; j < units.length ; j++) {
			currentimage=units[j];
			currentimage.id="ImageGroupsGr"+i+"Im"+j;
			var imghead = document.createElement("div");
			var leftlink;
			var rightlink;
			if (j != 0) {
				leftlink = document.createElement("a");
				leftlink.href = "javascript:toggleImage("+i+","+j+","+(j-1)+");";
				leftlink.innerHTML="◀";
			} else {
				leftlink = document.createElement("span");
				leftlink.innerHTML="&nbsp;";
			}
			if (j != units.length - 1) {
				rightlink = document.createElement("a");
				rightlink.href = "javascript:toggleImage("+i+","+j+","+(j+1)+");";
				rightlink.innerHTML="▶";
			} else {
				rightlink = document.createElement("span");
				rightlink.innerHTML="&nbsp;";
			}
			var comment = document.createElement("tt");
			comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
			imghead.style.fontSize="110%";
			imghead.style.fontweight="bold";
			imghead.appendChild(leftlink);
			imghead.appendChild(comment);
			imghead.appendChild(rightlink);
			currentimage.insertBefore(imghead,currentimage.childNodes[0]);
			if (j != 0) currentimage.style.display="none";
		}
	}
}
$(ImageGroup);
 
 
// Toglie "Soggetto/Intestazione" nelle creazioni delle discussioni al Bar
if (mw.config.get('wgNamespaceNumber') == 4 &&
    mw.config.get('wgPageName').indexOf("Wikipedia:Bar/") == 0 &&
    mw.config.get('wgAction') == "edit" &&
    document.URL.indexOf("&section=new&preload=") != -1)
$( function ()
{
  document.getElementById('wpSummaryLabel').style.display="none";
  document.getElementById('wpSummary').style.display="none";
});
 
 
 
//Cambia posizione e link del link "modifica" delle sezioni
//Fatto in Common.css, questo è un fix per IE7
if ($.client.profile().name == 'msie' && $.client.profile().versionNumber < 8)
$(function(){
    $('.editsection').each(function(i, e){$(e).parent().append(e)});
});
 
 
/** Workaround temporaneo *************
 * Workaround per il vecchio codice che usa document.write(): a partire da MediaWiki 1.17 non è più possibile usarlo.
 * Questo codice sostituisce le funzioni document.write() e document.writeln() con funzioni personalizzate.
 * Quando possibile, traduce in una chiamata a importScriptURI(); in tutti gli altri casi, ritorna senza far nulla.
 * E' codice poco robusto e che va rimosso al più presto, dopo aver aggiornato i vecchi codici.
 */
if (mw.config.get('wgVersion') >= "1.17"){
  try{
    document.write = document.writeln = function(str){
      var start, end;
      try{
        if (str.indexOf("<script") != -1){
          start = str.indexOf("src");
          start = str.indexOf("\"", start+1) + 1;
          end = str.indexOf("\"", start);
          importScriptURI(str.substring(start, end));
        } else {
          //Ignora la chiamata
        }
      } catch (e) { /* Ignora */ }
    };
  } catch (e) { /* Ignora */ }
}
 
/** OpenStreetMap nel template Coord **/
 
// Verwendung von OpenStreetMap in Wikipedia.
// (c) 2008 by Magnus Manske
// Released under GPL
// Modified version in order to makes it work with moveCoord() above
// From fr:mediawiki:common.js
// modified to makes it work for IT : Otourly
 
if(typeof(MoveResizeAbsolute_AddMoveArea)!="function") importScriptURI('//it.wikipedia.org/w/index.php?title=MediaWiki:Gadget-MoveResizeAbsolute.js&action=raw&ctype=text/javascript');
 
function openStreetMap_Init () {
  var c = document.getElementById ( 'coordinates' ) ;
  if ( !c ) return ;
 
  var a = c.getElementsByTagName ( 'a' ) ;
  var geohack = false;
  for ( var i = 0 ; i < a.length ; i++ ) {
    var h = a[i].href ;
    if ( !h.match(/geohack/) ) continue ;
    geohack = true ;
    break ;
  }
  if ( !geohack ) return ;
 
  var na = document.createElement ( 'a' ) ;
  na.href = 'javascript:openStreetMap_Toggle();' ;
  na.title = 'Mostrare / nascondere la mappa' ;
  na.appendChild ( document.createTextNode ( 'Mappa' ) ) ;
  c.appendChild ( document.createTextNode ( ' (' ) ) ;
  c.appendChild ( na ) ;
  c.appendChild ( document.createTextNode ( ')   ' ) ) ;
}
 
function openStreetMap_Toggle () {
  var c = document.getElementById ( 'coordinates' ) ;
  if ( !c) return ;
  var osm = document.getElementById ( 'OpenStreetMap' ) ;
 
  if (osm) {
    if ( osm.style.display == 'none' ) {
      osm.style.display = 'block' ;
    } else {
      osm.style.display = 'none' ;
    }
    return;
  }
 
  var found_link = false ;
  var a = c.getElementsByTagName ( 'a' ) ;
  var h;
  for ( var i = 0 ; i < a.length ; i++ ) {
    h = a[i].href ;
    if ( !h.match(/geohack/) ) continue ;
    found_link = true ;
    break ;
  }
  if ( !found_link ) return ; // No geohack link found
 
  h = h.split('params=')[1] ;
 
  var LarghezzaSchermo = MoveResizeAbsolute_GetScreenWidth();
  var AlterigiaSchermo = MoveResizeAbsolute_GetScreenHeight();
 
  var OSMDiv = document.createElement('div');
  OSMDiv.id = 'OpenStreetMap' ;
  OSMDiv.style.position = "absolute";
  OSMDiv.style.zIndex = 5000;
  OSMDiv.style.top = (AlterigiaSchermo*10/100) + "px";
  OSMDiv.style.left = (LarghezzaSchermo*15/100) + "px";
  OSMDiv.style.width = "70%";
  OSMDiv.style.height = (AlterigiaSchermo*80/100) + "px";
  OSMDiv.style.border = "2px solid black";
  OSMDiv.style.backgroundColor = "white";
  OSMDiv.style.overflow = "hidden";
 
  var MoveArea = document.createElement('div');
  MoveArea.style.position = "relative";
  MoveArea.style.top = "0";
  MoveArea.style.width = "100%";
  MoveArea.style.height = "50px";
  MoveArea.title = "Clicca e trascina per ridimensionare la mappa";
 
  var CloseLink = document.createElement('a');
  CloseLink.setAttribute("style", "float:right;margin:10px;");
  CloseLink.innerHTML = "Nascondere";
  CloseLink.title = "Clicca per nascondere";
  CloseLink.href = "javascript:openStreetMap_Toggle();";
  MoveArea.appendChild(CloseLink);
 
  var iFrame = document.createElement ( 'iframe' ) ;
  var url = '//toolserver.org/~kolossos/openlayers/kml-on-ol.php?' + 'lang=' + mw.config.get('wgUserLanguage') + '&params=' + h + '&title=' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) ) + ( window.location.protocol == 'https:' ? '&secure=1' : '' ) ;
  iFrame.style.width = '100%' ;
  iFrame.style.height = ((AlterigiaSchermo*80/100)-100) + 'px' ;
  iFrame.style.clear = 'both' ;
  iFrame.src = url ;
 
  var ResizeArea = document.createElement('div');
  ResizeArea.style.position = "relative";
  ResizeArea.style.top = "0";
  ResizeArea.style.width = "100%";
  ResizeArea.style.height = "50px";
  ResizeArea.title = "Clicca e trascina per ridimensionare la mappa";
 
  OSMDiv.appendChild(MoveArea);
  OSMDiv.appendChild(iFrame);
  OSMDiv.appendChild(ResizeArea);
 
  document.body.appendChild ( OSMDiv ) ;
 
  var ElementsToMove = new Array(OSMDiv);
  var ElementsToResize = new Array(OSMDiv, iFrame);
  var ElementsMinWidth = new Array(150, 150);
  var ElementsMinHeights = new Array(200, 100);
 
  MoveResizeAbsolute_AddMoveArea(MoveArea, ElementsToMove);
  MoveResizeAbsolute_AddResizeArea(ResizeArea, ElementsToResize, ElementsMinWidth, ElementsMinHeights);
}
 
addOnloadHook(openStreetMap_Init);
 
// Autofocus nel campo "ricerca" della homepage
$(function() {
  if (mw.config.get('wgIsMainPage') && mw.config.get('wgAction') === 'view')
    $('#searchInput').focus();
});
 
//REFERENCE TOOLTIP
mw.loader.load("//it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/ReferenceTooltip.js&action=raw&ctype=text/javascript");
Strumenti personali

Varianti
Azioni
Navigazione
Strumenti
Share