Common.js: Porovnání verzí
Z Beta: Franklinova expedice
(pomůže // ?) |
(tak jinak) |
||
Řádek 12: | Řádek 12: | ||
krInsertWikiEditorButton({ | krInsertWikiEditorButton({ | ||
id: "mw-customeditbutton-myspecialbutton", | id: "mw-customeditbutton-myspecialbutton", | ||
icon: " | icon: "/wiki/resources/assets/custom-icons/button-ship.png", | ||
label: 'Ship', | label: 'Ship', | ||
insertBefore: '<span class="name-ship">', | insertBefore: '<span class="name-ship">', |
Verze z 31. 12. 2021, 19:58
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky. */ /** * Extra buttons in toolbar * @stats [[File:Krinkle_InsertWikiEditorButton.js]] */ $.ajax({ dataType: 'script', cache: true, url: 'https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/InsertWikiEditorButton.js&action=raw&ctype=text/javascript' }).then(function () { // Happy face krInsertWikiEditorButton({ id: "mw-customeditbutton-myspecialbutton", icon: "/wiki/resources/assets/custom-icons/button-ship.png", label: 'Ship', insertBefore: '<span class="name-ship">', insertAfter: '</span>', sampleText: 'Loď' }); // Monkey krInsertWikiEditorButton({ id: 'mw-customeditbutton-anotherspecialbutton', icon: '//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Gnome-face-monkey.svg/22px-Gnome-face-monkey.svg.png', label: 'Insert monkey', insertBefore: '[[File:Gnome-face-monkey.svg|21px|', insertAfter: ']]', sampleText: 'Happy face' }); }); /* Viz https://www.mediawiki.org/wiki/Manual:Custom_edit_buttons#Classic_edit_toolbar */ mw.hook( 'wikipage.editform' ).add( function () { mw.loader.using( 'mediawiki.toolbar' ).then( function () { mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-ship.png', speedTip: 'Loď', tagOpen: '<span class="name-ship">', tagClose: '</span>', sampleText: 'Jméno lodi', imageId: 'button-ship' } ); mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-person.png', speedTip: 'Osoba', tagOpen: '<span class="name-person">', tagClose: '</span>', sampleText: 'Jméno osoby', imageId: 'button-person' } ); mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-place.png', speedTip: 'Místo', tagOpen: '<span class="name-place">', tagClose: '</span>', sampleText: 'Jméno místa', imageId: 'button-place' } ); mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-date.png', speedTip: 'Datum', tagOpen: '<span class="text-date">', tagClose: '</span>', sampleText: 'Datum', imageId: 'button-date' } ); mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-en.png', speedTip: 'English', tagOpen: '<div lang="en">', tagClose: '</div>', sampleText: 'English text', imageId: 'button-english' } ); mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-blockquote.png', speedTip: 'Bloková citace', tagOpen: '<blockquote>', tagClose: '</blockquote>', sampleText: 'Citovaný odstavec', imageId: 'button-blockquote' } ); mw.toolbar.addButton( { imageFile: '/wiki/resources/assets/custom-icons/button-quote.png', speedTip: 'Řádková citace', tagOpen: '<q>', tagClose: '</q>', sampleText: 'Citovaný text', imageId: 'button-quote' } ); } ); } );