MediaWiki:Common.js
From GATE
Revision as of 18:20, 15 January 2017 by Lorenzo Mancini (talk | contribs)
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.
/* Any JavaScript here will be <add>loaded</add>
<lb/>
<lb/>for
<lb/>
<pb/>
all users on every page load. */
var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'annotation': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Annotation'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'annotation',
groups: {
'text': {
'label': 'TEI'
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'annotation',
groups: {
'entities': {
'label': 'Entities'
}
}
} );
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"add": {
label: 'Addition',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/9/9c/TEI_Button_add_01.png',
action: {
type: 'encapsulate',
options: {
pre: '<add>',
post: "</add>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"del": {
label: 'Deletion',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/c/cf/TEI_Button_del.png',
action: {
type: 'encapsulate',
options: {
pre: '<del>',
post: "</del>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"lb": {
label: 'Line-break',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/bf/TEI_Button_lb.png',
action: {
type: 'encapsulate',
options: {
pre: '<lb/>',
ownline: true
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"pb": {
label: 'Page-break',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/4/4d/TEI_Button_pb.png',
action: {
type: 'encapsulate',
options: {
pre: '<pb/>',
ownline: true
}
}
}
}
});
};
/* 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' ).then( 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 );
}
} );
}