function removeDomainFromUrl(a){"use strict";return a.replace(/^https?:\/\/[^\/]+/i,"")}function var_dump(a,b){"use strict";var c="";b||(b=0);var e,d="";for(e=0;e \""+g+'"\n')}else c="===>"+a+"<===("+typeof a+")";return c}var IMG_PARAM={URL:0,TITLE:1,ALT:2,WIDTH:3,HEIGHT:4},pluginPath='http://lib.amic.ru/js/' /*removeDomainFromUrl(CKEDITOR.plugins.get("slideshow").path)*/,BASE_PATH=removeDomainFromUrl(CKEDITOR.basePath),SCRIPT_JQUERY=pluginPath+"3rdParty/jquery.min.js",SCRIPT_ADDGAL=pluginPath+"3rdParty/ad-gallery/jquery.ad-gallery.min.js",CSS_ADDGAL=pluginPath+"3rdParty/ad-gallery/jquery.ad-gallery.css",SCRIPT_FANCYBOX=pluginPath+"3rdParty/fancybox2/jquery.fancybox.pack.js?v=2.1.5",CSS_FANCYBOX=pluginPath+"3rdParty/fancybox2/jquery.fancybox.css?v=2.1.5",listItem=function(a){"use strict";return a.type==CKEDITOR.NODE_ELEMENT&&a.is("li")},ULItem=function(a){"use strict";return a.type==CKEDITOR.NODE_ELEMENT&&a.is("ul")},iFrameItem=function(a){"use strict";return a.type==CKEDITOR.NODE_ELEMENT&&a.is("iframe")};Array.prototype.pushUnique=function(a){"use strict";var b;for(b=0;b0?b:"",f.$.value=c):(null!==e&&e0?b:""),f.setValue(c)),f)}function e(a,b,c,d){if(a=k(a),b<0)return!1;var e=a.getChild(b);return e.setText(c),e.setValue(d),e}function f(a){for(a=k(a);a.getChild(0)&&a.getChild(0).remove(););}function g(a,b,d,f){a=k(a);var g=h(a);if(g<0)return!1;var j=g+b;if(j=j<0?0:j,j=j>=a.getChildCount()?a.getChildCount()-1:j,g==j)return!1;var l=/(^IMG_\d+)/,m=a.getChild(j),n=m.getText(),o=m.getValue();n=n.replace(l,"IMG_"+g),e(a,j,n,o),m=a.getChild(g),n=m.getText(),o=m.getValue(),m.remove(),n=n.replace(l,"IMG_"+j),m=c(a,n,o,d?d:null,j),i(a,j);var p=f.imagesList[g],q=f.imagesList[j];return f.imagesList[g]=q,f.imagesList[j]=p,m}function h(a){return a=k(a),a?a.$.selectedIndex:-1}function i(a,b){if(a=k(a),b<0)return null;var c=a.getChildren().count();return a.$.selectedIndex=b>=c?c-1:b,a}function k(a){return a&&a.domId&&a.getInputElement().$?a.getInputElement():!(!a||!a.$)&&a}function n(a){if(1!=a.openCloseStep){var b=a.getContentElement("slideshowinfoid","framepreviewid");b.isVisible()?z(a):s(a)}}function o(a){var b=a.getDialog();a=k(a);var d,e,f,c=0;for(d=0;d1?g/=e:f*=e;var h,j=a.getContentElement("slideshowinfoid","imglistitemsid"),k=a.imagesList.pushUnique([d,"","",f.toFixed(0),g.toFixed(0)]);k>=0&&(h=c(j,"IMG_"+k+" : "+d.substring(d.lastIndexOf("/")+1),d,a.getParentEditor().document),i(j,k),n(a))}function s(a){var b=a.getContentElement("slideshowinfoid","imglistitemsid"),c=h(b),d=a.imagesList[c];b=a.getContentElement("slideshowinfoid","imgtitleid"),b=k(b),b.setValue(d[1]),b=a.getContentElement("slideshowinfoid","imgdescid"),b=k(b),b.setValue(d[2]),b=a.getContentElement("slideshowinfoid","imgpreviewid"),b=k(b);var e='
'+d[2]+'
';b.setHtml(e);var f=a.getContentElement("slideshowinfoid","framepreviewid"),g=a.getContentElement("slideshowinfoid","imgparamsid");f=k(f),f.hide(),g=k(g),g.show()}function t(a){var d=a.getContentElement("slideshowinfoid","imglistitemsid");d=k(d);var f,e=!1;for(f=d.getChildren().count()-1;f>=0;f--)d.getChild(f).$.selected&&(a.imagesList.splice(f,1),d.getChild(f).remove(),e=!0);if(e){if(0==a.imagesList.length){var g=BASE_PATH+"plugins/slideshow/images/placeholder.png";c(d,"IMG_0 : "+g.substring(g.lastIndexOf("/")+1),g,a.getParentEditor().document);a.imagesList.pushUnique([g,b.imgTitle,b.imgDesc,"50","50"])}i(d,0),n(a)}}function u(a,b){var c=a.getContentElement("slideshowinfoid","imglistitemsid");c=k(c);var d=h(c);1!=c.getChildren().count()&&(b==-1&&0==d||1==b&&d==c.getChildren().count()-1||(g(c,b,a.getParentEditor().document,a),B(a)))}function x(a,b){a.imagesList[p(a)][IMG_PARAM.TITLE]=b,s(a)}function y(a,b){a.imagesList[p(a)][IMG_PARAM.ALT]=b,s(a)}function z(a){var b=a.getContentElement("slideshowinfoid","framepreviewid"),c=a.getContentElement("slideshowinfoid","imgparamsid");c=k(c),c.hide(),b=k(b),b.show(),B(a)}function A(a,b){a.open(),a.writeln(b),a.close()}function B(a){var b=436,c=300;if(1==a.params.getVal("showthumbid")?c-=120:1==a.params.getVal("showcontrolid")&&(c-=30),0!=a.imagesList.length){var d=a.getContentElement("slideshowinfoid","imglistitemsid"),e=h(d);e<0&&(e=0),d=a.getContentElement("slideshowinfoid","framepreviewid");var f="",g='';f+="",f+=g,f+='',f+='',1==a.params.getVal("openOnClickId")&&(f+='',f+='',f+='"),f+='",f+="",f+="";var i=P(a);f+=i.getOuterHtml(),f+="",f+="",d=k(d);var j=d.getFirst(iFrameItem);j&&j.remove();var l=null,m=b+60,n=c;1==a.params.getVal("showthumbid")?n+=120:1==a.params.getVal("showcontrolid")&&(n+=30);var o=CKEDITOR.dom.element.createFromHtml('');o.setAttribute("name","totoFrame"),o.setAttribute("id","totoFrame"),o.on("load",function(a){if(null==l){l=this.$;var b;l.contentDocument?b=l.contentDocument:l.contentWindow&&(b=l.contentWindow.document),b?A(b,f):alert("Cannot inject dynamic contents into iframe.")}}),d.append(o)}}function C(a,b){var d,e,f,g,h,j,k,l,m,o=b.$.getElementsByTagName("img"),p=a.getContentElement("slideshowinfoid","imglistitemsid");for(d=0;d1?l/=j:k*=j,m=a.imagesList.pushUnique([f,e.title,e.alt,k,l]);var q;m>=0&&(q=c(p,"IMG_"+m+" : "+f.substring(f.lastIndexOf("/")+1),f,a.getParentEditor().document))}i(p,0),n(a)}function D(a){var d=a.getContentElement("slideshowinfoid","imglistitemsid"),e=BASE_PATH+"plugins/slideshow/images/placeholder.png";c(d,"IMG_0 : "+e.substring(e.lastIndexOf("/")+1),e,a.getParentEditor().document);a.imagesList.pushUnique([e,b.imgTitle,b.imgDesc,"50","50"]),i(d,0),n(a)}function F(){var a=this.getDialog();if(a.newSlideShowMode)switch(a.slideshowDOM.setAttribute("data-"+this.id,this.getValue()),this.type){case"checkbox":break;case"text":break;case"select":}else switch(this.type){case"checkbox":this.setValue("true"==a.slideshowDOM.getAttribute("data-"+this.id));break;case"text":this.setValue(a.slideshowDOM.getAttribute("data-"+this.id));break;case"select":this.setValue(a.slideshowDOM.getAttribute("data-"+this.id))}}function G(){var a=this.getDialog();switch(a.params.updateVal(this.id,this.getValue()),this.type){case"checkbox":break;case"text":break;case"select":}n(a)}function H(a){a.previewImage&&(a.previewImage.removeListener("load",v),a.previewImage.removeListener("error",w),a.previewImage.removeListener("abort",w),a.previewImage.remove(),a.previewImage=null),a.imagesList=null,a.params=null,a.slideshowDOM=null;var b=a.getContentElement("slideshowinfoid","imglistitemsid");f(b),a.openCloseStep=!1}function I(a){for(var b="";b.length\'); })(jQuery);'),e.append(i)}if(!a.config.slideshowDoNotLoadFancyBoxScript||1!=a.config.slideshowDoNotLoadFancyBoxScript){var j=CKEDITOR.document.createElement("script",{attributes:{type:"text/javascript",src:SCRIPT_FANCYBOX}});e.append(j)}var k=CKEDITOR.document.createElement("script",{attributes:{type:"text/javascript"}});k.setText(M(b)),e.append(k)}var l=CKEDITOR.document.createElement("script",{attributes:{type:"text/javascript"}});l.setText(N(b)),e.append(l);var m=CKEDITOR.document.createElement("script",{attributes:{type:"text/javascript"}});m.setText("(function($) { $('head').append('\'); })(jQuery);'),e.append(m);var n=CKEDITOR.document.createElement("script",{attributes:{type:"text/javascript"}});n.setText(L(b,0,0,0)),e.append(n),b.imagesList.length&&(c.backgroundImage='url("'+b.imagesList[0][IMG_PARAM.URL]+'")'),c.backgroundSize="contain",c.backgroundRepeat="no-repeat",c.backgroundPosition="center",c.display="block",c.width="64px",c.height="64px",c.border="1px solid black";var o=a.createFakeElement(e,"cke_slideShow","slideShow",!1);return o.setAttributes(d),o.setStyles(c),b.fakeImage?(o.replace(b.fakeImage),a.getSelection().selectElement(o)):a.insertElement(o),H(b),b.hide(),!0}var b=a.lang.slideshow,v=function(){var a=this.previewImage;a.removeListener("load",v),a.removeListener("error",w),a.removeListener("abort",w),r(this)},w=function(){var a=this.previewImage;a.removeListener("load",v),a.removeListener("error",w),a.removeListener("abort",w)},J=function(a){return"cke_"+I(8)+"_"+a};return{title:b.dialogTitle,width:500,height:600,resizable:CKEDITOR.DIALOG_RESIZE_NONE,buttons:[CKEDITOR.dialog.okButton(a,{label:"OkCK",style:"display:none;"}),CKEDITOR.dialog.cancelButton,{id:"myokbtnid",type:"button",label:"OK",title:b.validModif,accessKey:"C",disabled:!1,onClick:function(){Q(this.getDialog())}}],contents:[{id:"slideshowinfoid",label:"Basic Settings",align:"center",elements:[{type:"text",id:"id",style:"display:none;",onLoad:function(){this.getInputElement().setAttribute("readOnly",!0)}},{type:"text",id:"txturlid",style:"display:none;",label:b.imgList,onChange:function(){var a=this.getDialog(),b=this.getValue();if(b.length>0){var c=a.previewImage;c.on("load",v,a),c.on("error",w,a),c.on("abort",w,a),c.setAttribute("src",b)}}},{type:"button",id:"browse",hidden:"true",style:"display:inline-block;margin-top:0px;",filebrowser:{action:"Browse",target:"slideshowinfoid:txturlid",url:a.config.filebrowserImageBrowseUrl||a.config.filebrowserBrowseUrl},label:b.imgAdd},{type:"vbox",align:"center",children:[{type:"html",align:"center",id:"framepreviewtitleid",style:"font-family: Amaranth; color: #1E66EB;\tfont-size: 20px; font-weight: bold;",html:b.previewMode},{type:"html",id:"framepreviewid",align:"center",style:"width:500px;height:320px",html:""},{type:"hbox",id:"imgparamsid",style:"display:none;width:500px;",height:"325px",children:[{type:"vbox",align:"center",width:"400px",children:[{type:"text",id:"imgtitleid",label:b.imgTitle,onChange:function(){x(this.getDialog(),this.getValue())},onBlur:function(){x(this.getDialog(),this.getValue())}},{type:"text",id:"imgdescid",label:b.imgDesc,onChange:function(){y(this.getDialog(),this.getValue())},onBlur:function(){y(this.getDialog(),this.getValue())}},{type:"html",id:"imgpreviewid",style:"width:400px;height:200px;",html:"
xx
"}]}]},{type:"hbox",align:"center",height:110,widths:["25%","50%"],children:[{type:"vbox",children:[{type:"checkbox",id:"autostartid",label:b.autoStart,default:"checked",style:"margin-top:15px;",onChange:G,commit:G,setup:F},{type:"checkbox",id:"showtitleid",label:b.showTitle,default:"checked",onChange:G,commit:G,setup:F},{type:"checkbox",id:"showcontrolid",label:b.showControls,default:"checked",onChange:G,commit:G,setup:F},{type:"checkbox",id:"showthumbid",label:b.showThumbs,default:"checked",onChange:G,commit:G,setup:F},{type:"checkbox",id:"openOnClickId",label:b.openOnClick,default:"checked",onChange:G,commit:G,setup:F}]},{type:"select",id:"imglistitemsid",label:b.picturesList,multiple:!1,style:"height:125px;width:250px",items:[],onChange:function(a){o(this)}},{type:"vbox",children:[{type:"button",id:"previewbtn",style:"margin-top:15px;margin-left:25px;",label:b.previewMode,onClick:function(){z(this.getDialog())}},{type:"button",id:"removeselectedbtn",style:"margin-left:25px;",label:b.imgDelete,onClick:function(){t(this.getDialog())}},{type:"button",id:"editselectedbtn",style:"margin-left:25px;",label:b.imgEdit,onClick:function(){s(this.getDialog())}},{type:"hbox",children:[{type:"button",id:"upselectedbtn",style:"width:32px; margin-left:25px;",label:b.arrowUp,onClick:function(){u(this.getDialog(),-1)}},{type:"button",id:"downselectedbtn",style:"width:32px;",label:b.arrowDown,onClick:function(){u(this.getDialog(),1)}}]}]}]},{type:"hbox",children:[{type:"text",id:"pictheightid",label:b.pictHeight,maxLength:3,style:"width:100px;",default:"300",onChange:function(a){var b=/^\d+$/;0==b.test(this.getValue())&&this.setValue(300),this.getDialog().params.updateVal(this.id,this.getValue()),n(this.getDialog())},commit:G,setup:F},{type:"text",id:"speedid",label:b.displayTime,maxLength:3,style:"width:100px;",default:"5",onChange:function(a){var b=/^\d+$/;0==b.test(this.getValue())&&this.setValue(5),this.getDialog().params.updateVal(this.id,this.getValue()),n(this.getDialog())},commit:G,setup:F},{type:"text",id:"animspeedid",label:b.transitionTime,style:"width:100px;",maxLength:4,default:"500",onChange:function(a){var b=/^\d+$/;0==b.test(this.getValue())&&this.setValue(500),this.getDialog().params.updateVal(this.id,this.getValue()),n(this.getDialog())},commit:G,setup:F},{type:"select",id:"transitiontypeid",label:b.transition,items:[[b.tr1,"none"],[b.tr2,"resize"],[b.tr3,"slide-vert"],[b.tr4,"slide-hori"],[b.tr5,"fade"]],default:"resize",style:"width:100px;",commit:G,setup:F,onChange:G}]}]}]}],onLoad:function(){},onShow:function(){this.dialog=this,this.slideshowDOM=null,this.openCloseStep=!0,this.fakeImage=null;var b=null;this.imagesList=[],this.params=[],this.previewImage=a.document.createElement("img"),this.okRefresh=!0;var c=this.getSelectedElement();if(c&&c.data("cke-real-element-type")&&"slideShow"==c.data("cke-real-element-type")&&(this.fakeImage=c,b=a.restoreRealElement(c)),b){this.slideshowDOM=b;var d=K(this,b);if(null==d)return alert("BIG Problem slideShowContainer !!"),!1;var e=b.getAttribute("id");if(null==e)return alert("BIG Problem slideshowid !!"),!1;this.params.push(["slideshowid",e]),C(this,d);var g,f=b.$.dataset;for(g in f)this.params.push([g,f[g]]);this.setupContent(this,!0),this.newSlideShowMode=!1}else this.params.push(["slideshowid",J("slideShow")]),D(this),this.commitContent(this);this.openCloseStep=!1,z(this)},onOk:function(){return!1},onHide:function(){H(this)}}});