WikiEditor

Z kapica.cz
Syntakticky špatný kód
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
  mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
    $textarea.wikiEditor( 'addToToolbar', {
     /* start section advanced */
		section: 'advanced',
		group: 'format',
		tools: {
          /* start section.groups.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 */
     /* start section advanced */
		section: 'advanced',
		group: 'format',
		tools: {
			comment: {
				label: 'Comment',
				type: 'button',
				icon: 'https://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<!-- ',
						post: ' -->'
					}
				}
			}
		}
     /* end section */
    });
  });
}
Syntakticky správný kód
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
  mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
    $textarea.wikiEditor( 'addToToolbar', {
     /* start section advanced */
		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: ' -->'
					}
				}
			}
		}
     /* end section */
    });
  });
}