Difference between revisions of "MediaWiki:Common.js"

From GATE
Line 26: Line 26:
 
tools: {
 
tools: {
 
"head": {
 
"head": {
label: 'Head: "The <head> element is used to identify a heading prefixed to the start of any textual division, at any level" (TEI P5.',
+
label: 'Head: "the <head> element is used to identify a heading prefixed to the start of any textual division, at any level" (TEI P5).',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/d/db/TEI_Head22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/d/db/TEI_Head22px.png',
Line 45: Line 45:
 
tools: {
 
tools: {
 
"paragraph": {
 
"paragraph": {
label: 'Paragraph',
+
label: 'Paragraph: the <p> tag "marks paragraphs in prose" (TEI P5)',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/b3/TEI_P22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/b3/TEI_P22px.png',
Line 64: Line 64:
 
tools: {
 
tools: {
 
"lb": {
 
"lb": {
label: 'Line-break',
+
label: 'Line break: "<lb> (line break) marks the start of a new (typographic) line in some edition or version of a text" (TEI P5).',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/1/1b/TEI_Lb22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/1/1b/TEI_Lb22px.png',
Line 83: Line 83:
 
tools: {
 
tools: {
 
"pb": {
 
"pb": {
label: 'Page-break',
+
label: 'Page break: "<pb> (page break) marks the start of a new page in a paginated document" (TEI P5).',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/2/28/TEI_Pb22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/2/28/TEI_Pb22px.png',
Line 102: Line 102:
 
tools: {
 
tools: {
 
"add": {
 
"add": {
label: 'Addition',
+
label: 'Addition: "<add> (addition) contains letters, words, or phrases inserted in the source text by an author, scribe, or a previous annotator or corrector" (TEI P5).',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/0/09/TEI_Add22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/0/09/TEI_Add22px.png',
Line 121: Line 121:
 
tools: {
 
tools: {
 
"del": {
 
"del": {
label: 'Deletion',
+
label: 'Deletion: "<del> (deletion) contains a letter, word, or passage deleted, marked as deleted, or otherwise indicated as superfluous or spurious in the copy text by an author, scribe, or a previous annotator or corrector" (TEI P5).',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/bb/TEI_Del22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/b/bb/TEI_Del22px.png',
Line 140: Line 140:
 
tools: {
 
tools: {
 
"gap": {
 
"gap": {
label: 'Gap',
+
label: 'Gap: "<gap> indicates a point where material has been omitted in a transcription, whether for editorial reasons described in the TEI header, as part of sampling practice, or because the material is illegible, invisible, or inaudible" (TEI P5).',
 
type: 'button',
 
type: 'button',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/3/3e/TEI_Gap22px.png',
 
icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/3/3e/TEI_Gap22px.png',

Revision as of 11:46, 16 January 2017

/* Any JavaScript here will be loaded for 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',
        group: 'text',
	tools: {
		"head": {
			label: 'Head: "the <head> element is used to identify a heading prefixed to the start of any textual division, at any level" (TEI P5).',
			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: the <p> tag "marks paragraphs in prose" (TEI P5)',
			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: "<lb> (line break) marks the start of a new (typographic) line in some edition or version of a text" (TEI P5).',
			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: "<pb> (page break) marks the start of a new page in a paginated document" (TEI P5).',
			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: "<add> (addition) contains letters, words, or phrases inserted in the source text by an author, scribe, or a previous annotator or corrector" (TEI P5).',
			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: "<del> (deletion) contains a letter, word, or passage deleted, marked as deleted, or otherwise indicated as superfluous or spurious in the copy text by an author, scribe, or a previous annotator or corrector" (TEI P5).',
			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: "<gap> indicates a point where material has been omitted in a transcription, whether for editorial reasons described in the TEI header, as part of sampling practice, or because the material is illegible, invisible, or inaudible" (TEI P5).',
			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>"
				}
			}
		}
	}
});

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'annotation',
	groups: {
		'entities': {
			'label': 'Entities'
		}
	}
} );

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'annotation',
        group: 'entities',
	tools: {
		"name": {
			label: 'Name',
			type: 'button',
			icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/5/57/Icon_Users.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: '[[citesName::',
					post: "]]"
				}
			}
		}
	}
});

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'annotation',
        group: 'entities',
	tools: {
		"place": {
			label: 'Place',
			type: 'button',
			icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/7/76/Icon_Placeholder.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: '[[citesPlace::',
					post: "]]"
				}
			}
		}
	}
});

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'annotation',
        group: 'entities',
	tools: {
		"work": {
			label: 'Work',
			type: 'button',
			icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/e/e0/Icon_work.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: '[[citesWork::',
					post: "]]"
				}
			}
		}
	}
});

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'annotation',
        group: 'entities',
	tools: {
		"object": {
			label: 'Object',
			type: 'button',
			icon: 'http://mediawikiarchivio.unigre.it/mediawiki/images/7/7e/Icon_object.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: '[[citesObject::',
					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' ).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 );
		}
	} );
}