Difference between revisions of "MediaWiki:Common.js"
From GATE
Line 34: | Line 34: | ||
} | } | ||
} ); | } ); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "head": { | ||
+ | label: 'Header', | ||
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/d/db/TEI_Head22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<head>', | ||
+ | post: "</head>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "paragraph": { | ||
+ | label: 'Paragraph', | ||
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/b3/TEI_P22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<p>', | ||
+ | post: "</p>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "lb": { | ||
+ | label: 'Line-break', | ||
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/1/1b/TEI_Lb22px.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/2/28/TEI_Pb22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<pb/>', | ||
+ | ownline: true | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
$('#wpTextbox1').wikiEditor('addToToolbar', { | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
Line 42: | Line 118: | ||
label: 'Addition', | label: 'Addition', | ||
type: 'button', | type: 'button', | ||
− | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/ | + | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/0/09/TEI_Add22px.png', |
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
Line 61: | Line 137: | ||
label: 'Deletion', | label: 'Deletion', | ||
type: 'button', | type: 'button', | ||
− | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/ | + | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/bb/TEI_Del22px.png', |
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
Line 77: | Line 153: | ||
group: 'text', | group: 'text', | ||
tools: { | tools: { | ||
− | " | + | "gap": { |
− | label: ' | + | label: 'Gap', |
type: 'button', | type: 'button', | ||
− | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/ | + | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/3/3e/TEI_Gap22px.png', |
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
− | pre: '< | + | pre: '<gap/>', |
ownline: true | ownline: true | ||
} | } | ||
Line 96: | Line 172: | ||
group: 'text', | group: 'text', | ||
tools: { | tools: { | ||
− | " | + | "unclear": { |
− | label: ' | + | label: 'Unclear', |
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/c/c7/TEI_Unclear22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<unclear>', | ||
+ | post: "</unclear>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "sic": { | ||
+ | label: 'Sic', | ||
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/9/91/TEI_Sic22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<sic>', | ||
+ | post: "</sic>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "underline": { | ||
+ | label: 'Underline', | ||
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/b5/TEI_Und22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<hi rend="underline">', | ||
+ | post: "</hi>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "superscript": { | ||
+ | label: 'Superscript', | ||
+ | type: 'button', | ||
+ | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/9/92/TEI_Sup22px.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: '<hi rend="superscript">', | ||
+ | post: "</hi>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'annotation', | ||
+ | group: 'text', | ||
+ | tools: { | ||
+ | "note": { | ||
+ | label: 'Note', | ||
type: 'button', | type: 'button', | ||
− | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/ | + | icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/f/f1/TEI_Note22px.png', |
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
− | pre: '< | + | pre: '<note>', |
− | + | post: "</note>" | |
} | } | ||
} | } |
Revision as of 19:34, 15 January 2017
/* 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: {
"head": {
label: 'Header',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/d/db/TEI_Head22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<head>',
post: "</head>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"paragraph": {
label: 'Paragraph',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/b3/TEI_P22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<p>',
post: "</p>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"lb": {
label: 'Line-break',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/1/1b/TEI_Lb22px.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/2/28/TEI_Pb22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<pb/>',
ownline: true
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"add": {
label: 'Addition',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/0/09/TEI_Add22px.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/b/bb/TEI_Del22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<del>',
post: "</del>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"gap": {
label: 'Gap',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/3/3e/TEI_Gap22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<gap/>',
ownline: true
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"unclear": {
label: 'Unclear',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/c/c7/TEI_Unclear22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<unclear>',
post: "</unclear>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"sic": {
label: 'Sic',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/9/91/TEI_Sic22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<sic>',
post: "</sic>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"underline": {
label: 'Underline',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/b5/TEI_Und22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<hi rend="underline">',
post: "</hi>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"superscript": {
label: 'Superscript',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/9/92/TEI_Sup22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<hi rend="superscript">',
post: "</hi>"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'annotation',
group: 'text',
tools: {
"note": {
label: 'Note',
type: 'button',
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/f/f1/TEI_Note22px.png',
action: {
type: 'encapsulate',
options: {
pre: '<note>',
post: "</note>"
}
}
}
}
});
};
/* 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 );
}
} );
}