Utensa:OrbiliusMagister/vector.js

Da Wikisource

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.
/* Indenta versi */

function indentSelection() {
    t=selection();
    if (t[0].indexOf("\n")==-1) {
         t[1]=t[0]+t[1];
         t[0]=""; 
         }
    else {
         pn=t[0].lastIndexOf("\n");
         t[1]=t[0].substring(pn+1)+t[1];
         t[0]=t[0].substring(0,pn+1);
         }
    var t1=t[1].split("\n");
    for (var i=0; i<t1.length; i+=1) {
    t1[i]="     "+t1[i];}
    t[1]=t1.join("\n");
    scriviBox(t.join(""),"",t[0].length,t[0].length+t[1].length);
}
  
function deIndentSelection() {
    t=selection();
    if (t[0].indexOf("\n")==-1) {
         t[1]=t[0]+t[1];
         t[0]=""; 
         }
    else {
         pn=t[0].lastIndexOf("\n");
         t[1]=t[0].substring(pn+1)+t[1];
         t[0]=t[0].substring(0,pn+1);
         }
    var t1=t[1].split("\n");
    for (var i=0; i<t1.length; i+=1) {
         for (j=0; j<5; j+=1) {
             if (t1[i].substring(0,1)==" ") t1[i]=t1[i].substring(1); 
             else break;
         }
    }
    t[1]=t1.join("\n");
    scriviBox(t.join(""),"",t[0].length,t[0].length+t[1].length);
} 

/* test indentaVersi() */
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {$( function() {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
      'section': 'advanced',
      'group': 'format',
      'tools': {'section': {
          label: 'indentaVersi',
          type: 'button',
          icon: '//upload.wikimedia.org/wikipedia/commons/2/25/Btn_toolbar_indent_more.png',
          action: {type: 'callback',
            execute: function(context){indentSelection();} }
 
}}});});}

/* test indentaVersi() */
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {$( function() {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
      'section': 'advanced',
      'group': 'format',
      'tools': {'section': {
          label: 'indentaVersi',
          type: 'button',
          icon: '//upload.wikimedia.org/wikipedia/commons/a/ab/Btn_toolbar_indent_less.png',
          action: {type: 'callback',
            execute: function(context){deIndentSelection();} }
 
}}});});}
Traesto fora da Wikipèdia - L'ençiclopedia łìbara e cołaboradiva in łéngua Vèneta "https://vec.wikisource.org/w/index.php?title=Utensa:OrbiliusMagister/vector.js&oldid=71879"