User:DG/common.js
From CODECS: Online Database and e-Resources for Celtic Studies
Note: After publishing, 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: Press Ctrl-F5.
/* Load in namespace 6 */ if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') { mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js'); } /* WSForm: loading Select2 */ function setupSelect2() { mw.loader.load('/vhcodecs/extensions/WSForm/select2.min.css', 'text/css'); $.getScript('/vhcodecs/extensions/WSForm/select2.min.js').done(function() { $('select[data-inputtype="ws-select2"]').each(function() { var selectid = $(this).attr('id'); var selectoptionsid = 'select2options-' + selectid; var select2config = $("input#" + selectoptionsid).val(); var F = new Function(select2config); return (F()); }); }); } if ($('select[data-inputtype="ws-select2"]')[0]) { setupSelect2(); } /* End of WSForm: Select2 */ /* 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/codecsscripts/medium/dist/js/medium-editor.js').done(function() { setupMedium(); }); //}); } else setupMedium(); } });