(function() { // Load plugin specific language pack tinymce.PluginManager.requireLangPack('adfever'); tinymce.create('tinymce.plugins.adfever', { /** * Initializes the plugin, this will be executed after the plugin has been created. * This call is done before the editor instance has finished it's initialization so use the onInit event * of the editor instance to intercept that event. * * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. * @param {string} url Absolute URL to where the plugin is located. */ init : function(ed, url) { if ( typeof AdfeverButtonClick == 'undefined' ) return; ed.addButton('adfever', { title : 'adfever.button_title', image : url + '/../../images/adfever.png', onclick : function() { AdfeverButtonClick( 'adfever' ); } }); /* * Load additional CSS */ ed.onInit.add(function() { if (ed.settings.content_css !== false) { dom = ed.windowManager.createInstance('tinymce.dom.DOMUtils', document); /* * Load first for the viewport * And then, inside the RTE frame */ dom.loadCSS(url + '/content.css'); ed.dom.loadCSS(url + '/content.css'); } }); /* * From Editor to database (Visual to HTML tab) * * We basically remove span element */ ed.onBeforeGetContent.add(function(ed, o){ tinymce.each(ed.getBody().getElementsByTagName('span'), function(tag){ if (ed.dom.hasClass(tag, 'adf_shortcode')) { tag.innerHTML = tag.innerHTML.replace(/<\/?[^>]*>/g, ''); } }); }); /* * From Editor to database (Visual to HTML tab) * * We basically remove span element */ ed.onPostProcess.add(function(ed, o){ o.content = o.content.replace( /