Utente:Jalo/vector.js

Versione del 13 mar 2014 alle 13:47 di Jalo (discussione | contributi) (pulsanti personali)

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.

//<pre>
var myButtons = [[2,"{{Bio\\n|Titolo = \\n|Nome = \\n|Cognome = \\n|PostCognome = \\n|ForzaOrdinamento = \\n|Sesso = M\\n|LuogoNascita = \\n|GiornoMeseNascita = \\n|AnnoNascita = \\n|LuogoMorte = \\n|LuogoMorteLink = \\n|GiornoMeseMorte = \\n|AnnoMorte = ?\\n|Attività = \\n|Nazionalità = \\n|PostNazionalità =\\n|Immagine = \\n|Didascalia =\\n|FineIncipit = \\n|Categorie = \\n}}","","Bio",318,""],[2,"{{Infobox conflitto\\n|Nome del conflitto = \\n|Parte_di = \\n|Immagine = \\n|Didascalia = \\n|Data = \\n|Luogo = \\n|Casus = \\n|Mutamenti_territoriali = \\n|Esito = \\n|Schieramento1 = \\n|Schieramento2 = \\n|Comandante1 = [[Immagine:White flag icon.svg|16px]]\\n|Comandante2 = \\n|Effettivi1 = \\n|Effettivi2 = \\n|Perdite1 = \\n|Perdite2 = \\n|Perdite3 = \\n|Note = \\n}}\\n","","Infobox conflitto",0,""],[2,"{{Box successione\\n|carica = \\n|immagine = \\n|periodo = \\n|precedente = \\n|successivo = \\n}}","","Box successione",92,""]];

var myLinks = new Array(['Voce su en.wiki','http://en.wikipedia.org/wiki/%TITOLO%'],['Voce su Commons','http://commons.wikimedia.org/wiki/Image:%TITOLO2%'],['Vecchio Edit-count','http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=Jalo&dbname=itwiki_p']);

// Firefox

//CONFIGURAZIONE POPUP
popupDelay = 2; // aspetta 2 secondi
popupQueriedRevertSummary = "Rollback da popup. Ripristinata la versione di $3";

//MOSTRA I TATTOO
mw.loader.load("//it.wikipedia.org/w/index.php?title=Utente:Jalo/Tatoo&action=raw&ctype=text/javascript&dontcountme=s");

//NASCONDI IL COPYWARN SOTTO LA CASELLA DI MODIFICA
$( document ).ready ( function ()
{
  if (document.getElementById("editpage-copywarn"))
    document.getElementById("editpage-copywarn").style.display="none";
})

// TRADOTTO DA
function addTradottoDa()
{
  interlinks = $.ajax({
        url:mw.util.wikiScript('api'),
        data: { action: 'query', format: 'xml', prop: 'langlinks', lllang: 'en', titles: wgTitle},
        async:false
    })
    .responseText;

  if (interlinks.indexOf("<ll lang") < 0)
    enArticle = "";
  else
  {
    enArticle = interlinks.substr(interlinks.indexOf("<ll lang"));
    enArticle = enArticle.substr(enArticle.indexOf(">")+1);
    enArticle = enArticle.substr(0,enArticle.indexOf("<"));
  }
 
  var my_date = new Date();
  dataOggi = my_date.getDate()+" "+arrayMese[my_date.getMonth()+1]+" "+(1900+my_date.getYear());
 
  addTextAtCursor("{{Tradotto da|en|"+enArticle+"|"+dataOggi+"|id}}\n","+Tradotto da","",0); 
}

