Difference between revisions of "User:DG/common.js"

From CODECS: Online Database and e-Resources for Celtic Studies
 
Line 59: Line 59:
 
console.log('no MediumEditor, loading...');
 
console.log('no MediumEditor, loading...');
 
//$.when($.getScript('/vhcodecs/resources/lib/jquery.ui/jquery.ui.sortable.js')).done(function() {
 
//$.when($.getScript('/vhcodecs/resources/lib/jquery.ui/jquery.ui.sortable.js')).done(function() {
$.getScript('/vhcodecs/codecsscripts/medium/dist/js/medium-editor.js').done(function() {
+
$.getScript('/vhcodecs/custom/js/medium/dist/js/medium-editor.js').done(function() {
 
setupMedium();
 
setupMedium();
 
});
 
});

Latest revision as of 23:31, 12 October 2019

/* Load in namespace 6 */

if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') {
	mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js');
}


/* Medium editor */

function setupMedium() {      

			var editor = new MediumEditor('.medium-wysiwyg', {
				toolbar: {
					/* These are the default options for the toolbar,
					   if nothing is passed this is what is used */
					disableReturn: true,
					disableDoubleReturn: true,
					disableExtraSpaces: true, 
					
					allowMultiParagraphSelection: true,
					buttons: ['bold', 
							  'italic', 
							  'underline', 
							  'superscript', 
							  'subscript'
					],
					diffLeft: 0,
					diffTop: -10,
					firstButtonClass: 'medium-editor-button-first',
					lastButtonClass: 'medium-editor-button-last',
					relativeContainer: null,
					standardizeSelectionStart: false,
					static: false,
					/* options which only apply when static is true */
					align: 'center',
					sticky: false,
					updateOnEmptySelection: false,
					
					toolbar: false,
					keyboardCommands: false,
					commands: [
					{
						command: false,
						key: 'B', // for bold
						meta: true,
						shift: false
					}
					]
				}
			});

}
/* end of function now declare it  */

$(function() {
	if ($('.medium-wysiwyg')[0]) {
    
		if( typeof( MediumEditor ) === "undefined" ) {
			console.log('no MediumEditor, loading...');
			//$.when($.getScript('/vhcodecs/resources/lib/jquery.ui/jquery.ui.sortable.js')).done(function() {
					$.getScript('/vhcodecs/custom/js/medium/dist/js/medium-editor.js').done(function() {
						setupMedium();
					});
			//});
		} else setupMedium();
    
  }
});