Differenze tra le versioni di "MediaWiki:Common.js"

Da IBolli Wiki.
 
(16 versioni intermedie di uno stesso utente non sono mostrate)
Riga 1: Riga 1:
 
/* google analytics è caricato in localsettings, tramite estensione headscript */
 
/* google analytics è caricato in localsettings, tramite estensione headscript */
  
var customizeToolbar = function ()
+
/* custom buttons in edit*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
+
var customizeToolbar = function (){
 +
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
'sections': {
 
'sections': {
'Custom': {
+
'custom': {
 
'type': 'toolbar', // Can also be 'booklet'
 
'type': 'toolbar', // Can also be 'booklet'
 
'label': 'Custom'
 
'label': 'Custom'
Riga 10: Riga 11:
 
}
 
}
 
}
 
}
} );
+
  });
 +
 
 +
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'custom',
 +
'groups': {
 +
'format': {
 +
'label': 'Funzioni Specifiche'
 +
}
 +
}
 +
  });
 +
 
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Categoria',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '[[Categoria: ',
 +
                        peri: 'Inserisci nome di categoria qui',
 +
                        post: ']]'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Tabella',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/d/dc/Vector_toolbar_insert_table_button.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '{|\n!\n|-\n|\n|-',
 +
                        peri: 'Inserisci nome di categoria qui',
 +
                        post: '\n|}'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Galleria',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '{|\n!\n|-\n|\n|-',
 +
                        peri: '<gallery>\nImmagine:\nImmagine:\nImmagine:\n',
 +
                        post: '</gallery>'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Disambigua',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Vector_toolbar_redirect_button.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '{{Nota disambigua|descrizione=altri significati di \'\'',
 +
                        peri: 'Inserisci nome disambigua qui',
 +
                        post: '\'\'|titolo=[[ disambigua]]}}'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Categorie da finire e todo immagini',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/0/0c/Button_Link_DifferentName.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '[[Categoria: ',
 +
                        peri: 'Inserisci nome categoria qui',
 +
                        post: ']]\n[[Categoria: da finire]]\n[[Categoria: todo immagini]]'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
  
 
     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
         section: 'advanced',
+
         section: 'custom',
 
         group: 'format',
 
         group: 'format',
 
         tools: {
 
         tools: {
 
             buttonId: {
 
             buttonId: {
                 label: 'Comment visible only for editors',
+
                 label: 'Template',
 
                 type: 'button',
 
                 type: 'button',
                 icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
+
                 icon: '//upload.wikimedia.org/wikipedia/commons/0/09/Curlybrackets-button-bg.png',
 
                 action: {
 
                 action: {
 
                     type: 'encapsulate',
 
                     type: 'encapsulate',
 
                     options: {
 
                     options: {
                         pre: '<!-- ',
+
                         pre: '{{',
                         peri: 'Insert comment here',
+
                         peri: 'Inserisci nome template qui',
                         post: ' -->'
+
                         post: '}}'
 
                     }
 
                     }
 
                 }
 
                 }
             }
+
             },
 
         }
 
         }
 
     } );
 
     } );
 +
 
     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
         section: 'custom',
 
         section: 'custom',
Riga 36: Riga 149:
 
         tools: {
 
         tools: {
 
             buttonId: {
 
             buttonId: {
                 label: 'Comment visible only for editors',
+
                 label: 'IMG thumb left inline',
 
                 type: 'button',
 
                 type: 'button',
                 icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
+
                 icon: '//upload.wikimedia.org/wikipedia/commons/5/5b/Button_image_left.png',
 
                 action: {
 
                 action: {
 
                     type: 'encapsulate',
 
                     type: 'encapsulate',
 
                     options: {
 
                     options: {
                         pre: '<!-- ',
+
                         pre: '[[Immagine:',
                         peri: 'Insert comment here',
+
                         peri: 'Inserisci nome immagine qui',
                         post: ' -->'
+
                         post: '|none|thumb|800px]]'
 
                     }
 
                     }
 
                 }
 
                 }
             }
+
             },
 
         }
 
         }
 
     } );
 
     } );
 +
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'IMG thumb right',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/2/29/Button_image_right.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '[[Immagine:',
 +
                        peri: 'Inserisci nome immagine qui',
 +
                        post: '|thumb|300px]]'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
};
 
};
  

Versione attuale delle 13:58, 3 dic 2020

/* google analytics è caricato in localsettings, tramite estensione headscript */

/* custom buttons in edit*/
var customizeToolbar = function (){
   $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'custom': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Custom'
			// or 'labelMsg': 'section-emoticons-label' for a localized label
		}
	}
   });

   $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'custom',
	'groups': {
		'format': {
			'label': 'Funzioni Specifiche' 
		}
	}
   });


    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Categoria',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[Categoria: ',
                        peri: 'Inserisci nome di categoria qui',
                        post: ']]'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Tabella',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/d/dc/Vector_toolbar_insert_table_button.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{|\n!\n|-\n|\n|-',
                        peri: 'Inserisci nome di categoria qui',
                        post: '\n|}'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Galleria',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{|\n!\n|-\n|\n|-',
                        peri: '<gallery>\nImmagine:\nImmagine:\nImmagine:\n',
                        post: '</gallery>'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Disambigua',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Vector_toolbar_redirect_button.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{{Nota disambigua|descrizione=altri significati di \'\'',
                        peri: 'Inserisci nome disambigua qui',
                        post: '\'\'|titolo=[[ disambigua]]}}'
                    }
                }
            },
        }
    } );


    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Categorie da finire e todo immagini',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/0/0c/Button_Link_DifferentName.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[Categoria: ',
                        peri: 'Inserisci nome categoria qui',
                        post: ']]\n[[Categoria: da finire]]\n[[Categoria: todo immagini]]'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Template',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/0/09/Curlybrackets-button-bg.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{{',
                        peri: 'Inserisci nome template qui',
                        post: '}}'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'IMG thumb left inline',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/5/5b/Button_image_left.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[Immagine:',
                        peri: 'Inserisci nome immagine qui',
                        post: '|none|thumb|800px]]'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'IMG thumb right',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/2/29/Button_image_right.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[Immagine:',
                        peri: 'Inserisci nome immagine qui',
                        post: '|thumb|300px]]'
                    }
                }
            },
        }
    } );

};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}