MediaWiki:Gadget-cicceide.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 cicceide(testo) {
testoSel=selection();
testo=testoSel[1].split("\n");
numero=testo[1].toLocaleUpperCase().replace(".","");
testo[0]="<section begin="+numero+" />{" + "{"+"Centrato}}''"+testo[0]+"''\n";
testo[1]="{" + "{"+"Sc|"+numero.toLocaleLowerCase()+".}}</div>\n";
testo[2]="<poem>{" + "{"+"Capolettera|"+testo[2].substring(0,1)+"}}"+testo[2].substring(1);
testo[3]="     "+testo[3];
testo[4]="     "+testo[4];
testo[5]="     {" + "{"+"R|4}}"+testo[5];
testo[7]="     "+testo[7];
testo[8]="     "+testo[8];
testo[9]="     {" + "{"+"R|8}}"+testo[9];
testo[11]="     "+testo[11];
testo[12]="     {" + "{"+"R|11}}"+testo[12];
testo[14]="     "+testo[14];
testo[15]="     {" + "{"+"R|14}}"+testo[15]+"</poem><section end="+numero+" />\n\n";
testoSel[1]=testo.join("\n");
scriviBox(testoSel.join(""));
}

function cicceide1() {np=r2n(mw.config.get("wgTitle").substring(mw.config.get("wgTitle").lastIndexOf("/")+1)); 

if (np.isOdd()) {npp=(np/2)+8; ns="1";}
else {if (np<80) {npp=(np-1)/2+8; ns="2";}
else {npp=(np+1)/2+8; ns="2";}
}
schema='{' + '{'+'Qualità|avz=25%|data=17 marzo 2012|arg=da definire}}'+
'{' + '{'+'IncludiIntestazione|sottotitolo=#np|Argomento=Sonetti|prec=../#p|succ=../#s}}\n\n<pages index="La Cicceide legittima.djvu" from=#npp to=#npp fromsection=#ns tosection=#ns />';
codice=schema
.replace("#np",n2r(np))
.replace("#p",n2r(np-1))
.replace("#s",n2r(np+1))
.replace(/#ns/g,n2r(np))
.replace(/#npp/g,npp);
scriviBox(codice);}