Uživatel:Keny/common.js
Z kapica.cz
Poznámka: Po zveřejnění musíte vyprázdnit cache vašeho prohlížeče, jinak změny neuvidíte.
- Firefox / Safari: Při kliknutí na Aktualizovat držte Shift nebo stiskněte Ctrl-F5 nebo Ctrl-R (na Macu ⌘-R)
- Google Chrome: Stiskněte Ctrl-Shift-R (na Macu ⌘-Shift-R)
- Edge: Při kliknutí na Aktualizovat držte Ctrl nebo stiskněte Ctrl-F5.
/* Zde uvedený JavaScript se použije jen pro uživatele Keny. */
// Check if we're editing a page.
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
$textarea.wikiEditor( 'addToToolbar', {
/* Kód pro toolbar */
section: 'advanced',
group: 'format',
tools: {
hline: {
label: 'Horizontal line',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/a/a4/H-line_icon.png',
action: {
type: 'encapsulate',
options: {
pre: '----',
ownline: true
}
}
},
/* ↑ nezapomenout na čárku! aby nenastala chyba v syntaxi */
comment: {
label: 'Comment',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
action: {
type: 'encapsulate',
options: {
pre: '<!-- ',
post: ' -->'
}
}
}
}
/* Konec kódu pro toolbar */
});
/* Remove button for <big> */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'advanced',
'group': 'size',
'tool': 'big'
});
});
/* modifikace sekce main, změna pouze pro pro švédštinu */
$( '#wpTextbox1' ).on( 'wikiEditor-toolbar-buildSection-main', function( event, section ) {
// Add icons for bold (F) and italic (L) for Swedish (sv)
// Don't overwrite them if they're already defined, so this hack can safely be removed once the
// usability team incorporates these icons in the software
if ( !( 'sv' in section.groups.format.tools.bold.icon ) ) {
// There's already a bold F icon for German, use that one
section.groups.format.tools.bold.icon['sv'] = 'format-bold-F.png';
section.groups.format.tools.bold.offset['sv'] = [2, -214];
}
if ( !( 'sv' in section.groups.format.tools.italic.icon ) ) {
// Use an icon from Commons for L
section.groups.format.tools.italic.icon['sv'] = '//upload.wikimedia.org/wikipedia/commons/3/32/Toolbaricon_italic_L.png';
section.groups.format.tools.italic.offset['sv'] = [2, -214];
}
} );
}