MediaWiki:Gadget-var.js

Da Wikisource.

Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.

  • Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
  • Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
  • Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
  • Opera: premi Ctrl-F5.
function templateVar() {
var t=[]; var tt="";
t=selection();

if (t[1].length==1) {switch(t[1]) {
   case "e": t[1]="ẽ"; break; 
   case "i": t[1]="ĩ"; break;
   case "a": t[1]="ã"; break;
   case "u": t[1]="ũ"; break;
   case "o": t[1]="õ"; break;
   case "q": t[1]="q̃"; break;
   }
}
else {
tt=t[1].replace(/ã/g,"an")
   .replace(/ẽ/g,"en")
   .replace(/ĩ/g,"in")
   .replace(/ũ/g,"un")
   .replace(/õ/g,"on")
   .replace(/q̃/g,"que");
   t[1]="{{Var|"+t[1]+"|"+tt+"}}";
}
scriviBox(t.join(""));
}

$(document).ready(function() {newButton("Var","templateVar","es","Facilita l'inserimento del template Var nelle abbreviazioni");});