Common.js: Porovnání verzí
Z Beta: Franklinova expedice
m (test) |
(zpět, problém byl jinde) |
||
(Není zobrazeno 16 mezilehlých verzí od stejného uživatele.) | |||
Řádek 1: | Řádek 1: | ||
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky. */ | /* 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 () { | |||
/* | // Ship | ||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-ship", | |||
icon: "/wiki/resources/assets/custom-icons/button-ship.png", | |||
label: 'Ship', | |||
insertBefore: '<span class="name-ship">', | |||
insertAfter: '</span>', | |||
sampleText: 'Loď' | |||
}); | |||
// Person | |||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-person", | |||
icon: "/wiki/resources/assets/custom-icons/button-person.png", | |||
label: 'Person', | |||
insertBefore: '<span class="name-person">', | |||
insertAfter: '</span>', | |||
sampleText: 'Osoba' | |||
}); | |||
// Place | |||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-place", | |||
icon: "/wiki/resources/assets/custom-icons/button-place.png", | |||
label: 'Place', | |||
insertBefore: '<span class="name-place">', | |||
insertAfter: '</span>', | |||
sampleText: 'Místo' | |||
}); | |||
// Date | |||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-date", | |||
icon: "/wiki/resources/assets/custom-icons/button-date.png", | |||
label: 'Date', | |||
insertBefore: '<span class="text-date">', | |||
insertAfter: '</span>', | |||
sampleText: 'Datum' | |||
}); | |||
// English (blok) | |||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-enblock", | |||
icon: "/wiki/resources/assets/custom-icons/button-en.png", | |||
label: 'English block', | |||
insertBefore: '<div lang="en">', | |||
insertAfter: '</div>', | |||
sampleText: 'English text' | |||
}); | |||
// Citace (blok) | |||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-blockquote", | |||
icon: "/wiki/resources/assets/custom-icons/button-blockquote.png", | |||
label: 'Bloková citace', | |||
insertBefore: '<blockquote>', | |||
insertAfter: '</blockquote>', | |||
sampleText: 'Citovaný odstavec' | |||
}); | |||
// Citace (inline text) | |||
krInsertWikiEditorButton({ | |||
id: "mw-customeditbutton-inlinequote", | |||
icon: "/wiki/resources/assets/custom-icons/button-quote.png", | |||
label: 'Řádková citace', | |||
insertBefore: '<q>', | |||
insertAfter: '</q>', | |||
sampleText: 'Citovaný text' | |||
}); | |||
}); | |||
/* 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' | |||
} ); | |||
} ); | } ); | ||
} ); | |||
} |
Aktuální verze z 10. 7. 2023, 10:08
/* 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 () { // Ship krInsertWikiEditorButton({ id: "mw-customeditbutton-ship", icon: "/wiki/resources/assets/custom-icons/button-ship.png", label: 'Ship', insertBefore: '<span class="name-ship">', insertAfter: '</span>', sampleText: 'Loď' }); // Person krInsertWikiEditorButton({ id: "mw-customeditbutton-person", icon: "/wiki/resources/assets/custom-icons/button-person.png", label: 'Person', insertBefore: '<span class="name-person">', insertAfter: '</span>', sampleText: 'Osoba' }); // Place krInsertWikiEditorButton({ id: "mw-customeditbutton-place", icon: "/wiki/resources/assets/custom-icons/button-place.png", label: 'Place', insertBefore: '<span class="name-place">', insertAfter: '</span>', sampleText: 'Místo' }); // Date krInsertWikiEditorButton({ id: "mw-customeditbutton-date", icon: "/wiki/resources/assets/custom-icons/button-date.png", label: 'Date', insertBefore: '<span class="text-date">', insertAfter: '</span>', sampleText: 'Datum' }); // English (blok) krInsertWikiEditorButton({ id: "mw-customeditbutton-enblock", icon: "/wiki/resources/assets/custom-icons/button-en.png", label: 'English block', insertBefore: '<div lang="en">', insertAfter: '</div>', sampleText: 'English text' }); // Citace (blok) krInsertWikiEditorButton({ id: "mw-customeditbutton-blockquote", icon: "/wiki/resources/assets/custom-icons/button-blockquote.png", label: 'Bloková citace', insertBefore: '<blockquote>', insertAfter: '</blockquote>', sampleText: 'Citovaný odstavec' }); // Citace (inline text) krInsertWikiEditorButton({ id: "mw-customeditbutton-inlinequote", icon: "/wiki/resources/assets/custom-icons/button-quote.png", label: 'Řádková citace', insertBefore: '<q>', insertAfter: '</q>', sampleText: 'Citovaný text' }); }); /* 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' } ); } ); } );