// closure to avoid namespace collision (function(){ // creates the plugin tinymce.create('tinymce.plugins.aswp_ads_shortcode', { createControl : function(id, controlManager) { if (id == 'aswp_ads_shortcode_button') { // creates the button var button = controlManager.createButton('aswp_ads_shortcode_button', { title : 'Ads Shortcodes', image : '../wp-content/plugins/adsense-wordpress-plugin/images/icon_editor.png', onclick : function() { var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width; W = W - 80; H = H - 284; tb_show('Ads Shortcodes', '#TB_inline?height=300&width=500&inlineId=aswp_ads_shortcode_id'); } }); return button; } return null; } }); // registers the plugin. tinymce.PluginManager.add('aswp_ads_shortcode', tinymce.plugins.aswp_ads_shortcode); jQuery(function(){ jQuery('#content_aswp_ads_shortcode_button').live('click', function(){ var h = jQuery(window).height(); jQuery('#TB_window').addClass('aswp_tb_window'); jQuery('.aswp_tb_window').css('width', 400+'px'); jQuery('.aswp_tb_window').css('height', 200+'px'); jQuery('#TB_window').css({marginLeft: '-200px'}); jQuery('#TB_window').css({top: parseInt(((h/2 - 100)), 10)+'px'}); jQuery('#TB_ajaxContent').addClass('aswp_tb_ajax_content'); jQuery('.aswp_tb_ajax_content').css('width', 370+'px'); jQuery('.aswp_tb_ajax_content').css('height', 156+'px'); }); aswp_tb_position = function() { if (jQuery('#TB_window').hasClass('aswp_tb_window')) { var h = jQuery(window).height(); jQuery('.aswp_tb_window').css('width', 400+'px'); jQuery('.aswp_tb_window').css('height', 200+'px'); jQuery('#TB_window').css({marginLeft: '-200px'}); jQuery('#TB_window').css({top: parseInt(((h/2 - 100)), 10)+'px'}); } else { tb_position(); } }; jQuery(window).resize( function() { aswp_tb_position() } ); jQuery(document).ready( function() { aswp_tb_position() } ); var url_data = 'mode=load_shortcodes&action=aswp_ajax_call'; var html_container = ''; jQuery.ajax({ url: ajaxurl, type: "POST", data: url_data, cache: false, dataType: "html", success: function (respond) { html_container = jQuery('