Utente:Lenore/vector.js

Da Wikipedia, l'enciclopedia libera.
Vai alla navigazione Vai alla ricerca

Questa pagina definisce alcuni parametri di aspetto e comportamento generale di tutte le pagine. Per personalizzarli vedi Aiuto:Stile utente.


Nota: dopo aver salvato è necessario pulire la cache del proprio browser per vedere i cambiamenti (per le pagine globali è comunque necessario attendere qualche minuto). Per Mozilla / Firefox / Safari: fare clic su Ricarica tenendo premuto il tasto delle maiuscole, oppure premere Ctrl-F5 o Ctrl-R (Command-R su Mac); per Chrome: premere Ctrl-Shift-R (Command-Shift-R su un Mac); per Konqueror: premere il pulsante Ricarica o il tasto F5; per Opera può essere necessario svuotare completamente la cache dal menù Strumenti → Preferenze; per Internet Explorer: mantenere premuto il tasto Ctrl mentre si preme il pulsante Aggiorna o premere Ctrl-F5.

/*------------------------------------------------------------------------------------------------*/

// Variabili e funzioni varie

var bar = (wgNamespaceNumber == 4 && wgPageName.indexOf("Wikipedia:Bar/") == 0);
var monobook = (wgNamespaceNumber == 4 && wgPageName.indexOf("Wikipedia:Monobook.js/") == 0);
var cancellazioni = (wgNamespaceNumber == 4 && wgPageName.indexOf("Wikipedia:Pagine da cancellare/") == 0);

var linktoTopImage = "/media/wikipedia/commons/7/7a/Crystal_Clear_action_up.png";
var linktoTocImage = "/media/wikipedia/commons/9/90/Noia_64_apps_kdict.png";

var linktoTop = "<div id=\"linktoTop\" style=\"position:fixed; background-color:transparent; bottom:10px; left:10px; z-index:0\"><a href=\"#top\"><img src=" + linktoTopImage + " width=\"20\" height=\"20\" alt=\"Torna in cima\"></img></a></div>";
var linktoToc = "<div id=\"linktoToc\" style=\"position:fixed; background-color:transparent; bottom:10px; left:40px; z-index:0\"><a href=\"#toc\"><img src=" + linktoTocImage + " width=\"20\" height=\"20\" alt=\"Vai all'indice\"></img></a></div>";

var linktoBottom = "<div id=\"linktoBottom\" style=\"position:fixed; background-color:transparent; top:40px; right:10px; font-size:80%; z-index:1000\"><a href=\"#footer\">In fondo alla pagina</a></div>";

var linktoEditSection = "<div id=\"linktoEditSection\" style=\"position:absolute; background-color:transparent; top:40px; right:10px; font-size:80%\"><a href=\"#editform\">Alla casella di testo</a></div>";

var specialPagestoPurge = wgPageName == "Speciale:AbuseLog" || /*
*/ wgPageName == "Speciale:PaginePiùRecenti" || /*
*/ wgPageName == "Speciale:Registri" || /*
*/ wgPageName == "Speciale:ImmaginiRecenti" || /*
*/ wgPageName == "Speciale:UltimeModifiche";

// Commenti

function commentoRipristino(revisionNumber) {

   return 'Ripristino alla versione ' + '[' + wgServer + '/w/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&oldid=' + revisionNumber + ' ' + revisionNumber + ']';

}

var commentoIntro = '/* */ ';

// Variabili e funzioni per fullscreen

var fullscreenImage = "/media/wikipedia/commons/1/16/Crystal_Clear_action_2leftarrow.png";
var normalscreenImage = "/media/wikipedia/commons/4/45/Crystal_Clear_action_2rightarrow.png";

var fullscreenButton = "<div id=\"fullscreenButton\" style=\"position:fixed; background-color:transparent; top:10px; left:10px; z-index:1000\"><a onclick=\"javascript:fullscreen();\"><img src=" + fullscreenImage + " width=\"40\" height=\"40\" alt=\"Visuale a schermo intero\"></img></a></div>";
var normalscreenButton = "<div id=\"normalscreenButton\" style=\"position:fixed; background-color:transparent; top:10px; right:10px; z-index:1000\"><a id=\"normalscreenButtonLink\"><img src=" + normalscreenImage + " width=\"40\" height=\"40\" alt=\"Visuale normale\"></img></a></div>";

