MediaWiki:Common.js

From GeoGebra Manual
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
var customizeToolbar = function() {
      
jQuery( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'groups': {
                'templates': {
                        'label': 'Templates' // or use labelMsg for a localized label, see above
                }
        }
} );

jQuery( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group':'templates',
        'tools': {
                'example': {
                        label: 'Example', // or use labelMsg for a localized label, see above
                        type: 'button',
icon: 'https://archive.geogebra.org/images/wiki/example.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{example|1=", // text to be inserted
                                        peri:"Insert comment here",
                                        post: " }}"
                                }
                        }
                },
  'note': {
                        label: 'Note', // or use labelMsg for a localized label, see above
                        type: 'button',
icon: 'https://archive.geogebra.org/images/wiki/note.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{note|1=", // text to be inserted
                                        peri:"Insert comment here",
                                        post: " }}"
                                }
                        }
                },
 'hint': {
                        label: 'Hint', // or use labelMsg for a localized label, see above
                        type: 'button',
icon: 'https://archive.geogebra.org/images/wiki/hint.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{hint|1=", // text to be inserted
                                        peri:"Insert comment here",
                                        post: " }}"
                                }
                        }
                },
 'warning': {
                        label: 'Warning', // or use labelMsg for a localized label, see above
                        type: 'button',
icon: 'https://archive.geogebra.org/images/wiki/warning.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{warning|1=", // text to be inserted
                                        peri:"Insert comment here",
                                        post: " }}"
                                }
                        }
                },
 'keycode': {
                        label: 'Key code', // or use labelMsg for a localized label, see above
                        type: 'button',
icon: 'https://archive.geogebra.org/images/wiki/keycode.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{KeyCode|", // text to be inserted
                                        peri:"Ctrl+A",
                                        post: " }}"
                                }
                        }
                }
        }
} );
};
 

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options', function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
© 2024 International GeoGebra Institute