/* global CKEDITOR */ ;(function() { var el = document.getElementById('ckeditor-init-script'); if (el && !window.CKEDITOR_BASEPATH) { window.CKEDITOR_BASEPATH = el.getAttribute('data-ckeditor-basepath'); } // Polyfill from https://developer.mozilla.org/en/docs/Web/API/Element/matches if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length; while (--i >= 0 && matches.item(i) !== this) {} return i > -1; }; } function runInitialisers() { initialiseCKEditor(); initialiseCKEditorInInlinedForms(); } if (document.readyState != 'loading') { runInitialisers(); } else { document.addEventListener('DOMContentLoaded', runInitialisers); } function initialiseCKEditor() { var textareas = Array.prototype.slice.call(document.querySelectorAll('textarea[data-type=ckeditortype]')); for (var i=0; i