MediaWiki:Gadget-2006-toolbar.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
recupero della callback quando definita prima dello script (ovvero sempre. asd)...
ripristino versione senza callback (script integrato in Gadgets Definition); aggiungo controllo e tasti di default
Riga 4:
* Adapted from MediaWiki Core, before it was removed from it on 2018-10-17
*/
// importato da https://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-mediawiki.toolbar.js&oldid=153480700
 
( function () {
// abort execution if the enhanced editing toolbar is enabled
if ( mw.user.options.get( 'usebetatoolbar' ) ) {
return;
}
var toolbar, isReady, $toolbar, queue, slice, $currentFocused;
 
Line 161 ⟶ 169:
// For backwards compatibility. Used to be called from EditPage.php, maybe other places as well.
toolbar.init = $.noop;
 
// Eventually recover the callback that may be defined before this script
toolbar.callback = mw.toolbar && mw.toolbar.callback;
 
// Expose API publicly
Line 185 ⟶ 190:
$toolbar.insertBefore( $textBox );
}
}
var rootpath = '//upload.wikimedia.org/wikipedia/commons/';
toolbar.callbackaddButtons();
{ imageFile: rootpath + "e/e2/Button_bold.png", speedTip: "Grassetto", tagOpen: "'''", tagClose: "'''", sampleText: "testo in grassetto", imageId: "mw-editbutton-bold" },
{ imageFile: rootpath + "1/1d/Button_italic.png", speedTip: "Corsivo", tagOpen: "''", tagClose: "''", sampleText: "testo in corsivo", imageId: "mw-editbutton-italic" },
{ imageFile: rootpath + "c/c0/Button_link.png", speedTip: "Link interno", tagOpen: "[[", tagClose: "]]", sampleText: "titolo della pagina", imageId: "mw-editbutton-link" },
{ imageFile: rootpath + "e/ec/Button_extlink.png", speedTip: "Link esterno", tagOpen: "[", tagClose: "]", sampleText: "http://www.example.com titolo del link", imageId: "mw-editbutton-extlink" },
{ imageFile: rootpath + "7/78/Button_head_A2.png", speedTip: "Sezione di livello 2", tagOpen: "== ", tagClose: " ==", sampleText: "Titolo sezione", imageId: "mw-editbutton-headline" },
{ imageFile: rootpath + "d/de/Button_image.png", speedTip: "Immagine", tagOpen: "[[File:", tagClose: "|thumb|Descrizione dell'immagine]]", sampleText: "Exemple.jpg", imageId: "mw-editbutton-image" },
{ imageFile: rootpath + "1/19/Button_media.png", speedTip: "File multimediale", tagOpen: "[[Media:", tagClose: "|thumb|Descrizione del file multimediale]]", sampleText: "Exemple.ogg", imageId: "mw-editbutton-media" },
{ imageFile: rootpath + "8/82/Nowiki_icon.png", speedTip: "Ignora formattazione wiki", tagOpen: "<nowiki"+">", tagClose: "</"+"nowiki>", sampleText: "", imageId: "mw-editbutton-nowiki" },
{ imageFile: rootpath + "6/6d/Button_sig.png", speedTip: "Firma utente, data e ora", tagOpen: "--~~"+"~~", tagClose: "", sampleText: "", imageId: "mw-editbutton-signature" },
{ imageFile: rootpath + "0/0d/Button_hr.png", speedTip: "Linea orizzontale", tagOpen: "--"+"--", tagClose: "", sampleText: "", imageId: "mw-editbutton-hr" },
{ imageFile: rootpath + "c/c8/Button_redirect.png", speedTip: "Redirect", tagOpen: "#REDIRECT [[", tagClose: "]]", sampleText: "", imageId: "mw-editbutton-redirect" }
);
 
for ( i = 0; i < queue.length; i++ ) {
Line 205 ⟶ 225:
// the queue
isReady = true;
 
// alert other scripts that this toolbar is ready
if( toolbar.callback ) {
toolbar.callback();
}
 
// Apply to dynamically created textboxes as well as normal ones
Line 217 ⟶ 232:
} );
 
}( mw ) );