(function(){tinymce.PluginManager.requireLangPack("wpAwshortcode");tinymce.create("tinymce.plugins.wpAwshortcodePlugin",{init:function(b,e){var f=this;b.addCommand("wpAwshortcodeSelector",function(a,c){var d=[];d.push("tinymce="+escape(tinymce.baseURL.replace(/^.+:\/\//,"//")));b.windowManager.open({file:e+"/shortcode-"+c+".html?"+d.join("&"),width:"450px",height:"490px",inline:1},{plugin_url:e,shortcode:c,widget:c.replace(/amazon-/,"")})});b.onInit.add(function(){if(b.settings.content_css!==false){dom= b.windowManager.createInstance("tinymce.dom.DOMUtils",document);dom.loadCSS(e+"/css/content.css");b.dom.loadCSS(e+"/css/content.css")}});b.onNodeChange.add(function(a){f._selectMenu(a)});b.onBeforeGetContent.add(function(a){tinymce.each(a.getBody().getElementsByTagName("span"),function(c){if(a.dom.hasClass(c,"awshortcode"))c.innerHTML=c.innerHTML.replace(/<\/?[^>]*>/g,"")})});b.onPostProcess.add(function(a,c){c.content=c.content.replace(//.test(a.innerHTML))a.innerHTML=a.innerHTML.replace(/(\[amazon-[a-z0-9]+[^\]]*\][^\[]+\[\/(amazon-[a-z0-9]+)\])/g,function(c,d,g){return''+d+""})})},createControl:function(b,e){var f=this,a=f._cache.menu,c,d=tinyMCE.activeEditor,g=tinymce.each;if(b!="awshortcode-selector")return null;c=e.createSplitButton(b,{cmd:"",scope:f,title:"wpAwshortcode.desc"}); c.onRenderMenu.add(function(l,j){j.add({"class":"mceMenuItemTitle",title:"wpAwshortcode.desc"}).setDisabled(1);g(d.settings.awshortcode_enabled_widgets.split(","),function(i){var h={icon:0},k="wpAwshortcode."+i.replace("-","_");h.onclick=function(){d.execCommand("wpAwshortcodeSelector",true,i)};h.title=k;h=j.add(h);a[i]=h});f._selectMenu(d)});return c},shortcodes:{"amazon-carrousel":"wpAwshortcode.amazon_carrousel","amazon-deals":"wpAwshortcode.amazon_deals","amazon-mp3":"wpAwshortcode.amazon_mp3", "amazon-myfavorites":"wpAwshortcode.amazon_myfavorites","amazon-product":"wpAwshortcode.amazon_product","amazon-productcloud":"wpAwshortcode.amazon_productcloud","amazon-slideshow":"wpAwshortcode.amazon_slideshow","amazon-wishlist":"wpAwshortcode.amazon_wishlist"},getInfo:function(){return{longname:"Amazon Widgets Shortcodes",author:"Oncle Tom",authorurl:"http://oncle-tom.net",infourl:"http://wordpress.org/extend/plugins/amazon-widgets-shortcodes/",version:"1.6"}},_cache:{menu:{}},_selectMenu:function(b){var e= b.selection.getNode(),f=tinymce.each,a=this._cache.menu;f(this.shortcodes,function(c,d){typeof a[d]=="undefined"||!a[d]||a[d].setSelected(b.dom.hasClass(e,d))})}});tinymce.PluginManager.add("wpAwshortcode",tinymce.plugins.wpAwshortcodePlugin)})();