/* Import plugin specific language pack */ tinyMCE.importPluginLanguagePack('adsense_deluxe', ''); function TinyMCE_adsense_deluxe_initInstance(inst) { tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/adsense_deluxe/adsense_deluxe.css"); } /** * Information about the plugin. */ function TinyMCE_g2image_getInfo() { return { longname : 'Adsense Deluxe plugin', author : 'Wayne K Walrath', authorurl : 'http://www.acmetech.com/blog/', infourl : 'http://www.acmetech.com/blog/', version : "0.7" }; }; function TinyMCE_adsense_deluxe_getControlHTML(control_name) { //class="mce_ads_dlx_SelectList" switch (control_name) { case "adsense_deluxe": var html = ''; //ad_select return html; var title_adsense = tinyMCE.getLang('lang_adsense_deluxe_button'); var buttons = ''; return buttons; } return ''; } function TinyMCE_adsense_deluxe_parseAttributes(attribute_string) { var attributeName = ""; var attributeValue = ""; var withInName; var withInValue; var attributes = new Array(); var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g'); var titleText = tinyMCE.getLang('lang_wordpress_more'); var titleTextPage = tinyMCE.getLang('lang_wordpress_page'); if (attribute_string == null || attribute_string.length < 2) return null; withInName = withInValue = false; for (var i=0; i'; return html; } function TinyMCE_adsense_deluxe_cleanup(type, content) { // return content; switch (type) { case "insert_to_editor": //-- //-- This doesn't handle the situation where you have AdsDlx tags //-- with ad names which were deleted from AdsDlx options after //-- the post was originally created. E.g., you inserted //-- published that post, then later you're editing the post but the "foo" //-- ads no longer existin in the plugin options. //-- [suggested "ToDo" for that: var startPos = 0; var altMore = tinyMCE.getLang('lang_adsense_deluxe_alt'); var ad_names = new Array('adsense'); if( __ADSENSE_DELUXE_ADS != null ){ for(var i=0; i<__ADSENSE_DELUXE_ADS.length; i++){ ad_names.push('adsense#' + __ADSENSE_DELUXE_ADS[i]); } } // Parse all tags and replace them with images for(var i=0; i'); while ((startPos = content.indexOf('', startPos)) != -1) { // Insert image var contentAfter = content.substring(startPos + ad_names[i].length+7); content = content.substring(0, startPos); content += TinyMCE_adsense_deluxe_make_imgtag(ad_names[i]); content += contentAfter; startPos++; } // go to next ad placeholder } // If any blocks weren't replaced, do it with this statement content = content.replace(new RegExp('', 'g'), '[Undefined Adsense Block ($1)]'); break; case "get_from_editor": // Parse all img tags and replace them with var startPos = -1; while ((startPos = content.indexOf('', startPos); var attribs = TinyMCE_adsense_deluxe_parseAttributes(content.substring(startPos + 4, endPos)); if (attribs['class'] == "mce_plugin_adsense_deluxe") { endPos += 2; var embedHTML = ''; if( attribs['title'] != null && attribs['title'] != '' ) embedHTML = ''; // Insert embed/object chunk chunkBefore = content.substring(0, startPos); chunkAfter = content.substring(endPos); content = chunkBefore + embedHTML + chunkAfter; } } // If it says & in the WYSIWYG editor, it should say & in the html. // content = content.replace(new RegExp('&', 'g'), '&'); // content = content.replace(new RegExp('&nbsp;', 'g'), ' '); break; } // Pass through to next handler in chain return content; } function TinyMCE_adsense_deluxe_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { return false; function getAttrib(elm, name) { return elm.getAttribute(name) ? elm.getAttribute(name) : ""; } tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonNormal'); if (node == null) return; do { if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0) tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected'); if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0) tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected'); } while ((node = node.parentNode)); return true; }