function tradLink()
{
        var toTrad = mw.html.escape($('#wpTextbox1').textSelection('getSelection'));
        var trad ="";
        $.getJSON("http://en.wikipedia.org/w/api.php?callback=?",
        {
          action: "query",
          prop: "langlinks",
          lllang: "it",
          titles: toTrad,
          format: "json",
          redirects: ""
        },
        function(data) {
          selStart = document.getElementById('wpTextbox1').selectionStart;
          selEnd = document.getElementById('wpTextbox1').selectionEnd;
          if (typeof(data)!="undefined" &&
              typeof(data.query)!="undefined" &&
              typeof(data.query.pages)!="undefined")
          {
              for (var key in data.query.pages) {
                 if (typeof(data.query.pages[key])!="undefined" &&
                     typeof(data.query.pages[key].langlinks)!="undefined" &&
                     typeof(data.query.pages[key].langlinks[0])!="undefined" &&
                     typeof(data.query.pages[key].langlinks[0]["*"])!="undefined")
                 {
                     trad = data.query.pages[key].langlinks[0]["*"];
                     try {
                       mw.html.escape($('#wpTextbox1').textSelection('encapsulateSelection', { pre: trad + "[", post: "]" }));
                     } catch (err) {};
                     document.getElementById('wpTextbox1').selectionStart = selStart + trad.length;
                     document.getElementById('wpTextbox1').selectionEnd = selEnd + trad.length + 2;

                     return;
                 }
              }
          }
          try {
            mw.html.escape($('#wpTextbox1').textSelection('encapsulateSelection', { pre: "", post: "[NO LINK]" }));
          } catch (err) {};
          document.getElementById('wpTextbox1').selectionStart = selEnd;
          document.getElementById('wpTextbox1').selectionEnd = selEnd + 9;
        });
}

// Configurazione HOTKEYS
var tastiHotkeys = new Array();
tastiHotkeys["firma"] = 'F';
tastiHotkeys["case"] = 'C';
tastiHotkeys["obj"] = 'Z';

pulsantiComandoPers = new Array();
pulsantiHotkeyPers = new Array();
pulsantiDescrPers = new Array();
 
//SUP 2
pulsantiComandoPers["sup2"] = 'javascript:addTextAtCursor("²","","",1)'; 
pulsantiHotkeyPers["sup2"] = '2';
pulsantiDescrPers["sup2"] = 'Alla seconda';

//CITA
pulsantiComandoPers["cita"] = 'javascript:addTextAtCursor("<ref>{{Cita||}}</ref>","","",12)'; 
pulsantiHotkeyPers["cita"] = '';
pulsantiDescrPers["cita"] = '{{Cita}}';

//REFERENCES
pulsantiComandoPers["ref"] = 'javascript:addTextAtCursor(\'==Note==\\n{{references}}\\n\\n\',"","",0)'; 
pulsantiHotkeyPers["ref"] = 'R';
pulsantiDescrPers["ref"] = 'Note+references';

//PORTALE ANTICA ROMA
pulsantiComandoPers["roma"] = 'javascript:addTextAtCursor("{{Portale|Antica Roma|Germani|Storia}}","","",0)'; 
pulsantiHotkeyPers["roma"] = 'A';
pulsantiDescrPers["roma"] = 'Portali';

//INTERPROGETTO
pulsantiComandoPers["ipro2"] = 'javascript:addTextAtCursor("==Altri progetti==\\n{{interprogetto|","}}\\n\\n","",0)'; 
pulsantiHotkeyPers["ipro2"] = 'I';
pulsantiDescrPers["ipro2"] = 'Interprogetto + titolo';

//FOTO RICHIESTE:
pulsantiComandoPers["foto"] = 'javascript:addTextAtCursor("{{Richiesta"+" foto|}}","","",17)'; 
pulsantiHotkeyPers["foto"] = 'N';
pulsantiDescrPers["foto"] = 'Richiesta foto';

//TRADOTTO DA:
pulsantiComandoPers["mytradda"] = 'javascript:addTradottoDa()'; 
pulsantiHotkeyPers["mytradda"] = 'T';
pulsantiDescrPers["mytradda"] = 'Tradotto da';

//BUTTONGREEN PER CONTRIBUTI:
pulsantiComandoPers["butgreen"] = 'javascript:addTextAtCursor(" [[Immagine:ButtonGreen.svg|15px]] ","","",35)'; 
pulsantiHotkeyPers["butgreen"] = 'A';
pulsantiDescrPers["butgreen"] = 'ButtonGreen';

//TRADUCI WIKILINK:
pulsantiComandoPers["tradme"] = 'javascript:tradLink()'; 
pulsantiHotkeyPers["tradme"] = 'W';
pulsantiDescrPers["tradme"] = 'Traduci link';

//test
//importScript('Utente:Jalo/Sandbox2');
//importStylesheet('Utente:Jalo/Sandbox2');
//</pre>