User:DG/common.js: Difference between revisions
From CODECS: Online Database and e-Resources for Celtic Studies
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
} | } | ||
/* WSShowOnSelect */ | |||
/* ***** Loading multipleInstanceTemplates and WSShowOnSelect ***** */ | |||
if ($('.WSmultipleTemplateWrapper') && $('.WSShowOnSelect').length == 0) { | |||
$.getScript('/vhcodecs/custom/js/multipleInstanceTemplates.js'); | |||
} | |||
if ($('.WSShowOnSelect').length > 0 && $('.WSmultipleTemplateWrapper').length == 0) { | |||
$.getScript('/vhcodecs/custom/js/WSShowOnSelect.js').done(function() { | |||
WsShowOnSelect(); | |||
}); | |||
} | |||
if ( $('.WSShowOnSelect').length > 0 && $('.WSmultipleTemplateWrapper').length > 0) { | |||
$.getScript('/wvhcodecs/custom/js/WSShowOnSelect.js').done(function() { | |||
$.getScript('/vhcodecs/custom/js/multipleInstanceTemplates.js').done(function() { | |||
WsShowOnSelect(); | |||
}); | |||
}); | |||
} | |||
/* ----- end of Loading multipleInstanceTemplates and WSShowOnSelect ----- */ | |||
/* Medium editor */ | /* Medium editor */ |
Revision as of 18:28, 24 May 2020
/* Load in namespace 6 */ if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') { mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js'); } /* WSShowOnSelect */ /* ***** Loading multipleInstanceTemplates and WSShowOnSelect ***** */ if ($('.WSmultipleTemplateWrapper') && $('.WSShowOnSelect').length == 0) { $.getScript('/vhcodecs/custom/js/multipleInstanceTemplates.js'); } if ($('.WSShowOnSelect').length > 0 && $('.WSmultipleTemplateWrapper').length == 0) { $.getScript('/vhcodecs/custom/js/WSShowOnSelect.js').done(function() { WsShowOnSelect(); }); } if ( $('.WSShowOnSelect').length > 0 && $('.WSmultipleTemplateWrapper').length > 0) { $.getScript('/wvhcodecs/custom/js/WSShowOnSelect.js').done(function() { $.getScript('/vhcodecs/custom/js/multipleInstanceTemplates.js').done(function() { WsShowOnSelect(); }); }); } /* ----- end of Loading multipleInstanceTemplates and WSShowOnSelect ----- */ /* 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(); } });