????JFIF??x?x????'403WebShell
403Webshell
Server IP : 104.21.48.1  /  Your IP : 216.73.216.145
Web Server : LiteSpeed
System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : tempvsty ( 647)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/thread-self/cwd/wp-content/plugins/motopress-content-editor/mp/ce/iframeProd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/cwd/wp-content/plugins/motopress-content-editor/mp/ce/iframeProd/concat.js
steal("jquery/controller",function(c){c.Controller("CE.Grid",{myThis:null},{columnWidthPiece:null,columnMarginPiece:null,splitterWidthPiece:null,splitterMarginPiece:null,column:null,padding:null,columnCount:parent.CE.Iframe.myThis.gridObj.row.col,columnWidthStatus:null,colWidthByNumber:[],rowEl:c("<div />",{"class":parent.CE.Iframe.myThis.gridObj.row["class"]}),columnEl:c("<div />",{}),setup:function(a){var b=null;a.append(this.rowEl);for(a=1;a<=this.columnCount;a++)b=this.columnEl.clone().addClass(parent.CE.Iframe.myThis.gridObj.span["class"]+
a),this.rowEl.append(b),this.rowEl.append(this.columnEl.clone().addClass(parent.CE.Iframe.myThis.gridObj.span["class"]+1)),this.colWidthByNumber[a]=parseFloat(b.width())},init:function(a){CE.Grid.myThis=this;this.column=a.find("."+parent.CE.Iframe.myThis.gridObj.span.minclass+":last");this.setSize();c(window).on("resize",this.proxy("setSize"))},setSize:function(){var a=this.column.width();this.columnWidthStatus&&this.columnWidthStatus===a||(this.padding=parseFloat(this.column.css("padding-left")),
this.columnWidthPiece=parseFloat(this.column.width()),this.columnMarginPiece=parseFloat(this.column.css("margin-left")),this.splitterWidthPiece=this.columnMarginPiece/100*66.66666,this.splitterMarginPiece=this.columnMarginPiece/100*83.33333,this.columnWidthStatus&&(CE.Resizer.myThis.updateSplittableOptions(null,null,null,"init"),CE.Resizer.myThis.updateSplitterHeight(null,"init")),this.columnWidthStatus=a)}})});
steal("jquery/class",function(c){c.Class("CE.LeftBar",{myThis:null},{leftBar:c("<div />",{"class":"motopress-default",id:"motopress-content-editor-leftbar",tabIndex:-1}),leftBarOverlap:c("<div />",{"class":"motopress-leftbar-overlap"}),group:c("<div />",{"class":"motopress-leftbar-group motopress-default"}),groupInner:c("<div />",{"class":"motopress-leftbar-group-inner motopress-default"}),groupIcon:c("<div />",{"class":"motopress-leftbar-group-icon"}),groupActive:c("<div />",{"class":"motopress-leftbar-group-active motopress-default"}),
object:c("<section />",{"class":"motopress-ce-object motopress-default-drag"}),objectInner:c("<div />",{"class":"motopress-ce-object-inner motopress-default"}),objectDot:c("<div />",{"class":"motopress-ce-object-dot motopress-default"}),objectIcon:c("<div />",{"class":"motopress-ce-object-icon"}),objectName:c("<span />",{"class":"motopress-ce-object-name motopress-default motopress-no-color-text"}),library:null,setup:function(){this.getLibrary();this.groupIcon.append(this.groupActive).appendTo(this.groupInner);
this.groupInner.append(this.groupPopover).appendTo(this.group);this.objectInner.append(this.objectDot,this.objectIcon,this.objectName).appendTo(this.object);c("body").prepend(this.leftBar).append(this.leftBarOverlap)},init:function(){CE.LeftBar.myThis=this},getLibrary:function(){c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"json",data:{action:"motopress_ce_get_library",nonce:parent.motopressCE.nonces.motopress_ce_get_library,postID:parent.motopressCE.postID},success:function(a){CE.LeftBar.myThis.library=
a.groups;c.isPlainObject(a.globalPredefinedClasses)&&!c.isEmptyObject(a.globalPredefinedClasses)&&(CE.Style.globalPredefinedClasses=a.globalPredefinedClasses);c.isArray(a.tinyMCEStyleFormats)&&!c.isEmptyObject(a.tinyMCEStyleFormats)&&(CE.InlineEditor.styleFormats=a.tinyMCEStyleFormats);c.isPlainObject(a.templates)&&!c.isEmptyObject(a.templates)&&(CE.Template.templates=a.templates);CE.LeftBar.myThis.createGroup();parent.MP.Preloader.myThis.load(CE.LeftBar.shortName);new CE.DragDrop;c("#motopress-templates").length&&
new CE.Template(c("#motopress-templates"));parent.MP.Preloader.myThis.hide();c("form#post #motopress-ce-edited-post",parent.document).length||c("form#post",parent.document).prepend(c("<input>",{type:"hidden",id:"motopress-ce-edited-post",name:"motopress-ce-edited-post",value:parent.motopressCE.postID}))},error:function(a){parent.MP.Preloader.myThis.hide();a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),parent.MP.Flash.showMessage())}})},createGroup:function(){if(null!==
this.library&&!c.isEmptyObject(this.library)){for(var a in this.library)if(this.library[a].show){var b=this.group.clone();b.find(".motopress-leftbar-group-icon").css("background-image","url("+this.library[a].icon+")");b.clickover({html:!0,animation:!1,width:this.getPopupWidth(this.library[a]),title:localStorage.getItem("addBlockTip"),content:this.createObject(this.library[a].id,this.library[a].objects),onShown:function(){this.$tip.find(".arrow").removeClass("arrow").addClass("motopress-ce-arrow");
var a=this.$element.is(":first-child")?5:0,a=parseInt(this.$tip.css("top"))+parseInt(this.$tip.css("height"))/2-23+a;this.$tip.css("top",a);a=this.$tip.find(".popover-title");a.addClass("motopress-default motopress-default-text");if(a.next(".popover-content").length){var b=a.next();a.insertAfter(b);b.addClass("motopress-ce-object-container")}CE.DragDrop.myThis.makeDraggableNewBlock()},onHidden:function(){this.$element.find(".motopress-leftbar-group-active").removeClass("active")}});b.find(".motopress-leftbar-group-active").on("mousedown",
function(a){a.preventDefault();a.stopPropagation()});b.appendTo(this.leftBar)}this.hoverActive()}},getPopupWidth:function(a){return 6>Object.keys(a.objects).length?"205px":"620px"},createObject:function(a,b){if(!c.isEmptyObject(b)){var d=c("<div />"),e;for(e in b)if(b[e].show){var f=this.object.clone();this.setAttrs(f,a,b[e]);f.find(".motopress-ce-object-icon").css("background-image","url("+b[e].icon+")");f.find(".motopress-ce-object-name").text(b[e].name);d.append(f)}return d}},setAttrs:function(a,
b,d){a.attr({"data-motopress-close-type":d.closeType,"data-motopress-shortcode":d.id,"data-motopress-group":b,"data-motopress-resize":d.resize});b=d.parameters;if(!c.isEmptyObject(b)){var e={};c.each(b,function(a){e[a]={}});a.attr("data-motopress-parameters",JSON.stringify(e))}b=a.hasClass(this.object.attr("class"))?CE.Style.props:CE.Style.gridProps;c.extend(!0,b,d.styles,b);if(!c.isEmptyObject(b)){var f={};c.each(b,function(a){f[a]={}});a.attr("data-motopress-styles",JSON.stringify(f))}},hoverActive:function(){c(".motopress-leftbar-group .motopress-leftbar-group-active").mouseover(function(){c(this).addClass("active")})},
disable:function(){this.leftBarOverlap.show()},enable:function(){this.leftBarOverlap.hide()}})});
steal("jquery/class",function(c){c.Class("CE.ImageLibrary",{myThis:null},{frame:null,propertyImage:null,init:function(){CE.ImageLibrary.myThis=this;this.frame=parent.wp.media({id:"motopress-image-library",multiple:!1,describe:!1,toolbar:"select",sidebar:"settings",content:"upload",router:"browse",menu:"default",searchable:!0,filterable:!1,sortable:!1,title:localStorage.getItem("CEImageLibraryText"),button:{text:localStorage.getItem("CEImageLibraryText")},library:{type:"image"},contentUserSetting:!0,
syncSelection:!0});this.frame.on("open",this.proxy("onOpen"));this.frame.on("select",this.proxy("setImage"));this.frame.on("close",this.proxy("onClose"))},onOpen:function(){this.frame.reset();this.propertyImage=CE.Dialog.myThis.element.find('[data-motopress-open-img-lib="1"]');var a=this.propertyImage.controller();null!==a.id&&(a=parent.wp.media.attachment(a.id),a.fetch(),this.frame.state().get("selection").add(a))},setImage:function(){var a=this.frame.state().get("selection").models[0].attributes,
b="full";a.sizes.hasOwnProperty("medium")?b="medium":a.sizes.hasOwnProperty("thumbnail")&&(b="thumbnail");var c=a.sizes[b].url,b=this.propertyImage.controller(),c={id:a.id,src:c};null!==b.shortcode&&(c.full=a.sizes.full.url);b.set(c);b.showTools();b.element.trigger("change");this.propertyImage.removeAttr("data-motopress-open-img-lib")},onClose:function(){c("."+CE.Dialog.myThis.dialogClass).focus();var a=c(parent.document).find("html, body");a.addClass("motopress-ce-jumping-fix");var b=setTimeout(function(){a.removeClass("motopress-ce-jumping-fix");
clearTimeout(b)},0)}})});
steal("jquery/class",function(c){c.Class("CE.Link",{myThis:null,wpLink:null,submitCallback:null,closeCallback:null,inputs:{}},{init:function(){CE.Link.myThis=this;CE.Link.wpLink=parent.wpLink;CE.Link.inputs.submit=c("#wp-link-submit",parent.document);CE.Link.inputs.cancel=c("#wp-link-cancel",parent.document);CE.Link.inputs.url=c("#url-field",parent.document);CE.Link.inputs.title=c("#link-title-field",parent.document);CE.Link.inputs.openInNewTab=c("#link-target-checkbox",parent.document)},open:function(a,
b,d,e){var f={url:!0,title:!0,target:!0};"undefined"!==typeof b&&c.extend(f,b);"undefined"!=typeof CE.Link.wpLink&&(CE.Link.submitCallback=d,CE.Link.inputs.submit.off("mousedown.motopress-wplink-submit").on("mousedown.motopress-wplink-submit",this.wpSubmitButtonHandler),CE.Link.inputs.cancel.off("click.motopress-wplink-cancel").on("click.motopress-wplink-cancel",e),parent.wpActiveEditor=!0,CE.Link.wpLink.setDefaultValues=function(){var b=null,d=null,e=null;c.isPlainObject(a)?(b=a.href,d="_blank"===
a.target?!0:!1,e=a.textarea):(b=a.val(),e=a);if(""===b||"#"===b)b="http://";CE.Link.inputs.url.val(b);CE.Link.inputs.openInNewTab.prop("checked",d);CE.Link.wpLink.textarea=e},CE.Link.wpLink.open(),"undefined"===typeof CE.Link.inputs.close&&(CE.Link.inputs.close=c(".ui-dialog-titlebar-close",parent.document)),CE.Link.inputs.close.off("mousedown.motopress-wplink-close").on("mousedown.motopress-wplink-close",e),f.url||CE.Link.inputs.url.closest("div").hide(),f.title||CE.Link.inputs.title.closest("div").hide(),
f.target||CE.Link.inputs.openInNewTab.closest("div").hide(),parent.CE.Iframe.myThis.wpLinkCloseCallback(this.onDialogClose))},wpCancelButtonHandler:function(a){CE.Link.wpLink.close();return!1},wpSubmitButtonHandler:function(a){a=CE.Link.wpLink.getAttrs();if(a.href&&"http://"!=a.href)return CE.Link.submitCallback&&CE.Link.submitCallback(a),CE.Link.wpLink.close(),!1},onDialogClose:function(){CE.Link.inputs.submit.off("mousedown.motopress-wplink-submit");CE.Link.inputs.cancel.off("click.motopress-wplink-cancel");
CE.Link.inputs.close.off("mousedown.motopress-wplink-close");CE.Link.inputs.url.closest("div").show();CE.Link.inputs.title.closest("div").show();CE.Link.inputs.openInNewTab.closest("div").show()}})});
steal("jquery/class",function(c){c.Class("CE.WPGallery",{myThis:null},{frame:null,ctrl:null,init:function(){CE.WPGallery.myThis=this;var a=parent.wp.media,b=a.model.Attachment;a.controller.CEGallery=a.controller.FeaturedImage.extend({defaults:parent._.defaults({id:"motopress-media-library-gallery",title:localStorage.getItem("CEWpGalleryText"),toolbar:"main-insert",filterable:"uploaded",library:a.query({type:"image"}),multiple:"add",editable:!0,priority:60,syncSelection:!1},a.controller.Library.prototype.defaults),
updateSelection:function(){var a=this.get("selection"),c=CE.WPGallery.myThis.ctrl.get(),f;""!==c&&-1!==c&&(f=parent._.map(c.split(/,/),function(a){return b.get(a)}));a.reset(f)}});a.view.MediaFrame.CEGallery=a.view.MediaFrame.Post.extend({createStates:function(){this.states.add([new a.controller.CEGallery])},bindHandlers:function(){a.view.MediaFrame.Select.prototype.bindHandlers.apply(this,arguments);this.on("toolbar:create:main-insert",this.createToolbar,this);parent._.each({content:{embed:"embedContent",
"edit-selection":"editSelectionContent"},toolbar:{"main-insert":"mainInsertToolbar"}},function(a,b){parent._.each(a,function(a,c){this.on(b+":render:"+c,this[a],this)},this)},this)},mainInsertToolbar:function(a){var b=this;this.selectionStatusToolbar(a);a.set("insert",{style:"primary",priority:80,text:localStorage.getItem("CEWpGalleryText"),requires:{selection:!0},click:function(){var a=b.state(),c=a.get("selection");b.close();a.trigger("insert",c).reset()}})}});this.frame=new a.view.MediaFrame.CEGallery(parent._.defaults({},
{state:"motopress-media-library-gallery",title:localStorage.getItem("CEWpGalleryText"),library:{type:"image"},multiple:!0}));this.frame.on("open",this.proxy("onOpen"));this.frame.on("close",this.proxy("onClose"));this.frame.on("insert",this.proxy("setImage"))},open:function(a){this.ctrl=a;this.frame.open()},onOpen:function(){var a=this.frame;a.reset();var b=this.ctrl.getArray();if(null!==b){var c=null;b.forEach(function(b){c=parent.wp.media.attachment(b);c.fetch();a.state().get("selection").add(c)})}},
onClose:function(){c("."+CE.Dialog.myThis.dialogClass).focus();var a=c(parent.document).find("html, body");a.addClass("motopress-ce-jumping-fix");var b=setTimeout(function(){a.removeClass("motopress-ce-jumping-fix");clearTimeout(b)},0)},setImage:function(){var a=[],b=this.frame.state().get("selection").models;c.each(b,function(b,c){a.push(c.attributes.id)});this.ctrl.set(a);this.ctrl.element.trigger("change")}})});
steal("jquery/class",function(c){c.Class("CE.Dialog",{myThis:null},{dialogClass:"motopress-dialog",element:c("<div />",{id:"motopress-dialog"}),shortcode:null,dialog:null,minimizeRestoreBtn:c("<button />",{"class":"ui-dialog-titlebar-minimize"}),state:{minimized:"minimized",restored:"restored"},tabs:c("<div />",{id:"motopress-dialog-tabs"}),settingsTitle:c("<li />"),styleTitle:c("<li />"),settingsTab:c("<div />",{id:"motopress-dialog-settings-tab"}),styleTab:c("<div />",{id:"motopress-dialog-style-tab"}),
setup:function(){var a=c("<ul />");c("<a />",{href:"#"+this.settingsTab.attr("id"),"class":"motopress-text-no-color-text",text:localStorage.getItem("CESettings")}).append(c("<i />",{"class":"motopress-settings-icon"})).appendTo(this.settingsTitle);c("<a />",{href:"#"+this.styleTab.attr("id"),"class":"motopress-text-no-color-text",text:localStorage.getItem("CEStyle")}).append(c("<i />",{"class":"motopress-style-icon"})).appendTo(this.styleTitle);a.append(this.settingsTitle,this.styleTitle);this.tabs.append(a,
this.settingsTab,this.styleTab).appendTo(this.element);this.element.appendTo("body")},init:function(){CE.Dialog.myThis=this;var a=null,b=!1,d=0,e=parent.MP.Utils.version_compare(c.fn.jquery,"1.9.0","<"),f=sessionStorage.getItem("motopressDialogLeft"),g=sessionStorage.getItem("motopressDialogTop"),f=null!==f&&null!==g?[parseInt(f),parseInt(g)]:{my:"right-20 top+20",at:"right top",of:window},g=sessionStorage.getItem("motopressDialogWidth"),k=sessionStorage.getItem("motopressDialogHeight");null===g&&
(g=300);null===k&&(k=500);c.ui.dialog.prototype._focusTabbable=function(){};this.element.dialog({autoOpen:!1,closeOnEscape:!0,closeText:"",dialogClass:this.dialogClass,draggable:!0,modal:!1,position:f,resizable:!0,minWidth:280,width:g,minHeight:280,height:k,maxHeight:c(window).height(),create:function(){CE.Dialog.myThis.dialog=CE.Dialog.myThis.element.dialog("widget");a=CE.Dialog.myThis.dialog;a.on("resizestart",function(a,f){b=c(a.originalEvent.target).hasClass("ui-resizable-n");d=c(document).scrollTop();
e&&(b||c(this).css("top",parseInt(c(this).css("top"))-d))});a.on("resize",function(a,f){e&&b&&c(this).css("top",parseInt(c(this).css("top"))-d)});a.on("resizestop",function(a,b){CE.Dialog.myThis.savePosition(b);CE.Dialog.myThis.saveSize(b)});c(this).prev(".ui-dialog-titlebar").find(".ui-dialog-titlebar-close").before(CE.Dialog.myThis.minimizeRestoreBtn);var f=a.draggable("option","cancel")+", .ui-dialog-titlebar-minimize, .ui-dialog-titlebar-restore";a.draggable("option","cancel",f);CE.Dialog.myThis.minimizeRestoreBtn.on("click",
function(){c(this).hasClass("ui-dialog-titlebar-minimize")?CE.Dialog.myThis.minimize():CE.Dialog.myThis.restore()})},dragStart:function(a,b){CE.LeftBar.myThis.disable()},dragStop:function(a,b){CE.Dialog.myThis.savePosition(b);CE.LeftBar.myThis.enable()},close:function(){CE.Dialog.myThis.close()},open:function(){var b=c("."+CE.Selectable.myThis.selectedClass);b.length&&CE.Selectable.focusWithoutScroll(b.prev());var b=parseInt(sessionStorage.getItem("motopressDialogLeft")),d=parseInt(sessionStorage.getItem("motopressDialogTop")),
e=a.width(),f=a.height(),g=c(window).width(),k=c(window).height();f>k&&(f=k,a.height(f));0>d?a.css("top",0):f<k&&d+f>k?a.css("top",k-f):d+f>k?a.css("top",k-f):a.css("top",d);0>b?a.css("left",0):e<g&&b+e>g?a.css("left",g-e):a.css("left",b)},resizeStart:function(){CE.LeftBar.myThis.disable()},resizeStop:function(){CE.LeftBar.myThis.enable()}});c(parent.window).on("resize",this.proxy("onResize"));this.tabs.tabs({activate:function(a,b){CE.Dialog.myThis.shortcode.attr("data-motopress-dialog-tab",b.newTab.index())}});
this.element.on("click",function(a){c(a.target).is(".motopress-property-color-picker-preview, .motopress-property-input, .iris-picker, .iris-picker-inner, .iris-palette, .iris-palette-add")||c(".motopress-property-color-picker .motopress-property-input").iris("hide")})},onResize:function(){this.element.dialog("option","maxHeight",c(window).height())},open:function(a){a.hasClass("motopress-clmn-select-handle")?this.shortcode=a.closest(".motopress-clmn"):a.hasClass("motopress-row-select-handle")?this.shortcode=
a.closest(".motopress-row"):this.shortcode=a.parent(".motopress-helper").prev(".motopress-block-content").children("[data-motopress-shortcode]");var b=this.shortcode.controller(CE.Controls);if(null!==CE.LeftBar.myThis.library&&"undefined"!==typeof b.group&&"undefined"!==typeof b.shortcodeName&&CE.LeftBar.myThis.library[b.group].objects.hasOwnProperty(b.shortcodeName)){var d=CE.LeftBar.myThis.library[b.group].objects[b.shortcodeName];a=c.isEmptyObject(d.parameters);var e=this.isGrid?"gridProps":"props";
a&&c.isEmptyObject(CE.Style[e])||(this.setTitle(d.name),d=!1,this.shortcode.hasClass("motopress-new-object")&&(d=!0,this.shortcode.removeClass("motopress-new-object")),b.displaySettings(d),b.displayStyle(d),sessionStorage.getItem("motopressDialogState")===this.state.minimized?this.minimize():this.restore(),b=a?this.styleTitle.index():this.settingsTitle.index(),d=this.shortcode.attr("data-motopress-dialog-tab"),"undefined"!==typeof d&&(b=d),a?this.tabs.tabs("disable",this.settingsTitle.index()):!1!==
this.tabs.tabs("option","disabled")&&this.tabs.tabs("enable",this.settingsTitle.index()),this.tabs.tabs("option","active",b),this.element.dialog("open"),this.element.find(".motopress-controls").trigger("dialogOpen"))}},close:function(){this.setTitle();var a=c("."+CE.Selectable.myThis.selectedClass);a.length&&CE.Selectable.focusWithoutScroll(a.prev())},setTitle:function(a){a="undefined"!==typeof a?a:"";"string"===typeof a&&this.element.dialog("option","title",a)},savePosition:function(a){sessionStorage.setItem("motopressDialogLeft",
this.dialog.css("left"));sessionStorage.setItem("motopressDialogTop",this.dialog.css("top"))},saveSize:function(a){sessionStorage.setItem("motopressDialogWidth",a.size.width);sessionStorage.setItem("motopressDialogHeight",a.size.height)},minimize:function(){this.minimizeRestoreBtn.removeClass("ui-dialog-titlebar-minimize").addClass("ui-dialog-titlebar-restore");sessionStorage.setItem("motopressDialogState",this.state.minimized);this.element.nextAll().add(this.element).addClass("motopress-hide");this.dialog.removeClass("motopress-dialog-"+
this.state.restored).addClass("motopress-dialog-"+this.state.minimized)},restore:function(){this.minimizeRestoreBtn.removeClass("ui-dialog-titlebar-restore").addClass("ui-dialog-titlebar-minimize");sessionStorage.setItem("motopressDialogState",this.state.restored);this.element.nextAll().add(this.element).removeClass("motopress-hide");this.dialog.removeClass("motopress-dialog-"+this.state.minimized).addClass("motopress-dialog-"+this.state.restored)}})});
steal("jquery/class",function(c){c.Class("CE.WPAudio",{myThis:null},{frame:null,propertyAudio:null,propertyAudioTitle:null,init:function(){CE.WPAudio.myThis=this;this.frame=parent.wp.media({id:"motopress-audio-library",multiple:!1,describe:!1,toolbar:"select",sidebar:"settings",content:"upload",router:"browse",menu:"default",searchable:!0,filterable:!1,sortable:!1,title:"Set audio file",button:{text:"Set audio file"},library:{type:"audio"},contentUserSetting:!0,syncSelection:!0});this.frame.on("open",
this.proxy("onOpen"));this.frame.on("select",this.proxy("setAudio"));this.frame.on("close",this.proxy("onClose"))},onOpen:function(){var a;this.propertyAudio=CE.Dialog.myThis.element.find(".motopress-property-audio-id");this.propertyAudioTitle=CE.Dialog.myThis.element.find(".motopress-property-audio-title");a=this.propertyAudio.val();a=null!==a?parent.wp.media.attachment(a):parent.wp.media.attachment();a.fetch();this.frame.state().get("selection").add(a)},setAudio:function(){var a=this.frame.state().get("selection").models[0].attributes;
this.propertyAudio.val(a.id);this.propertyAudioTitle.val(a.title);this.propertyAudio.trigger("change")},onClose:function(){c("."+CE.Dialog.myThis.dialogClass).focus();var a=c(parent.document).find("html, body");a.addClass("motopress-ce-jumping-fix");var b=setTimeout(function(){a.removeClass("motopress-ce-jumping-fix");clearTimeout(b)},0)}});c.Class("CE.WPVideo",{myThis:null},{frame:null,propertyVideo:null,init:function(){CE.WPVideo.myThis=this;this.frame=parent.wp.media({id:"motopress-video-library",
multiple:!1,describe:!1,toolbar:"select",sidebar:"settings",content:"upload",router:"browse",menu:"default",searchable:!0,filterable:!1,sortable:!1,title:localStorage.getItem("CEVideoLibraryText"),button:{text:localStorage.getItem("CEVideoLibraryText")},library:{type:"video"},contentUserSetting:!0,syncSelection:!0});this.frame.on("open",this.proxy("onOpen"));this.frame.on("select",this.proxy("setVideo"));this.frame.on("close",this.proxy("onClose"))},onOpen:function(){this.propertyVideo=CE.Dialog.myThis.element.find("[data-motopress-open-video-lib=1]")},
setVideo:function(){var a=this.frame.state().get("selection").models[0].attributes.url,b=this.propertyVideo.controller();b.set(a);b.element.removeAttr("data-motopress-open-video-lib");b.element.trigger("change")},onClose:function(){c("."+CE.Dialog.myThis.dialogClass).focus();this.propertyVideo.removeAttr("data-motopress-open-video-lib");var a=c(parent.document).find("html, body");a.addClass("motopress-ce-jumping-fix");var b=setTimeout(function(){a.removeClass("motopress-ce-jumping-fix");clearTimeout(b)},
0)}})});
steal("jquery/class",function(c){c.Class("CE.Style",{gridProps:null,props:{margin:{type:"margin",label:localStorage.getItem("CEMarginLabel"),sides:["top","bottom","left","right"],values:["none",0,10,15,20,25,50,100],"default":["none","none","none","none"],classPrefix:"motopress-margin-",regExp:""},mp_style_classes:{type:"select2",label:localStorage.getItem("CEStyleClassesLabel"),description:localStorage.getItem("CEStyleClassesLabelDesc")}},globalPredefinedClasses:{},setup:function(){this.props.margin.regExp=new RegExp("^"+
this.props.margin.classPrefix+"(?:|("+this.props.margin.sides.join("|")+")-)("+this.props.margin.values.slice(1).join("|")+")$","i");this.gridProps=c.extend(!0,{},this.props);this.gridProps.margin.sides.splice(2);this.gridProps.margin["default"].splice(2);delete this.gridProps.margin.regExp}},{})});
steal("jquery/controller",function(c){c.Controller("CE.Ctrl",{processValue:function(a,b,c){(a="undefined"!==typeof c&&c&&"undefined"===typeof a?b:a)||(a="");return String(a)}},{name:null,dependency:!1,isChild:!1,disabled:!1,isStyle:!1,init:function(a,b){this.name=b.name;b.hasOwnProperty("dependency")&&(this.dependency=b.dependency);b.hasOwnProperty("isChild")&&(this.isChild=b.isChild);b.hasOwnProperty("disabled")&&(this.disabled="true"===b.disabled);b.hasOwnProperty("isStyle")&&(this.isStyle=b.isStyle)},
get:function(){},set:function(){},change:function(a,b){if(!this.isChild){var d=this,e=null;CE.Dialog.myThis.settingsTab.find('> .motopress-settings-forms > [data-motopress-parameter] > .motopress-controls, > .motopress-settings-forms > [data-motopress-parameter] > :not(".motopress-property-label, .motopress-property-description, hr") > .motopress-controls').each(function(){e=c(this).controller();e.dependency&&d.name===e.dependency.parameter&&(d.get()!=e.dependency.value?c(this).closest("[data-motopress-parameter]").addClass("motopress-hide"):
c(this).closest("[data-motopress-parameter]").removeClass("motopress-hide"))})}var f=CE.Dialog.myThis.shortcode.controller(CE.Controls);this.isStyle?f.saveStyle(this):f.saveSettings(this)}});CE.Ctrl("CE.CtrlInput",{},{get:function(){return this.element.val()},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);this.element.val(a)}});CE.Ctrl("CE.CtrlSpinner",{listensTo:["customize"]},{min:null,max:null,step:1,init:function(a,b){this._super(a,b);b.hasOwnProperty("min")&&(this.min=b.min);b.hasOwnProperty("max")&&
(this.max=b.max);b.hasOwnProperty("step")&&(this.step=b.step)},customize:function(a,b){var c=this;a.spinner({disabled:this.disabled,min:this.min,max:this.max,step:this.step,spin:function(b,f){var g=c.get(),k=setTimeout(function(){a.trigger("change",g);clearTimeout(k)},0)}})},change:function(a,b,c){var e=this.get();null!==e&&c!==e&&e>=this.min&&e<=this.max&&0===(e/this.step).toFixed(12)%1&&CE.Ctrl.prototype.change.apply(this,[a,b])},get:function(){return this.element.spinner("value")},set:function(a,
b,c){a=CE.Ctrl.processValue(a,b,c);"undefined"!==typeof this.element.data("uiSpinner")?this.element.spinner("value",a):this.element.val(a)}});CE.Ctrl("CE.CtrlLink",{},{get:function(){return c(".motopress-property-link-input",this.element).val()},set:function(a,b,d){a=CE.Ctrl.processValue(a,b,d);c(".motopress-property-link-input",this.element).val(a)},".motopress-property-button-default click":function(a){var b=c(".motopress-property-link-input",this.element);CE.Link.myThis.open(b,{title:!1,target:!1},
function(a){b.val!=a.href&&(b.val(a.href),b.trigger("change"))},CE.Link.myThis.wpCancelButtonHandler);return!1}});CE.Ctrl("CE.CtrlTextarea",{},{get:function(){return this.element.val()},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);this.element.val(a)}});CE.Ctrl("CE.CtrlTextarea64",{},{get:function(){return parent.MP.Utils.base64_encode(this.element.val())},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);this.element.val(parent.MP.Utils.base64_decode(a))}});CE.Ctrl("CE.CtrlTextareaTable",{},
{get:function(){return parent.MP.Utils.nl2br(this.element.val())},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);a=a.replace(/^<p>/,"").replace(/<\/p>$/,"");a=parent.MP.Utils.br2nl(a);this.element.val(a)}});CE.Ctrl("CE.CtrlTextareaTinymce",{},{textarea:null,currentShortcode:null,init:function(a,b){this._super(a,b);this.textarea=a.children(".motopress-property-textarea");this.currentShortcode=b.currentShortcode},get:function(){return this.textarea.val()},set:function(a,b,c){a=CE.Ctrl.processValue(a,
b,c);this.textarea.val(a)},".motopress-property-button-default click":function(a,b){var c=parent.CE.CodeModal.myThis.editor;parent.CE.CodeModal.currentShortcode=this.currentShortcode;parent.CE.CodeModal.currentTextareaTinymce=this.element;var e=this.get();e.length&&(null!==c&&c.setContent(e,{format:"html"}),parent.CE.CodeModal.myThis.content.val(e));parent.CE.CodeModal.myThis.saveHandler=this.saveHandler;parent.CE.CodeModal.myThis.element.data("modal").closeDialog=!1;parent.CE.CodeModal.myThis.element.mpmodal("show")},
saveHandler:function(a){a=parent.CE.CodeModal.myThis;a.switchVisual();var b=parent.CE.CodeModal.currentTextareaTinymce.controller(),c=a.editor.getContent({format:"html"});c.length&&(b.set(c),parent.CE.CodeModal.currentTextareaTinymce.trigger("change"));a.element.mpmodal("hide")}});CE.Ctrl("CE.CtrlAudio",{},{init:function(a,b){this._super(a,b);c(".motopress-property-audio-title",this.element).val(b.audioTitle).attr("disabled","disabled")},get:function(){return c(".motopress-property-audio-id",this.element).val()},
set:function(a,b,d){a=CE.Ctrl.processValue(a,b,d);c(".motopress-property-audio-id",this.element).val(a)},".motopress-property-button-default click":function(a){CE.WPAudio.myThis.frame.open(this)}});CE.Ctrl("CE.CtrlMediaVideo",{},{init:function(a,b){this._super(a,b)},get:function(){return c(".motopress-property-video-url",this.element).val()},set:function(a,b,d){a=CE.Ctrl.processValue(a,b,d);c(".motopress-property-video-url",this.element).val(a)},".motopress-property-button-default click":function(a){this.element.attr("data-motopress-open-video-lib",
1);CE.WPVideo.myThis.frame.open(this)}});CE.Ctrl("CE.CtrlImageGeneral",{listensTo:["dialogOpen"]},{autoOpen:!1,init:function(a,b){this._super(a,b);b.isNew&&"true"===b.autoOpen&&(this.autoOpen=!0)}});CE.CtrlImageGeneral("CE.CtrlImage",{thumbnail:parent.MP.Settings.pluginRootUrl+"/"+parent.MP.Settings.pluginName+"/images/ce/imageThumbnail.png"+parent.motopress.pluginVersionParam},{id:null,shortcode:null,init:function(a,b){this._super(a,b);this.shortcode=b.shortcode},dialogOpen:function(a){this.autoOpen&&
(a.find(".motopress-thumbnail-crop").trigger("click"),this.autoOpen=!1)},get:function(){return null!==this.id?this.id:""},set:function(a,b,d){if(c.isPlainObject(a)&&a.hasOwnProperty("id")&&a.hasOwnProperty("src"))this.id=a.id,this.setThumbnail(a.src,b,d),a.hasOwnProperty("full")&&(this.setFullSrc(a.full),this.shortcode.css("background-image","url('"+a.full+"')"));else if(c.isNumeric(a)&&null===this.id){this.showPreloader();this.id=a;var e=this;c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"text",
data:{action:"motopress_ce_get_attachment_thumbnail",nonce:parent.motopressCE.nonces.motopress_ce_get_attachment_thumbnail,postID:parent.motopressCE.postID,id:e.id},success:function(a){a=c.parseJSON(a);e.setThumbnail(a.medium,b,d);e.setFullSrc(a.full);e.hidePreloader()},error:function(a){a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),parent.MP.Flash.showMessage());e.setThumbnail(CE.CtrlImage.thumbnail,b,d);e.hidePreloader()}})}},setThumbnail:function(a,
b,c){a=CE.Ctrl.processValue(a,b,c);this.element.find(".motopress-thumbnail").attr("src",a)},setFullSrc:function(a){this.element.find(".motopress-thumbnail").attr("data-full-src",a)},".motopress-thumbnail-crop click":function(a,b){a.hasClass(CE.Shortcode.preloaderClass)||(this.element.attr("data-motopress-open-img-lib",1),CE.ImageLibrary.myThis.frame.open())},".motopress-icon-trash click":function(){this.id=null;this.element.find(".motopress-thumbnail").attr("src",CE.CtrlImage.thumbnail);this.hideTools();
null!==this.shortcode&&(this.shortcode.css("background-image",""),this.element.find(".motopress-thumbnail").removeAttr("data-full-src"));this.element.trigger("change")},showTools:function(){this.element.children(".motopress-image-tools").show()},hideTools:function(){this.element.children(".motopress-image-tools").hide()},showPreloader:function(){this.element.children(".motopress-thumbnail-crop").addClass(CE.Shortcode.preloaderClass).children(".motopress-thumbnail").css("visibility","hidden");this.hideTools()},
hidePreloader:function(){var a=this.element.children(".motopress-thumbnail-crop"),b=a.children(".motopress-thumbnail");a.removeClass(CE.Shortcode.preloaderClass);b.css("visibility","visible");b.attr("src")!==CE.CtrlImage.thumbnail&&this.showTools()}});CE.CtrlImageGeneral("CE.CtrlImageSlider",{},{ids:null,init:function(a,b){this._super(a,b)},dialogOpen:function(a){this.autoOpen&&(a.trigger("click"),this.autoOpen=!1)},get:function(){return null!==this.ids?this.ids:""},set:function(a,b,d){a=CE.Ctrl.processValue(a,
b,d);b=typeof a;if("object"===b){b="";d=a.length;for(var e=0;e<d;e++)b=e<d-1?b+(a[e]+","):b+a[e];this.ids=b}else if("number"===b||"string"===b)this.ids=c.trim(a)},getArray:function(){var a=[];if(this.ids)for(var a=this.ids.split(","),b,c=0;c<a.length;c++)(b=parseInt(a[c],10))?a[c]=b:delete a[c];return a},click:function(a){a.hasClass(CE.Shortcode.preloaderClass)||CE.WPGallery.myThis.open(this)}});CE.Ctrl("CE.CtrlVideo",{},{init:function(a,b){this._super(a,b);this.element.on("paste",function(){var b=
setTimeout(function(){a.blur();clearTimeout(b)},0)})},get:function(){return this.element.val()},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);this.element.val(a)}});CE.Ctrl("CE.CtrlCheckbox",{},{get:function(){return this.element.is(":checked").toString()},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);"true"===a?this.element.attr("checked","checked"):this.element.removeAttr("checked")}});CE.CtrlCheckbox("CE.CtrlGroupCheckbox",{},{change:function(a,b){a.is(":checked")&&a.closest(".motopress-property-group-accordion-item").siblings().find('.motopress-property-group-accordion-item-content > [data-motopress-parameter="'+
this.name+'"] > .motopress-controls').each(function(){var a=c(this).controller();"true"===a.get()&&(a.set("false"),CE.Ctrl.prototype.change.apply(a,[c(this),b]))});CE.Ctrl.prototype.change.apply(this,[a,b])}});CE.Ctrl("CE.CtrlSelect",{listensTo:["customize"],init:function(){c("body").on("click",".motopress-property-select:not(.open) > .dropdown-toggle",function(){var a=c(this).next(),b=a.find("ul > li").length;a.find("li:eq("+(6<=b?5:b-1)+") > a").focus();a.find("ul > li > a.motopress-dropdown-selected").focus()})},
setSelected:function(a){var b=a.find("option"),b=b.index(b.filter(":selected"));a=a.next().find(".dropdown-menu > ul > li");a.children("a.motopress-dropdown-selected").removeClass("motopress-dropdown-selected");a.filter('[rel="'+b+'"]').children("a").addClass("motopress-dropdown-selected")}},{get:function(){return this.element.val()},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);this.element.find('[value="'+a+'"]').attr("selected","selected")},change:function(a){this._super();CE.CtrlSelect.setSelected(a)},
customize:function(a){"undefined"!==typeof a.data("selectpicker")&&(a.next().remove(),c.removeData(a[0],"selectpicker"));a.selectpicker({size:6});var b=a.next();b.removeClass("ce_ctrl_select motopress-controls");b=b.children(".dropdown-toggle");b.html(b.html().replace(/&nbsp;/g,""));CE.CtrlSelect.setSelected(a)}});CE.Ctrl("CE.CtrlSelect2",{listensTo:["customize"]},{isPreview:!1,previewClass:null,unsetClasses:[],data:null,init:function(a,b){this._super(a,b);this.options.style=CE.LeftBar.myThis.library[this.options.instance.group].objects[this.options.instance.shortcodeName].styles.mp_style_classes},
get:function(){var a=this,b=this.element.select2("data"),d="";this.isPreview&&(b=b.filter(function(b){return-1===c.inArray(b.id,a.unsetClasses)}));b.forEach(function(a,b){a.hasOwnProperty("locked")||!0===a.locked||(d+=""!==d?" "+a.id:a.id)});this.isPreview&&(d+=""!==d?" "+this.previewClass:this.previewClass);return d},set:function(a,b,d){a=CE.Ctrl.processValue(a,b,d);c.isEmptyObject(this.options.style.basic)||(b=this.getBasicClassesString(),a=a?b+" "+a:b);this.options.value=a;this.element.val(a)},
customize:function(a,b){var d=this;this.data=this.getClassesList();a.select2({multiple:!0,separator:" ",closeOnSelect:!1,createSearchChoice:function(a,b){if(/^[-_A-Za-z0-9]+$/.test(a)&&0===c(b).filter(function(){return this.hasOwnProperty("id")?0===this.text.toUpperCase().localeCompare(a.toUpperCase())||0===this.id.toUpperCase().localeCompare(a.toUpperCase()):0!==c(this.children).filter(function(){return 0===this.text.toUpperCase().localeCompare(a.toUpperCase())||0===this.id.toUpperCase().localeCompare(a.toUpperCase())}).length}).length)return{id:a.toLowerCase(),
text:a,custom:!0}},initSelection:function(a,b){b(d.valueToData(d.options.value.split(" ")))},query:function(a){d.options.value=d.element.val();var b={results:[]};c.each(d.data,function(g,k){k.hasOwnProperty("children")?(result={text:k.text,children:[]},result.children=c.makeArray(k.children.filter(function(b){return(0<=b.id.toUpperCase().indexOf(a.term.toUpperCase())||0<=b.text.toUpperCase().indexOf(a.term.toUpperCase()))&&c.inArray(b.id,-1===d.options.value.split(" "))})),result.children.length&&
b.results.push(result)):(0<=k.id.toUpperCase().indexOf(a.term.toUpperCase())||0<=k.text.toUpperCase().indexOf(a.term.toUpperCase()))&&-1===c.inArray(k.id,d.options.value.split(" "))&&b.results.push(k)});a.callback(b)},formatNoMatches:function(){return localStorage.getItem("CEStyleClassesFormatNoMatches")},formatResult:function(a,b){if(a.hasOwnProperty("children"))return a.text;a.hasOwnProperty("disabled")&&a.disabled&&b.attr("title",localStorage.getItem("CELiteTooltipText"));return'<i class="select2-preview-icon"'+
(a.hasOwnProperty("external")?' data-external="'+a.external+'"':"")+' data-value="'+a.id+'"></i>'+a.text},dropdownCssClass:"select2-control-dropdown"});d.select2el=a.closest(".select2-container").find("");a.on("select2-highlight",function(a){d.unsetClasses=d.getUnsetClasses(a.val)});c(".select2-control-dropdown").off("mouseover",".select2-preview-icon").on("mouseover",".select2-preview-icon",function(){var a=c(this).attr("data-external");"undefined"!==typeof a&&0===c('[href="'+a+'"]').length&&(a=
c("<link />",{rel:"stylesheet",type:"text/css",href:a}),c("head").append(a));a=c(this).attr("data-value");d.unsetClasses=d.getUnsetClasses(a);d.isPreview=!0;d.setPreviewClass(a)});c(".select2-control-dropdown").off("mouseleave").on("mouseleave",".select2-preview-icon",function(){d.isPreview=!1;d.unsetClasses=[];d.setPreviewClass()});a.on("select2-blur",function(a){d.isPreview=!1;d.unsetClasses=[];d.setPreviewClass()});a.on("select2-close",function(a){d.isPreview=!1;d.unsetClasses=[];d.setPreviewClass()});
a.on("select2-selecting",function(a){d.isPreview=!1;if(a.object.hasOwnProperty("external")&&0===c('[href="'+a.object.external+'"]').length){var b=c("<link />",{rel:"stylesheet",type:"text/css",href:a.object.external});c("head").append(b)}b=c(d.element).select2("val");b=d.excludeGroupValues(b);a.object.hasOwnProperty("custom")&&!0===a.object.custom&&d.data.push({id:a.object.id,text:a.object.text,custom:a.object.custom});d.element.select2("data",d.valueToData(b))});a.on("select2-loaded",function(a,
b){c("#select2-drop>.select2-results>li.select2-result.select2-selected").each(function(){$this=c(this);$this.find(".select2-disabled:not(.select2-selected)").length&&$this.removeClass("select2-selected")})})},valueToData:function(a){var b=this,d=[];c.each(a,function(a,f){c.each(b.data,function(a){b.data[a].hasOwnProperty("children")?c.each(b.data[a].children,function(c){b.data[a].children[c].id===f&&d.push(b.data[a].children[c])}):b.data[a].id===f&&d.push(b.data[a])})});return d},excludeGroupValues:function(a){var b=
this;return a=a.filter(function(a){return-1===c.inArray(a,b.unsetClasses)})},setPreviewClass:function(a){this.previewClass=a;this.options.instance.saveStyle(this)},getUnsetClasses:function(a){var b=[];c.each(this.data,function(d,e){var f=!1;if(e.hasOwnProperty("children")&&(void 0===e.allowMultiple||!1===e.allowMultiple)){c.each(e.children,function(c,d){d.id===a?f=!0:b.push(d.id)});if(f)return!1;b=[]}});return b},getClassesList:function(){var a=this.getPredefinedClasses(),b=""!==this.options.value?
this.options.value.split(" "):[],d=this.getGlobalPredefinedClasses(),e=this.getBasicClasses().concat(d,a);b.forEach(function(a,b){0===c(e).filter(function(){var b=!1;return b=this.hasOwnProperty("children")?0!==c(this.children).filter(function(){return this.hasOwnProperty("id")?0===this.id.localeCompare(a):!1}).length:this.hasOwnProperty("id")?0===this.id.localeCompare(a):!1}).length&&e.push({id:a,text:a})});return e},getBasicClasses:function(){basicClasses=[];c.isEmptyObject(this.options.style.basic)||
(this.options.style.basic.hasOwnProperty("class")?basicClasses.push({id:this.options.style.basic["class"],text:this.options.style.basic.label,locked:!0}):c.each(this.options.style.basic,function(a,b){basicClasses.push({id:b["class"],text:b.label,locked:!0})}));return basicClasses},getBasicClassesString:function(){var a=this.getBasicClasses(),b=[];c.each(a,function(a,c){b.push(c.id)});return b.join(" ")},getPredefinedClasses:function(){var a=[];if(!c.isEmptyObject(this.options.style.predefined)){var b=
this.options.style.predefined;for(group in b)if(b[group].hasOwnProperty("values")){var d=[];for(el in b[group].values)d.push({id:b[group].values[el]["class"],text:b[group].values[el].label,disabled:b[group].values[el].hasOwnProperty("disabled")&&b[group].values[el].disabled,external:b[group].values[el].external});a.push({text:b[group].label,children:d,allowMultiple:b[group].allowMultiple})}else a.push({id:b[group]["class"],text:b[group].label,disabled:b[group].hasOwnProperty("disabled")&&b[group].disabled,
external:b[group].external})}return a},getGlobalPredefinedClasses:function(){var a=[];c.each(CE.Style.globalPredefinedClasses,function(b,d){if(d.hasOwnProperty("values")){var e=[];c.each(d.values,function(a,b){e.push({id:b["class"],text:b.label,disabled:b.hasOwnProperty("disabled")&&b.disabled})});a.push({text:d.label,children:e,allowMultiple:d.allowMultiple})}else a.push({id:d["class"],text:d.label,disabled:d.hasOwnProperty("disabled")&&d.disabled})});return a}});CE.Ctrl("CE.CtrlEditorButton",{},
{dragHandle:null,init:function(a,b){this._super(a,b);this.dragHandle=b.shortcode.parent(".motopress-block-content").next(".motopress-helper").children(".motopress-drag-handle")},click:function(){this.dragHandle.click()}});CE.Ctrl("CE.CtrlColorPicker",{listensTo:["customize","dialogOpen"]},{lastTimerId:null,preview:null,input:null,init:function(a,b){this._super(a,b);this.preview=a.children(".motopress-property-color-picker-preview");this.input=a.children(".motopress-property-input")},set:function(a,
b,c){a=CE.Ctrl.processValue(a,b,c);this.input.val(a);""!==a&&this.preview.css("background-color",a)},get:function(){return this.input.val()},change:function(a,b){},dialogOpen:function(){this.input.iris("hide")},".motopress-property-input click":function(a,b){c(".motopress-property-color-picker>.motopress-property-input").iris("hide");this.input.iris("show")},".iris-palette-add click":function(a,b){var d=parent.MP.Settings.palettes;d.pop();d.unshift(this.input.iris("option","color"));c.ajax({url:parent.motopress.ajaxUrl,
type:"POST",data:{action:"motopress_ce_colorpicker_update_palettes",nonce:parent.motopressCE.nonces.motopress_ce_colorpicker_update_palettes,postID:parent.motopressCE.postID,palettes:d},success:function(a){a=c.parseJSON(a);parent.MP.Settings.palettes=a.palettes;c(".motopress-property-color-picker>.motopress-property-input").iris("option","palettes",parent.MP.Settings.palettes)},error:function(a){a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),
parent.MP.Flash.showMessage())}})},customize:function(a,b){var c=this;this.input.iris({change:function(e,f){c.preview.css("background-color",f.color.toString());clearTimeout(c.lastTimerId);c.lastTimerId=setTimeout(function(){CE.Ctrl.prototype.change.apply(c,[a,b])},1E3)},palettes:parent.MP.Settings.palettes,width:213})}});CE.Ctrl("CE.CtrlSlider",{},{slider:null,span:null,init:function(a,b){var c=this;this._super(a,b);this.slider=a.children(".motopress-property-slider");this.span=a.children(".motopress-property-slider-value");
this.slider.slider({range:"min",min:parseInt(b.min),max:parseInt(b.max),step:parseInt(b.step),value:parseInt(b.value),slide:function(a,b){c.span.html(b.value)},change:function(b,c){"undefined"!==typeof b.handleObj&&a.trigger("change")},disabled:"true"==b.disabled})},set:function(a,b,c){a=CE.Ctrl.processValue(a,b,c);this.span.text(a);this.slider.slider("value",a)},get:function(){return this.slider.slider("option","value")}});CE.Ctrl("CE.CtrlRadioButtons",{},{init:function(a,b){this._super(a,b);this.element.buttonset()},
set:function(a,b,c){a="undefined"!==typeof a?a:b;this.element.find(':radio[value="'+a+'"]').attr("checked",!0);this.element.find(':radio[value="'+a+'"]').button("refresh")},get:function(){return this.element.find(":radio:checked").val()}});CE.Ctrl("CE.CtrlGroup",{listensTo:["render"]},{currentSpan:null,shortcode:null,group:null,shortcodeName:null,label:null,accordion:null,button:null,oldItemIndex:null,init:function(a,b){this._super(a,b);this.currentSpan=b.currentSpan;this.shortcode=b.shortcode;this.group=
this.shortcode.attr("data-motopress-group");this.shortcodeName=this.shortcode.attr("data-motopress-shortcode");this.label=b.label;this.accordion=a.children(".motopress-property-group-accordion");this.button=a.find("> .motopress-property-button-wrapper > .motopress-property-button-default")},render:function(a,b,d){this.updateLabel();var e=this;b=this.shortcode.attr("data-motopress-active-item");b=d&&"undefined"!==typeof b?parseInt(b):!1;this.accordion.accordion({active:b,header:"> div > h3",heightStyle:"content",
collapsible:!0,beforeActivate:function(a,b){a.hasOwnProperty("originalEvent")&&a.originalEvent.hasOwnProperty("target")&&c(a.originalEvent.target).hasClass("motopress-property-group-accordion-item-remove")&&a.preventDefault()},activate:function(a,b){var c=e.shortcode.children("div"),d=!1;if(b.newHeader.length&&!b.oldHeader.length||b.newHeader.length&&b.oldHeader.length&&!b.newHeader.is(b.oldHeader))switch(d=b.newHeader.parent(".motopress-property-group-accordion-item").index(),e.shortcode.attr("data-motopress-active-item",
d),e.shortcodeName){case "mp_tabs":try{c.tabs("option","active",d)}catch(l){}break;case "mp_accordion":try{c.accordion("option","active",d)}catch(n){}}else switch(e.shortcodeName){case "mp_accordion":e.shortcode.attr("data-motopress-active-item",d);try{c.accordion("option","active",d)}catch(m){}}}}).sortable({axis:"y",handle:"h3 > .ui-accordion-header-icon",update:function(b,c){var d=c.item.closest(".motopress-property-group-accordion-item").index(),h=e.shortcode.children("div").children("[data-motopress-shortcode]");
e.oldItemIndex<d?h.eq(e.oldItemIndex).insertAfter(h.eq(d)):h.eq(e.oldItemIndex).insertBefore(h.eq(d));a.trigger("change")},start:function(a,b){e.oldItemIndex=b.item.closest(".motopress-property-group-accordion-item").index()}});this.disabled&&(!d||d&&this.accordion.children(".motopress-property-group-accordion-item").length)&&this.button.attr("disabled",!0)},change:function(a,b,d){this.updateLabel();var e=this,f="";this.shortcode.children("div").children("[data-motopress-shortcode]").each(function(){if(d&&
"true"===c(this).attr("data-motopress-new")){var a="undefined"!==typeof c(this).attr("data-motopress-parameters")?c(this).attr("data-motopress-parameters"):null,b="undefined"!==typeof c(this).attr("data-motopress-styles")?c(this).attr("data-motopress-styles"):null,h=e.currentSpan.controller();h.setDefaultAttrs(a,c(this));h.setDefaultStyle(b);c(this).removeAttr("data-motopress-new")}f=parent.CE.Save.getShortcode(f,c(this))});this.shortcode.attr("data-motopress-content",f);CE.Ctrl.prototype.change.apply(this,
[a,b])},"> .motopress-property-button-wrapper > .motopress-property-button-default click":function(a,b,d){b.stopPropagation();if(!this.disabled||"undefined"!==typeof d){a=c("<div />",{"data-motopress-new":"true"});b=null;switch(this.shortcodeName){case "mp_tabs":b=CE.LeftBar.myThis.library[this.group].objects.mp_tab;break;case "mp_accordion":b=CE.LeftBar.myThis.library[this.group].objects.mp_accordion_item}null!==b&&CE.LeftBar.myThis.setAttrs(a,this.group,b);if("undefined"!==typeof d){b=c();for(var e=
0;e<d;e++)b=b.add(a.clone());a=b}b=this.shortcode.children("div");b.append(a);"undefined"===typeof d&&(d=b.children("[data-motopress-shortcode]").index(c(a).eq(-1)),this.shortcode.attr("data-motopress-active-item",d));d=this.currentSpan.controller();d.generateSettingsForms(void 0,void 0,this.name);d.displaySettings(!0,void 0,void 0,this.name,!0)}},".motopress-property-group-accordion-item-remove click":function(a,b){b.stopPropagation();var c=a.closest(".motopress-property-group-accordion-item").index();
this.shortcode.children("div").children("[data-motopress-shortcode]:eq("+c+")").remove();this.shortcode.removeAttr("data-motopress-active-item");c=this.currentSpan.controller();c.generateSettingsForms(void 0,void 0,this.name);c.displaySettings(!1,void 0,void 0,this.name,!0)},updateLabel:function(){if(this.label.hasOwnProperty("parameter")){var a=this;this.accordion.find(".motopress-property-group-accordion-item-label-text").each(function(){var b=c(this).parent(".motopress-property-group-accordion-item-label").next(".motopress-property-group-accordion-item-content").find('[data-motopress-parameter="'+
a.label.parameter+'"] > .motopress-controls, [data-motopress-parameter="'+a.label.parameter+'"] > :not(".motopress-property-label, .motopress-property-description, hr") > .motopress-controls');b.length&&c(this).text(b.controller().get())})}}});CE.Ctrl("CE.CtrlMargin",{},{margin:null,init:function(a,b){this._super(a,b);this.margin=b.margin},get:function(){var a=[],b=this,d=!0,b=this;c.each(b.margin.sides,function(c,f){var g=b.element.find('[data-motopress-margin-side="'+f+'"] .'+b.margin.classPrefix+
"value").text();a.push(g);g!==b.margin.values[0]&&(d=!1)});return d?"":a.join(",")},set:function(a,b,d){a=CE.Ctrl.processValue(a,b,d);if("string"===typeof a){if(!a.length)return;a=a.split(",")}var e=this;c.each(a,function(a,b){var c=parseInt(b);isNaN(c)||(b=c);var d=e.element.find('[data-motopress-margin-side="'+e.margin.sides[a]+'"]'),c=d.find("."+e.margin.classPrefix+"icon"),l=d.find("."+e.margin.classPrefix+"value"),d=d.find("."+e.margin.classPrefix+"values");l.text(b);d.removeAttr("data-motopress-margin-disabled");
d.filter('[data-motopress-margin-value="'+b+'"]').attr("data-motopress-margin-disabled","");b!==e.margin["default"][a]?(c.attr("data-motopress-margin-active",""),l.attr("data-motopress-margin-active","")):(c.removeAttr("data-motopress-margin-active"),l.removeAttr("data-motopress-margin-active"))})},".motopress-margin-values click":function(a){if("undefined"===typeof a.attr("data-motopress-margin-disabled")){var b=a.closest("[data-motopress-margin-side]"),c=b.index(),e=b.find("."+this.margin.classPrefix+
"icon"),f=b.find("."+this.margin.classPrefix+"value"),b=b.find("."+this.margin.classPrefix+"values"),g=a.text(),k=parseInt(g);isNaN(k)||(g=k);f.text(g);b.removeAttr("data-motopress-margin-disabled");a.attr("data-motopress-margin-disabled","");g!==this.margin["default"][c]?(e.attr("data-motopress-margin-active",""),f.attr("data-motopress-margin-active","")):(e.removeAttr("data-motopress-margin-active"),f.removeAttr("data-motopress-margin-active"));this.element.trigger("change")}},getClasses:function(a){var b=
[];if("undefined"!==typeof a&&a.length){"string"===typeof a&&(a=a.split(","));var d=[];c.each(a,function(a,b){-1===c.inArray(b,d)&&d.push(b)});var e=1===d.length;if(4===a.length&&e&&d[0]!==this.margin.values[0])b.push(this.margin.classPrefix+d[0]);else{var f=this;c.each(a,function(a,c){c!==f.margin["default"][a]&&b.push(f.margin.classPrefix+f.margin.sides[a]+"-"+c)})}}return b.join(" ")}})});
steal("jquery/class",function(c){c.Class("CE.CtrlTemplates",{createLegend:function(a){return"undefined"!==typeof a&&a.length?(a=c("<div />",{"class":"motopress-property-legend",html:a}),c.merge(a,c("<hr />"))):null},createLabel:function(a){return c("<label />",{"class":"motopress-property-label",text:a})},createDescription:function(a){a=c("<div />",{"class":"motopress-property-description",html:a});return c.merge(a,c("<hr />"))},createInput:function(a,b,d,e){"undefined"===typeof b&&(b=null);"undefined"===
typeof d&&(d="text");"undefined"===typeof e&&(e="input");var f={};if(a.hasOwnProperty("disabled")){var g="true"===a.disabled;g&&(f.disabled=g)}b=c("<input />",{"class":"motopress-property-"+e,type:d,name:b});this.setAttrs(b,a,f);return b},createLink:function(a,b){var d=c("<div />",{"class":"motopress-property-link"}),e=this.createInput(a,b,void 0,"link-input"),f=this.createButton(a);d.append(e,f);this.setAttrs(d,a,{});return d},createMedia:function(a,b){"undefined"===typeof b&&(b=null);var d="",e=
{},f=c("<div />",{"class":"motopress-property-link"});switch(a.type){case "audio":this.createInput(a,b,"hidden","audio-id").appendTo(f);d="audio-title";break;case "media-video":d="video-url"}var d=this.createInput(a,b,"text",d).appendTo(f),g=this.createButton(a,b).appendTo(f);this.setAttrs(d,a,e);this.setAttrs(g,a,e);return f},createTextarea:function(a){var b={rows:5,cols:10};if(a.hasOwnProperty("disabled")){var d="true"===a.disabled;d&&(b.disabled=d)}d=c("<textarea />",{"class":"motopress-property-textarea"});
this.setAttrs(d,a,b);return d},createTextareaTinyMCE:function(a){var b=this.createTextarea(a);a=this.createButton(a);return c("<div />",{"class":"motopress-property-textarea-tinymce"}).append(b,a)},createImage:function(a){var b=c("<div />",{"class":"motopress-property-image"}),d=c("<div />",{"class":"motopress-image-tools"});c("<div />",{"class":"motopress-default motopress-icon-trash motopress-icon-white"}).appendTo(d);a.hasOwnProperty("value")&&a.value||d.hide();var e=c("<div />",{"class":"motopress-thumbnail-crop"}),
f=c("<img />",{src:CE.CtrlImage.thumbnail,"class":"motopress-thumbnail"}).appendTo(e);b.append(e,d);a.hasOwnProperty("disabled")&&"true"===a.disabled&&b.append(c("<div />",{"class":"motopress-image-disabled"}));this.setAttrs(f,a,{});return b},createVideo:function(a,b){"undefined"===typeof b&&(b=null);var c=this.createInput(a,b,"text","video");this.setAttrs(c,a,{});return c},createCheckbox:function(a,b){"undefined"===typeof b&&(b=null);var c=this.createInput(a,b,"checkbox","checkbox-input motopress-property-input");
this.setAttrs(c,a,{});return c},createSelect:function(a,b){"undefined"===typeof b&&(b=null);var d={};if(a.hasOwnProperty("disabled")){var e="true"===a.disabled;e&&(d.disabled=e)}var f=c("<select />",{"class":"motopress-property-select",name:b});c.each(a.list,function(a,b){f.append(c("<option />",{value:a,text:b}))});this.setAttrs(f,a,d);return f},createColorSelect:function(a,b){"undefined"===typeof b&&(b=null);var d={};if(a.hasOwnProperty("disabled")){var e="true"===a.disabled;e&&(d.disabled=e)}var f=
c("<select />",{"class":"motopress-property-select color-select",name:b}),g="undefined"===typeof a["class-prefix"]?"":a["class-prefix"];c.each(a.list,function(a,b){var d="string"==typeof a?a.toLowerCase():"";f.append(c("<option />",{value:a,text:b}).attr("data-content",'<span class="color '+g+d+'"></span><span>'+b+"</span>"))});this.setAttrs(f,a,d);return f},createButton:function(a,b,d){"undefined"===typeof b&&(b=null);"undefined"!==typeof d&&d||(d="default");var e={};if(a.hasOwnProperty("disabled")){var f=
"true"===a.disabled;f&&(e.disabled=f)}b=c("<button />",{"class":"motopress-property-button-"+d,text:a.text,name:b});this.setAttrs(b,a,e);return b},createColorPicker:function(a,b){var d=c("<div>",{"class":"motopress-property-color-picker-preview"}),e=this.createInput(a,b),d=c("<div />",{"class":"motopress-property-color-picker"}).append(d,e);this.setAttrs(d,a,{});return d},createSlider:function(a,b){var d=c("<div>",{"class":"motopress-property-slider"}),e=c("<span>",{type:"text","class":"motopress-property-slider-value",
text:a["default"]}),f=c("<div>",{"class":"motopress-property-slider"});d.appendTo(f);e.appendTo(f);return f},createRadioButtons:function(a){var b=this,d={};if(a.hasOwnProperty("disabled")){var e="true"===a.disabled;e&&(d.disabled=e)}var f=c("<div />",{"class":"motopress-property-radio-buttons"}),g=parent.MP.Utils.uniqid(),k=0;c.each(a.list,function(e,l){var n=c("<input />",{type:"radio",id:g+k,name:g,value:e});b.setAttrs(n,a,d);var m=c("<label />",{"for":g+k,text:l});f.append(n,m);k++});this.setAttrs(f,
a,d);return f},createGroup:function(a){var b=c("<div />",{"class":"motopress-property-group"});c("<div />",{"class":"motopress-property-group-accordion"}).appendTo(b);var d=c("<div />",{"class":"motopress-property-button-wrapper"}).appendTo(b),e=c.extend({},a);a.hasOwnProperty("disabled")&&"true"===a.disabled&&(delete e.disabled,c("<div />",{"class":"motopress-property-disabled"}).appendTo(d));this.createButton(e).appendTo(d);this.setAttrs(b,a,{});return b},createItem:function(a,b){var d=c("<span />",
{"class":"motopress-property-group-accordion-item-label-text",text:a.label["default"]+" "+b}),e=c("<span />",{"class":"motopress-property-group-accordion-item-remove"}),d=c("<h3 />",{"class":"motopress-property-group-accordion-item-label"}).append(d,e),e=c("<div />",{"class":"motopress-property-group-accordion-item-content"});return c("<div />",{"class":"motopress-property-group-accordion-item"}).append(d,e)},createMargin:function(a){var b=c("<table />",{"class":"motopress-property-margin"});c.each(a.sides,
function(d,e){var f=c("<tr />",{"data-motopress-margin-side":e}).appendTo(b);c("<td />").append(c("<i />",{"class":a.classPrefix+"icon "+a.classPrefix+"icon-"+e})).appendTo(f);c("<td />").append(c("<div />",{"class":a.classPrefix+"value",text:a["default"][d]})).appendTo(f);c.each(a.values,function(b,d){c("<td />").append(c("<div />",{"class":a.classPrefix+"values","data-motopress-margin-value":d,text:d})).appendTo(f)})});return b},setAttrs:function(a,b,d){"object"!==typeof b&&(b={});c.each(d,function(c,
d){"undefined"!==typeof b[c]?a.attr(c,b[c]):null!==d&&a.attr(c,d)})}},{})});
steal("jquery/controller",function(c){c.Controller("CE.Shortcode",{listensTo:["render"],preloaderClass:"motopress-small-preload"},{group:null,isGrid:!1,shortcodeName:null,shortcode:null,child:null,init:function(a,b){this.group=a.attr("data-motopress-group");this.isGrid=this.group===CE.LeftBar.myThis.library.mp_grid.id;this.shortcodeName=a.attr("data-motopress-shortcode");this.shortcode=a;this.isGrid||(this.child=this.shortcode.children("div"))},renderShortcode:function(a){if(!this.isGrid){a="undefined"!==
typeof a&&a?!0:!1;var b=this,d=this.element.parent("."+CE.DragDrop.myThis.blockContent.attr("class")).next("."+CE.DragDrop.myThis.helper.attr("class")).children("."+CE.DragDrop.myThis.dragHandle.attr("class"));d.addClass(CE.Shortcode.preloaderClass);var e=this.element.attr("data-motopress-close-type"),f="undefined"!==typeof this.element.attr("data-motopress-wrap-render")?this.element.attr("data-motopress-wrap-render"):null,g="undefined"!==typeof this.element.attr("data-motopress-parameters")?this.element.attr("data-motopress-parameters"):
null,k="undefined"!==typeof this.element.attr("data-motopress-styles")?this.element.attr("data-motopress-styles"):null;a&&g&&(g=this.setDefaultAttrs(g));a&&k&&(k=this.setDefaultStyle(k));var h="undefined"!==typeof this.element.attr("data-motopress-content")?this.element.attr("data-motopress-content").replace(/\[\]/g,"["):null;"undefined"!==typeof this.element.attr("data-motopress-active-item")&&(g=c.parseJSON(g),g.active={value:this.element.attr("data-motopress-active-item")},g=JSON.stringify(g));
c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"html",data:{action:"motopress_ce_render_shortcode",nonce:parent.motopressCE.nonces.motopress_ce_render_shortcode,postID:parent.motopressCE.postID,closeType:e,shortcode:b.shortcodeName,wrapRender:f,parameters:g,styles:k,content:h},success:function(e){var f=b.element.closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');if(!f.closest(".motopress-row").parent(".motopress-content-wrapper").length){var f=f.closest(".motopress-row").nextAll(".motopress-handle-middle-in:last"),
g=parseInt(f.css("min-height"));f.height(g)}c(".motopress-content-wrapper > .motopress-handle-middle-in:last").height("");b.element.html(e);b.child=b.element.children("div");e=b.shortcode.find("img");var k=e.length,h=0;if(k)e.on("load",function(){h++;h===k&&b.element.trigger("render")});if(a)switch(b.shortcodeName){case "mp_tabs":b.settingsForms.find('> [data-motopress-parameter="tabs"] > .motopress-property-group > .motopress-property-button-wrapper > .motopress-property-button-default').trigger("click",
CE.LeftBar.myThis.library[b.group].objects[b.shortcodeName].parameters.tabs.items.count);break;case "mp_accordion":b.settingsForms.find('> [data-motopress-parameter="accordionItems"] > .motopress-property-group > .motopress-property-button-wrapper > .motopress-property-button-default').trigger("click",CE.LeftBar.myThis.library[b.group].objects[b.shortcodeName].parameters.accordionItems.items.count)}b.element.trigger("render");d.removeClass(CE.Shortcode.preloaderClass);parent.CE.Save.changeContent()},
error:function(a){a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),parent.MP.Flash.showMessage());d.removeClass(CE.Shortcode.preloaderClass)}})}},setDefaultAttrs:function(a,b){if(null!==a){var d=c.parseJSON(a),e=this.getGeneralAttrs(b),f=this;c.each(d,function(a,c){"undefined"!==typeof c.value&&c.value||("undefined"!==typeof b&&"mp_tab"===b.attr("data-motopress-shortcode")&&"id"===a?c.value=parent.MP.Utils.uniqid():e[a].hasOwnProperty("saveInContent")&&
"true"===e[a].saveInContent?("undefined"===typeof b?f.shortcode:b).attr("data-motopress-content",e[a]["default"]):c.value=e[a]["default"])});this.setShortcodeAttrs(d,b);return JSON.stringify(d)}return a},setDefaultStyle:function(a){"undefined"===typeof a&&(a=this.element.attr("data-motopress-styles"));a=c.parseJSON(a);var b=this.isGrid?CE.Style.gridProps:CE.Style.props;c.extend(!0,b,CE.LeftBar.myThis.library[this.group].objects[this.shortcodeName].styles,b);var d=this;c.each(a,function(a,f){if("undefined"===
typeof f.value||!f.value){var g=b[a]["default"];switch(b[a].type){case "margin":var k=!0;c.each(b[a]["default"],function(c,d){d!==b[a].values[0]&&(k=!1)});g=k?"":g.join(",");break;case "select2":var h=[];CE.LeftBar.myThis.library[d.group].objects[d.shortcodeName].styles.mp_style_classes.hasOwnProperty("default")&&c.each(CE.LeftBar.myThis.library[d.group].objects[d.shortcodeName].styles.mp_style_classes["default"],function(a,b){h.push(b)});g=h.join(" ")}f.value=g}});this.setShortcodeStyle(a);return JSON.stringify(a)}})});
steal("jquery/controller",function(c){CE.Shortcode("CE.Controls",{},{settingsForms:null,styleForms:null,isNew:!1,init:function(a,b){this._super(a,b);this.isNew=b.isNew;this.settingsForms=c("<div />",{"class":"motopress-settings-forms"});this.styleForms=c("<div />",{"class":"motopress-style-forms"});this.generateSettingsForms();this.generateStyleForms()},render:function(a){if(!this.isGrid){if(a||"undefined"===typeof a)CE.Resizer.myThis.updateBottomInHandleMiddle(),CE.Resizer.myThis.updateHandle(),
CE.Resizer.myThis.updateHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(this.element,"render");this.shortcode.find("a").attr("tabindex",-1)}},generateSettingsForms:function(a,b,d){var e=this.getShortcodeAttrs(a),f="undefined"===typeof b?this.settingsForms:b;if(e){var g=this,k=this.getGeneralAttrs(a);if("undefined"!==typeof d){var h={};h[d]=k[d];k=h}var l=null,n=null,m=null,r=null;c.each(k,function(b,d){var h=parent.MP.Utils.uniqid();d.value=e[b].value;n=CE.CtrlTemplates.createLegend(d.legend);
m=CE.CtrlTemplates.createLabel(d.label);r=CE.CtrlTemplates.createDescription(d.description);var k=c("<div />",{"data-motopress-parameter":b,"data-motopress-disabled":d.disabled}),q="undefined"===typeof a?!1:!0;switch(d.type){case "text":l=CE.CtrlTemplates.createInput(d,b);l.ce_ctrl_input({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "text-hidden":l=CE.CtrlTemplates.createInput(d,b,"hidden");l.ce_ctrl_input({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});
k.append(l);break;case "link":l=CE.CtrlTemplates.createLink(d,b);l.ce_ctrl_link({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "spinner":l=CE.CtrlTemplates.createInput(d,b,null,"spinner");l.ce_ctrl_spinner({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled,min:d.min,max:d.max,step:d.step});k.append(n,m,l,r);break;case "longtext":l=CE.CtrlTemplates.createTextarea(d);l.ce_ctrl_textarea({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});
k.append(n,m,l,r);break;case "longtext64":l=CE.CtrlTemplates.createTextarea(d);l.ce_ctrl_textarea64({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "longtext-table":l=CE.CtrlTemplates.createTextarea(d);l.ce_ctrl_textarea_table({name:b,dependency:d.dependency,disabled:d.disabled});k.append(n,m,l,r);break;case "longtext-tinymce":l=CE.CtrlTemplates.createTextareaTinyMCE(d);l.ce_ctrl_textarea_tinymce({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled,
currentShortcode:g.element});k.append(n,m,l,r);break;case "image":d.src=d.value;l=CE.CtrlTemplates.createImage(d);l.ce_ctrl_image({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,autoOpen:d.autoOpen,disabled:d.disabled,shortcode:"parallax_image"!==b||"mp_row"!==g.shortcodeName&&"mp_row_inner"!==g.shortcodeName?null:g.shortcode});k.append(n,m,l,r);break;case "audio":l=CE.CtrlTemplates.createMedia(d);var v=g.child.attr("data-audio-title");l.ce_ctrl_audio({name:b,isNew:g.isNew,dependency:d.dependency,
isChild:q,audioTitle:v,disabled:d.disabled});k.append(n,m,l,r);break;case "media-video":l=CE.CtrlTemplates.createMedia(d);l.ce_ctrl_media_video({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "multi-images":l=CE.CtrlTemplates.createButton(d,null,"default");l.ce_ctrl_image_slider({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,autoOpen:d.autoOpen,disabled:d.disabled});k.append(n,m,l,r);break;case "video":l=CE.CtrlTemplates.createVideo(d,
b);l.ce_ctrl_video({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "checkbox":l=CE.CtrlTemplates.createCheckbox(d);l.ce_ctrl_checkbox({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});m.addClass("motopress-property-checkbox-label");k.append(n,l,m,r);break;case "group-checkbox":l=CE.CtrlTemplates.createCheckbox(d);l.ce_ctrl_group_checkbox({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});m.addClass("motopress-property-checkbox-label");
k.append(n,l,m,r);break;case "select":l=CE.CtrlTemplates.createSelect(d);l.ce_ctrl_select({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "color-select":l=CE.CtrlTemplates.createColorSelect(d);l.ce_ctrl_select({name:b,dependency:d.dependency,isChild:q,disabled:d.disabled});k.append(n,m,l,r);break;case "editor-button":l=CE.CtrlTemplates.createButton(d,null,"default");l.ce_ctrl_editor_button({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,shortcode:g.shortcode,
disabled:d.disabled});k.append(n,m,l,r);break;case "color-picker":l=CE.CtrlTemplates.createColorPicker(d,b);l.ce_ctrl_color_picker({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,shortcode:g.shortcode,disabled:d.disabled});k.append(n,m,l,r);break;case "group":l=CE.CtrlTemplates.createGroup(d);var x=l.children(".motopress-property-group-accordion");l.ce_ctrl_group({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,disabled:d.disabled,currentSpan:g.element,shortcode:g.shortcode,label:d.items.label});
g.shortcode.attr("data-motopress-wrap-render","true");g.child.children("[data-motopress-shortcode]").each(function(a){a=CE.CtrlTemplates.createItem(d.items,a);var b=a.find(".motopress-property-group-accordion-item-content");x.append(a);g.generateSettingsForms(c(this),b)});k.append(n,m,l,r);break;case "slider":l=CE.CtrlTemplates.createSlider(d);l.ce_ctrl_slider({name:b,isNew:g.isNew,dependency:d.dependency,isChild:q,min:"undefined"===typeof d.min||isNaN(d.min)?0:d.min,max:"undefined"===typeof d.max||
isNaN(d.max)?100:d.max,step:"undefined"===typeof d.step||isNaN(d.step)?1:d.step,value:d.value,disabled:d.disabled});k.append(n,m,l,r);break;case "radio-buttons":l=CE.CtrlTemplates.createRadioButtons(d),l.ce_ctrl_radio_buttons({name:b,dependency:d.dependency,isChild:q,value:d.value,disabled:d.disabled}),k.append(n,m,l,r)}if(d.hasOwnProperty("disabled")&&"true"===d.disabled){var y=null,y="group"===d.type?l.find("> .motopress-property-button-wrapper > .motopress-property-disabled"):c("<div />",{"class":"motopress-property-disabled"}).appendTo(k);
y.data("popover")||y.mppopover({placement:"top",trigger:"manual",container:k,content:localStorage.getItem("CELiteTooltipText")});y.on("click",function(){c(this).mppopover("show");var a=setTimeout(function(){y.mppopover("hide");clearTimeout(a)},2E3)})}f.append(k);l.addClass("motopress-controls");l.attr("id",h);m.attr("for",h)})}"undefined"===typeof b&&("undefined"!==typeof d&&(b=f.children('[data-motopress-parameter="'+d+'"]:first'),d=f.children('[data-motopress-parameter="'+d+'"]:last'),b.replaceWith(d)),
this.settingsForms=f)},displaySettings:function(a,b,d,e,f){"undefined"===typeof b&&"undefined"===typeof e&&(CE.Dialog.myThis.settingsTab.children(".motopress-settings-forms").detach(),CE.Dialog.myThis.settingsTab.html(this.settingsForms));var g=this.getShortcodeAttrs(b);if(g){var k=this,h="undefined"===typeof d?this.settingsForms:d,l=null,n=null,m=this.getGeneralAttrs(b);"undefined"!==typeof e&&(d={},d[e]=m[e],m=d);var r=null,p=null;c.each(m,function(d,e){l=h.find('> [data-motopress-parameter="'+
d+'"] > .motopress-controls, > [data-motopress-parameter="'+d+'"] > :not(".motopress-property-legend, .motopress-property-label, .motopress-property-description, hr") > .motopress-controls');if(l.hasClass("motopress-property-group"))f&&l.trigger("change",a),k.child.children("[data-motopress-shortcode]").each(function(b){b=l.find(".motopress-property-group-accordion-item-content:eq("+b+")");k.displaySettings(a,c(this),b)}),l.trigger("render",a);else{p=l.controller();if(e.hasOwnProperty("saveInContent")&&
"true"===e.saveInContent){var s="undefined"===typeof b?k.shortcode:b;"undefined"!==typeof s.attr("data-motopress-content")&&(n=s.attr("data-motopress-content").replace(/\[\]/g,"["))}else n=g[p.name].value;r=m[p.name]["default"];p.set(n,r,a);l.trigger("customize");if(!p.isChild&&p.dependency){var q=null;k.settingsForms.find('> [data-motopress-parameter] > .motopress-controls, > [data-motopress-parameter] > :not(".motopress-property-legend, .motopress-property-label, .motopress-property-description, hr") > .motopress-controls').each(function(){q=
c(this).controller();q.name===p.dependency.parameter&&q.get()!=p.dependency.value&&k.settingsForms.children('[data-motopress-parameter="'+p.name+'"]').addClass("motopress-hide")})}}})}},saveSettings:function(a){if("undefined"!==typeof a&&"undefined"!==typeof a.name){var b=null;a.isChild?(b=a.element.closest(".motopress-property-group-accordion-item").index(),b=this.child.children("[data-motopress-shortcode]:eq("+b+")")):b=this.shortcode;var d=this.getShortcodeAttrs(b);if(d){var e=this.getGeneralAttrs(b)[a.name],
f=a.get();e.hasOwnProperty("saveInContent")&&"true"===e.saveInContent?b.attr("data-motopress-content",f):d[a.name].value=void 0!==f&&"string"===typeof f?f.replace(new RegExp(/"/g),"'").replace(new RegExp(/[\[\]]/g),""):f;this.setShortcodeAttrs(d,b);a.isChild||this.renderShortcode();if("mp_row"===this.shortcodeName||"mp_row_inner"===this.shortcodeName){if("bg_media_type"===a.name)switch(this.clearRowMediaBG(this.element),f){case "video":this.renderHTML5VideoBG();break;case "youtube":this.renderYoutubeBG();
break;case "parallax":this.element.addClass("motopress-row-parallax").attr("data-stellar-background-ratio",.5),this.element.css("background-image","url('http://static.getmotopress.com/motopress-parallax-background-demo.jpg')"),c.stellar("refresh")}-1!==jQuery.inArray(a.name,["bg_video_youtube","bg_video_youtube_cover"])&&(this.clearRowMediaBG(this.element),this.renderYoutubeBG());-1!==jQuery.inArray(a.name,["bg_video_webm","bg_video_mp4","bg_video_ogg","bg_video_cover"])&&(this.clearRowMediaBG(this.element),
this.renderHTML5VideoBG())}}}},renderYoutubeBG:function(){$this=this;var a="undefined"!==typeof this.element.attr("data-motopress-parameters")?this.element.attr("data-motopress-parameters"):null,a=c.parseJSON(a);c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"text",data:{action:"motopress_ce_render_youtube_bg",nonce:parent.motopressCE.nonces.motopress_ce_render_youtube_bg,postID:parent.motopressCE.postID,bg_video_youtube:a.bg_video_youtube.value,bg_video_youtube_cover:a.bg_video_youtube_cover.value,
bg_video_youtube_repeat:a.bg_video_youtube_repeat.value,bg_video_youtube_mute:a.bg_video_youtube_mute.value},success:function(a){$this.element.addClass("mp-row-video").children(".motopress-row-helper").before(a);mpInitYouTubePlayers($this.element.children(".mp-video-container").find(".mp-youtube-video"));mpFixBackgroundVideoSize($this.element.children(".mp-video-container"))},error:function(a){console.log(a)}})},renderHTML5VideoBG:function(){$this=this;var a="undefined"!==typeof this.element.attr("data-motopress-parameters")?
this.element.attr("data-motopress-parameters"):null,a=c.parseJSON(a);c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"text",data:{action:"motopress_ce_render_video_bg",nonce:parent.motopressCE.nonces.motopress_ce_render_video_bg,postID:parent.motopressCE.postID,bg_video_mp4:a.bg_video_mp4.value,bg_video_webm:a.bg_video_webm.value,bg_video_ogg:a.bg_video_ogg.value,bg_video_cover:a.bg_video_cover.value,bg_video_mute:a.bg_video_mute.value,bg_video_repeat:a.bg_video_repeat.value},success:function(a){$this.element.addClass("mp-row-video").children(".motopress-row-helper").before(a);
mpFixBackgroundVideoSize($this.element.children(".mp-video-container"))},error:function(a){console.log(a)}})},clearRowMediaBG:function(a){a.children(".mp-video-container").remove();a.removeClass("mp-row-video motopress-row-parallax").css("background-image","").css("background-position","");a.removeAttr("data-stellar-background-ratio").removeData("stellarBackgroundIsActive stellarBackgroundRatio stellarBackgroundStartingLeft stellarBackgroundStartingTop");c.stellar("refresh")},getShortcodeAttrs:function(a){return(a=
("undefined"===typeof a?this.shortcode:a).attr("data-motopress-parameters"))?c.parseJSON(a):!1},setShortcodeAttrs:function(a,b){("undefined"===typeof b?this.shortcode:b).attr("data-motopress-parameters",JSON.stringify(a))},getGeneralAttrs:function(a){var b=this.group,d=this.shortcodeName;"undefined"!==typeof a&&(b=a.attr("data-motopress-group"),d=a.attr("data-motopress-shortcode"));return c.extend(!0,{},CE.LeftBar.myThis.library[b].objects[d].parameters)},generateStyleForms:function(){var a=this.getShortcodeStyle();
if(a){var b=this,d=null,e=null,f=null,g=null,k=null,h=null;c.each(this.isGrid?CE.Style.gridProps:CE.Style.props,function(l,n){d=parent.MP.Utils.uniqid();n.value=a[l].value;f=CE.CtrlTemplates.createLegend(n.legend);g=CE.CtrlTemplates.createLabel(n.label);h=n.description;if("select2"===n.type){var m=CE.LeftBar.myThis.library[b.group].objects[b.shortcodeName].styles.mp_style_classes.additional_description;c.isEmptyObject(m)||(h+=" "+m)}k=CE.CtrlTemplates.createDescription(h);m=c("<div />",{"data-motopress-parameter":l,
"data-motopress-disabled":n.disabled});switch(n.type){case "margin":e=CE.CtrlTemplates.createMargin(n);e.ce_ctrl_margin({name:l,dependency:n.dependency,isChild:!1,disabled:n.disabled,isStyle:!0,margin:n});m.append(f,g,e,k);break;case "text":e=CE.CtrlTemplates.createInput(n,l);e.ce_ctrl_input({name:l,dependency:n.dependency,isChild:!1,disabled:n.disabled,isStyle:!0});m.append(f,g,e,k);break;case "select2":e=CE.CtrlTemplates.createInput(n,l),e.ce_ctrl_select2({name:l,dependency:n.dependency,isChild:!1,
disabled:n.disabled,isStyle:!0,instance:b}),m.append(f,g,e,k)}b.styleForms.append(m);e.addClass("motopress-controls");e.attr("id",d);g.attr("for",d)})}},displayStyle:function(a){CE.Dialog.myThis.styleTab.children(".motopress-style-forms").detach();CE.Dialog.myThis.styleTab.html(this.styleForms);var b=this.getShortcodeStyle();if(b){var d=this,e=null,f=null,g=null,k=null,h=this.isGrid?CE.Style.gridProps:CE.Style.props;c.each(b,function(c,n){f=d.styleForms.find('> [data-motopress-parameter="'+c+'"] > .motopress-controls, > [data-motopress-parameter="'+
c+'"] > :not(".motopress-property-legend, .motopress-property-label, .motopress-property-description, hr") > .motopress-controls:not(".select2-container")');e=f.controller();g=b[e.name].value;k=h[e.name]["default"];e.set(g,k,a);f.trigger("customize")})}},getShortcodeStyle:function(){var a=this.shortcode.attr("data-motopress-styles");if(a){a=c.parseJSON(a);if(!this.isGrid&&a.hasOwnProperty("margin")&&c.isEmptyObject(a.margin)&&this.child.length){var b=CE.Style.props.margin["default"].slice(),d=this.child.prop("class").split(" ").filter(function(a){return CE.Style.props.margin.regExp.test(a)});
d.length&&(c.each(d,function(a,d){var g=d.match(CE.Style.props.margin.regExp),k=g[1],h=parseInt(g[2]);"undefined"===typeof k?c.each(b,function(a,c){h!==CE.Style.props.margin["default"][a]&&(b[a]=h)}):(g=c.inArray(k,CE.Style.props.margin.sides),-1!==g&&(b[g]=h))}),a.margin.value=b.join(","),this.setShortcodeStyle(a))}return a}return!1},saveStyle:function(a){var b=this.getShortcodeStyle();if(b)if("undefined"===typeof a&&this.isGrid){var d=this,e=null;c.each(b,function(c){e=d.styleForms.find('> [data-motopress-parameter="'+
c+'"] > .motopress-controls, > [data-motopress-parameter="'+c+'"] > :not(".motopress-property-legend, .motopress-property-label, .motopress-property-description, hr") > .motopress-controls:not(".select2-container")');a=e.controller();d._saveStyle(b,a,!1)})}else this._saveStyle(b,a),CE.Resizer.myThis.updateBottomInHandleMiddle(),CE.Resizer.myThis.updateHandle(),CE.Resizer.myThis.updateSplitterHeight(),CE.Resizer.myThis.updateHandleMiddle()},_saveStyle:function(a,b,d){"undefined"===typeof d&&(d=!0);
var e=a[b.name].value,f=d?b.get():e;d&&(a[b.name].value=f,this.setShortcodeStyle(a));a=null;this.isGrid?a=this.shortcode:this.child.length&&(a=this.child);if("margin"!==b.name&&CE.LeftBar.myThis.library[this.group].objects[this.shortcodeName].styles.mp_style_classes.hasOwnProperty("selector")){var g=CE.LeftBar.myThis.library[this.group].objects[this.shortcodeName].styles.mp_style_classes.selector;g.length&&(a=a.find(g))}switch(b.name){case "margin":g=b.getClasses(e);g.length&&(e=g);b=b.getClasses(f);
b.length&&(f=b);break;case "mp_style_classes":if(!d&&!c.isEmptyObject(b.options.style.basic)){var k="";c.isArray(b.options.style.basic)?c.each(b.options.style.basic,function(a,b){k+=b["class"]+" "}):k=b.options.style.basic["class"]+" ";f=k+f}}null!==a&&a.length&&(d&&a.removeClass(e),a.addClass(f))},setShortcodeStyle:function(a){this.element.attr("data-motopress-styles",JSON.stringify(a))}})});
steal("jquery/controller",function(c){CE.Controls("CE.InlineEditor",{curElement:null,styleFormats:!1,init:function(){c(document).on("mousedown",".mce-tinymce.mce-panel",function(a){a.preventDefault()});c(document).on("keydown",'[data-motopress-shortcode="mp_text"], [data-motopress-shortcode="mp_heading"]',function(a){a.which===c.ui.keyCode.TAB?CE.Selectable.myThis.unselect():a.which===c.ui.keyCode.ESCAPE&&(CE.InlineEditor.curElement&&CE.InlineEditor.curElement.controller().close(!0,"show"),a=c(this).parent("."+
CE.DragDrop.myThis.blockContent.attr("class")).next("."+CE.DragDrop.myThis.helper.attr("class")).children("."+CE.DragDrop.myThis.dragHandle.attr("class")),CE.Selectable.focusWithoutScroll(a.prev()),CE.Dialog.myThis.element.dialog("isOpen")||CE.Dialog.myThis.open(a))});c(parent.document).on("mousedown",function(a){CE.InlineEditor.curElement&&!c(a.target).closest(".ui-dialog").length&&CE.InlineEditor.curElement.controller().close(!0,"show")})},isTinymce:function(a){var b=!1;c(a.target).hasClass("motopress-drag-handle")||
(a=c(a.currentTarget.activeElement),a.length&&(a.closest("[data-motopress-shortcode]").length||a.closest(".mce-tinymce").length||a.closest(".mce-window").length||a.closest(".mce-popover").length)&&(b=!0));return b}},{id:null,isOpen:!1,editor:null,helpers:null,blockContent:null,floatpanel:null,saved:!1,init:function(a,b){this._super(a,b);this.id=parent.MP.Utils.uniqid();this.blockContent=this.element.parent("."+CE.DragDrop.myThis.blockContent.attr("class"));var c=this.blockContent.next("."+CE.DragDrop.myThis.helper.attr("class"));
this.helpers=c.add(c.children().not(".motopress-splitter"));this.resizers=this.blockContent.nextAll(".ui-resizable-handle");this.element.parent("."+CE.DragDrop.myThis.blockContent.attr("class")).next("."+CE.DragDrop.myThis.helper.attr("class")).children("."+CE.DragDrop.myThis.dragHandle.attr("class")).on("click",this.proxy("onClick"))},destroy:function(){CE.InlineEditor.curElement=null;this.floatpanel&&this.floatpanel.remove();this._super()},render:function(){var a=this;this.shortcode.children("div").attr("id",
this.id);var b=this.element.parent("."+CE.DragDrop.myThis.blockContent.attr("class")).next("."+CE.DragDrop.myThis.helper.attr("class")).children("."+CE.DragDrop.myThis.dragHandle.attr("class")),d=setTimeout(function(){var e="bold italic underline | ";c.isEmptyObject(CE.InlineEditor.styleFormats)||(e+="styleselect | ");tinyMCE.init({selector:"#"+a.id,inline:!0,plugins:"link hr textcolor",visual:!1,convert_urls:!1,menubar:!1,toolbar:e+"formatselect | fontsizeselect forecolor | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | link unlink hr removeformat",
fontsize_formats:"8px 9px 10px 12px 14px 16px 18px 24px 36px 48px 60px 72px",language:parent.MP.Settings.lang.tinymce,skin:"motopresscontenteditor",browser_spellcheck:parent.MP.Settings.spellcheck,style_formats_merge:!1,style_formats:CE.InlineEditor.styleFormats,setup:function(d){a.editor=d;d.on("loadContent",function(){a.autoOpen(b,1)});d.on("execCommand",function(b){switch(b.command){case "mceToggleEditor":if(!a.floatpanel&&(b=c("body").children(".mce-floatpanel:last"),b.length&&(a.floatpanel=b,
50<b.height()))){var d=b.find('.mce-container-body.mce-flow-layout > [role="toolbar"]:first').outerHeight(!0)-2;b.width(723).height(d);b.children(".mce-container-body.mce-abs-layout").width(723).height(d).children(".mce-container.mce-panel").width(723).height(d).children(".mce-container-body.mce-stack-layout").width(723).height(d)}a.floatpanel.offset().left+a.floatpanel.width()>c(window).width()&&(b=a.element.offset().left+a.element.width()-a.floatpanel.width(),a.floatpanel.css("left",b))}})},init_instance_callback:function(d){c.each(d.menuItems.formats.menu,
function(a,b){"Blocks"===b.text&&c.each(b.menu,function(a,c){"Div"===c.text&&delete b.menu[a]})});c(d.getBody()).on("blur",function(){a.save()});c(d.getBody()).on("focus",function(){a.saved=!1;if(b.hasClass(CE.Selectable.myThis.selectedClass))b.trigger("click");else var c=setTimeout(function(){CE.LeftBar.myThis.leftBar.focus();clearTimeout(c)},0)})}});clearTimeout(d)},0)},onClick:function(a){c(a.target).hasClass(CE.Selectable.myThis.selectedClass)&&!this.isOpen&&(this.isOpen=!0,CE.InlineEditor.curElement=
this.element,CE.Dialog.myThis.element.dialog("isOpen")&&CE.Dialog.myThis.element.dialog("close"),this.helpers.hide(),c(".motopress-content-wrapper > .motopress-handle-middle-in:last").height(""),this.resizers.hide(),this.blockContent.addClass("motopress-overflow-visible-important"),this.editor.execCommand("mceToggleEditor",!1),this.showHideFloatpanel("show"))},close:function(a,b){this.isOpen&&(this.isOpen=!1,this.save(),this.helpers.show(),"undefined"!==typeof a&&("show"===b?this.resizers.show():
"hide"===b&&this.resizers.hide()),this.showHideFloatpanel("hide"),this.blockContent.removeClass("motopress-overflow-visible-important"),CE.Resizer.myThis.updateHandle(),parent.CE.Save.changeContent())},save:function(){this.saved||(this.shortcode.attr("data-motopress-content",this.editor.getContent({format:"html"})),this.saved=!0,CE.Resizer.myThis.updateBottomInHandleMiddle(),CE.Resizer.myThis.updateSplitterHeight(this.element,"split"),CE.Resizer.myThis.updateHandleMiddle())},autoOpen:function(a,b){if(3>=
b)if(1<b&&a.hasClass(CE.Selectable.myThis.selectedClass))CE.Dialog.myThis.element.dialog("isOpen")&&CE.Dialog.myThis.element.dialog("close"),c(this.editor.getBody()).trigger("blur").trigger("focus"),a.trigger("click");else var d=this,e=setTimeout(function(){d.autoOpen(a,b+1);clearTimeout(e)},500)},showHideFloatpanel:function(a){this.floatpanel&&("show"===a?this.floatpanel.show():this.floatpanel.hide())}})});
steal("jquery/controller",function(c){CE.Controls("CE.CodeEditor",{},{init:function(a,b){this._super(a,b);var c=this.element.parent("."+CE.DragDrop.myThis.blockContent.attr("class")).next("."+CE.DragDrop.myThis.helper.attr("class")).children("."+CE.DragDrop.myThis.dragHandle.attr("class"));this.autoOpen(c,1);c.on("click",this.proxy("onClick"))},destroy:function(){this._super()},render:function(){this.shortcode.find(".row").removeClass("row").addClass(parent.CE.Iframe.myThis.gridObj.row["class"]);
this.shortcode.find("a").attr("tabindex",-1);CE.Resizer.myThis.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight();CE.Resizer.myThis.updateHandle();CE.Resizer.myThis.updateHandleMiddle()},autoOpen:function(a,b){if(3>=b)if(1<b&&a.hasClass(CE.Selectable.myThis.selectedClass))a.trigger("click");else var c=this,e=setTimeout(function(){c.autoOpen(a,b+1);clearTimeout(e)},500)},onClick:function(a){if(c(a.target).hasClass(CE.Selectable.myThis.selectedClass)){a=parent.CE.CodeModal.myThis.editor;
parent.CE.CodeModal.currentShortcode=this.element;var b=this.shortcode.attr("data-motopress-content");"undefined"!==typeof b&&(b=b.replace(RegExp("\\[\\]","ig"),"["),null!==a&&a.setContent(b,{format:"html"}),parent.CE.CodeModal.myThis.content.val(parent.switchEditors._wp_Nop(b)));parent.CE.CodeModal.myThis.saveHandler=this.saveHandler;parent.CE.CodeModal.myThis.element.mpmodal("show")}},saveHandler:function(a){a=parent.CE.CodeModal.myThis;a.switchVisual();var b=parent.CE.CodeModal.currentShortcode.controller(),
c=null!==a.editor?a.editor.getContent({format:"html"}):parent.switchEditors._wp_Autop(a.content.val());c.length?b.shortcode.attr("data-motopress-content",c):b.shortcode.removeAttr("data-motopress-content");b.renderShortcode();a.element.mpmodal("hide")}})});
steal("jquery/class",function(c){c.Class("CE.Tools",{myThis:null},{init:function(){CE.Tools.myThis=this},removeBlock:function(){var a=c(".motopress-selected").closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),b=a.closest(".motopress-row");CE.Selectable.setScrollY(window.scrollY);CE.Dialog.myThis.element.dialog("isOpen")&&CE.Dialog.myThis.element.dialog("close");parent.CE.Navbar.myThis.hideObjectControlBtns();var d=a.parents(".motopress-row, .motopress-content-wrapper").eq(-2),
e=parent.MP.Utils.getSpanClass(a.prop("class").split(" "));CE.DragDrop.myThis.removeEmptyBlocks(a,e);e=b.children(".motopress-clmn").index(a);e=CE.DragDrop.myThis.canBeMoved(b,null,e);if(a.hasClass("ce_inline_editor")){var f=a.controller().child.attr("id");"undefined"!==typeof f&&(f=tinymce.get(f),"undefined"!==typeof f&&f.destroy())}a.remove();var f=CE.DragDrop.myThis.clearIfEmpty(b,"remove"),g=!1;f&&f.hasOwnProperty("row")&&(g=!0,b=f.row);CE.DragDrop.myThis.isEmptyScene()&&(c(".motopress-handle-middle-in").remove(),
CE.DragDrop.myThis.emptySceneHelper.show(),CE.DragDrop.myThis.moreHandler.hide());g||CE.DragDrop.myThis.resize(b,a,"remove",e);CE.DragDrop.myThis.resizer.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplittableOptions(null,b,null);CE.Resizer.myThis.updateSplitterHeight(d,"remove");CE.Resizer.myThis.updateHandle();CE.Resizer.myThis.updateHandleMiddle()}})});
steal("jquery/class",function(c){c.Class("CE.Resizer",{myThis:null},{minHeight:30,minWidth:8,spaceMinHeight:10,gmapMinHeight:150,handle:null,addedStyleProperties:"position top left width height background-position background-repeat".split(" "),emptySpan:c("<div />",{"class":"motopress-clmn motopress-empty mp-hidden-phone"}),splitter:c("<div />",{"class":"motopress-splitter"}),oldWidth:null,emptySpanNumber:0,init:function(){CE.Resizer.myThis=this;CE.Grid.myThis.padding&&this.splitter.css({width:2*
CE.Grid.myThis.padding,"margin-left":-2*CE.Grid.myThis.padding});c(window).on("resize",function(a){a.target===this&&CE.Resizer.myThis.proxy("updateHandle")})},getMinHeight:function(a){var b=a.find(".motopress-block-content > [data-motopress-shortcode]");return b.length&&"mp_gmap"===b.attr("data-motopress-shortcode")?this.gmapMinHeight:a.hasClass(CE.DragDrop.myThis.spaceClass)?this.spaceMinHeight:this.minHeight},makeResizable:function(a){var b=this;a.not("[data-motopress-wrapper-id], .motopress-empty").each(function(){c(this).resizable({grid:[1,
10],handles:"e, s, w, se, sw",helper:"motopress-resizer-helper",minWidth:2,minHeight:CE.Resizer.myThis.getMinHeight(c(this)),zIndex:1002,create:function(){c(this).resizable("option","maxWidth",parseFloat(c(this).css("width")));c(this).children(".ui-resizable-handle").hide();var a=CE.Grid.myThis.padding-4;c(this).children(".ui-resizable-e, .ui-resizable-se").css("right",a);c(this).children(".ui-resizable-w, .ui-resizable-sw").css("left",a)},start:function(a,d){CE.LeftBar.myThis.disable();b.hideSplitters();
b.hideEmptySpans();c(".motopress-content-wrapper > .motopress-handle-middle-in:last").height("");c(this).find(".motopress-handle-bottom-in").css({bottom:"",height:""});CE.Dialog.myThis.element.dialog("isOpen")&&CE.Dialog.myThis.element.dialog("close");CE.Resizer.myThis.handle=c(a.originalEvent.target);b.oldWidth=parseFloat(d.element.css("width"));var e=parent.MP.Utils.getHandleClass(CE.Resizer.myThis.handle.prop("class").split(" ")),h=null,h="ui-resizable-e"===e||"ui-resizable-se"===e?d.element.next(".motopress-empty"):
d.element.prev(".motopress-empty"),e=parent.MP.Utils.getSpanClass(d.element.prop("class").split(" ")),e=parent.MP.Utils.getSpanNumber(e);b.oldSpanNumber=e;var l=0;h&&h.length&&(h=parent.MP.Utils.getSpanClass(h.prop("class").split(" ")),l=parent.MP.Utils.getSpanNumber(h));h=e+l;CE.Resizer.myThis.maxSpanNumber=h;var n=c(this).parent(".motopress-row-edge").width()/100;d.element.resizable("option","maxWidth",n*CE.Grid.myThis.colWidthByNumber[h]);e=[];for(l=1;l<=h;l++)e[l]=n*CE.Grid.myThis.colWidthByNumber[l];
for(var n=Math.floor(h/2),m=0===h%2,l=1;l<=n;l++)0>e[l]-2*CE.Grid.myThis.padding&&(e[l]*=-1,m?l!==n&&(e[h-l]*=-1):e[h-l]*=-1);d.element.data("mp-snap-grid",e);CE.Resizer.myThis.handle.addClass("motopress-resizable-handle-hover");d.element.css({position:"relative",top:0,left:0});c(this).closest(".motopress-row").parent(".motopress-content-wrapper").length||(h=c(this).closest(".motopress-row").nextAll(".motopress-handle-middle-in:last"),e=parseInt(h.css("min-height")),h.height(e))},stop:function(d,
e){c(".mp-grid-test").remove();CE.LeftBar.myThis.enable();b.showSplitters();b.showEmptySpans();CE.Resizer.myThis.splitterHandle=!1;CE.Resizer.myThis.handle.removeClass("motopress-resizable-handle-hover");for(var k={},h=0;h<CE.Resizer.myThis.addedStyleProperties.length;h++)k[CE.Resizer.myThis.addedStyleProperties[h]]="";e.element.css(k);c(this).hasClass("ce_controls")&&!CE.Dialog.myThis.element.dialog("isOpen")&&(k=e.element.find(".motopress-drag-handle"),CE.Dialog.myThis.open(k));k=e.element.prev(".motopress-empty");
h=e.element.next(".motopress-empty");CE.DragDrop.myThis.makeEditableEmptySpan(k.add(h));b.updateSplittableOptions(k,null,null);b.updateSplittableOptions(h,null,null);CE.Resizer.myThis.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(a,"resize");CE.Resizer.myThis.updateHandle();CE.Resizer.myThis.updateHandleMiddle();parent.CE.Save.changeContent()},resize:function(a,b){var c=parent.MP.Utils.getHandleClass(CE.Resizer.myThis.handle.prop("class").split(" "));switch(c){case "ui-resizable-s":CE.Resizer.myThis.verticalResize(b);
break;case "ui-resizable-w":CE.Resizer.myThis.horizontalResize(c,b);break;case "ui-resizable-e":CE.Resizer.myThis.horizontalResize(c,b);break;case "ui-resizable-sw":CE.Resizer.myThis.verticalResize(b);CE.Resizer.myThis.horizontalResize(c,b);break;case "ui-resizable-se":CE.Resizer.myThis.verticalResize(b),CE.Resizer.myThis.horizontalResize(c,b)}}});var d=c(this).find(".motopress-block-content > [data-motopress-shortcode]");if(d.length){var e=d.attr("data-motopress-resize");"undefined"===typeof e&&
(e=d.attr("data-motopress-group"),d=d.attr("data-motopress-shortcode"),e=CE.LeftBar.myThis.library[e].objects[d].resize);switch(e){case "none":c(this).children(".ui-resizable-handle").addClass("motopress-hide");break;case "horizontal":c(this).children('.ui-resizable-handle:not(".ui-resizable-e, .ui-resizable-w")').addClass("motopress-hide");break;case "vertical":c(this).children('.ui-resizable-handle:not(".ui-resizable-s")').addClass("motopress-hide")}}})},horizontalResize:function(a,b){var c=parseFloat(b.helper.css("width"));
b.element.css({top:0,left:0});if(c===this.oldWidth)return!1;for(var e=c<this.oldWidth?-1:1,f=b.element.data("mp-snap-grid"),g=f.length-1,k=!1,h=1;h<=g;h++)if(!(0>=f[h])&&(k=1===h?0>e?f[h]:Math.abs(f[h+1])-Math.abs(f[h]):h==g?Math.abs(f[h])-Math.abs(f[h-1]):0>e?Math.abs(f[h])-Math.abs(f[h-1]):Math.abs(f[h+1])-Math.abs(f[h]))&&(k=Math.abs(k)/2,c>=f[h]-k/2&&c<=f[h]+k&&(k=h-this.oldSpanNumber,0!==k))){e=null;e=parent.MP.Utils.getSpanClass(b.element.prop("class").split(" "));CE.Resizer.myThis.changeSpanClass(b.element,
e,parent.CE.Iframe.myThis.gridObj.span["class"]+h);"ui-resizable-e"===a||"ui-resizable-se"===a?(f="east",e=b.element.next(".motopress-empty")):(f="west",e=b.element.prev(".motopress-empty"));e&&e.length?(f=parent.MP.Utils.getSpanClass(e.prop("class").split(" ")),g=parent.MP.Utils.getSpanNumber(f),k<g?CE.Resizer.myThis.changeSpanClass(e,f,parent.CE.Iframe.myThis.gridObj.span["class"]+(g-k)):e.remove()):(e=CE.Resizer.myThis.emptySpan.clone(),e.addClass(parent.CE.Iframe.myThis.gridObj.span["class"]+
Math.abs(k)).addClass("motopress-empty-hide"),"east"===f?b.element.after(e):b.element.before(e));b.element.css({width:""});this.oldWidth=c;this.oldSpanNumber=h;break}return!1},verticalResize:function(a){var b=parseInt(a.element.css("min-height")),c=a.helper.height();b===c&&a.element.css("min-height","");a.element.css("min-height",c);a.element.css("height",c)},getMinChildColumn:function(a){var b=CE.Grid.myThis.columnCount;a.find(".motopress-clmn").each(function(){var a=parent.MP.Utils.getSpanNumber(parent.MP.Utils.getSpanClass(c(this).prop("class").split(" ")));
a<b&&(b=a)});return b},isAllowedColSize:function(a,b){return 0>b/100*CE.Grid.myThis.colWidthByNumber[a]-2*CE.Grid.myThis.padding?!1:!0},makeSplittable:function(a){if(!a.length)return!1;var b=this,d,e,f;(a.hasClass("motopress-splitter")?a:a.find(".motopress-splitter")).draggable({axis:"x",cursor:"col-resize",grid:[1,0],helper:"clone",zIndex:1,start:function(a,e){e.helper.hide();b.hideSplitters(c(this));b.hideEmptySpans();c(".motopress-content-wrapper > .motopress-handle-middle-in:last").height("");
d=null;f=!1;CE.LeftBar.myThis.disable();c(this).addClass("motopress-splitter-hover");CE.Dialog.myThis.element.dialog("isOpen")&&CE.Dialog.myThis.element.dialog("close");var h=e.helper.closest(".motopress-row");h.find(".motopress-drag-handle").css("cursor","col-resize");var l=(h.hasClass("motopress-row-edge")?h:h.find(".motopress-row-edge").first()).width()/100,h=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),n=h.prev('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+
'"].motopress-clmn'),m=parent.MP.Utils.getSpanNumber(parent.MP.Utils.getSpanClass(h.prop("class").split(" "))),r=parent.MP.Utils.getSpanNumber(parent.MP.Utils.getSpanClass(n.prop("class").split(" "))),p=n.offset().left;if(n.is("[data-motopress-wrapper-id]"))var t=b.getMinChildColumn(n);if(h.is("[data-motopress-wrapper-id]"))var u=b.getMinChildColumn(h);for(var s=m+r-1,q=[],v=1;v<=s;v++)q[v]=l*CE.Grid.myThis.colWidthByNumber[v];for(var l=q.slice(),x,v=1;v<r;v++)0>q[v]-2*CE.Grid.myThis.padding?q[v]=
-1*(p+q[v]):(x=1,s=Math.abs(q[v]),0<q[v]&&n.is("[data-motopress-wrapper-id]")&&(b.isAllowedColSize(t,s)||(x=-1)),q[v]=(p+q[v])*x);t=r-1;for(v=m;1<=v;v--)t++,0>l[v]-2*CE.Grid.myThis.padding?q[t]=-1*(p+q[t]):(x=1,s=l[v],0<l[v]&&h.is("[data-motopress-wrapper-id]")&&(b.isAllowedColSize(u,s)||(x=-1)),q[t]=(p+q[t])*x);c(this).data("mp-snap-grid",q);b.currentI=r;b.curSplitterArea=""},stop:function(a,d){CE.LeftBar.myThis.enable();b.showSplitters();b.showEmptySpans();d.helper.closest(".motopress-row").find(".motopress-drag-handle").css("cursor",
"move");c(this).removeClass("motopress-splitter-hover");var h=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');CE.Resizer.myThis.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(h,"split");CE.Resizer.myThis.updateSplittableOptions(h,null,null,"split");CE.Resizer.myThis.updateHandle();CE.Resizer.myThis.updateHandleMiddle();f&&e.length&&e.remove();parent.CE.Save.changeContent()},drag:function(a,k){var h=k.offset.left-CE.Grid.myThis.padding/
2;null===d&&(d=h);if(h!==d){var l=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),n=l.closest(".motopress-row-edge").width(),m,r,p=c(this).data("mp-snap-grid"),t=p.length-1;1<t?(m=Math.abs(p[2])-Math.abs(p[1]),r=Math.abs(p[t])-Math.abs(p[t-1])):m=r=n/100*CE.Grid.myThis.colWidthByNumber[1];m>CE.Grid.myThis.padding&&(m-=CE.Grid.myThis.padding);m>CE.Grid.myThis.padding&&(m-=CE.Grid.myThis.padding);r>CE.Grid.myThis.padding&&(r-=CE.Grid.myThis.padding);m=
h<=Math.abs(p[1])-m;r=h>=Math.abs(p[t])+1.5*r;if(m||r){if(m&&"left"===b.curSplitterArea||r&&"right"===b.curSplitterArea)return;h=l.prev('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');n=parent.MP.Utils.getSpanClass(l.prop("class").split(" "));r=parent.MP.Utils.getSpanClass(h.prop("class").split(" "));var u=parent.MP.Utils.getSpanNumber(n),s=parent.MP.Utils.getSpanNumber(r);if(m)if(b.curSplitterArea="left",h.hasClass("motopress-empty"))CE.Resizer.myThis.changeSpanClass(l,
n,parent.CE.Iframe.myThis.gridObj.span["class"]+(u+s)),e=h,f=!0;else{var q=0;for(m=1;m<=t;m++)if(0<p[m]){q=m;break}q&&(CE.Resizer.myThis.changeSpanClass(l,n,parent.CE.Iframe.myThis.gridObj.span["class"]+(t+1-q)),CE.Resizer.myThis.changeSpanClass(h,r,parent.CE.Iframe.myThis.gridObj.span["class"]+q),b.currentI=q)}else if(b.curSplitterArea="right",l.hasClass("motopress-empty"))CE.Resizer.myThis.changeSpanClass(h,r,parent.CE.Iframe.myThis.gridObj.span["class"]+(s+u)),e=l,f=!0;else{q=0;for(m=t;1<=m;m--)if(0<
p[m]){q=m;break}q&&(CE.Resizer.myThis.changeSpanClass(l,n,parent.CE.Iframe.myThis.gridObj.span["class"]+(t+1-q)),CE.Resizer.myThis.changeSpanClass(h,r,parent.CE.Iframe.myThis.gridObj.span["class"]+q),b.currentI=q)}}else for(b.curSplitterArea="center",r=h<d?-1:1,q=!1,m=1;m<=t;m++)if(!(0>=p[m])&&(q=1<t?1===m?Math.abs(p[m+1])-Math.abs(p[m]):m==t?Math.abs(p[m])-Math.abs(p[m-1]):0>r?Math.abs(p[m])-Math.abs(p[m-1]):Math.abs(p[m+1])-Math.abs(p[m]):n/100*CE.Grid.myThis.colWidthByNumber[1])&&(q=Math.abs(q)/
2,h>=p[m]-q/2&&h<=p[m]+q&&(q=m-b.currentI,f=!1,0!==q))){l=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');h=l.prev('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');n=parent.MP.Utils.getSpanClass(l.prop("class").split(" "));parent.MP.Utils.getSpanClass(h.prop("class").split(" "));r=parent.MP.Utils.getSpanClass(h.prop("class").split(" "));u=parent.MP.Utils.getSpanNumber(n);s=parent.MP.Utils.getSpanNumber(r);p=s+q;CE.Resizer.myThis.changeSpanClass(l,
n,parent.CE.Iframe.myThis.gridObj.span["class"]+(u-q));CE.Resizer.myThis.changeSpanClass(h,r,parent.CE.Iframe.myThis.gridObj.span["class"]+p);b.currentI=m;break}l&&l.length&&(l=parseInt(l.css("margin-top"))+parseInt(l.css("border-top-width")),p=c(this).closest(".motopress-row").height(),c(this).css({top:-l,height:p}),f&&a.preventDefault())}}})},calcSplitterOptions:function(a,b){var d=null,e=null,f=null;if("column"===b)e=a.parent(".motopress-row-edge").width(),d=a;else if("row"===b)d=a.hasClass("motopress-row-edge")?
a:a.find(".motopress-row-edge").first(),e=d.width(),d=d.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');else return!1;if(!CE.Grid.myThis.padding)var e=e/100,g=e*CE.Grid.myThis.columnMarginPiece,k=e*CE.Grid.myThis.splitterWidthPiece+g,h=-(e*CE.Grid.myThis.splitterMarginPiece+g/2);d.each(function(){f=c(this).find(".motopress-helper > .motopress-splitter");CE.Resizer.myThis.makeSplittable(f);CE.Grid.myThis.padding||(f.width(k),f.css("margin-left",h-parseInt(c(this).css("border-left-width"))));
c(this).children(".motopress-row").length||CE.Resizer.myThis.makeResizable(c(this))})},updateSplittableOptions:function(a,b,d,e){"undefined"===typeof e&&(e="default");"init"===e||"split"===e?(b=null,"init"===e?b=c(".motopress-content-wrapper .motopress-row"):"split"===e&&(a=a.parents(".motopress-row, .motopress-content-wrapper").eq(-2),"undefined"!==typeof a&&(b=c.merge(c.merge([],a),a.find(".motopress-row")))),b&&"undefined"!==typeof b&&c.each(b,function(){CE.Resizer.myThis.calcSplitterOptions(c(this),
"row")})):(a&&this.calcSplitterOptions(a,"column"),b&&c.each(c.merge(c.merge([],b),b.find(".motopress-row")),function(){CE.Resizer.myThis.calcSplitterOptions(c(this),"row")}),d&&c.each(c.merge(c.merge([],d),d.find(".motopress-row")),function(){CE.Resizer.myThis.calcSplitterOptions(c(this),"row")}))},updateSplitterHeight:function(a,b){var d=setTimeout(function(){var a=null,a=c(".motopress-content-wrapper .motopress-row");c.each(a.get().reverse(),function(){var a=(c(this).hasClass("motopress-row-edge")?
c(this):c(this).find(".motopress-row-edge").first()).children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),b=c(this).height();a.filter(".motopress-empty").height(b)});c.each(a,function(){var a=c(this),a=a.hasClass("motopress-row-edge")?a:a.find(".motopress-row-edge").first(),b=a.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),d=0,d=CE.Grid.myThis.padding?2*CE.Grid.myThis.padding:a.width()/100*CE.Grid.myThis.columnMarginPiece,
e=a.height();b.each(function(){var a=c(this),b=parseInt(a.css("margin-top"))+parseInt(a.css("border-top-width")),f=CE.Grid.myThis.padding&&c(this).is("[data-motopress-wrapper-id]")?d/2:d;a.find(".motopress-splitter").css({height:e,top:-b});a.find(".motopress-handle-intermediate").css({width:d,height:e,top:-b,left:-f-parseInt(a.css("border-left-width"))})})});clearTimeout(d)},50)},hideSplitters:function(a){a="undefined"===typeof a?a=!1:a;var b=c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+
'"] .motopress-splitter');a?b.not(a).addClass("motopress-hide"):b.addClass("motopress-hide")},showSplitters:function(){c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"] .motopress-splitter').removeClass("motopress-hide")},hideEmptySpans:function(){c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-empty').addClass("motopress-empty-hide").height(1)},showEmptySpans:function(){c('.motopress-content-wrapper [class*="'+
parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-empty').removeClass("motopress-empty-hide")},calculateRowGap:function(a,b){var d=0;if(a.hasClass("motopress-row-edge"))d+=parseInt(a.css("padding-"+b)),d+=parseInt(a.css("border-"+b+"-width")),d+=-parseInt(a.css("margin-"+b));else{var e=a.find(".motopress-row-edge").first();e.parentsUntil(".motopress-row").each(function(){d+=parseInt(c(this).css("padding-"+b))});d+=parseInt(e.css("padding-"+b));d+=parseInt(e.css("border-"+b+"-width"));d+=
-parseInt(e.css("margin-"+b))}return d},updateHandle:function(){var a=setTimeout(function(){if(!CE.DragDrop.myThis.isEmptyScene()){var b=c(".motopress-content-wrapper > .motopress-row:first"),d=b.offset(),e=parseFloat(b.css("margin-left")),f=c(".motopress-content-wrapper > .motopress-row:last"),g=CE.LeftBar.myThis.leftBar.width(),k=c(".motopress-handle-wrapper-left:first, .motopress-handle-wrapper-right:first").width(),h=d.left-g-parent.CE.Navbar.myThis.scrollWidth/2;c(".motopress-content-wrapper > .motopress-row").each(function(){var a=
c(this),b=a.height(),d=c(this).hasClass("motopress-row-edge")?c(this):c(this).find(".motopress-row-edge").first(),e=d.offset().left-g-parent.CE.Navbar.myThis.scrollWidth/2,f=e-k;d.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:first, [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:last').each(function(){var d=c(this),g=parseInt(d.css("margin-top"))+parseInt(d.css("border-top-width"));c(this).children(".motopress-wrapper-helper, .motopress-helper").each(function(){var h=
c(this).hasClass("motopress-wrapper-helper")?f:e,k={left:c(this).hasClass("motopress-wrapper-helper")?parseInt(d.css("padding-left")):0,right:c(this).hasClass("motopress-wrapper-helper")?parseInt(d.css("padding-right")):0};c(this).find(".motopress-handle-left, .motopress-handle-right").each(function(){var f=c(this).hasClass("motopress-handle-left")?"left":"right",l=CE.Resizer.myThis.calculateRowGap(a,f),m=parseInt(d.css("border-"+f+"-width")),n={top:-g,width:h+l,height:b};n[f]=-e-m+k[f]-l;c(this).css(n)})})})});
var l=c("#motopress-container"),n=l.parent().width()-parent.CE.Navbar.myThis.scrollWidth,m=c(".motopress-content-wrapper > .motopress-handle-middle-in:first"),r=c(".motopress-content-wrapper > .motopress-handle-middle-in:last"),p=r.prevAll(".motopress-handle-middle-in:first");p[0]!==m[0]&&p.css({width:"",left:"",height:"","margin-top":""});var t=c("html").height(),u=parseInt(l.css("top")),p=t-r.offset().top;t<u+l.outerHeight(!0)&&(p+=u);f=parseInt(f.css("margin-bottom"));Math.abs(parseInt(r.css("margin-top")))!==
f&&(p+=f);b=parseInt(b.css("margin-top"));m.css({width:n,height:d.top,top:b-d.top,left:-h+e,"margin-top":""});r.css({width:n,left:-h+e,height:p,"margin-top":-f});c(".motopress-content-wrapper > .motopress-handle-more-disable").css({width:n,top:b-d.top,left:-h+e})}clearTimeout(a)},50)},updateBottomInHandleMiddle:function(){var a=setTimeout(function(){CE.DragDrop.myThis.isEmptyScene()||c(".motopress-content-wrapper > .motopress-row").each(function(){CE.Resizer.myThis.setHandleHeight(c(this))});clearTimeout(a)},
50)},setHandleHeight:function(a){var b=parseInt(a.find(".motopress-handle-middle-in:last").css("min-height"));a.find(".motopress-handle-middle-in").each(function(){c(this).height(b)});(a.hasClass("motopress-row-edge")?a:a.find(".motopress-row-edge").first()).children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:not(".motopress-empty")').each(function(){var b=c(this).children(".motopress-row"),e=null,f=null,g=null,k=0,h=a.is(":last-of-type")?0:5;b.length?(h=c(this).children(".motopress-handle-middle-in:last"),
g=parseInt(h.css("min-height")),e=a.height(),f=c(this).outerHeight(!0),f<e&&(k=e-f),h.height(k+g),b.each(function(){CE.Resizer.myThis.setHandleHeight(c(this))})):(b=c(this).find(".motopress-handle-bottom-in"),g=parseInt(b.css("min-height")),e=a.height(),f=c(this).outerHeight(!0),f<e&&(k=e-f),b.css({bottom:h-k,height:k+g}))})},updateHandleMiddle:function(){var a=setTimeout(function(){c('.motopress-content-wrapper > .motopress-handle-middle-in:not(":first, :last"), .motopress-content-wrapper > .motopress-row-edge > [class*="'+
parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn .motopress-handle-middle-in:not(":last-of-type")').each(function(){var a=c(this),d=a.prev(".motopress-more-handler").length?a.prev(".motopress-more-handler").prev(".motopress-row"):a.prev(".motopress-row"),e=a.next(".motopress-row"),f=d.length?parseInt(d.css("margin-bottom")):0,g=e.length?parseInt(e.css("margin-top")):0,e=-f-5,f=Math.max(f,g)+10;a.is('.motopress-content-wrapper>.motopress-handle-middle-in:not(":first, :last")')&&(d.css("margin-left"),
d.css("margin-right"),d.css("width"));0<f?a.css({"margin-top":e,height:f}):a.css({"margin-top":"",height:""})});c(".motopress-content-wrapper > .motopress-handle-middle-in:first, .motopress-content-wrapper > .motopress-handle-middle-in:last").css({"margin-left":"","margin-right":""});clearTimeout(a)},70)},changeSpanClass:function(a,b,c){parent.CE.Iframe.myThis.gridObj.span.type&&"multiple"===parent.CE.Iframe.myThis.gridObj.span.type&&"undefined"!==typeof a.attr("data-motopress-shortcode")&&(spanNumber=
parent.MP.Utils.getSpanNumber(c),a.attr("data-motopress-shortcode",parent.CE.Iframe.myThis.gridObj.span.shortcode[spanNumber-1]));c===parent.CE.Iframe.myThis.gridObj.span.minclass&&(c+=" motopress-clmn-min");a.removeClass(b+" motopress-clmn-min").addClass(c)}})});
steal("jquery/class",function(c){c.Class("CE.DragDrop",{myThis:null,interruptInsert:!1,curHandle:null},{blockContent:c("<div />",{"class":"motopress-block-content"}),handleTopIn:c("<div />",{"class":"motopress-handle-top-in","data-motopress-position":"top-in"}),handleBottomIn:c("<div />",{"class":"motopress-handle-bottom-in","data-motopress-position":"bottom-in"}),handleIntermediate:c("<div />",{"class":"motopress-handle-intermediate","data-motopress-position":"intermediate"}),handleLeftOut:c("<div />",
{"class":"motopress-handle-left-out","data-motopress-position":"left-out"}),handleRightOut:c("<div />",{"class":"motopress-handle-right-out","data-motopress-position":"right-out"}),handleLeftIn:c("<div />",{"class":"motopress-handle-left-in","data-motopress-position":"left-in"}),handleRightIn:c("<div />",{"class":"motopress-handle-right-in","data-motopress-position":"right-in"}),handleLeft:c("<div />",{"class":"motopress-handle-left","data-motopress-position":"left"}),handleRight:c("<div />",{"class":"motopress-handle-right",
"data-motopress-position":"right"}),overlay:c("<div />",{"class":"motopress-overlay"}),dragHandle:c("<div />",{"class":"motopress-drag-handle"}),focusArea:c("<div />",{"class":"motopress-focus-area",tabindex:-1}),helper:c("<section />",{"class":"motopress-helper"}),handleMiddleOut:c("<span />",{"class":"motopress-handle-middle-out","data-motopress-position":"middle-out"}),handleMiddleIn:c("<span />",{"class":"motopress-handle-middle-in","data-motopress-position":"middle-in"}),emptySceneHelper:c("<section />",
{id:"motopress-empty-scene-helper"}),emptySceneDroppable:c("<div />",{"class":"motopress-empty-scene",html:'<div class="motopress-empty-scene-container-first"><div class="motopress-empty-scene-image"></div><div class="motopress-empty-scene-wrapper-right"><div class="motopress-empty-scene-title">'+localStorage.getItem("CEEmptySceneHelperTitle")+'</div><div class="motopress-empty-scene-content">'+localStorage.getItem("CEEmptySceneHelperContent")+'</div></div></div><div class="motopress-empty-scene-container-second"><div class="motopress-empty-scene-or-label">'+
localStorage.getItem("CEEmptySceneHelperOr")+'</div><input type="text" class="motopress-empty-scene-type-here" value="'+localStorage.getItem("CEEmptySceneHelperInputText")+'"></div>'}),templates:c("<div />",{"class":"motopress-templates-container",html:'<div class="motopress-templates-title"><div class="motopress-templates-separator"><div class="motopress-templates-separator-line"></div></div><div class="motopress-templates-label">'+localStorage.getItem("CEChooseLayout")+'</div><div class="motopress-templates-separator"><div class="motopress-templates-separator-line"></div></div></div><div id="motopress-templates"></div>'}),
handleInsert:c("<div />",{"class":"motopress-handle-insert","data-motopress-position":"insert"}),emptySpanOverlay:c("<div />",{"class":"motopress-overlay"}),emptySpanHelper:c("<section />",{"class":"motopress-helper"}),handleWrapper:c("<div />",{"class":"motopress-handle-wrapper"}),wrapperHelperContainer:c("<div />",{"class":"motopress-wrapper-helper-container"}),handleWrapperLeft:c("<div />",{"class":"motopress-handle-wrapper-left","data-motopress-position":"wrapper-left"}),handleWrapperRight:c("<div />",
{"class":"motopress-handle-wrapper-right","data-motopress-position":"wrapper-right"}),wrapperHelper:c("<section />",{"class":"motopress-wrapper-helper"}),wrapperHelperResizer:c("<section />",{"class":"motopress-helper"}),wrapperId:0,lineHelperIntermediate:c("<div />",{"class":"motopress-line-helper-intermediate"}),lineHelperLeftOut:c("<div />",{"class":"motopress-line-helper-left-out"}),lineHelperRightOut:c("<div />",{"class":"motopress-line-helper-right-out"}),lineHelperLeft:c("<div />",{"class":"motopress-line-helper-left"}),
lineHelperRight:c("<div />",{"class":"motopress-line-helper-right"}),lineHelperLeftIn:c("<div />",{"class":"motopress-line-helper-left-in"}),lineHelperRightIn:c("<div />",{"class":"motopress-line-helper-right-in"}),lineHelperTopIn:c("<div />",{"class":"motopress-line-helper-top-in"}),lineHelperBottomIn:c("<div />",{"class":"motopress-line-helper-bottom-in"}),lineHelperHandleMiddle:c("<div />",{"class":"motopress-line-helper-middle-in"}),lineHelperInsert:c("<div />",{"class":"motopress-line-helper-insert"}),
lineHelperWrapperLeft:c("<div />",{"class":"motopress-line-helper-wrapper-left"}),lineHelperWrapperRight:c("<div />",{"class":"motopress-line-helper-wrapper-right"}),textHelperIntermediate:c("<div />",{"class":"motopress-text-helper-intermediate",text:localStorage.getItem("helperNewColumn")}),textHelperLeftOut:c("<div />",{"class":"motopress-text-helper-left-out",text:localStorage.getItem("helperNewColumn")}),textHelperRightOut:c("<div />",{"class":"motopress-text-helper-right-out",text:localStorage.getItem("helperNewColumn")}),
textHelperLeft:c("<div />",{"class":"motopress-text-helper-left",text:localStorage.getItem("helperNewColumn")}),textHelperRight:c("<div />",{"class":"motopress-text-helper-right",text:localStorage.getItem("helperNewColumn")}),textHelperLeftIn:c("<div />",{"class":"motopress-text-helper-left-in",text:localStorage.getItem("helperInsert")}),textHelperRightIn:c("<div />",{"class":"motopress-text-helper-right-in",text:localStorage.getItem("helperInsert")}),textHelperTopIn:c("<div />",{"class":"motopress-text-helper-top-in",
text:localStorage.getItem("helperInsert")}),textHelperBottomIn:c("<div />",{"class":"motopress-text-helper-bottom-in",text:localStorage.getItem("helperInsert")}),textHelperHandleMiddle:c("<div />",{"class":"motopress-text-helper-middle-in",text:localStorage.getItem("helperMiddle")}),textHelperInsert:c("<div />",{"class":"motopress-text-helper-insert",text:localStorage.getItem("helperInsert")}),textHelperWrapperLeft:c("<div />",{"class":"motopress-text-helper-wrapper-left",text:localStorage.getItem("helperNewColumn")}),
textHelperWrapperRight:c("<div />",{"class":"motopress-text-helper-wrapper-right",text:localStorage.getItem("helperNewColumn")}),textHelperHalfSize:null,lineHelperThickness:null,lineHelperHalfThickness:null,handleMiddleHalfThickness:null,moreHandler:null,helperContainer:c("<div />",{"class":"motopress-helper-container"}).appendTo("body"),newBlock:c("<div />",{"class":parent.CE.Iframe.myThis.gridObj.span.minclass+" motopress-clmn"}),spaceClass:"motopress-space",resizer:null,tools:null,canDrop:!1,spanSizeRules:null,
rowHtml:null,rowInnerHtml:null,setup:function(){this.resizer=new CE.Resizer;this.tools=new CE.Tools;this.generateSpanSizeRules();this.setCalcWrapperWidth(this.helper);this.setCalcWrapperWidth(this.emptySpanHelper);this.setCalcWrapperWidth(this.wrapperHelper);this.setCalcWrapperWidth(this.wrapperHelperResizer);this.overlay.append(this.handleIntermediate.clone(),this.handleLeft.clone(),this.handleTopIn,this.handleBottomIn,this.handleLeftOut,this.handleRightOut,this.handleLeftIn,this.handleRightIn,this.handleRight.clone());
this.helper.append(this.overlay,this.focusArea.clone(),this.dragHandle.clone(),this.resizer.splitter.clone());this.emptySpanOverlay.append(this.handleIntermediate.clone(),this.handleLeft.clone(),this.handleInsert.clone(),this.handleRight.clone());this.emptySpanHelper.append(this.emptySpanOverlay,this.resizer.splitter.clone());this.handleWrapperLeft.append(this.wrapperHelperContainer.clone());this.handleWrapperRight.append(this.wrapperHelperContainer.clone());this.wrapperHelper.append(this.handleIntermediate.clone(),
this.handleLeft.clone(),this.handleRight.clone());this.wrapperHelperResizer.append(this.resizer.splitter.clone());var a=setTimeout(function(){CE.DragDrop.myThis.textHelperHalfSize=Math.round(CE.DragDrop.myThis.textHelperHandleMiddle.height()/2);CE.DragDrop.myThis.lineHelperThickness=CE.DragDrop.myThis.lineHelperLeftIn.outerWidth();CE.DragDrop.myThis.lineHelperHalfThickness=Math.round(CE.DragDrop.myThis.lineHelperHandleMiddle.height()/2);CE.DragDrop.myThis.handleMiddleHalfThickness=Math.round(3);clearTimeout(a)},
0);this.emptySceneHelper.append(this.emptySceneDroppable,this.templates).appendTo(c(".motopress-content-wrapper"));this.helperContainer.append(this.lineHelperIntermediate,this.lineHelperLeftOut,this.lineHelperRightOut,this.lineHelperLeft,this.lineHelperRight,this.lineHelperLeftIn,this.lineHelperRightIn,this.lineHelperTopIn,this.lineHelperBottomIn,this.lineHelperHandleMiddle,this.lineHelperInsert,this.textHelperIntermediate,this.textHelperLeftOut,this.textHelperRightOut,this.textHelperLeft,this.textHelperRight,
this.textHelperLeftIn,this.textHelperRightIn,this.textHelperTopIn,this.textHelperBottomIn,this.textHelperHandleMiddle,this.textHelperInsert);c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"html",data:{action:"motopress_ce_render_shortcode",nonce:parent.motopressCE.nonces.motopress_ce_render_shortcode,postID:parent.motopressCE.postID,closeType:CE.LeftBar.myThis.library.mp_grid.objects[parent.CE.Iframe.myThis.gridObj.row.shortcode].closeType,shortcode:parent.CE.Iframe.myThis.gridObj.row.shortcode,
wrapRender:!1,parameters:null,styles:null,content:'<div class="motopress-filler-content"></div>'},success:function(a){CE.DragDrop.myThis.rowHtml=c(a)},error:function(a){a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),parent.MP.Flash.showMessage())}});c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"html",data:{action:"motopress_ce_render_shortcode",nonce:parent.motopressCE.nonces.motopress_ce_render_shortcode,postID:parent.motopressCE.postID,
closeType:CE.LeftBar.myThis.library.mp_grid.objects[parent.CE.Iframe.myThis.gridObj.row.inner].closeType,shortcode:parent.CE.Iframe.myThis.gridObj.row.inner,wrapRender:!1,parameters:null,styles:null,content:'<div class="motopress-filler-content"></div>'},success:function(a){CE.DragDrop.myThis.rowInnerHtml=c(a)},error:function(a){a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),parent.MP.Flash.showMessage())}})},init:function(){CE.DragDrop.myThis=
this;this.main();parent.MP.Preloader.myThis.load(CE.DragDrop.shortName)},main:function(){this.setEdgeRow(c(".motopress-content-wrapper .motopress-row"));this.moreHandler=c(".motopress-content-wrapper > .motopress-more-handler");this.addEmptySceneHelper();this.addHandleMoreDisable();this.recursiveAddHandleMiddle(c(".motopress-content-wrapper"));this.makeEditable(c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:not(.motopress-empty)'));this.makeRowEditable(c(".motopress-content-wrapper .motopress-row"));
this.makeEditableEmptySpan(c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn.motopress-empty'));this.resizer.updateBottomInHandleMiddle();this.resizer.updateSplitterHeight(null,"init");this.resizer.updateSplittableOptions(null,null,null,"init");this.resizer.updateHandle();this.resizer.updateHandleMiddle();this.makeDraggableMoreHandler()},isEmptyScene:function(){return c(".motopress-content-wrapper .motopress-row").length?!1:!0},addEmptySceneHelper:function(){this.makeEmptySceneHelperDroppable();
this.makeEmptySceneHelperFocusable();this.isEmptyScene()&&(this.emptySceneHelper.show(),this.moreHandler.hide())},addHandleMoreDisable:function(){var a=c(".motopress-content-wrapper");a.children(".motopress-handle-more-disable").length||a.prepend(c("<section />",{"class":"motopress-handle-more-disable","data-motopress-position":"more-disable"}))},makeEmptySceneHelperFocusable:function(){c(".motopress-empty-scene-type-here").on("focusin",function(){CE.DragDrop.myThis.emptySceneHelper.hide().css("opacity",
1);var a=c(this).closest(".motopress-row"),b=CE.DragDrop.myThis.newBlock.clone();CE.Resizer.myThis.changeSpanClass(b,parent.CE.Iframe.myThis.gridObj.span.minclass,parent.CE.Iframe.myThis.gridObj.span.fullclass);var d={helper:c("<div />",{"data-motopress-close-type":CE.LeftBar.myThis.library.mp_text.objects.mp_text.closeType,"data-motopress-shortcode":CE.LeftBar.myThis.library.mp_text.objects.mp_text.id,"data-motopress-group":CE.LeftBar.myThis.library.mp_text.id,"data-motopress-resize":CE.LeftBar.myThis.library.mp_text.objects.mp_text.resize})},
e=CE.LeftBar.myThis.library.mp_text.objects.mp_text.parameters;if(!c.isEmptyObject(e)){var f={};c.each(e,function(a){f[a]={}});d.helper.attr("data-motopress-parameters",JSON.stringify(f))}e=CE.Style.props;if(!c.isEmptyObject(e)){var g={};c.each(e,function(a){g[a]={}});d.helper.attr("data-motopress-styles",JSON.stringify(g))}CE.DragDrop.myThis.makeEditable(b,d,!0);a=CE.DragDrop.myThis.rowHtml.clone().find(".motopress-filler-content").replaceWith(b).end();CE.DragDrop.myThis.makeRowEditable(a,!0);c(".motopress-content-wrapper").append(a);
var k=setTimeout(function(){CE.DragDrop.myThis.addHandleMiddle(a,parent.CE.Iframe.myThis.gridObj.span.fullclass);clearTimeout(k)},0),h=setTimeout(function(){CE.Selectable.myThis.select(b.find(".motopress-drag-handle"));CE.DragDrop.myThis.makeDroppable();CE.DragDrop.myThis.resizer.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(b,"drop");CE.Resizer.myThis.updateSplittableOptions(b,null,a);CE.DragDrop.myThis.resizer.updateHandle();CE.DragDrop.myThis.resizer.updateHandleMiddle();
clearTimeout(h)},0);parent.CE.Save.changeContent();CE.DragDrop.myThis.moreHandler.show()})},makeSpanSelectable:function(a){var b=c("<div />",{"class":"motopress-clmn-select-handle"});a.children(".motopress-helper").append(b.clone())},makeRowEditable:function(a,b){b="undefined"!==typeof b&&b?!0:!1;a.each(function(){var a=c(this);CE.DragDrop.myThis.setEdgeRow(a);var e=a.hasClass("motopress-row-edge")?a:a.find(".motopress-row-edge").first();if(!e.children(".motopress-row-helper").length){var f=c("<span />",
{"class":"motopress-row-helper"}),g=c("<div />",{"class":"motopress-row-select-handle"});f.append(g.clone());e.append(f.clone());f=a.attr("data-motopress-shortcode");!b&&f||CE.DragDrop.myThis.setAttrs(a)}"undefined"===typeof a.controller(CE.Controls)&&a.ce_controls({isNew:b});e=a.controller(CE.Controls);!b&&f||!e||(e.setDefaultStyle(),a="undefined"!==typeof a.attr("data-motopress-parameters")?a.attr("data-motopress-parameters"):null,e.setDefaultAttrs(a),e.saveStyle())})},setEdgeRow:function(a){c.each(a,
function(){c(this).hasClass(parent.CE.Iframe.myThis.gridObj.row["class"])?c(this).addClass("motopress-row-edge"):c(this).find("."+parent.CE.Iframe.myThis.gridObj.row["class"]).first().addClass("motopress-row-edge")})},makeEditable:function(a,b,d){d="undefined"!==typeof d&&d?!0:!1;a.each(function(){var a=c(this);if(!a.closest(".motopress-block-content").length){CE.DragDrop.myThis.addHelpers(a);CE.DragDrop.myThis.resizer.makeResizable(a);CE.DragDrop.myThis.resizer.makeSplittable(a);CE.DragDrop.myThis.makeDraggable(a);
CE.DragDrop.myThis.makeDroppable();"undefined"!==typeof b&&null!==b&&CE.DragDrop.myThis.setAttrs(a,b);d&&a.addClass("motopress-new-object");a.ce_controls({isNew:d});var f=a.controller(CE.Controls);d&&f&&(f.setDefaultStyle(),f.saveStyle());f=a.children(".motopress-block-content");if(f.length){var f=f.children("[data-motopress-shortcode]"),g=f.attr("data-motopress-shortcode");d&&f.addClass("motopress-new-object");switch(g){case "mp_text":case "mp_heading":f.ce_inline_editor({isNew:d});break;case "mp_code":f.ce_code_editor({isNew:d});
break;default:f.ce_controls({isNew:d})}(f=f.controller(CE.Controls))&&(d?f.renderShortcode(d):f.render(!1))}a.children(".motopress-clmn-select-handle").length||CE.DragDrop.myThis.makeSpanSelectable(a)}})},makeEditableEmptySpan:function(a){if(a.length){a.each(function(){c(this).children(".motopress-helper").length||c(this).append(CE.DragDrop.myThis.emptySpanHelper.clone())});var b=setTimeout(function(){CE.DragDrop.myThis.makeDroppable();clearTimeout(b)},0);this.resizer.makeSplittable(a)}},addHelpers:function(a){a.each(function(){if(!c(this).children(".motopress-block-content").length&&
!c(this).children(".motopress-row").length){c(this).find("script").remove().end().wrapInner(CE.DragDrop.myThis.blockContent.clone());c(this).children(".motopress-block-content").children().length||c(this).children(".motopress-block-content").append("<div />");var a=c(this).find(".motopress-block-content > [data-motopress-shortcode]");a.length&&a.attr("data-motopress-shortcode")}c(this).children(".motopress-helper").length||(c(this).children(".motopress-row").length?(c(this).attr("data-motopress-wrapper-id",
CE.DragDrop.myThis.wrapperId),CE.DragDrop.myThis.setCalcWrapperWidth(c(this).children(".motopress-handle-middle-in")),c(this).prepend(CE.DragDrop.myThis.wrapperHelperResizer.clone()),a=null,c(this).closest(".motopress-row").parent(".motopress-content-wrapper").length?(a=CE.DragDrop.myThis.wrapperHelper.clone(),c(this).prepend(a)):a=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:has(".motopress-wrapper-helper")').children(".motopress-wrapper-helper"),CE.DragDrop.myThis.addHandleWrapper(a),
CE.DragDrop.myThis.droppableHandleWrapper(a),CE.DragDrop.myThis.wrapperId++):c(this).append(CE.DragDrop.myThis.helper.clone()))})},setAttrs:function(a,b){this._setAttrs(a);var c=a.find("> .motopress-block-content > div");if(c.length){var e=b.draggable?b.draggable:b.helper,f={closeType:e.attr("data-motopress-close-type"),id:e.attr("data-motopress-shortcode"),group:e.attr("data-motopress-group"),resize:e.attr("data-motopress-resize")},g=e.attr("data-motopress-parameters");"undefined"!==typeof g&&(f.parameters=
g);e=e.attr("data-motopress-styles");"undefined"!==typeof e&&(f.styles=e);this._setAttrs(c,f)}},_setAttrs:function(a,b){if("undefined"===typeof b){var c=null;a.hasClass("motopress-row")?c=a.parent(".motopress-content-wrapper").length?parent.CE.Iframe.myThis.gridObj.row.shortcode:parent.CE.Iframe.myThis.gridObj.row.inner:"multiple"===parent.CE.Iframe.myThis.gridObj.span.type?(c=parent.MP.Utils.getSpanClass(a.prop("class").split(" ")),c=parent.MP.Utils.getSpanNumber(c),c=parent.CE.Iframe.myThis.gridObj.span.shortcode[c-
1]):c=parent.CE.Iframe.myThis.gridObj.span.shortcode;CE.LeftBar.myThis.setAttrs(a,CE.LeftBar.myThis.library.mp_grid.id,CE.LeftBar.myThis.library.mp_grid.objects[c])}else a.attr({"data-motopress-close-type":b.closeType,"data-motopress-shortcode":b.id,"data-motopress-group":b.group,"data-motopress-resize":b.resize}),b.hasOwnProperty("parameters")&&a.attr("data-motopress-parameters",b.parameters),b.hasOwnProperty("styles")&&a.attr("data-motopress-styles",b.styles)},makeDraggable:function(a){var b=this,
d=a.find(".motopress-drag-handle");a.draggable({cursor:"move",distance:5,helper:"clone",handle:".motopress-drag-handle",opacity:"0",zIndex:1,appendTo:".motopress-content-wrapper:first",start:function(){CE.LeftBar.myThis.disable();b.canDrop=!0;CE.Selectable.myThis.unselect(d);c(".motopress-splitter").addClass("motopress-hide");c(this).css("opacity",.3);c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn .motopress-drag-handle').addClass("motopress-start-drag")},
stop:function(a,b){CE.LeftBar.myThis.enable();c(".motopress-splitter").removeClass("motopress-hide");c(this).css("opacity","");c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn .motopress-drag-handle').removeClass("motopress-start-drag");CE.Selectable.myThis.select(d);CE.DragDrop.myThis.helperContainer.children().hide()},drag:function(){CE.DragDrop.myThis.onDrag()}}).removeClass("ui-draggable")},makeDraggableMoreHandler:function(){var a=null,
b=null,d=null,e=null,f=parseFloat(CE.DragDrop.myThis.moreHandler.css("left")),g=parseFloat(c("#motopress-container > .motopress-row").attr("data-margin-left"));CE.DragDrop.myThis.moreHandler.length&&CE.DragDrop.myThis.moreHandler[0].style.setProperty("left",f+g+"px","important");CE.DragDrop.myThis.moreHandler.draggable({cursor:"move",zIndex:10002,axis:"y",cursorAt:{top:15},helper:"clone",appendTo:".motopress-content-wrapper:first",start:function(f,g){c(this).hide();CE.DragDrop.myThis.makeDroppableForMore();
a=c(".motopress-content-wrapper > .motopress-handle-more-disable").height();b=c(".motopress-content-wrapper > .motopress-handle-middle-in:first");d=parseInt(b.css("top"));e=b.height();var l=e-a;b[0].style.setProperty("top",d+a+"px","important");b[0].style.setProperty("height",l+"px","important");var n=CE.LeftBar.myThis.leftBar.width(),l=c('.motopress-content-wrapper > .motopress-handle-middle-in:not(":first, :last")');if(l.length){var n=l.eq(0).offset().left-n-parent.CE.Navbar.myThis.scrollWidth/
2,m=l.eq(0).css("margin-left"),r=l.eq(0).css("margin-right");g.helper.data("handle-middle-margin-left",m);g.helper.data("handle-middle-margin-right",r);g.helper.data("handle-middle-width",l.css("width"));l.css({"margin-left":-n+parseFloat(m),"margin-right":-n+parseFloat(r),width:"+="+2*n+"px"});n=c("#motopress-container").offset().left-l.eq(0).offset().left-3;l.css({"padding-left":n})}l=c(".motopress-content-wrapper").children(".motopress-handle-middle-in:last, .motopress-handle-middle-in:first, .motopress-handle-more-disable");
n=c("#motopress-container").offset().left-l.eq(0).offset().left-3;l.css("padding-left",n);CE.LeftBar.myThis.disable();l=c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"] .motopress-drag-handle.'+CE.Selectable.myThis.selectedClass);l.length&&CE.Selectable.myThis.unselect(l);c(".motopress-splitter").addClass("motopress-hide");g.helper.data("dropped",!1);c(".motopress-content-wrapper").children(".motopress-handle-middle-in, .motopress-handle-more-disable").addClass("motopress-more-dragging")},
stop:function(a,f){c(".motopress-content-wrapper").children(".motopress-handle-middle-in, .motopress-handle-more-disable").removeClass("motopress-more-dragging");c(this).show();CE.DragDrop.myThis.makeDroppable();b=c(".motopress-content-wrapper > .motopress-handle-middle-in:first");b[0].style.setProperty("top",d+"px","important");b[0].style.setProperty("height",e+"px","important");c('.motopress-content-wrapper > .motopress-handle-middle-in:not(":first, :last")').css({"margin-left":f.helper.data("handle-middle-margin-left"),
"margin-right":f.helper.data("handle-middle-margin-right"),width:f.helper.data("handle-middle-width")});c(".motopress-content-wrapper").find(".motopress-handle-middle-in, .motopress-handle-more-disable").css({"padding-left":""});CE.LeftBar.myThis.enable();c(".motopress-splitter").removeClass("motopress-hide");CE.DragDrop.myThis.helperContainer.children().hide();!0===f.helper.data("dropped")&&parent.CE.Save.changeContent()}})},makeDraggableNewBlock:function(){var a=this;c(".motopress-ce-object").draggable({cursor:"move",
cursorAt:{top:-10,left:-10},helper:"clone",zIndex:10002,appendTo:".motopress-content-wrapper:first",start:function(b,d){CE.LeftBar.myThis.disable();a.canDrop=!0;var e=c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"] .motopress-drag-handle.'+CE.Selectable.myThis.selectedClass);e.length&&CE.Selectable.myThis.unselect(e);c(".motopress-empty-scene-type-here").addClass("motopress-empty-scene-type-here-nohover");d.helper.children(".motopress-ce-object-inner").css("cssText",
"box-shadow: none !important");c(this).closest(".popover").prev('.motopress-leftbar-group[data-clickover-open="1"]').trigger("mousedown");c(".motopress-splitter").addClass("motopress-hide");c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn .motopress-drag-handle').addClass("motopress-start-drag");d.helper.data("dropped",!1)},stop:function(a,d){CE.LeftBar.myThis.enable();c(".motopress-empty-scene-type-here").removeClass("motopress-empty-scene-type-here-nohover");
c(".motopress-splitter").removeClass("motopress-hide");c('.motopress-content-wrapper [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn .motopress-drag-handle').removeClass("motopress-start-drag");!1===d.helper.data("dropped")&&CE.DragDrop.myThis.dropOnStageHandler(a,d)&&parent.CE.Save.changeContent();CE.DragDrop.myThis.helperContainer.children().hide()},drag:function(){CE.DragDrop.myThis.onDrag()}})},onDrag:function(){var a=c(".motopress-droppable-hover");if(a.length){if(a=
a.attr("data-motopress-position"),null!==a){var a=".motopress-line-helper-"+a+", .motopress-text-helper-"+a,b=this.helperContainer.children();b.not(a).hide();b.filter(a).show()}}else this.helperContainer.children().hide()},dropOnStageHandler:function(a,b){var d=b.helper.hasClass("motopress-ce-object"),e=c(".motopress-content-wrapper").find(".motopress-handle-middle-in:last");if(d&&e&&e.hasClass("motopress-handle-middle-in")){var f,g=CE.DragDrop.myThis,k=g.newBlock.clone();"mp_space"===b.helper.attr("data-motopress-shortcode")&&
k.addClass(g.spaceClass);g.makeEditable(k,b,!0);parent.MP.Utils.getSpanClass(k.prop("class").split(" "));f=CE.DragDrop.myThis.rowHtml.clone().find(".motopress-filler-content").replaceWith(k).end();e.after(f);CE.DragDrop.myThis.makeRowEditable(f,d);var h=setTimeout(function(){g.addHandleMiddle(f,"motopress-content-wrapper");g.resize(void 0,k,"middle");var a=k.find(".motopress-drag-handle");CE.Selectable.myThis.select(a);g.makeDroppable();CE.DragDrop.myThis.resizer.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(k,
"drop");CE.Resizer.myThis.updateSplittableOptions(k,void 0,f);CE.DragDrop.myThis.resizer.updateHandle();CE.DragDrop.myThis.resizer.updateHandleMiddle();clearTimeout(h)},0);return!0}return!1},makeEmptySceneHelperDroppable:function(){var a=this;this.emptySceneDroppable.droppable({accept:".motopress-ce-object",tolerance:"pointer",drop:function(b,d){if(a.canDrop)a.canDrop=!1;else return!1;CE.DragDrop.myThis.emptySceneHelper.hide();c(this).css("opacity",1);var e=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+
'"].motopress-clmn');0==e.length&&(e=c(this));var f=parent.MP.Utils.getSpanClass(e.prop("class").split(" ")),g=e=null,k=c(this).closest(".motopress-row"),h=null,l=d.draggable.hasClass("motopress-ce-object");l?(h=CE.DragDrop.myThis.newBlock.clone(),"mp_space"===d.draggable.attr("data-motopress-shortcode")&&h.addClass(CE.DragDrop.myThis.spaceClass),CE.DragDrop.myThis.makeEditable(h,d,!0),g=null):(h=d.draggable,g=h.parent(".motopress-row"));var e=parent.MP.Utils.getSpanClass(h.prop("class").split(" ")),
e=CE.DragDrop.myThis.removeEmptyBlocks(h,e),n=!1;null==f&&(f=parent.CE.Iframe.myThis.gridObj.span.fullclass,n=!0);k=CE.DragDrop.myThis.rowHtml.clone().find(".motopress-filler-content").replaceWith(h).end();c(".motopress-content-wrapper").append(k);CE.DragDrop.myThis.makeRowEditable(k,l);var m=setTimeout(function(){g=CE.DragDrop.myThis.clearIfEmpty(g);n&&(f="motopress-content-wrapper");CE.DragDrop.myThis.addHandleMiddle(k,f);CE.DragDrop.myThis.resize(g,h,"middle");clearTimeout(m)},0),r=setTimeout(function(){var a=
h.find(".motopress-drag-handle");CE.Selectable.myThis.select(a);CE.DragDrop.myThis.makeDroppable();CE.DragDrop.myThis.resizer.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(h,"drop");CE.Resizer.myThis.updateSplittableOptions(h,g,k);CE.DragDrop.myThis.resizer.updateHandle();CE.DragDrop.myThis.resizer.updateHandleMiddle();clearTimeout(r)},0);CE.DragDrop.myThis.moreHandler.show();parent.CE.Save.changeContent()},over:function(){c(this).css("opacity",.5)},out:function(){c(this).css("opacity",
1)}})},makeDroppableForMore:function(){c(".motopress-content-wrapper").children(".motopress-handle-middle-in, .motopress-handle-more-disable").droppable({accept:".motopress-more-handler",tolerance:"pointer",hoverClass:"motopress-droppable-hover",drop:function(a,b){b.helper.data("dropped",!0);b.draggable.insertBefore(c(this));b.draggable.css("top","");switch(c(this).attr("data-motopress-position")){case "middle-in":b.draggable.removeClass("motopress-more-handler-disabled");break;case "more-disable":b.draggable.addClass("motopress-more-handler-disabled"),
b.draggable.css("top",-parseInt(c("#motopress-container").css("padding-top")))}},over:function(){},out:function(){}})},makeDroppable:function(){var a=this;c(".motopress-content-wrapper").find(".motopress-handle-intermediate, .motopress-handle-left, .motopress-handle-top-in, .motopress-handle-bottom-in, .motopress-handle-left-out, .motopress-handle-right-out, .motopress-handle-left-in, .motopress-handle-right-in, .motopress-handle-middle-in, .motopress-handle-insert, .motopress-handle-right").droppable({accept:'[class*="'+
parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn, .motopress-ce-object',tolerance:"pointer",hoverClass:"motopress-droppable-hover",drop:function(b,d){if(a.canDrop)a.canDrop=!1;else return!1;var e=c(this).attr("data-motopress-position");d.helper.data("dropped",!0);var f=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');0===f.length&&(f=c(this));var g=parent.MP.Utils.getSpanClass(f.prop("class").split(" ")),k=null,h=null,l=c(this).closest(".motopress-row-edge"),
n=null,m=null,r=null,p=null,t=d.draggable.hasClass("motopress-ce-object");t?(r=null,p=CE.DragDrop.myThis.newBlock.clone(),"mp_space"===d.draggable.attr("data-motopress-shortcode")&&p.addClass(CE.DragDrop.myThis.spaceClass),CE.DragDrop.myThis.makeEditable(p,d,!0),h=null):(r=d,p=r.draggable,h=p.closest(".motopress-row"));var u,m=null;null!==h&&(n=h.children(".motopress-clmn").index(p),m=p.prev(),m.length&&m.hasClass("motopress-empty")&&n--);m=l.children(".motopress-clmn");k=parent.MP.Utils.getSpanClass(p.prop("class").split(" "));
k=CE.DragDrop.myThis.removeEmptyBlocks(p,k);switch(e){case "top-in":if(!1!==(u=CE.DragDrop.myThis.canBeMoved(h,null,n,0,r))){n=CE.DragDrop.myThis.rowInnerHtml.clone().find(".motopress-filler-content").replaceWith(p).end();e=CE.DragDrop.myThis.rowInnerHtml.clone();f.before(e);var s=e.find(".motopress-filler-content").replaceWith(f).end().wrap('<div class="'+g+' motopress-clmn" />');s.before(n);CE.DragDrop.myThis.makeRowEditable(n.add(s),t);f=s.parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+
'"].motopress-clmn');f.attr({"data-motopress-wrapper-id":CE.DragDrop.myThis.wrapperId}).prepend(CE.DragDrop.myThis.wrapperHelperResizer.clone());CE.DragDrop.myThis.resizer.makeSplittable(f);t=null;f.closest(".motopress-row").parent(".motopress-content-wrapper").length?(t=CE.DragDrop.myThis.wrapperHelper.clone(),f.prepend(t)):t=f.closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:has(".motopress-wrapper-helper")').children(".motopress-wrapper-helper");CE.DragDrop.myThis.makeEditable(f,
d,!0);CE.DragDrop.myThis.addHandleWrapper(t);CE.DragDrop.myThis.droppableHandleWrapper(t);CE.DragDrop.myThis.wrapperId++;var q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);CE.DragDrop.myThis.addHandleMiddle(s,g);CE.DragDrop.myThis.resize(h,p,"top-in",u);clearTimeout(q)},0)}break;case "bottom-in":!1!==(u=CE.DragDrop.myThis.canBeMoved(h,null,n,0,r))&&(n=CE.DragDrop.myThis.rowInnerHtml.clone().find(".motopress-filler-content").replaceWith(p).end(),e=CE.DragDrop.myThis.rowInnerHtml.clone(),
f.before(e),s=e.find(".motopress-filler-content").replaceWith(f).end().wrap('<div class="'+g+' motopress-clmn" />'),s.after(n),CE.DragDrop.myThis.makeRowEditable(n.add(s),t),f=s.parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),f.attr({"data-motopress-wrapper-id":CE.DragDrop.myThis.wrapperId}).prepend(CE.DragDrop.myThis.wrapperHelperResizer.clone()),CE.DragDrop.myThis.resizer.makeSplittable(f),t=null,f.closest(".motopress-row").parent(".motopress-content-wrapper").length?
(t=CE.DragDrop.myThis.wrapperHelper.clone(),f.prepend(t)):t=f.closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:has(".motopress-wrapper-helper")').children(".motopress-wrapper-helper"),CE.DragDrop.myThis.makeEditable(f,d,!0),CE.DragDrop.myThis.addHandleWrapper(t),CE.DragDrop.myThis.droppableHandleWrapper(t),CE.DragDrop.myThis.wrapperId++,q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);CE.DragDrop.myThis.addHandleMiddle(s,g);CE.DragDrop.myThis.resize(h,
p,"bottom-in",u);clearTimeout(q)},0));break;case "left-out":case "left":case "intermediate":m="left"===e?0:m.index(f);!1!==(u=CE.DragDrop.myThis.canBeMoved(h,l,n,0>m?0:m,r,"out"))&&(f.parent().length&&f.before(p),q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);if(null===h||h[0]!==l[0])CE.DragDrop.myThis.resize(h,p,"left-out",u);else{var a=parent.MP.Utils.calcSpanNumber(h,r);CE.Resizer.myThis.changeSpanClass(p,k,parent.CE.Iframe.myThis.gridObj.span["class"]+(parent.CE.Iframe.myThis.gridObj.row.col-
a))}clearTimeout(q)},0));break;case "right-out":case "right":m="right"===e?m.length:m.index(f)+1;!1!==(u=CE.DragDrop.myThis.canBeMoved(h,l,n,m,r,"out"))&&(f.parent().length&&f.after(p),q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);if(null===h||h[0]!==l[0])CE.DragDrop.myThis.resize(h,p,"right-out",u);else{var a=parent.MP.Utils.calcSpanNumber(h,r);CE.Resizer.myThis.changeSpanClass(p,k,parent.CE.Iframe.myThis.gridObj.span["class"]+(parent.CE.Iframe.myThis.gridObj.row.col-a))}clearTimeout(q)},
0));break;case "left-in":m=0;1<parent.MP.Utils.getSpanNumber(g)&&!1!==(u=CE.DragDrop.myThis.canBeMoved(h,l,n,m,r,"left-in",f))&&(e=CE.DragDrop.myThis.rowInnerHtml.clone(),f.before(e),s=e.find(".motopress-filler-content").replaceWith(f).end().wrap('<div class="'+g+' motopress-clmn" />'),f.before(p),CE.DragDrop.myThis.makeRowEditable(s,t),f=s.parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),f.attr({"data-motopress-wrapper-id":CE.DragDrop.myThis.wrapperId}).prepend(CE.DragDrop.myThis.wrapperHelperResizer.clone()),
CE.DragDrop.myThis.resizer.makeSplittable(f),t=null,f.closest(".motopress-row").parent(".motopress-content-wrapper").length?(t=CE.DragDrop.myThis.wrapperHelper.clone(),f.prepend(t)):t=f.closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:has(".motopress-wrapper-helper")').children(".motopress-wrapper-helper"),CE.DragDrop.myThis.makeEditable(f,d,!0),CE.DragDrop.myThis.addHandleWrapper(t),CE.DragDrop.myThis.droppableHandleWrapper(t),CE.DragDrop.myThis.wrapperId++,q=
setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);CE.DragDrop.myThis.addHandleMiddle(s,g);CE.DragDrop.myThis.resize(h,p,"left-in",u);clearTimeout(q)},0));break;case "right-in":m=1;1<parent.MP.Utils.getSpanNumber(g)&&!1!==(u=CE.DragDrop.myThis.canBeMoved(h,l,n,m,r,"right-in",f))&&(e=CE.DragDrop.myThis.rowInnerHtml.clone(),f.before(e),s=e.find(".motopress-filler-content").replaceWith(f).end().wrap('<div class="'+g+' motopress-clmn" />'),f.after(p),CE.DragDrop.myThis.makeRowEditable(s,t),f=
s.parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),f.attr({"data-motopress-wrapper-id":CE.DragDrop.myThis.wrapperId}).prepend(CE.DragDrop.myThis.wrapperHelperResizer.clone()),CE.DragDrop.myThis.resizer.makeSplittable(f),t=null,f.closest(".motopress-row").parent(".motopress-content-wrapper").length?(t=CE.DragDrop.myThis.wrapperHelper.clone(),f.prepend(t)):t=f.closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:has(".motopress-wrapper-helper")').children(".motopress-wrapper-helper"),
CE.DragDrop.myThis.makeEditable(f,d,!0),CE.DragDrop.myThis.addHandleWrapper(t),CE.DragDrop.myThis.droppableHandleWrapper(t),CE.DragDrop.myThis.wrapperId++,q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);CE.DragDrop.myThis.addHandleMiddle(s,g);CE.DragDrop.myThis.resize(h,p,"right-in",u);clearTimeout(q)},0));break;case "middle-in":if(!1!==(u=CE.DragDrop.myThis.canBeMoved(h,null,n,0,r))){var v=!1;null==g&&(g=parent.CE.Iframe.myThis.gridObj.span.fullclass+" motopress-clmn",v=!0);var x=parseInt(c(this).css("min-height"));
c(this).siblings(".motopress-handle-middle-in").add(this).each(function(){c(this).height(x)});c(".motopress-content-wrapper > .motopress-handle-middle-in:last").height("");l=c(this).parent(".motopress-content-wrapper").length?CE.DragDrop.myThis.rowHtml.clone().find(".motopress-filler-content").replaceWith(p).end():CE.DragDrop.myThis.rowInnerHtml.clone().find(".motopress-filler-content").replaceWith(p).end();c(this).after(l);CE.DragDrop.myThis.makeRowEditable(l,t);q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);
v&&(g="motopress-content-wrapper");CE.DragDrop.myThis.addHandleMiddle(l,g);CE.DragDrop.myThis.resize(h,p,"middle",u);clearTimeout(q)},0)}break;case "insert":t=parent.MP.Utils.getSpanClass(f.prop("class").split(" ")),f.parent().length&&f.replaceWith(p),a.resizer.changeSpanClass(p,k,t),m=m.index(f),h&&(u=CE.DragDrop.myThis.canBeMoved(h,null,n,m,r,"insert"),q=setTimeout(function(){h=CE.DragDrop.myThis.clearIfEmpty(h);CE.DragDrop.myThis.resize(h,p,"insert",u);clearTimeout(q)},0))}var y=setTimeout(function(){var a=
p.find(".motopress-drag-handle");CE.Selectable.myThis.select(a);CE.DragDrop.myThis.makeDroppable();CE.DragDrop.myThis.resizer.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(p,"drop");CE.Resizer.myThis.updateSplittableOptions(p,h,l);CE.DragDrop.myThis.resizer.updateHandle();CE.DragDrop.myThis.resizer.updateHandleMiddle();clearTimeout(y)},0);parent.CE.Save.changeContent()},over:function(){var a=c(this).attr("data-motopress-position"),d="middle-in"!==a?c(this).closest('[class*="'+
parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'):c(this);CE.DragDrop.myThis.showLineTextHelper(d,a)},out:function(){c(this).attr("data-motopress-position");a.onDrag()}})},showLineTextHelper:function(a,b){var d=a.offset(),e=d.left+CE.Grid.myThis.padding,d=d.top,f,g,k;if(0<=c.inArray(b,["intermediate","left-out","right-out","left","right"])){k=a.children(".motopress-helper, .motopress-wrapper-helper").find(".motopress-handle-intermediate").width();4<k?(f=2,g=k-4,k-=f):(f=1,g=k);var h=
0;CE.Grid.myThis.padding||(h=f/2)}switch(b){case "intermediate":this.lineHelperIntermediate.css({width:g,height:a.parent().height(),top:d-parseFloat(a.css("margin-top")),left:Math.ceil(e-k-h)}).show();this.textHelperIntermediate.css({top:this.lineHelperIntermediate.offset().top,left:this.lineHelperIntermediate.offset().left+g}).show();break;case "left-out":this.lineHelperLeftOut.css({width:g,height:a.parent().height(),top:d-parseInt(a.css("margin-top")),left:Math.ceil(e-k-h)}).show();this.textHelperLeftOut.css({top:this.lineHelperLeftOut.offset().top,
left:this.lineHelperLeftOut.offset().left+g}).show();break;case "right-out":var l=a.next('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');this.lineHelperRightOut.css({width:g,height:a.parent().height(),top:d-parseInt(a.css("margin-top")),left:Math.ceil(l.length?l.offset().left+CE.Grid.myThis.padding-k-h:e+a.width()+f)}).show();this.textHelperRightOut.css({top:this.lineHelperRightOut.offset().top,left:this.lineHelperRightOut.offset().left+g}).show();break;case "left":this.lineHelperLeft.css({width:g,
height:a.parent().height(),top:d-parseInt(a.css("margin-top")),left:Math.ceil(e-k-h)}).show();this.textHelperLeft.css({top:this.lineHelperLeft.offset().top,left:this.lineHelperLeft.offset().left+g}).show();break;case "right":l=a.next('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');this.lineHelperRight.css({width:g,height:a.parent().height(),top:d-parseInt(a.css("margin-top")),left:Math.ceil(l.length?l.offset().left+CE.Grid.myThis.padding-k-h:e+a.width()+f)}).show();
this.textHelperRight.css({top:this.lineHelperRight.offset().top,left:this.lineHelperRight.offset().left+g}).show();break;case "left-in":this.lineHelperLeftIn.css({height:a.outerHeight(),top:d,left:e}).show();this.textHelperLeftIn.css({top:this.lineHelperLeftIn.offset().top,left:this.lineHelperLeftIn.offset().left+this.lineHelperThickness}).show();break;case "right-in":this.lineHelperRightIn.css({height:a.outerHeight(),top:d,left:e+a.width()-this.lineHelperThickness}).show();this.textHelperRightIn.css({top:this.lineHelperRightIn.offset().top,
left:this.lineHelperRightIn.offset().left-this.textHelperRightIn.outerWidth()}).show();break;case "top-in":this.lineHelperTopIn.css({width:a.width(),top:d,left:e}).show();this.textHelperTopIn.css({top:d,left:e}).show();break;case "bottom-in":this.lineHelperBottomIn.css({width:a.width(),top:d+a.height()-this.lineHelperThickness,left:e}).show();this.textHelperBottomIn.css({top:this.lineHelperBottomIn.offset().top,left:this.lineHelperBottomIn.offset().left}).show();break;case "middle-in":k=a.width();
f=a.height()-2*parseInt(this.lineHelperHandleMiddle.css("outline-width"));d+=parseInt(this.lineHelperHandleMiddle.css("outline-width"));g=e-CE.Grid.myThis.padding;e=c(".motopress-content-wrapper > .motopress-handle-middle-in:first");if(a[0]===e[0]||a[0]===c(".motopress-content-wrapper > .motopress-handle-middle-in:last")[0])k=c(".motopress-content-wrapper"),g=k.offset(),k.find(".motopress-row"),k=k.width(),f=20,a[0]===e[0]&&(d=g.top-f),g=g.left;this.lineHelperHandleMiddle.css({width:k,height:f,top:d,
left:g}).show();e=this.lineHelperHandleMiddle.offset();this.textHelperHandleMiddle.css({top:e.top,left:e.left}).show();break;case "insert":this.lineHelperInsert.css({width:a.width(),height:a.outerHeight(),left:e,top:d}).show();this.textHelperInsert.css({top:this.lineHelperInsert.offset().top,left:this.lineHelperInsert.offset().left-this.textHelperInsert.outerWidth()}).show();break;case "wrapper-left":this.lineHelperWrapperLeft.css({height:a.height(),top:d,left:e-this.lineHelperThickness}).show();
this.textHelperWrapperLeft.css({top:this.lineHelperWrapperLeft.offset().top,left:this.lineHelperWrapperLeft.offset().left-this.textHelperWrapperLeft.outerWidth()}).show();break;case "wrapper-right":this.lineHelperWrapperRight.css({height:a.height(),top:d,left:e+a.width()}).show(),this.textHelperWrapperRight.css({top:this.lineHelperWrapperRight.offset().top,left:this.lineHelperWrapperRight.offset().left+this.lineHelperThickness}).show()}},removeEmptyBlocks:function(a,b){var c=a.prev(".motopress-empty"),
e=a.next(".motopress-empty"),f=0,g=0;"undefined"!=typeof c[0]&&(f=parent.MP.Utils.getSpanNumber(parent.MP.Utils.getSpanClass(c.prop("class").split(" "))));"undefined"!=typeof e[0]&&(g=parent.MP.Utils.getSpanNumber(parent.MP.Utils.getSpanClass(e.prop("class").split(" "))));if("undefined"!=typeof c[0]||"undefined"!=typeof e[0])a.removeClass(b),b=parent.CE.Iframe.myThis.gridObj.span["class"]+(parent.MP.Utils.getSpanNumber(b)+f+g),a.addClass(b),c.remove(),e.remove();return b},clearIfEmpty:function(a,
b){"undefined"===typeof b&&(b="default");if(null!==a){var d=a.hasClass("motopress-row-edge")?a:a.find(".motopress-row-edge").first(),e=a.parent(),d=d.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');if(!d.length){for(d=0;0===a.parent(".motopress-content-wrapper").length&&!a.siblings('.motopress-row, [class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').length&&!a.parent(".motopress-content-wrapper").length;){if(a.parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+
'"].motopress-clmn').length){var f=a.parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').attr("data-motopress-wrapper-id");c('[data-motopress-wrapper-id="'+f+'"].motopress-handle-wrapper').remove()}a.siblings(".motopress-handle-middle-in, .motopress-wrapper-helper, .motopress-helper").remove().end().unwrap();d++;if(100===d){console.log("LOOPED IN `clearIfEmpty()`");break}}d=!1;f=null;a.siblings(".motopress-row").length||(d=!0,a.parent(":not(.motopress-content-wrapper)").length?
f=a.parent():a.parent(".motopress-row").length&&(f=a.parent(".motopress-row")));a.prev(".motopress-handle-middle-in").remove().end().remove();if("undefined"!==typeof e&&null!==e&&!e.hasClass("motopress-content-wrapper")){var g=e.children(".motopress-row");if(1===g.length&&(g=(g.hasClass("motopress-row-edge")?g:g.find(".motopress-row-edge").first()).children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn:not(.motopress-empty)'),1===g.length)){var k=parent.MP.Utils.getSpanClass(g.prop("class").split(" ")),
h=parent.MP.Utils.getSpanClass(e.prop("class").split(" "));CE.Resizer.myThis.changeSpanClass(g,k,h);e.replaceWith(g)}}return d?f:a}if(1===d.length&&!a.parent(".motopress-content-wrapper").length){var l,n,m,r=null;d.parentsUntil(".motopress-content-wrapper",'[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').each(function(){l=c(this).children(".motopress-row");n=c(this).siblings('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');m=c(this).closest(".motopress-row").parent(".motopress-content-wrapper");
if(1===l.length&&(n.length||m.length))return r=c(this),!1});null!==r&&(e=parent.MP.Utils.getSpanClass(d.prop("class").split(" ")),f=parent.MP.Utils.getSpanClass(r.prop("class").split(" ")),CE.Resizer.myThis.changeSpanClass(d,e,f),r.replaceWith(d),a="remove"===b?{row:r.parent()}:null)}}return a},recursiveAddHandleMiddle:function(a){a.children(".motopress-row").each(function(a){var d=null,d=CE.DragDrop.myThis.handleMiddleIn;0==a&&c(this).before(d.clone());c(this).next(".motopress-more-handler").length?
c(this).next(".motopress-more-handler").after(d.clone()):c(this).after(d.clone());a=c(this).hasClass("motopress-row-edge")?c(this):c(this).find(".motopress-row-edge").first();a.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').children(".motopress-row").length&&a.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').each(function(){CE.DragDrop.myThis.recursiveAddHandleMiddle(c(this))})})},addHandleMiddle:function(a,b){a.parent("."+
b+".motopress-clmn, .motopress-content-wrapper").children(".motopress-row").each(function(a){var b=null,b=CE.DragDrop.myThis.handleMiddleIn;0==a&&(a=c(this).prevAll(".motopress-handle-middle-in"),0==a.length?(c(this).before(b.clone()),c(this).parent().is("[data-motopress-wrapper-id]")&&CE.DragDrop.myThis.setCalcWrapperWidth(c(this).prev())):a.each(function(a,b){0!=a&&c(b).remove()}));b=b.clone();a=c(this).nextUntil(".motopress-row",".motopress-handle-middle-in");0==a.length?(c(this).next(".motopress-more-handler").length?
c(this).next(".motopress-more-handler").after(b):c(this).after(b),c(this).parent().is("[data-motopress-wrapper-id]")&&CE.DragDrop.myThis.setCalcWrapperWidth(b)):a.each(function(a,b){0!=a&&c(b).remove()})})},addHandleWrapper:function(a){a.find(".motopress-handle-wrapper-left > .motopress-wrapper-helper-container").append(this.handleWrapper.clone().attr({"data-motopress-wrapper-id":this.wrapperId,"data-motopress-position":"wrapper-left"}));a.find(".motopress-handle-wrapper-right > .motopress-wrapper-helper-container").append(this.handleWrapper.clone().attr({"data-motopress-wrapper-id":this.wrapperId,
"data-motopress-position":"wrapper-right"}))},droppableHandleWrapper:function(a){a.find(".motopress-handle-wrapper").droppable({accept:'[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn, .motopress-ce-object',tolerance:"pointer",drop:function(a,d){var e=c(this).attr("data-motopress-position");d.helper.data("dropped",!0);var f=c(this).attr("data-motopress-wrapper-id"),f=c('[data-motopress-wrapper-id="'+f+'"][class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),
g=null,k=null,h=f.closest(".motopress-row"),l=null,n=null;d.draggable.hasClass("motopress-ce-object")?(l=null,n=CE.DragDrop.myThis.newBlock.clone(),"mp_space"===d.draggable.attr("data-motopress-shortcode")&&n.addClass(CE.DragDrop.myThis.spaceClass),CE.DragDrop.myThis.makeEditable(n,d,!0),k=null):(l=d,n=l.draggable,k=n.closest(".motopress-row"));g=parent.MP.Utils.getSpanClass(n.prop("class").split(" "));g=CE.DragDrop.myThis.removeEmptyBlocks(n,g);switch(e){case "wrapper-left":if(CE.DragDrop.myThis.canBeMoved(h,
l)){f.before(n);var m=setTimeout(function(){k=CE.DragDrop.myThis.clearIfEmpty(k);if(null===k||k[0]!==h[0])CE.DragDrop.myThis.resize(k,n,"wrapper-left");else{var a=parent.MP.Utils.calcSpanNumber(k,l);CE.Resizer.myThis.changeSpanClass(n,g,parent.CE.Iframe.myThis.gridObj.span["class"]+(parent.CE.Iframe.myThis.gridObj.row.col-a))}clearTimeout(m)},0)}break;case "wrapper-right":CE.DragDrop.myThis.canBeMoved(h,l)&&(f.after(n),m=setTimeout(function(){k=CE.DragDrop.myThis.clearIfEmpty(k);if(null===k||k[0]!==
h[0])CE.DragDrop.myThis.resize(k,n,"wrapper-right");else{var a=parent.MP.Utils.calcSpanNumber(k,l);CE.Resizer.myThis.changeSpanClass(n,g,parent.CE.Iframe.myThis.gridObj.span["class"]+(parent.CE.Iframe.myThis.gridObj.row.col-a))}clearTimeout(m)},0))}var r=setTimeout(function(){var a=n.find(".motopress-drag-handle");CE.Selectable.myThis.select(a);CE.DragDrop.myThis.makeDroppable();CE.DragDrop.myThis.resizer.updateBottomInHandleMiddle();CE.Resizer.myThis.updateSplitterHeight(n,"drop");CE.Resizer.myThis.updateSplittableOptions(n,
k,h);CE.DragDrop.myThis.resizer.updateHandle();CE.DragDrop.myThis.resizer.updateHandleMiddle();clearTimeout(r)},0);parent.CE.Save.changeContent()},over:function(){var a=c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');CE.DragDrop.myThis.showLineTextHelper(a,c(this).attr("data-motopress-position"))},out:function(){}})},getMinAllowedSpanSize:function(a,b,c){for(var e=1,f,g=1;g<=parent.CE.Iframe.myThis.gridObj.row.col;g++)if(e=g,b){if(f=a/100*CE.Grid.myThis.colWidthByNumber[g],
this.resizer.isAllowedColSize(c,f))break}else if(this.resizer.isAllowedColSize(g,a))break;return e},canBeMoved:function(a,b,d,e,f,g,k){a="undefined"===typeof a||a instanceof jQuery&&!a.length?null:a;b="undefined"===typeof b||b instanceof jQuery&&!b.length?null:b;d="undefined"===typeof d?null:d;e="undefined"===typeof e?null:e;f="undefined"===typeof f?null:f;g="undefined"===typeof g?!1:g;k="undefined"===typeof k?null:k;var h={},l=parent.CE.Iframe.myThis.gridObj.row.col,n=0,m=null,r=!0;if(null!==b){m=
b.hasClass("motopress-row-edge")?b:b.find(".motopress-row-edge").first();if(g&&"out"===g&&null!==a&&a[0]===m[0])return!0;m.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').each(function(){parent.MP.Utils.notClone(c(this),f)&&n++})}if(n<l||null===m){var p=this,t,u,s,q,v,x,y,H,E=[];b=[];var C,D,G=null,I=null,A=[],z=[];if(null!==a){t=-1;C=parseFloat(a.css("width"));y=a.children(".motopress-clmn");var w=y.length-1;H=!0;g&&"insert"===g&&(w++,m=null,H=!1);var J=!1;
if(m){var L=m.parent().closest(".motopress-row-edge");a[0]===L[0]&&(J=!0)}if(1<=w){var M=this.getMinAllowedSpanSize(C,!1);x=v=0;q=!1;u=p.getSpanSizeRules(w);var K=!1;!g||"left-in"!==g&&"right-in"!==g||(K=!0);y.each(function(a){a===d&&H||(t++,s={},s.index=t,s.isWrapper=c(this).is("[data-motopress-wrapper-id]"),s.size=u[t],s.isWrapper?(J&&c(this).find(".motopress-row-edge").each(function(){c(this)[0]===m[0]&&(G=t)}),s.wrapperWidth=C/100*CE.Grid.myThis.colWidthByNumber[u[t]],s.minSpan=p.resizer.getMinChildColumn(c(this)),
s.minSize=p.getMinAllowedSpanSize(C,!0,s.minSpan),s.isAllowed=p.resizer.isAllowedColSize(s.minSpan,s.wrapperWidth)):(s.minSize=M,K&&this===k[0]&&1>=s.minSize&&(s.minSize=2),s.isAllowed=p.resizer.isAllowedColSize(u[t],C)),s.size<s.minSize?v+=s.minSize-s.size:x+=s.size-s.minSize,q||s.isAllowed||(q=!0),A.push(s))});if(q)if(v>x)r=!1;else{for(y=a=0;2*v!==a+y;)for(w=0;w<A.length;w++)A[w].isAllowed&&A[w].size>A[w].minSize&&a<v?(A[w].size--,a++):!A[w].isAllowed&&A[w].size<A[w].minSize&&(A[w].size++,y++);
for(w=0;w<A.length;w++)E.push(A[w].size);h.from=E}null!==G&&(I=E.length?C/100*CE.Grid.myThis.colWidthByNumber[E[G]]:C/100*CE.Grid.myThis.colWidthByNumber[u[G]])}}if(r){var F;if(g&&"out"!==g&&"insert"!==g)switch(g){case "left-in":case "right-in":for(D=parseFloat(k.css("width")),u=p.getSpanSizeRules(2),w=0;w<u.length;w++)if(F=this.getMinAllowedSpanSize(D,!1,u[w]),u[w]<F){r=!1;break}}else if(null!==m){D=I?I:parseFloat(m.css("width"));g=m.children(".motopress-clmn");var E=g.length,B;t=-1;u=p.getSpanSizeRules(n+
1);F=this.getMinAllowedSpanSize(D,!1);x=v=0;q=!1;B={index:e,isWrapper:!1,size:u[e],minSize:F,isAllowed:u[e]>=F};B.size<B.minSize?v+=B.minSize-B.size:x+=B.size-B.minSize;g.each(function(a){t++;a===e&&(z.push(B),q||B.isAllowed||(q=!0),t++);s={};s.index=t;s.isWrapper=c(this).is("[data-motopress-wrapper-id]");s.size=u[t];s.isWrapper?(s.wrapperWidth=D/100*CE.Grid.myThis.colWidthByNumber[u[t]],s.minSpan=p.resizer.getMinChildColumn(c(this)),s.minSize=p.getMinAllowedSpanSize(D,!0,s.minSpan),s.isAllowed=p.resizer.isAllowedColSize(s.minSpan,
s.wrapperWidth)):(s.minSize=F,s.isAllowed=p.resizer.isAllowedColSize(u[t],D));s.size<s.minSize?v+=s.minSize-s.size:x+=s.size-s.minSize;q||s.isAllowed||(q=!0);z.push(s)});e===E&&(z.push(B),q||B.isAllowed||(q=!0));if(q)if(v>x)r=!1;else{for(y=a=0;2*v!==a+y;)for(w=0;w<z.length;w++)z[w].isAllowed&&z[w].size>z[w].minSize&&a<v?(z[w].size--,a++):!z[w].isAllowed&&z[w].size<z[w].minSize&&(z[w].size++,y++);for(w=0;w<z.length;w++)b.push(z[w].size);h.to=b}}}}return n>=l||!r?(CE.DragDrop.interruptInsert=!0,parent.MP.Flash.setFlash(localStorage.getItem("blocksOverflow"),
"error"),parent.MP.Flash.showMessage(),!1):Object.keys(h).length?h:!0},resize:function(a,b,d,e){e="object"===typeof e?e:{};var f=null,g=null;if(null!==a&&"undefined"!==typeof a){a=(a.hasClass("motopress-row-edge")?a:a.find(".motopress-row-edge").first()).children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn');var k=a.length;0<k&&k<=parent.CE.Iframe.myThis.gridObj.row.col&&(g=e.hasOwnProperty("from")?e.from:this.getSpanSizeRules(k),a.each(function(a){f=parent.MP.Utils.getSpanClass(c(this).prop("class").split(" "));
CE.Resizer.myThis.changeSpanClass(c(this),f,parent.CE.Iframe.myThis.gridObj.span["class"]+g[a])}))}if("undefined"===typeof d||"undefined"!==typeof d&&"insert"!==d)a=b.parent(),null!==a&&"undefined"!==typeof a&&(a=a.children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),k=a.length,0<k&&k<=parent.CE.Iframe.myThis.gridObj.row.col&&(g=e.hasOwnProperty("to")?e.to:this.getSpanSizeRules(k),a.each(function(a){f=parent.MP.Utils.getSpanClass(c(this).prop("class").split(" "));
CE.Resizer.myThis.changeSpanClass(c(this),f,parent.CE.Iframe.myThis.gridObj.span["class"]+g[a])})));"undefined"===typeof d||"top-in"!==d&&"bottom-in"!==d||(f=parent.MP.Utils.getSpanClass(b.prop("class").split(" ")),CE.Resizer.myThis.changeSpanClass(b,f,parent.CE.Iframe.myThis.gridObj.span.fullclass),d="top-in"===d?1:0,b=b.closest(".motopress-row").parent('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').children(".motopress-row").get(d),b=c(b),b=(b.hasClass("motopress-row-edge")?
b:b.find(".motopress-row-edge").first()).children('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'),"undefined"!==typeof b&&b.length&&(f=parent.MP.Utils.getSpanClass(b.prop("class").split(" ")),CE.Resizer.myThis.changeSpanClass(b,f,parent.CE.Iframe.myThis.gridObj.span.fullclass)))},getSpanSizeRules:function(a){return this.spanSizeRules[a]},generateSpanSizeRules:function(){for(var a=parent.CE.Iframe.myThis.gridObj.row.col,b=[],c=1;c<=a;c++){b[c]=[];for(var e=Math.floor(a/
c),f=a%c,g=1;g<=c;g++)b[c].push(g<=f?e+1:e)}this.spanSizeRules=b},setCalcWrapperWidth:function(a){if(CE.Grid.myThis.padding){var b=2*CE.Grid.myThis.padding,c="";parent.MP.Utils.Browser.Mozilla?c="-moz-":parent.MP.Utils.Browser.Chrome&&(c="-webkit-");a.css("width",c+"calc(100% - "+b+"px)")}}})});
steal("jquery/controller",function(c){c.Controller("CE.Template",{myThis:null,templates:null},{template:c("<div />",{"class":"motopress-template",html:'<img class="motopress-template-icon"><p class="motopress-template-name"></p>'}),init:function(a,b){CE.Template.myThis=this;if(null!==CE.Template.templates){var d=this,e=[];c.each(CE.Template.templates,function(a,b){var c=d.template.clone();c.attr("data-motopress-template-id",b.id);c.children(".motopress-template-icon").attr("src",b.icon);c.children(".motopress-template-name").text(b.name);
e.push(c)});this.element.append(e)}},".motopress-template click":function(a,b){var d=a.attr("data-motopress-template-id");d&&(parent.MP.Preloader.myThis.show(),c.ajax({url:parent.motopress.ajaxUrl,type:"POST",dataType:"html",data:{action:"motopress_ce_render_template",nonce:parent.motopressCE.nonces.motopress_ce_render_template,postID:parent.motopressCE.postID,templateId:d},success:function(a){CE.DragDrop.myThis.emptySceneHelper.hide();CE.DragDrop.myThis.moreHandler.show();CE.DragDrop.myThis.emptySceneHelper.before(a);
parent.CE.Iframe.myThis.unwrapGrid();CE.DragDrop.myThis.main();parent.CE.Save.changeContent();parent.MP.Preloader.myThis.hide()},error:function(a){parent.MP.Preloader.myThis.hide();a=c.parseJSON(a.responseText);a.debug?console.log(a.message):(parent.MP.Flash.setFlash(a.message,"error"),parent.MP.Flash.showMessage())}}))}})});
steal("jquery/class",function(c){c.Class("CE.Selectable",{myThis:null,scrollY:0,focusFlag:!1,blurFlag:!1,setScrollY:function(a){CE.Selectable.scrollY=a},focusWithoutScroll:function(a){if(!CE.Selectable.focusFlag){CE.Selectable.focusFlag=!0;a.focus();window.scrollTo(0,CE.Selectable.scrollY);var b=setTimeout(function(){CE.Selectable.focusFlag=!1;clearTimeout(b)},0)}return a},blurWithoutScroll:function(a){if(!CE.Selectable.blurFlag){CE.Selectable.blurFlag=!0;a.blur();window.scrollTo(0,CE.Selectable.scrollY);
var b=setTimeout(function(){CE.Selectable.blurFlag=!1;clearTimeout(b)},0)}return a}},{selectedClass:"motopress-selected",init:function(){CE.Selectable.myThis=this;c(document).mousedown(function(){CE.Selectable.setScrollY(window.scrollY)});c(document).mouseup(function(){CE.Selectable.setScrollY(window.scrollY)});this.makeSelectable()},makeSelectable:function(){c(".motopress-content-wrapper").on("click",".motopress-drag-handle, .motopress-clmn-select-handle, .motopress-row-select-handle",function(){if(c(this).hasClass(".motopress-clmn-select-handle")&&
c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn').hasClass(CE.Selectable.myThis.selectedClass)||c(this).hasClass(".motopress-row-select-handle")&&c(this).closest(".motopress-row").hasClass(CE.Selectable.myThis.selectedClass)||c(this).hasClass(CE.Selectable.myThis.selectedClass)){var a=null,a=c(this).hasClass(".motopress-row-select-handle")?c(this).closest(".motopress-row"):c(this).hasClass(".motopress-clmn-select-handle")?c(this).closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+
'"].motopress-clmn'):c(this).parent(".motopress-helper").prev(".motopress-block-content").children("[data-motopress-shortcode]"),b=a.controller(),b=a.hasClass("ce_inline_editor")?b.isOpen:!1;!(a.hasClass("ce_controls")||a.hasClass("ce_inline_editor")||a.hasClass("ce_code_editor")||a.hasClass(".motopress-row"))||CE.Dialog.myThis.element.dialog("isOpen")||parent.CE.CodeModal.myThis.element.data("modal").isShown||b||CE.Dialog.myThis.open(c(this))}else CE.Selectable.myThis.select(c(this));CE.Selectable.focusWithoutScroll(c(this).prev())});
c(".motopress-content-wrapper").on("keydown",".motopress-focus-area",function(a){if(c(this).next().hasClass(CE.Selectable.myThis.selectedClass))if(a.which===c.ui.keyCode.ESCAPE)CE.Selectable.setScrollY(window.scrollY),CE.Selectable.myThis.unselect();else if(a.which===c.ui.keyCode.DELETE||a.which===c.ui.keyCode.BACKSPACE)a.preventDefault(),CE.Selectable.setScrollY(window.scrollY),CE.Tools.myThis.removeBlock(),parent.CE.Save.changeContent()});c(document).on("click",function(a){c(a.target).hasClass(CE.Selectable.myThis.selectedClass)||
c(a.target).hasClass("motopress-clmn-select-handle")||c(a.target).hasClass("motopress-row-select-handle")||c(a.target).closest("."+CE.Dialog.myThis.dialogClass).length||CE.InlineEditor.isTinymce(a)||CE.Selectable.myThis.unselect()})},select:function(a){if(!1===CE.DragDrop.interruptInsert){this.unselect();var b=null;CE.Selectable.focusWithoutScroll(a.prev());a.hasClass("motopress-row-select-handle")?(a.closest(".motopress-row").addClass(this.selectedClass),b=a.closest(".motopress-row")):(a.hasClass("motopress-clmn-select-handle")?
a.closest(".motopress-clmn").addClass(this.selectedClass):a.addClass(this.selectedClass).closest(".motopress-helper").nextAll('.ui-resizable-handle:not(".motopress-hide")').show(),b=a.closest('[class*="'+parent.CE.Iframe.myThis.gridObj.span["class"]+'"].motopress-clmn'));a.hasClass("motopress-row-select-handle")||a.hasClass("motopress-clmn-select-handle")||parent.CE.Navbar.myThis.showObjectControlBtns();(b.hasClass("ce_controls")||b.hasClass("ce_inline_editor")||b.hasClass("ce_code_editor")||b.hasClass("motopress-row"))&&
!CE.Dialog.myThis.element.dialog("isOpen")&&CE.Dialog.myThis.open(a)}CE.DragDrop.interruptInsert=!1},unselect:function(){var a=c(".motopress-content-wrapper ."+this.selectedClass);a.length&&(a.each(function(){c(this).removeClass(CE.Selectable.myThis.selectedClass);c(this).hasClass("motopress-clmn")||c(this).hasClass("motopress-row")||c(this).closest(".motopress-helper").nextAll('.ui-resizable-handle:not(".motopress-hide")').hide()}),parent.CE.Navbar.myThis.hideObjectControlBtns(),CE.Dialog.myThis.element.dialog("isOpen")&&
CE.Dialog.myThis.element.dialog("close"),CE.InlineEditor.curElement&&CE.InlineEditor.curElement.controller().close(),CE.Selectable.blurWithoutScroll(a.prev()))}})});

Youez - 2016 - github.com/yon3zu
LinuXploit