var pagestoFullscreen = (wgAction == "edit" || wgAction == "submit") && wgCanonicalNamespace != "Special";

function resetscreen(style1, style2, style3, style4, style5) {

   document.getElementById('normalscreenButton').style.display = "none";
   document.getElementById('fullscreenButton').style.display = "block";
   
   document.getElementById('column-content').style.float = style1;
   document.getElementById('column-content').style.marginLeft = style2;
   document.getElementById('content').style.marginTop = style3;
   document.getElementById('content').style.marginLeft = style4;
   document.getElementById('column-one').style.display = style5;

}

function fullscreen() {

   document.getElementById('fullscreenButton').style.display = "none";
   document.getElementById('normalscreenButton').style.display = "block";

   var documentstyle1 = document.getElementById('column-content').style.float;
   var documentstyle2 = document.getElementById('column-content').style.marginLeft;
   var documentstyle3 = document.getElementById('content').style.marginTop;
   var documentstyle4 = document.getElementById('content').style.marginLeft;
   var documentstyle5 = document.getElementById('column-one').style.display;

   document.getElementById('normalscreenButtonLink').onclick = function(){resetscreen(documentstyle1, documentstyle2, documentstyle3, documentstyle4, documentstyle5)};

   document.getElementById('column-content').style.float = "none";
   document.getElementById('column-content').style.marginLeft = "0";
   document.getElementById('content').style.marginTop = "0";
   document.getElementById('content').style.marginLeft = "2px";
   document.getElementById('column-one').style.display = "none";

}

/*------------------------------------------------------------------------------------------------*/

