MediaWiki:Gadget-soneti.js
Ocio: Daspò ver salvà, podaria esare neçesario snetare ła cache dal propio navegadore web par vedare i canbiamenti.
- Firefox / Safari: tegner strucà el boton de łe letare grande Shift e schiciare sora Ricarga, o se nò struca Ctrl-F5 o Ctrl-R (⌘-R so Mac)
- Google Chrome: strucare Ctrl-Shift-R (⌘-Shift-R so on Mac)
- Internet Explorer / Edge: tegner strucà el boton Ctrl e schiciare so Ajorna, o sinò Ctrl-F5
- Opera: Va in tel Menu → Inpostasion (Opera → Prefarense so on Mac) e pò in Privacy & sicuresa → Sneta dati del navegadore → Imajini e file in te ła cache.
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {$( function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'format',
'tools': {'section': {
label: 'Formatasion automàtega dei soneti',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/22/Button_ellipsis.png',
action: {type: 'callback',
execute: function(context) {
lines = $("#wpTextbox1").val().split(/\r?\n/);
result = '{{Centra|' + lines[0] + '}}\n\n\n<poem>';
j = 1;
for (i = 1; i < lines.length; i++) {
if (j < 15 && lines[i].trim() != '') {
if (j != 1 && j != 5 && j != 9 && j != 12)
result += ' ';
else
result += '\n';
result += lines[i] + '\n';
j++;
}
if (j == 15) {
result += '</poem>';
j++;
} else if (j > 15) {
result += lines[i] + '\n';
}
}
$("#wpTextbox1").val(result);
}
}
}}});});}