MediaWiki: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 bude použit pro všechny uživatele při načtení každé stránky. */

// 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 */
  'sections': {
    'snippets': {
      'type': 'booklet',
      'labelMsg': 'useful-snippets',
      'pages': {
        'section-nav': {
          'labelMsg': 'page-nav',
          'layout': 'characters',
          'characters': [
             {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '<noinclude>{{from}}',
                  'peri': '\n',
                  'post': '… </noinclude>'
                },
                'label': 'FROM'
              }
             },
             {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '<noinclude>{{next|',
                  'peri': '',
                  'post': '</noinclude>}}'
                },
                label: 'NEXT'
              }
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '<noinclude>{{from|',
                  'peri': '',
                  'post': '</noinclude>}}'
                },
               label: 'CONT'
              }
            }
          ]
        },
        'section-xml': {
          'label': 'XML Tags',
          'layout': 'characters',
          'characters': [
            '<references/>',
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '<ref>',
                  'peri': '',
                  'post': '</ref>'
                }
              },
              'label': '<ref></ref>'
            }
          ]
        },
        'section-links': {
          'label': 'Wikilinks',
          'layout': 'characters',
          'characters': [
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '[[Category:',
                  'peri': '',
                  'post': ']]'
                }
              },
              'label': '[[Category:]]'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '[[File:',
                  'peri': '',
                  'post': ']]'
                }
              },
              'label': '[[File:]]'
            }
          ]
        }
      }
    }
  }
      /* Konec kódu pro toolbar */
    });
  });
}