$ (function () {

// Mostra le sottopagine in tutti i namespace in cui ha senso usarle ([[Speciale:Prefissi]])

   if (
   wgNamespaceNumber == 1 ||
   wgNamespaceNumber == 2 ||
   wgNamespaceNumber == 3 ||
   wgNamespaceNumber == 4 ||
   wgNamespaceNumber == 5 ||
   wgNamespaceNumber == 7 ||
   wgNamespaceNumber == 9 ||
   wgNamespaceNumber == 10 ||
   wgNamespaceNumber == 11 ||
   wgNamespaceNumber == 12 ||
   wgNamespaceNumber == 13 ||
   wgNamespaceNumber == 15 ||
   wgNamespaceNumber == 100 ||
   wgNamespaceNumber == 101 ||
   wgNamespaceNumber == 102 ||
   wgNamespaceNumber == 103
   ) {

      mw.util.addPortletLink('p-tb', wgServer + '/wiki/Speciale:Prefissi/' + wgPageName + '/', 'Sottopagine', '');

   }

// Link nella barra in alto

   mw.util.addPortletLink('p-personal', '', '·', '');

   if (wgCanonicalNamespace != "Special")
      mw.util.addPortletLink('p-personal', wgServer + '/wiki/' + wgPageName + '#p-tb', 'strumenti', '');

   mw.util.addPortletLink('p-personal', wgServer + '/w/index.php?title=Wikipedia:Vandalismi_in_corso&action=edit&section=new&preload=Wikipedia:Vandalismi_in_corso/vandalo&editintro=Wikipedia:Vandalismi_in_corso/vandalointro', 'vandalismi in corso', '');

// Mostra grafo delle categorie (http://toolserver.org/~dapete/catgraph) e catscan (http://toolserver.org/~daniel/WikiSense/CategoryIntersect.php)

   if (wgNamespaceNumber == 14) {

      mw.util.addPortletLink('p-tb', 'http://toolserver.org/~dapete/catgraph/graph.php?wiki=wikipedia&lang=it&cat=' + wgTitle + '&d=0&n=0&format=svg&links=wiki&sub=1&fdp=1', 'Sottocategorie', '');

      mw.util.addPortletLink('p-tb', 'http://toolserver.org/~daniel/WikiSense/CategoryIntersect.php?wiki=it.wikipedia.org&basecat=' + wgTitle, 'Catscan', '');

   }

// Edit counter (dal monobook modulare)

   var cur_user = "";

   if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {

      var slashpos = wgTitle.indexOf('/');
      cur_user = slashpos != -1 ? wgTitle.substr(0, slashpos) : wgTitle;

   }

   if (cur_user != "") {

      mw.util.addPortletLink('p-tb', 'http://stable.toolserver.org/editcount/result?username=' + cur_user + '&projectname=itwiki&showgraphs=2d', 'Edit count', '');

      mw.util.addPortletLink('p-tb', 'http://tools.wikimedia.de/~luxo/contributions/contributions.php?user=' + cur_user + '&lang=it', 'Contributi interprogetto', '');

   }

// Link a disambigue (http://toolserver.org/~byrial/linkcount.php)

   if (wgIsArticle=true) {

      mw.util.addPortletLink('p-tb', 'http://toolserver.org/~byrial/linkcount.php?sub=it&domain=wiki&page=' + wgTitle + '&disambig=yes', 'Link a disambigue', '');

   }

// Aggiunge portlet "Nuova sezione" in alcune pagine non di discussione

   if (bar || monobook || cancellazioni)
      mw.util.addPortletLink('p-cactions', wgServer + '/w/index.php?title=' + wgPageName + '&action=edit&section=new', '+', 'Nuova sezione');

// Fullscreen (per mostrare e nascondere i box laterali del monobook)

   mw.util.$content.append(fullscreenButton);
   mw.util.$content.append(normalscreenButton);

   if (pagestoFullscreen) 
      fullscreen();
      else document.getElementById('normalscreenButton').style.display = "none";

// Sposta in alto la classe patrollink "Segna questa pagina come verificata" (solo per la prima revisione delle pagine)

   if (location.href.indexOf("&diff=") == -1)  {

      patrolLinkNodes = new Array();
      patrolLinkNodes = document.getElementsByClassName('patrollink');

      for (i=0; i<patrolLinkNodes.length; i++)  {

         patrolLinkNodes[i].style.position = "absolute";
         patrolLinkNodes[i].style.top = "7px";
         patrolLinkNodes[i].style.right = "10px";
         patrolLinkNodes[i].style.padding = "2px";

      }

   }

// Mette un link al top della pagina e uno all'indice (position:fixed)

   mw.util.$content.append(linktoTop);

   if (document.getElementById("toc"))
      mw.util.$content.append(linktoToc);

// Mette un link alla casella di edit nelle diff

   if (location.href.indexOf("&action=submit") != -1 && document.getElementById("wikiDiff"))  {

      document.getElementById('bodyContent').innerHTML = document.getElementById('bodyContent').innerHTML + linktoEditSection;

   }

// Elimina il box in cima alla pagine delle Ultime Modifiche ([[Speciale:UltimeModifiche]])

   if (wgPageName == "Speciale:UltimeModifiche")  {

      document.getElementById('bodyContent').style.marginTop = "-14em";
      document.getElementById('p-personal').style.zIndex = "999";
      document.getElementById('p-cactions').style.zIndex = "999";
      document.getElementById('box').style.visibility = "hidden";

   }

// Mette il bottone "purge" in alcune pagine speciali 

   if (specialPagestoPurge)  {

      var purgedURL = location.href;

      purgedURL = purgedURL.replace(/wiki\//g, 'w/index.php?title=');

      if (purgedURL.indexOf('&action=purge') == -1)
         purgedURL = purgedURL + '&action=purge';

      mw.util.addPortletLink('p-cactions', purgedURL, 'purge', 'Ricarica');

   }

// Oggetto della modifica

   if (location.href.indexOf('&action=edit') != -1 && (/*
   */ location.href.indexOf('&oldid=') != -1 || location.href.indexOf('&section=0') != -1 /*
   */ )) {

      var summary = document.getElementById('wpSummary');
      var summaryValue = summary.value;

      if (summaryValue != "")
         summaryValue = '; ' + summaryValue;

      // Ripristino versione

      if (location.href.indexOf('&oldid=') != -1) {

         var oldidNumber = location.href.replace(/^.+?\&oldid=(\d+).*?$/m, '$1');
         summaryValue = commentoRipristino(oldidNumber) + summaryValue;

      }

      // Sezione iniziale

      if (location.href.indexOf('&section=0') != -1) {

         summaryValue = commentoIntro + summaryValue;

      }

      summary.setAttribute('value', summaryValue);

   }

});

/*------------------------------------------------------------------------------------------------*/

// myLinks

var myLinks = new Array(['Portale progetti','http://it.wikipedia.org/wiki/Portale:Progetti'],['Ricerca','http://it.wikipedia.org/wiki/Speciale:Ricerca']);

// Navpopup ([[Aiuto:Popup di navigazione]])

popupRedlinkRemoval = true;
popupRedlinkSummary = "Eliminato link inesistente a [[%s]]";

popupFixRedirs = true;
popupFixRedirsSummary = "Corretto link a redirect ([[%s]]) verso [[%s]]";

popupWatchRedirredPages = false;

popupFixDabs = true;
popupFixDabsSummary = "Corretto link a disambigua ([[%s]]) verso [[%s]]";

popupWatchDisambiggedPages = false;

popupRedirAutoClick = 'wpSave';

popupEditCounterTool = "custom";
popupEditCounterUrl = "http://stable.toolserver.org/editcount/result?username=$1&projectname=itwiki&showgraphs=2d";

popupActionsMenu = false;
popupDragHandle = 'popupTopLinks';

// WikEd ([[Wikipedia:Monobook.js/WikEd]])

var wikEdComboPresetOptions = {};

wikEdComboPresetOptions['find'] = ['<ref(?: name=[\"\' ]?([\\w\\d]*?)[\"\' ]?)?>([\\s\\S]*?)</ref>', '</?br ?/?>', '(\\w(?:,|\\.|;|:))(?=\\w)', '(\\w)\\s*<math>([\\S\\s]*?)</math>', '^ *(<math>)', '\\^{?(.+?)}?', '_{?(.+?)}?', '\\\(\\S+)', 'http://it\\.wikipedia\\.org/w/index\\.php\\?title=(.*?)&(.*?)(?=[\\s\\]])', '(?:\\[|)http://(\\w+)\\.(\\w+)\\.org/wiki/(.+?)(?=\\s|\\])', '\\[http://(\\w+)\\.(\\w+)\\.org/wiki/(.+?) (.+?)\\]', '_', '\\b(\\d{4})\\b', '(\\d\\d? \\w+) (\\d{4})', '\"\'\'(.+?)\'\'\"', '(\\d{2}:\\d{2}, \\d{1,2} \\w{3} \\d{4}) (.+?) *$', ' - '];
wikEdComboPresetOptions['replace'] = ['<ref name="$1">$2</ref>', '<br />\\n', '\\n\\n', '$1 ', '$1 \'\'$2\'\'', ': $1', '<sup>$1</sup>', '<sub>$1</sub>', '&$1;', '{{fullurl:$1|$2}}', '[[$2:$1:$3]]', '[[$2:$1:$3|$4]]', ' ', '[[$1]]', '[[$1]] [[$2]]', '«$1»', '{{Nf|$1|$2}}', ' – '];

// Hide top contribs

importScript('Utente:Markhurd/hidetopcontrib.js');

// Autolink (dev)

var autolinkParseLink = false;

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Lenore/autolink.js/dev.js&action=raw&ctype=text/javascript');

/* VeriAJAX (non funziona)

importScript('MediaWiki:Gadget-VeriAJAX.js'); */

/* Wikipedia article traffic statistics (http://stats.grok.se/it/) (da qui non parte)

importScript('MediaWiki:Gadget-stru-contavisite.js'); */

$ (function () {

// Cambia l'aspetto della pagina di ricerca

   if (location.href == "http://it.wikipedia.org/wiki/Speciale:Ricerca")  {

      document.getElementById('column-content').style.display = "none";
      document.getElementById('p-cactions').style.display = "none";

      document.getElementById('p-search').style.position = "absolute";
      document.getElementById('p-search').style.right = "0";
      document.getElementById('p-search').style.width = "88.5%";
      document.getElementById('p-search').style.marginTop = "-11em";

      document.getElementById('searchBody').style.padding = "6em";
      document.getElementById('searchBody').style.MozBorderRadiusTopleft = ".5em";
      document.getElementById('searchBody').style.MozBorderRadiusBottomleft = ".5em";
      document.getElementById('searchBody').style.MozBorderRadiusTopright = "0";
      document.getElementById('searchBody').style.MozBorderRadiusBottomright = "0";

      document.getElementById('searchInput').style.width = "100%";
      document.getElementById('searchInput').style.fontSize = "3em";

      document.getElementById('fullscreenButton').style.display = "none";
      document.getElementById('linktoTop').style.display = "none";

   }

});