From d3186d94beec6c6a31cccea24655f919f76102f4 Mon Sep 17 00:00:00 2001 From: Yim Hyun Date: Sun, 23 Oct 2016 00:12:57 -0400 Subject: [PATCH] more ajax improvements, especially for gallery --- public/assets/js/lasso.js | 98 ++++++++++----- public/assets/js/lasso.min.js | 2 +- public/assets/js/source/process-gallery.js | 27 ++-- .../js/source/process-save-component.js | 116 ++++++++---------- public/includes/lasso.php | 7 +- 5 files changed, 135 insertions(+), 115 deletions(-) diff --git a/public/assets/js/lasso.js b/public/assets/js/lasso.js index abf89ee..08bd827 100644 --- a/public/assets/js/lasso.js +++ b/public/assets/js/lasso.js @@ -12685,21 +12685,11 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { }); function editus_gallery_swap(galleryID){ - var data = { - action: 'process_gallery_swap', - gallery_id: galleryID, - nonce: lasso_editor.swapGallNonce - } - - $.post( lasso_editor.ajaxurl, data, function(response) { - if( true == response.success ) { - // window.component is the current component being edited - window.component.replaceWith( response.data.gallery ); - } - }).fail(function(xhr, err) { - var responseTitle= $(xhr.responseText).filter('title').get(0); - alert($(responseTitle).text() + "\n" + EditusFormatAJAXErrorMessage(xhr, err) ); - }); + var data3 = { + componentType: 'gallery', + id: galleryID + }; + window.get_aesop_component_ajax(data3); } /////////// @@ -12723,8 +12713,11 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { } function ase_encode_gallery_items(){ - var imageArray = gallery.sortable('toArray'); - $('#ase_gallery_ids').val( imageArray ); + gallery = $('#lasso--gallery__images #ase-gallery-images'); + if (gallery.length) { + var imageArray = gallery.sortable('toArray'); + $('#ase_gallery_ids').val( imageArray ); + } } // inserting gallery items @@ -13182,6 +13175,53 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { (function( $ ) { var form; + // get updated aesop componets through ajax calls (global function) + window.get_aesop_component_ajax = function(cdata) + { + var data = { + action: 'get_aesop_component', + code: 'aesop_'+cdata['componentType'] + }; + for ( var index in cdata ) { + // Don't accept componentType as a param + if ( !cdata.hasOwnProperty(index) || index == 'componentType' || index =='sortableItem') { + continue; + } + data[index] = cdata[index]; + } + + jQuery.post(lasso_editor.ajaxurl2, data, function(response) { + if( response ){ + var $a = $(response); + window.component.replaceWith($a); + window.component = $a; + $('.aesop-component').each(function(){ + + // if there's no toolbar present + if ( !$('.lasso-component--toolbar').length > 0 ) { + + // if this is a map then we need to first wrap it so that we can drag the map around + if ( $(this).hasClass('aesop-map-component') ) { + + var $this = $(this) + + // so wrap it with a aesop-compoentn aesop-map-component div + // @todo - note once a map is inserted it can't be edited after saving again. a user has to delete the existin map and add a new map + // to + //$this.wrap('
').before( lassoDragHandle ).after( lassoMapForm ); + $this.wrap('
').before( lassoDragHandle ); + + } else { + + $(this).append( lasso_editor.handle ); + } + } + }); + } else { + alert("error"); + } + }); + } //$('#lasso--component-settings-form').live('submit', function(e) { jQuery(document).on('submit', '#lasso--component-settings-form', function(e){ @@ -13216,6 +13256,7 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { delete cdata['sortableItem']; return cdata; } + /** * @@ -13283,7 +13324,8 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { if ( 'gallery-created' == response.data.message ) { saveSequence( false, 1000, true ); - editus_gallery_swap(response.data.id); + // load the new gallery + cdata['id'] = response.data.id; } else if ( 'gallery-updated' == response.data.message ) { @@ -13295,6 +13337,7 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { alert( 'error' ); } + window.get_aesop_component_ajax(cdata); }).fail(function(xhr, err) { var responseTitle= $(xhr.responseText).filter('title').get(0); @@ -13306,22 +13349,13 @@ function EditusFormatAJAXErrorMessage(jqXHR, exception) { saveSequence( true, 1200 ); } - - }); - function editus_gallery_swap(galleryID){ - var data = { - action: 'process_gallery_swap', - gallery_id: galleryID, - nonce: lasso_editor.swapGallNonce + + if ( 'image' == cdata['componentType'] || 'quote' == cdata['componentType'] || 'parallax' == cdata['componentType'] || 'chapter' == cdata['componentType'] || + 'character' == cdata['componentType'] || 'collection' == cdata['componentType']) { + window.get_aesop_component_ajax(cdata); } - $.post( lasso_editor.ajaxurl, data, function(response) { - if( true == response.success ) { - // window.component is the current component being edited - window.component.replaceWith( response.data.gallery ); - } - }); - } + }); })( jQuery ); diff --git a/public/assets/js/lasso.min.js b/public/assets/js/lasso.min.js index 949b5dd..cd018ce 100644 --- a/public/assets/js/lasso.min.js +++ b/public/assets/js/lasso.min.js @@ -3,5 +3,5 @@ v=Math.floor((s+u)/2),i.removeChild(l)}if(q=l.nextSibling,-1==m&&q&&k(q)){h.setE if(!k.shift){var b,d,e,f=m.atCaret()||{},g=c.children,h=f===c.lastChild?c.lastChild:null;h&&h!==c.firstChild&&r.autoHR&&"partial"!==r.mode&&r.tags.horizontalRule&&(n.preventDefaultEvent(a),b=""===m.text(h)&&h.nodeName.toLowerCase()===r.tags.paragraph,b&&g.length>=2&&(d=g[g.length-2],d.nodeName.toLowerCase()===r.tags.horizontalRule&&(b=!1)),b&&(m.addTag(r.tags.horizontalRule,!1,!0,f),f=f.nextSibling),null!==(e=m.addTag(r.tags.paragraph,!0,null,f))&&(e.innerHTML="",l.set(0,e)))}return!0},backspaceOrDeleteKey:function(a){if(null!==c.lastChild){var b=c.lastChild,d=b.previousSibling;b&&r.tags.horizontalRule&&b.nodeName.toLocaleLowerCase()===r.tags.horizontalRule?c.removeChild(b):b&&d&&n.html.text(b).length<1&&d.nodeName.toLowerCase()===r.tags.horizontalRule&&b.nodeName.toLowerCase()===r.tags.paragraph&&(c.removeChild(b),c.removeChild(d))}}},q={element:null,modifier:"auto",placeholder:"",autofocus:!1,autoHR:!0,mode:i.richMode,maxLength:-1,modifiers:{b:"bold",i:"italicize",u:"underline",v:"paste"},tags:{"break":"br",horizontalRule:"hr",paragraph:"p",outerLevel:["pre","blockquote","figure"],innerLevel:["a","b","u","i","img","strong"]},cssClasses:{editor:"Medium",pasteHook:"Medium-paste-hook",placeholder:"Medium-placeholder",clear:"Medium-clear"},attributes:{remove:["style","class"]},pasteAsText:!0,beforeInvokeElement:function(){},beforeInsertHtml:function(){},beforeAddTag:function(a,b,c,d){},keyContext:null,pasteEventHandler:function(b){b=b||a.event,f.makeUndoable();var d,e=f.value().length;if(r.pasteAsText){n.preventDefaultEvent(b);var g=n.selection.saveSelection(),h=prompt(i.Messages.pastHere)||"";if(h.length>0)return c.focus(),i.activeElement=c,n.selection.restoreSelection(g),h=m.encodeHtml(h),d=h.length+e,r.maxLength>0&&d>r.maxLength&&(h=h.substring(0,r.maxLength-e)),r.mode!==i.inlineMode&&(h=h.replace(/\n/g,"
")),new i.Html(f,h).setClean(!1).insert(r.beforeInsertHtml,!0),m.clean(),m.placeholders(),!1}else setTimeout(function(){m.clean(),m.placeholders()},20)}},r=n.deepExtend(q,b),s={};for(e in q)"object"!=typeof q[e]&&q.hasOwnProperty(e)&&r.element.getAttribute("data-medium-"+h)&&(d=r.element.getAttribute("data-medium-"+h),("false"===d.toLowerCase()||"true"===d.toLowerCase())&&(d="true"===d.toLowerCase()),r[e]=d);if(r.modifiers)for(e in r.modifiers)"undefined"!=typeof h[e]&&(r.modifiers[h[e]]=r.modifiers[e]);if(r.keyContext)for(e in r.keyContext)"undefined"!=typeof h[e]&&(r.keyContext[h[e]]=r.keyContext[e]);c=r.element;var e,t=c.children;for(e=0;e0&&(d(c,"class")||e.push("class")),new i.Element(this,a,b).invoke(this.settings.beforeInvokeElement),this.utils.triggerEvent(this.element,"change"),this},behavior:function(){return g?"wild":"domesticated"},value:function(a){return"undefined"==typeof a?this.element.innerHTML:(this.element.innerHTML=a,this.html.clean(),this.html.placeholders(),this)},focus:function(){var a=this.element;return a.focus(),this},select:function(){var c,d,e=this.element;return e.focus(),b.body.createTextRange?(c=b.body.createTextRange(),c.moveToElementText(e),c.select()):a.getSelection&&(d=a.getSelection(),c=b.createRange(),c.selectNodeContents(e),d.removeAllRanges(),d.addRange(c)),this},isActive:function(){return i.activeElement===this.element},destroy:function(){var a=this.element,b=this.intercept,d=this.settings,e=this.placeholder||null;null!==e&&e.setup&&(e.parentNode.removeChild(e),delete a.placeHolderActive),a.removeAttribute("contenteditable"),a.className=c(a.className.replace(d.cssClasses.editor,"").replace(d.cssClasses.clear,"").replace(d.cssClasses.editor+"-"+d.mode,"")),this.utils.removeEvent(a,"keyup",b.up).removeEvent(a,"keydown",b.down).removeEvent(a,"focus",b.focus).removeEvent(a,"blur",b.focus).removeEvent(a,"paste",d.pasteEventHandler)},clear:function(){this.element.innerHTML="",this.html.placeholders()}},i.Element=function(a,b,c){if(this.medium=a,this.element=a.settings.element,g)this.tagName=b;else switch(b.toLowerCase()){case"bold":this.tagName="b";break;case"italic":this.tagName="i";break;case"underline":this.tagName="u";break;default:this.tagName=b}this.attributes=c||{},this.clean=!0},i.Html=function(a,b){this.medium=a,this.element=a.settings.element,this.html=b,this.clean=!0},i.Injector=function(){},g?(i.Element.prototype={invoke:function(a){i.activeElement===this.element&&(a&&a.apply(this),b.execCommand(this.tagName,!1))},setClean:function(){return this}},i.Injector.prototype={inject:function(a,b){return this.insertHTML(a,b),null}},i.Undoable=function(){}):(e.rangePrototype.insertNodeAtEnd=function(a){var b=this.cloneRange();b.collapse(!1),b.insertNode(a),b.detach(),this.setEndAfter(a)},i.Element.prototype={invoke:function(b){if(i.activeElement===this.element){b&&b.apply(this);var c,d,f=this.attributes,g=this.tagName.toLowerCase();void 0!==f.className?(d=(f.className.split[" "]||[f.className]).shift(),delete f.className):d="lasso-"+g,c=e.createClassApplier(d,{elementTagName:g,elementAttributes:this.attributes}),this.medium.makeUndoable(),c.toggleSelection(a),this.clean&&(this.medium.html.clean(),this.medium.html.placeholders())}},setClean:function(a){return this.clean=a,this}},i.Injector.prototype={inject:function(a){var c,d=!1;if("string"==typeof a){var e=b.createElement("div");e.innerHTML=a,c=e.childNodes,d=!0}else c=a;this.insertHTML('');var f=b.getElementById("wedge"),g=f.parentNode,h=0;if(f.removeAttribute("id"),d)for(;h0&&(c=k.text(h),d=c.length,e=d+f.value.length,e>d&&(f.value=f.value.substring(0,i.maxLength-d))),a(f.value),k.deleteNode(f)},2)},setupContents:function(){var a,c=this.element,d=c.children,e=c.childNodes;!this.settings.tags.paragraph||d.length>0||this.settings.mode===i.inlineMode||(e.length>0?(a=b.createElement(this.settings.tags.paragraph),c.innerHTML.match("^[&]nbsp[;]")&&(c.innerHTML=c.innerHTML.substring(6,c.innerHTML.length-1)),a.innerHTML=c.innerHTML,c.innerHTML="",c.appendChild(a),this.cursor.set(a.innerHTML.length,a)):(a=b.createElement(this.settings.tags.paragraph),a.innerHTML=" ",c.appendChild(a)))},traverseAll:function(a,b,c){var d,e=a.childNodes,f=e.length,g=0,c=c||1;if(b=b||{},f>0)for(;f>g;g++){switch(d=e[g],d.nodeType){case 1:this.traverseAll(d,b,c+1),void 0!==b.element&&b.element(d,g,c,a);break;case 3:void 0!==b.fragment&&b.fragment(d,g,c,a)}f=e.length,d===a.lastChild&&(g=f)}}},i.Selection=function(){},i.Selection.prototype={setBridge:function(a){for(var b in a)this[b]=a[b]},saveSelection:function(){if(a.getSelection){var c=a.getSelection();if(c.rangeCount>0)return c.getRangeAt(0)}else if(b.selection&&b.selection.createRange)return b.selection.createRange();return null},restoreSelection:function(c){if(c)if(a.getSelection){var d=a.getSelection();d.removeAllRanges(),d.addRange(c)}else b.selection&&c.select&&c.select()}},i.Cursor=function(){},i.Cursor.prototype={setBridge:function(a){for(var b in a)this[b]=a[b]},set:function(c,d){var e,f=this.html;if(b.createRange){var g=a.getSelection(),h=f.lastChild(),i=f.text(h).length-1,j=d?d:h,k="undefined"!=typeof c&&null!==c?c:i;e=b.createRange(),e.setStart(j,k),e.collapse(!0),g.removeAllRanges(),g.addRange(e)}else e=b.body.createTextRange(),e.moveToElementText(d),e.collapse(!1),e.select()},parent:function(){var c,d=null;return a.getSelection?(c=a.getSelection().getRangeAt(0),d=c.commonAncestorContainer,d=1===d.nodeType?d:d.parentNode):b.selection&&(d=b.selection.createRange().parentElement()),"SPAN"==d.tagName&&(d=d.parentNode),d},caretToBeginning:function(a){this.set(0,a)},caretToEnd:function(a){this.set(this.html.text(a).length,a)}},i.HtmlAssistant=function(){},i.HtmlAssistant.prototype={setBridge:function(a){for(var b in a)this[b]=a[b]},encodeHtml:function(a){return b.createElement("a").appendChild(b.createTextNode(a)).parentNode.innerHTML},text:function(a,b){if(a=a||this.settings.element,b)a.textContent&&"undefined"!=typeof a.textContent?a.textContent=b:a.innerText=b;else{if(a.innerText)return c(a.innerText);if(a.textContent)return c(a.textContent);if(a.data)return c(a.data)}return""},changeTag:function(a,c){var d,e,f=b.createElement(c);for(d=a.firstChild;d;)e=d.nextSibling,f.appendChild(d),d=e;return a.parentNode.insertBefore(f,a),a.parentNode.removeChild(a),f},deleteNode:function(a){a.parentNode.removeChild(a)},placeholders:function(){if(a.getComputedStyle){var d=this.settings,e=this.medium.placeholder||(this.medium.placeholder=b.createElement("div")),f=d.element,g=e.style,h=a.getComputedStyle(f,null),j=function(a){return h.getPropertyValue(a)},k=this.utils,l=k.html.text(f),m=this.cursor,n=f.children.length;if(f.placeholder=e,l.length<1&&2>n){if(f.placeHolderActive)return;f.innerHTML.match("<"+d.tags.paragraph)||(f.innerHTML=""),d.placeholder.length>0&&(e.setup||(e.setup=!0,g.background=j("background"),g.backgroundColor=j("background-color"),g.fontSize=j("font-size"),g.color=h.color,g.marginTop=j("margin-top"),g.marginBottom=j("margin-bottom"),g.marginLeft=j("margin-left"),g.marginRight=j("margin-right"),g.paddingTop=j("padding-top"),g.paddingBottom=j("padding-bottom"),g.paddingLeft=j("padding-left"),g.paddingRight=j("padding-right"),g.borderTopWidth=j("border-top-width"),g.borderTopColor=j("border-top-color"),g.borderTopStyle=j("border-top-style"),g.borderBottomWidth=j("border-bottom-width"),g.borderBottomColor=j("border-bottom-color"),g.borderBottomStyle=j("border-bottom-style"),g.borderLeftWidth=j("border-left-width"),g.borderLeftColor=j("border-left-color"),g.borderLeftStyle=j("border-left-style"),g.borderRightWidth=j("border-right-width"),g.borderRightColor=j("border-right-color"),g.borderRightStyle=j("border-right-style"),e.className=d.cssClasses.placeholder+" "+d.cssClasses.placeholder+"-"+d.mode,e.innerHTML="
"+d.placeholder+"
",f.parentNode.insertBefore(e,f)),f.className+=" "+d.cssClasses.clear,g.display="",g.minHeight=f.clientHeight+"px",g.minWidth=f.clientWidth+"px",d.mode!==i.inlineMode&&(k.setupContents(),0===n&&f.firstChild&&m.set(0,f.firstChild))),f.placeHolderActive=!0}else f.placeHolderActive&&(f.placeHolderActive=!1,g.display="none",f.className=c(f.className.replace(d.cssClasses.clear,"")),k.setupContents())}},clean:function(b){var c,d,e,f=this.settings,g=f.cssClasses.placeholder,h=(f.attributes||{}).remove||[],i=f.tags||{},j=i.outerLevel||null,k=i.innerLevel||null,l={},m={},n=(i.paragraph||"").toUpperCase(),o=this.html;if(b=b||f.element,null!==j)for(e=0;e1&&void 0!==m[q]&&(r=!1),r))if("block"===a.getComputedStyle(b,null).getPropertyValue("display")){if(n.length>0&&n!==q&&o.changeTag(b,n),i>1)for(;p.childNodes.length>f;)p.parentNode.insertBefore(p.lastChild,p.nextSibling)}else switch(q){case"BR":if(b===b.parentNode.lastChild){if(b===b.parentNode.firstChild)break;d=document.createTextNode(""),d.innerHTML=" ",p.insertBefore(d,b);break}default:for(;null!==b.firstChild;)p.insertBefore(b.firstChild,b);o.deleteNode(b)}}})},lastChild:function(){return this.element.lastChild},addTag:function(a,c,d,e){if(!this.settings.beforeAddTag(a,c,d,e)){var f,g=b.createElement(a);return"undefined"!=typeof d&&d===!1&&(g.contentEditable=!1),0==g.innerHTML.length&&(g.innerHTML=" "),e&&e.nextSibling?(e.parentNode.insertBefore(g,e.nextSibling),f=e.nextSibling):(this.settings.element.appendChild(g),f=this.html.lastChild()),c&&(this.cache.focusedElement=f,this.cursor.set(0,f)),g}return null},baseAtCaret:function(){if(!this.medium.isActive())return null;var b=a.getSelection?a.getSelection():document.selection;if(b.rangeCount){var c=b.getRangeAt(0),d=c.endContainer;switch(d.nodeType){case 3:if(d.data&&d.data.length!=c.endOffset)return!1}return d}return null},getTopLevel:function(a){for(;a&&a.parentNode!==this.element;)a=a.parentNode;return a},atCaret:function(){var a=this.baseAtCaret()||{};this.element;return a===!1?null:(a=this.getTopLevel(a),a&&1==a.nodeType?a:null)},textElementsAtCaret:function(){if(!this.medium.isActive())return null;var b=a.getSelection?a.getSelection():document.selection;if(b.rangeCount){for(var c=b.getRangeAt(0),d=this.getTopLevel(c.startContainer),e=this.getTopLevel(c.endContainer),f=[];;){if(1==d.nodeType&&f.push(d),d===e||!d.nextElementSibling)break;d=d.nextElementSibling}return f}return null}},i.Action=function(){},i.Action.prototype={setBridge:function(a){for(var b in a)this[b]=a[b]},listen:function(){var a=this.element,b=this.intercept;this.utils.addEvent(a,"keyup",b.up).addEvent(a,"keydown",b.down).addEvent(a,"focus",b.focus).addEvent(a,"blur",b.blur).addEvent(a,"paste",this.settings.pasteEventHandler)},preserveElementFocus:function(){var c=a.getSelection?a.getSelection().anchorNode:b.activeElement;if(c){var d,e=this.medium.cache,f=this.settings,g=c.parentNode,h=f.element.children,i=g!==e.focusedElement,j=0;for(g===f.element&&(g=c),d=0;dd?0:d>e?e:d;var f=b(L*(E-C)/(C-K));z.scrollTop(f)}function i(a,c){var d=a+c,e=B-G;H=0>d?0:d>e?e:d;var f=b(H*(D-B)/(B-G));z.scrollLeft(f)}function j(a){return y.minScrollbarLength&&(a=Math.max(a,y.minScrollbarLength)),y.maxScrollbarLength&&(a=Math.min(a,y.maxScrollbarLength)),a}function k(){var a={width:I};N?a.left=z.scrollLeft()+B-D:a.left=z.scrollLeft(),T?a.bottom=S-z.scrollTop():a.top=U+z.scrollTop(),Q.css(a);var b={top:z.scrollTop(),height:M};$?N?b.right=D-z.scrollLeft()-Z-Y.outerWidth():b.right=Z-z.scrollLeft():N?b.left=z.scrollLeft()+2*B-D-_-Y.outerWidth():b.left=_+z.scrollLeft(),X.css(b),R.css({left:H,width:G-V}),Y.css({top:L,height:K-aa})}function l(){z.removeClass("ps-active-x"),z.removeClass("ps-active-y"),B=y.includePadding?z.innerWidth():z.width(),C=y.includePadding?z.innerHeight():z.height(),D=z.prop("scrollWidth"),E=z.prop("scrollHeight"),!y.suppressScrollX&&B+y.scrollXMarginOffset=I-G&&(H=I-G),L>=M-K&&(L=M-K),k(),F&&z.addClass("ps-active-x"),J&&z.addClass("ps-active-y")}function m(){var b,c,d=function(a){i(b,a.pageX-c),l(),a.stopPropagation(),a.preventDefault()},e=function(b){Q.removeClass("in-scrolling"),a(P).unbind(O("mousemove"),d)};R.bind(O("mousedown"),function(f){c=f.pageX,b=R.position().left,Q.addClass("in-scrolling"),a(P).bind(O("mousemove"),d),a(P).one(O("mouseup"),e),f.stopPropagation(),f.preventDefault()}),b=c=null}function n(){var b,c,d=function(a){h(b,a.pageY-c),l(),a.stopPropagation(),a.preventDefault()},e=function(b){X.removeClass("in-scrolling"),a(P).unbind(O("mousemove"),d)};Y.bind(O("mousedown"),function(f){c=f.pageY,b=Y.position().top,X.addClass("in-scrolling"),a(P).bind(O("mousemove"),d),a(P).one(O("mouseup"),e),f.stopPropagation(),f.preventDefault()}),b=c=null}function o(a,b){var c=z.scrollTop();if(0===a){if(!J)return!1;if(0===c&&b>0||c>=E-C&&0>b)return!y.wheelPropagation}var d=z.scrollLeft();if(0===b){if(!F)return!1;if(0===d&&0>a||d>=D-B&&a>0)return!y.wheelPropagation}return!0}function p(a,b){var c=z.scrollTop(),d=z.scrollLeft(),e=Math.abs(a),f=Math.abs(b);if(f>e){if(0>b&&c===E-C||b>0&&0===c)return!y.swipePropagation}else if(e>f&&(0>a&&d===D-B||a>0&&0===d))return!y.swipePropagation;return!0}function q(){function a(a){var b=a.originalEvent.deltaX,c=-1*a.originalEvent.deltaY;return("undefined"==typeof b||"undefined"==typeof c)&&(b=-1*a.originalEvent.wheelDeltaX/6,c=a.originalEvent.wheelDeltaY/6),a.originalEvent.deltaMode&&1===a.originalEvent.deltaMode&&(b*=10,c*=10),b!==b&&c!==c&&(b=0,c=a.originalEvent.wheelDelta),[b,c]}function b(b){if(f||!(z.find("select:focus").length>0)){var d=a(b),e=d[0],g=d[1];c=!1,y.useBothWheelAxes?J&&!F?(g?z.scrollTop(z.scrollTop()-g*y.wheelSpeed):z.scrollTop(z.scrollTop()+e*y.wheelSpeed),c=!0):F&&!J&&(e?z.scrollLeft(z.scrollLeft()+e*y.wheelSpeed):z.scrollLeft(z.scrollLeft()-g*y.wheelSpeed),c=!0):(z.scrollTop(z.scrollTop()-g*y.wheelSpeed),z.scrollLeft(z.scrollLeft()+e*y.wheelSpeed)),l(),c=c||o(e,g),c&&(b.stopPropagation(),b.preventDefault())}}var c=!1;"undefined"!=typeof window.onwheel?z.bind(O("wheel"),b):"undefined"!=typeof window.onmousewheel&&z.bind(O("mousewheel"),b)}function r(){var b=!1;z.bind(O("mouseenter"),function(a){b=!0}),z.bind(O("mouseleave"),function(a){b=!1});var c=!1;a(P).bind(O("keydown"),function(d){if((!d.isDefaultPrevented||!d.isDefaultPrevented())&&b){for(var e=document.activeElement?document.activeElement:P.activeElement;e.shadowRoot;)e=e.shadowRoot.activeElement;if(!a(e).is(":input,[contenteditable]")){var f=0,g=0;switch(d.which){case 37:f=-30;break;case 38:g=30;break;case 39:f=30;break;case 40:g=-30;break;case 33:g=90;break;case 32:case 34:g=-90;break;case 35:g=d.ctrlKey?-E:-C;break;case 36:g=d.ctrlKey?z.scrollTop():C;break;default:return}z.scrollTop(z.scrollTop()-g),z.scrollLeft(z.scrollLeft()+f),c=o(f,g),c&&d.preventDefault()}}})}function s(){function a(a){a.stopPropagation()}Y.bind(O("click"),a),X.bind(O("click"),function(a){var c=b(K/2),d=a.pageY-X.offset().top-c,e=C-K,f=d/e;0>f?f=0:f>1&&(f=1),z.scrollTop((E-C)*f)}),R.bind(O("click"),a),Q.bind(O("click"),function(a){var c=b(G/2),d=a.pageX-Q.offset().left-c,e=B-G,f=d/e;0>f?f=0:f>1&&(f=1),z.scrollLeft((D-B)*f)})}function t(){function b(){var a=window.getSelection?window.getSelection():document.getSlection?document.getSlection():{rangeCount:0};return 0===a.rangeCount?null:a.getRangeAt(0).commonAncestorContainer}function c(){e||(e=setInterval(function(){return A()?(z.scrollTop(z.scrollTop()+f.top),z.scrollLeft(z.scrollLeft()+f.left),void l()):void clearInterval(e)},50))}function d(){e&&(clearInterval(e),e=null),Q.removeClass("in-scrolling"),X.removeClass("in-scrolling")}var e=null,f={top:0,left:0},g=!1;a(P).bind(O("selectionchange"),function(c){a.contains(z[0],b())?g=!0:(g=!1,d())}),a(window).bind(O("mouseup"),function(a){g&&(g=!1,d())}),a(window).bind(O("mousemove"),function(a){if(g){var b={x:a.pageX,y:a.pageY},e=z.offset(),h={left:e.left,right:e.left+z.outerWidth(),top:e.top,bottom:e.top+z.outerHeight()};b.xh.right-3?(f.left=5,Q.addClass("in-scrolling")):f.left=0,b.yh.bottom-3?(b.y-h.bottom+3<5?f.top=5:f.top=20,X.addClass("in-scrolling")):f.top=0,0===f.top&&0===f.left?d():c()}})}function u(b,c){function d(a,b){z.scrollTop(z.scrollTop()-b),z.scrollLeft(z.scrollLeft()-a),l()}function e(a){r=!0}function f(a){r=!1}function g(a){return a.originalEvent.targetTouches?a.originalEvent.targetTouches[0]:a.originalEvent}function h(a){var b=a.originalEvent;return b.targetTouches&&1===b.targetTouches.length?!0:b.pointerType&&"mouse"!==b.pointerType&&b.pointerType!==b.MSPOINTER_TYPE_MOUSE?!0:!1}function i(a){if(h(a)){s=!0;var b=g(a);m.pageX=b.pageX,m.pageY=b.pageY,n=(new Date).getTime(),null!==q&&clearInterval(q),a.stopPropagation()}}function j(a){if(!r&&s&&h(a)){var b=g(a),c={pageX:b.pageX,pageY:b.pageY},e=c.pageX-m.pageX,f=c.pageY-m.pageY;d(e,f),m=c;var i=(new Date).getTime(),j=i-n;j>0&&(o.x=e/j,o.y=f/j,n=i),p(e,f)&&(a.stopPropagation(),a.preventDefault())}}function k(a){!r&&s&&(s=!1,clearInterval(q),q=setInterval(function(){return A()?Math.abs(o.x)<.01&&Math.abs(o.y)<.01?void clearInterval(q):(d(30*o.x,30*o.y),o.x*=.8,void(o.y*=.8)):void clearInterval(q)},10))}var m={},n=0,o={},q=null,r=!1,s=!1;b&&(a(window).bind(O("touchstart"),e),a(window).bind(O("touchend"),f),z.bind(O("touchstart"),i),z.bind(O("touchmove"),j),z.bind(O("touchend"),k)),c&&(window.PointerEvent?(a(window).bind(O("pointerdown"),e),a(window).bind(O("pointerup"),f),z.bind(O("pointerdown"),i),z.bind(O("pointermove"),j),z.bind(O("pointerup"),k)):window.MSPointerEvent&&(a(window).bind(O("MSPointerDown"),e),a(window).bind(O("MSPointerUp"),f),z.bind(O("MSPointerDown"),i),z.bind(O("MSPointerMove"),j),z.bind(O("MSPointerUp"),k)))}function v(){z.bind(O("scroll"),function(a){l()})}function w(){z.unbind(O()),a(window).unbind(O()),a(P).unbind(O()),z.data("perfect-scrollbar",null),z.data("perfect-scrollbar-update",null),z.data("perfect-scrollbar-destroy",null),R.remove(),Y.remove(),Q.remove(),X.remove(),z=Q=X=R=Y=F=J=B=C=D=E=G=H=S=T=U=K=L=Z=$=_=N=O=null}function x(){l(),v(),m(),n(),s(),t(),q(),(ca||da)&&u(ca,da),y.useKeyboard&&r(),z.data("perfect-scrollbar",z),z.data("perfect-scrollbar-update",l),z.data("perfect-scrollbar-destroy",w)}var y=a.extend(!0,{},c),z=a(this),A=function(){return!!z};if("object"==typeof d?a.extend(!0,y,d):g=d,"update"===g)return z.data("perfect-scrollbar-update")&&z.data("perfect-scrollbar-update")(),z;if("destroy"===g)return z.data("perfect-scrollbar-destroy")&&z.data("perfect-scrollbar-destroy")(),z;if(z.data("perfect-scrollbar"))return z.data("perfect-scrollbar");z.addClass("ps-container");var B,C,D,E,F,G,H,I,J,K,L,M,N="rtl"===z.css("direction"),O=e(),P=this.ownerDocument||document,Q=a("
").appendTo(z),R=a("
").appendTo(Q),S=b(Q.css("bottom")),T=S===S,U=T?null:b(Q.css("top")),V=b(Q.css("borderLeftWidth"))+b(Q.css("borderRightWidth")),W=b(Q.css("marginLeft"))+b(Q.css("marginRight")),X=a("
").appendTo(z),Y=a("
").appendTo(X),Z=b(X.css("right")),$=Z===Z,_=$?null:b(X.css("left")),aa=b(X.css("borderTopWidth"))+b(X.css("borderBottomWidth")),ba=b(X.css("marginTop"))+b(X.css("marginBottom")),ca="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,da=null!==window.navigator.msMaxTouchPoints;return x(),z})}}),function(a,b){function c(){function c(b){var c=b||a.event,d=c.keyCode||c.which;if(-1!==[9,13,32,27].indexOf(d)){for(var e=c.target||c.srcElement,f=-1,g=0;g"),e.innerHTML=y(b.text||"").split("\n").join("
"),b.text&&A(e),b.customClass&&w(c,b.customClass),C(c.querySelectorAll(".icon")), b.type){for(var i=!1,j=0;jd;d++)c=parseInt(a.substr(2*d,2),16),c=Math.round(Math.min(Math.max(0,c+c*b),255)).toString(16),e+=("00"+c).substr(c.length);return e}function f(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function g(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?parseInt(b[1],16)+", "+parseInt(b[2],16)+", "+parseInt(b[3],16):null}function h(a,b){var c=g(b);a.style.boxShadow="0 0 2px rgba("+c+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"}function i(){var a=t();F(u(),10),A(a),w(a,"showSweetAlert"),x(a,"hideSweetAlert"),l=b.activeElement;var c=a.querySelector("button.confirm");c.focus(),setTimeout(function(){w(a,"visible")},500);var d=a.getAttribute("data-timer");"null"!==d&&""!==d&&(a.timeout=setTimeout(function(){j()},d))}function j(){var c=t();G(u(),5),G(c,5),x(c,"showSweetAlert"),w(c,"hideSweetAlert"),x(c,"visible");var d=c.querySelector(".icon.success");x(d,"animate"),x(d.querySelector(".tip"),"animateSuccessTip"),x(d.querySelector(".long"),"animateSuccessLong");var e=c.querySelector(".icon.error");x(e,"animateErrorIcon"),x(e.querySelector(".x-mark"),"animateXMark");var f=c.querySelector(".icon.warning");x(f,"pulseWarning"),x(f.querySelector(".body"),"pulseWarningIns"),x(f.querySelector(".dot"),"pulseWarningIns"),a.onkeydown=n,b.onclick=m,l&&l.focus(),o=void 0,clearTimeout(c.timeout)}function k(){var a=t();a.style.marginTop=E(t())}var l,m,n,o,p=".sweet-alert",q=".sweet-overlay",r=["error","warning","info","success"],s={title:"",text:"",type:null,allowOutsideClick:!1,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#AEDEF4",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null},t=function(){return b.querySelector(p)},u=function(){return b.querySelector(q)},v=function(a,b){return new RegExp(" "+b+" ").test(" "+a.className+" ")},w=function(a,b){v(a,b)||(a.className+=" "+b)},x=function(a,b){var c=" "+a.className.replace(/[\t\r\n]/g," ")+" ";if(v(a,b)){for(;c.indexOf(" "+b+" ")>=0;)c=c.replace(" "+b+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")}},y=function(a){var c=b.createElement("div");return c.appendChild(b.createTextNode(a)),c.innerHTML},z=function(a){a.style.opacity="",a.style.display="block"},A=function(a){if(a&&!a.length)return z(a);for(var b=0;b0?setTimeout(d,b):a.style.display="none"};d()},H=function(c){if(MouseEvent){var d=new MouseEvent("click",{view:a,bubbles:!1,cancelable:!0});c.dispatchEvent(d)}else if(b.createEvent){var e=b.createEvent("MouseEvents");e.initEvent("click",!1,!1),c.dispatchEvent(e)}else b.createEventObject?c.fireEvent("onclick"):"function"==typeof c.onclick&&c.onclick()},I=function(b){"function"==typeof b.stopPropagation?(b.stopPropagation(),b.preventDefault()):a.event&&a.event.hasOwnProperty("cancelBubble")&&(a.event.cancelBubble=!0)};a.sweetAlertInitialize=function(){var a='

Title

Text

',c=b.createElement("div");c.innerHTML=a,b.body.appendChild(c)},a.sweetAlert=a.swal=function(){var a=arguments;if(null!==t())c.apply(this,a);else var b=setInterval(function(){null!==t()&&(clearInterval(b),c.apply(this,a))},100)},a.swal.setDefaults=function(a){if(!a)throw new Error("userParams is required");if("object"!=typeof a)throw new Error("userParams has to be a object");f(s,a)},function(){"complete"===b.readyState||"interactive"===b.readyState&&b.body?a.sweetAlertInitialize():b.addEventListener?b.addEventListener("DOMContentLoaded",function(){b.removeEventListener("DOMContentLoaded",arguments.callee,!1),a.sweetAlertInitialize()},!1):b.attachEvent&&b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&(b.detachEvent("onreadystatechange",arguments.callee),a.sweetAlertInitialize())})}()}(window,document),function(a,b,c,d){function e(b,c){this.options=a.extend(!0,{},f,c),this.input=b,this.$input=a(b),this._defaults=f,this._name="geocomplete",this.init()}var f={bounds:!0,country:null,map:!1,details:!1,detailsAttribute:"name",autoselect:!0,location:!1,mapOptions:{zoom:14,scrollwheel:!1,mapTypeId:"roadmap"},markerOptions:{draggable:!1},maxZoom:16,types:["geocode"],blur:!1},g="street_address route intersection political country administrative_area_level_1 administrative_area_level_2 administrative_area_level_3 colloquial_area locality sublocality neighborhood premise subpremise postal_code natural_feature airport park point_of_interest post_box street_number floor room lat lng viewport location formatted_address location_type bounds".split(" "),h="id place_id url website vicinity reference name rating international_phone_number icon formatted_phone_number".split(" ");a.extend(e.prototype,{init:function(){this.initMap(),this.initMarker(),this.initGeocoder(),this.initDetails(),this.initLocation()},initMap:function(){if(this.options.map){if("function"==typeof this.options.map.setCenter)return void(this.map=this.options.map);this.map=new google.maps.Map(a(this.options.map)[0],this.options.mapOptions),google.maps.event.addListener(this.map,"click",a.proxy(this.mapClicked,this)),google.maps.event.addListener(this.map,"zoom_changed",a.proxy(this.mapZoomed,this))}},initMarker:function(){if(this.map){var b=a.extend(this.options.markerOptions,{map:this.map});b.disabled||(this.marker=new google.maps.Marker(b),google.maps.event.addListener(this.marker,"dragend",a.proxy(this.markerDragged,this)))}},initGeocoder:function(){var b={types:this.options.types,bounds:this.options.bounds===!0?null:this.options.bounds,componentRestrictions:this.options.componentRestrictions};this.options.country&&(b.componentRestrictions={country:this.options.country}),this.autocomplete=new google.maps.places.Autocomplete(this.input,b),this.geocoder=new google.maps.Geocoder,this.map&&this.options.bounds===!0&&this.autocomplete.bindTo("bounds",this.map),google.maps.event.addListener(this.autocomplete,"place_changed",a.proxy(this.placeChanged,this)),this.$input.keypress(function(a){return 13===a.keyCode?!1:void 0}),this.$input.bind("geocode",a.proxy(function(){this.find()},this)),this.options.blur===!0&&this.$input.blur(a.proxy(function(){this.find()},this))},initDetails:function(){function b(a){e[a]=c.find("["+d+"="+a+"]")}if(this.options.details){var c=a(this.options.details),d=this.options.detailsAttribute,e={};a.each(g,function(a,c){b(c),b(c+"_short")}),a.each(h,function(a,c){b(c)}),this.$details=c,this.details=e}},initLocation:function(){var a,b=this.options.location;if(b){if("string"==typeof b)return void this.find(b);b instanceof Array&&(a=new google.maps.LatLng(b[0],b[1])),b instanceof google.maps.LatLng&&(a=b),a&&(this.map&&this.map.setCenter(a),this.marker&&this.marker.setPosition(a))}},find:function(a){this.geocode({address:a||this.$input.val()})},geocode:function(b){this.options.bounds&&!b.bounds&&(this.options.bounds===!0?b.bounds=this.map&&this.map.getBounds():b.bounds=this.options.bounds),this.options.country&&(b.region=this.options.country),this.geocoder.geocode(b,a.proxy(this.handleGeocode,this))},selectFirstResult:function(){var b="";a(".pac-item-selected")[0]&&(b="-selected");var c=a(".pac-container .pac-item"+b+":first span:nth-child(2)").text(),d=a(".pac-container .pac-item"+b+":first span:nth-child(3)").text(),e=c;return d&&(e+=" - "+d),this.$input.val(e),e},handleGeocode:function(a,b){if(b===google.maps.GeocoderStatus.OK){var c=a[0];this.$input.val(c.formatted_address),this.update(c),a.length>1&&this.trigger("geocode:multiple",a)}else this.trigger("geocode:error",b)},trigger:function(a,b){this.$input.trigger(a,[b])},center:function(a){a.viewport?(this.map.fitBounds(a.viewport),this.map.getZoom()>this.options.maxZoom&&this.map.setZoom(this.options.maxZoom)):(this.map.setZoom(this.options.maxZoom),this.map.setCenter(a.location)),this.marker&&(this.marker.setPosition(a.location),this.marker.setAnimation(this.options.markerOptions.animation))},update:function(a){this.map&&this.center(a.geometry),this.$details&&this.fillDetails(a),this.trigger("geocode:result",a)},fillDetails:function(b){var c={},d=b.geometry,e=d.viewport,f=d.bounds;a.each(b.address_components,function(b,d){d.types[0];a.each(d.types,function(a,b){c[b]=d.long_name,c[b+"_short"]=d.short_name})}),a.each(h,function(a,d){c[d]=b[d]}),a.extend(c,{formatted_address:b.formatted_address,location_type:d.location_type||"PLACES",viewport:e,bounds:f,location:d.location,lat:d.location.lat(),lng:d.location.lng()}),a.each(this.details,a.proxy(function(a,b){var d=c[a];this.setDetail(b,d)},this)),this.data=c},setDetail:function(a,b){b===d?b="":"function"==typeof b.toUrlValue&&(b=b.toUrlValue()),a.is(":input")?a.val(b):a.text(b)},markerDragged:function(a){this.trigger("geocode:dragged",a.latLng)},mapClicked:function(a){this.trigger("geocode:click",a.latLng)},mapZoomed:function(a){this.trigger("geocode:zoom",this.map.getZoom())},resetMarker:function(){this.marker.setPosition(this.data.location),this.setDetail(this.details.lat,this.data.location.lat()),this.setDetail(this.details.lng,this.data.location.lng())},placeChanged:function(){var a=this.autocomplete.getPlace();if(a&&a.geometry)this.update(a);else if(this.options.autoselect){var b=this.selectFirstResult();this.find(b)}}}),a.fn.geocomplete=function(b){var c="plugin_geocomplete";if("string"==typeof b){var d=a(this).data(c)||a(this).geocomplete().data(c),f=d[b];return"function"==typeof f?(f.apply(d,Array.prototype.slice.call(arguments,1)),a(this)):(2==arguments.length&&(f=arguments[1]),f)}return this.each(function(){var d=a.data(this,c);d||(d=new e(this,b),a.data(this,c,d))})}}(jQuery,window,document),function(){function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if("object"==typeof a){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;bc;c++)b.push(a[c]);else b.push(a);return b}function g(a,b,c){if(!(this instanceof g))return new g(a,b);"string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=f(a),this.options=d({},this.options),"function"==typeof b?c=b:d(this.options,b),c&&this.on("always",c),this.getImages(),j&&(this.jqDeferred=new j.Deferred);var e=this;setTimeout(function(){e.check()})}function h(a){this.img=a}function i(a){this.src=a,n[a]=this}var j=a.jQuery,k=a.console,l="undefined"!=typeof k,m=Object.prototype.toString;g.prototype=new b,g.prototype.options={},g.prototype.getImages=function(){this.images=[];for(var a=0,b=this.elements.length;b>a;a++){var c=this.elements[a];"IMG"===c.nodeName&&this.addImage(c);var d=c.nodeType;if(d&&(1===d||9===d||11===d))for(var e=c.querySelectorAll("img"),f=0,g=e.length;g>f;f++){var h=e[f];this.addImage(h)}}},g.prototype.addImage=function(a){var b=new h(a);this.images.push(b)},g.prototype.check=function(){function a(a,e){return b.options.debug&&l&&k.log("confirm",a,e),b.progress(a),c++,c===d&&b.complete(),!0}var b=this,c=0,d=this.images.length;if(this.hasAnyBroken=!1,!d)return void this.complete();for(var e=0;d>e;e++){var f=this.images[e];f.on("confirm",a),f.check()}},g.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded;var b=this;setTimeout(function(){b.emit("progress",b,a),b.jqDeferred&&b.jqDeferred.notify&&b.jqDeferred.notify(b,a)})},g.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var b=this;setTimeout(function(){if(b.emit(a,b),b.emit("always",b),b.jqDeferred){var c=b.hasAnyBroken?"reject":"resolve";b.jqDeferred[c](b)}})},j&&(j.fn.imagesLoaded=function(a,b){var c=new g(this,a,b);return c.jqDeferred.promise(j(this))}),h.prototype=new b,h.prototype.check=function(){var a=n[this.img.src]||new i(this.img.src);if(a.isConfirmed)return void this.confirm(a.isLoaded,"cached was confirmed");if(this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var b=this;a.on("confirm",function(a,c){return b.confirm(a.isLoaded,c),!0}),a.check()},h.prototype.confirm=function(a,b){this.isLoaded=a,this.emit("confirm",this,b)};var n={};return i.prototype=new b,i.prototype.check=function(){if(!this.isChecked){var a=new Image;c.bind(a,"load",this),c.bind(a,"error",this),a.src=this.src,this.isChecked=!0}},i.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},i.prototype.onload=function(a){this.confirm(!0,"onload"),this.unbindProxyEvents(a)},i.prototype.onerror=function(a){this.confirm(!1,"onerror"),this.unbindProxyEvents(a)},i.prototype.confirm=function(a,b){this.isConfirmed=!0,this.isLoaded=a,this.emit("confirm",this,b)},i.prototype.unbindProxyEvents=function(a){c.unbind(a.target,"load",this),c.unbind(a.target,"error",this)},g}),function(a,b){if(!a)return b;var c=function(){this.el=b,this.items=b,this.sizes=[],this.max=[0,0],this.current=0,this.interval=b,this.opts={speed:500,delay:3e3,complete:b,keys:!b,dots:b,fluid:b};var c=this;this.init=function(b,c){return this.el=b,this.ul=b.children("ul"),this.max=[b.outerWidth(),b.outerHeight()],this.items=this.ul.children("li").each(this.calculate),this.opts=a.extend(this.opts,c),this.setup(),this},this.calculate=function(b){var d=a(this),e=d.outerWidth(),f=d.outerHeight();c.sizes[b]=[e,f],e>c.max[0]&&(c.max[0]=e),f>c.max[1]&&(c.max[1]=f)},this.setup=function(){if(this.el.css({overflow:"hidden",width:c.max[0],height:this.items.first().outerHeight()}),this.ul.css({width:100*this.items.length+"%",position:"relative"}),this.items.css("width",100/this.items.length+"%"),this.opts.delay!==b&&(this.start(),this.el.hover(this.stop,this.start)),this.opts.keys&&a(document).keydown(this.keys),this.opts.dots&&this.dots(),this.opts.fluid){var d=function(){c.el.css("width",Math.min(Math.round(c.el.outerWidth()/c.el.parent().outerWidth()*100),100)+"%")};d(),a(window).resize(d)}this.opts.arrows&&this.el.parent().append('

←→

').find(".arrows span").click(function(){a.isFunction(c[this.className])&&c[this.className]()}),a.event.swipe&&this.el.on("swipeleft",c.prev).on("swiperight",c.next)},this.move=function(b,d){this.items.eq(b).length||(b=0),0>b&&(b=this.items.length-1);var e=this.items.eq(b),f={height:e.outerHeight()},g=d?5:this.opts.speed;this.ul.is(":animated")||(c.el.find(".dot:eq("+b+")").addClass("active").siblings().removeClass("active"),this.el.animate(f,g)&&this.ul.animate(a.extend({left:"-"+b+"00%"},f),g,function(e){c.current=b,a.isFunction(c.opts.complete)&&!d&&c.opts.complete(c.el)}))},this.start=function(){c.interval=setInterval(function(){c.move(c.current+1)},c.opts.delay)},this.stop=function(){return c.interval=clearInterval(c.interval),c},this.keys=function(b){var d=b.which,e={37:c.prev,39:c.next,27:c.stop};a.isFunction(e[d])&&e[d]()},this.next=function(){return c.stop().move(c.current+1)},this.prev=function(){return c.stop().move(c.current-1)},this.dots=function(){var b='
    ';a.each(this.items,function(a){b+='
  1. '+(a+1)+"
  2. "}),b+="
",this.el.addClass("has-dots").append(b).find(".dot").click(function(){c.move(a(this).index())})}};a.fn.unslider=function(b){var d=this.length;return this.each(function(e){var f=a(this),g=(new c).init(f,b);f.data("unslider"+(d>1?"-"+(e+1):""),g)})}}(window.jQuery,!1),function(a){function b(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var c,d=a.ui.mouse.prototype,e=d._mouseInit,f=d._mouseDestroy;d._touchStart=function(a){var d=this;!c&&d._mouseCapture(a.originalEvent.changedTouches[0])&&(c=!0,d._touchMoved=!1,b(a,"mouseover"),b(a,"mousemove"),b(a,"mousedown"))},d._touchMove=function(a){c&&(this._touchMoved=!0,b(a,"mousemove"))},d._touchEnd=function(a){c&&(b(a,"mouseup"),b(a,"mouseout"),this._touchMoved||b(a,"click"),c=!1)},d._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),e.call(b)},d._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),f.call(b)}}}(jQuery),function(a){a.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var b=this;this.element.is("input")?(this.tagList=a("
    ").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.addClass("tagit-hidden-field")):this.tagList=this.element.find("ul, ol").andSelf().last(),this.tagInput=a('').addClass("ui-widget-content"),this.options.readOnly&&this.tagInput.attr("disabled","disabled"),this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex),this.options.placeholderText&&this.tagInput.attr("placeholder",this.options.placeholderText),this.options.autocomplete.source||(this.options.autocomplete.source=function(b,c){var d=b.term.toLowerCase(),e=a.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(e=this._subtractArray(e,this.assignedTags())),c(e)}),this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(a,c){b._showAutocomplete()}),"undefined"==typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=0)),a.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=a.proxy(this.options.autocomplete.source,this)),a.isFunction(this.options.tagSource)&&(this.options.tagSource=a.proxy(this.options.tagSource,this)),this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(a('
  • ').append(this.tagInput)).click(function(c){var d=a(c.target);if(d.hasClass("tagit-label")){var e=d.closest(".tagit-choice");e.hasClass("removed")||b._trigger("onTagClicked",c,{tag:e,tagLabel:b.tagLabel(e)})}else b.tagInput.focus()});var c=!1;if(this.options.singleField)if(this.options.singleFieldNode){var d=a(this.options.singleFieldNode),e=d.val().split(this.options.singleFieldDelimiter);d.val(""),a.each(e,function(a,d){b.createTag(d,null,!0),c=!0})}else this.options.singleFieldNode=a(''),this.tagList.after(this.options.singleFieldNode);if(c||this.tagList.children("li").each(function(){a(this).hasClass("tagit-new")||(b.createTag(a(this).text(),a(this).attr("class"),!0),a(this).remove())}),this.tagInput.keydown(function(c){if(c.which==a.ui.keyCode.BACKSPACE&&""===b.tagInput.val()){var d=b._lastTag();!b.options.removeConfirmation||d.hasClass("remove")?b.removeTag(d):b.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else b.options.removeConfirmation&&b._lastTag().removeClass("remove ui-state-highlight");(c.which===a.ui.keyCode.COMMA&&c.shiftKey===!1||c.which===a.ui.keyCode.ENTER||c.which==a.ui.keyCode.TAB&&""!==b.tagInput.val()||c.which==a.ui.keyCode.SPACE&&b.options.allowSpaces!==!0&&('"'!=a.trim(b.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==a.trim(b.tagInput.val()).charAt(0)&&'"'==a.trim(b.tagInput.val()).charAt(a.trim(b.tagInput.val()).length-1)&&a.trim(b.tagInput.val()).length-1!==0))&&((c.which!==a.ui.keyCode.ENTER||""!==b.tagInput.val())&&c.preventDefault(),b.options.autocomplete.autoFocus&&b.tagInput.data("autocomplete-open")||(b.tagInput.autocomplete("close"),b.createTag(b._cleanedInput())))}).blur(function(a){b.tagInput.data("autocomplete-open")||b.createTag(b._cleanedInput())}),this.options.availableTags||this.options.tagSource||this.options.autocomplete.source){var f={select:function(a,c){return b.createTag(c.item.value),!1}};a.extend(f,this.options.autocomplete),f.source=this.options.tagSource||f.source,this.tagInput.autocomplete(f).bind("autocompleteopen.tagit",function(a,c){b.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(a,c){b.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")}},destroy:function(){return a.Widget.prototype.destroy.call(this),this.element.unbind(".tagit"),this.tagList.unbind(".tagit"),this.tagInput.removeData("autocomplete-open"),this.tagList.removeClass(["tagit","ui-widget","ui-widget-content","ui-corner-all","tagit-hidden-field"].join(" ")),this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){a(this).hasClass("tagit-new")?a(this).remove():(a(this).removeClass(["tagit-choice","ui-widget-content","ui-state-default","ui-state-highlight","ui-corner-all","remove","tagit-choice-editable","tagit-choice-read-only"].join(" ")),a(this).text(a(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove()),this},_cleanedInput:function(){return a.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var b=this,c=[];return this.options.singleField?(c=a(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter),""===c[0]&&(c=[])):this._tags().each(function(){c.push(b.tagLabel(this))}),c},_updateSingleTagsField:function(b){a(this.options.singleFieldNode).val(b.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(b,c){for(var d=[],e=0;e=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:d}),!1;var g=a(this.options.onTagClicked?'':'').text(b),h=a("
  • ").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(c).append(g);if(this.options.readOnly)h.addClass("tagit-choice-read-only");else{h.addClass("tagit-choice-editable");var i=a("").addClass("ui-icon ui-icon-close"),j=a('×').addClass("tagit-close").append(i).click(function(a){e.removeTag(h)});h.append(j)}if(!this.options.singleField){var k=g.html();h.append('')}if(this._trigger("beforeTagAdded",null,{tag:h,tagLabel:this.tagLabel(h),duringInitialization:d})!==!1){if(this.options.singleField){var l=this.assignedTags();l.push(b),this._updateSingleTagsField(l)}this._trigger("onTagAdded",null,h),this.tagInput.val(""),this.tagInput.parent().before(h),this._trigger("afterTagAdded",null,{tag:h,tagLabel:this.tagLabel(h),duringInitialization:d}),this.options.showAutocompleteOnFocus&&!d&&setTimeout(function(){e._showAutocomplete()},0)}},removeTag:function(b,c){if(c="undefined"==typeof c?this.options.animate:c,b=a(b),this._trigger("onTagRemoved",null,b),this._trigger("beforeTagRemoved",null,{tag:b,tagLabel:this.tagLabel(b)})!==!1){if(this.options.singleField){var d=this.assignedTags(),e=this.tagLabel(b);d=a.grep(d,function(a){return a!=e}),this._updateSingleTagsField(d)}if(c){b.addClass("removed");var f=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],g=this;f.push(function(){b.remove(),g._trigger("afterTagRemoved",null,{tag:b,tagLabel:g.tagLabel(b)})}),b.fadeOut("fast").hide.apply(b,f).dequeue()}else b.remove(),this._trigger("afterTagRemoved",null,{tag:b,tagLabel:this.tagLabel(b)})}},removeTagByLabel:function(a,b){var c=this._findTagByLabel(a);if(!c)throw"No such tag exists with the name '"+a+"'";this.removeTag(c,b)},removeAll:function(){var a=this;this._tags().each(function(b,c){a.removeTag(c,!1)})}})}(jQuery), jQuery(document).ready(function(a){function b(a){if(a)if(window.getSelection){var b=window.getSelection();b.removeAllRanges(),b.addRange(a)}else document.selection&&a.select&&a.select()}var c=lasso_editor.editor,d=lasso_editor.strings,e=lasso_editor.settingsLink,f=lasso_editor.article_object,g=lasso_editor.toolbar,h=lasso_editor.toolbarHeadings,j=lasso_editor.component_sidebar,k=lasso_editor.postid,l=(lasso_editor.component_modal,lasso_editor.components),m=lasso_editor.featImgClass,n=(lasso_editor.featImgNonce,lasso_editor.titleClass),o=lasso_editor.featImgControls,p=lasso_editor.wpImgEdit,q=lasso_editor.handle,r=(lasso_editor.mapFormFooter,lasso_editor.mapLocations),s=lasso_editor.mapZoom,t=lasso_editor.mapStart,u=lasso_editor.objectsNoSave,v=lasso_editor.objectsNonEditable,w=lasso_editor.supportedNoSave;a("#lasso--edit").click(function(x){function y(a){function b(a){return("0"+parseInt(a).toString(16)).slice(-2)}return a=a.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+b(a[1])+b(a[2])+b(a[3])}function z(){(localStorage.getItem("lasso_backup_"+k)||lasso_editor.dirtyByComponent)&&a(".lasso--controls__right a:not(#lasso--exit)").trigger("click")}function A(){return a("body").hasClass("lasso-sidebar-open")?(a("body").removeClass("lasso-sidebar-open"),void a("#lasso--component__settings").perfectScrollbar("destroy")):(a("body").removeClass("lasso-sidebar-open lasso-editing"),a(".lasso--toolbar_wrap, #lasso--sidebar, #lasso--featImgControls, #lasso--wpimg-edit, #lasso--exit").fadeOut().remove(),a("#lasso--edit").css("opacity",1),a(".lasso--controls__right").css("opacity",0),a(f).attr("id",""),a(".lasso--wpimg__wrap").each(function(){a(this).children().unwrap()}),a("#lasso--map-form").each(function(){var b=a(this);b.find(".lasso-component--controls, .lasso--map-form__footer ").remove(),b.children().unwrap()}),a(n).attr("contenteditable",!1),void articleMedium.destroy())}if(0==a(f).length&&(f=".entry-content",0==a(f).length))return void swal({title:d.warning,type:"info",text:d.missingClass,showCancelButton:!0,cancelButtonText:d.cancelText,confirmButtonColor:"#007aab",confirmButtonText:d.missingConfirm,closeOnConfirm:!1},function(){location.replace(e)});x.preventDefault(),a("body").toggleClass("lasso-editing"),a(f).attr("id",c),a(g).hide().appendTo("body").fadeIn(300),a(".lasso--controls__right").css("opacity",1),a("#"+c).attr("contenteditable",!0),a("body").append(j),a(m).length>0&&a(m).append(o),a(n).length>0?a(n).attr("contenteditable",!0):(n=".entry-header",a(n).length>0&&a(n).attr("contenteditable",!0)),a(".scroll-nav__section").each(function(){a(this).children().unwrap()}),a(".lasso--controls__right ").prepend(''),a(".aesop-component").each(function(){if(!a(".lasso-component--toolbar").length>0)if(a(this).hasClass("aesop-map-component")){var b=a(this);b.wrap('
    ').before(q)}else a(this).append(q)}),a("[class*='wp-image-']").each(function(){var b=a(this);!a(".lasso--wpimg-edit").length>0&&(b.parent().hasClass("wp-caption")?b.parent().addClass("lasso--wpimg__wrap"):b.wrap('
    '),b.parent().prepend(p))}),a(".lasso-component:not(.lasso--wpimg__wrap)").each(function(){a(this);!a(".lasso-component--toolbar").length>0&&a(this).append(q)}),a(u).remove(),a(w).remove(),article=document.getElementById(c),articleMedium=new Medium({element:article,mode:Medium.richMode,attributes:null,tags:null,placeholder:lasso_editor.strings.justWrite,pasteAsText:!0,cssClasses:{editor:"lasso-editor",pasteHook:"lasso-editor-paste-hook",placeholder:"lasso-editor-placeholder",clear:"lasso-editor-clear"}}),a(v).attr("contenteditable",!1),a(v).attr("readonly",!0),document.execCommand("defaultParagraphSeparator",!1,"p"),article.highlight=function(){return document.activeElement===article?!1:void article.focus()},document.getElementById("lasso-toolbar--bold").onmousedown=function(){return articleMedium.element.contentEditable=!0,article.highlight(),articleMedium.invokeElement("b"),!1},lasso_editor.showColor&&(a("#lasso-toolbar--color-pick").iris(),a("#lasso-toolbar--color-pick").iris("color","#f00"),a("#lasso-toolbar--color-pick").css("color","#f00"),a("#lasso-toolbar--color-set").css("color","#f00"),a(window).mousedown(function(){a("#lasso-toolbar--color-pick").iris("hide")}),lasso_editor.isMobile||a(".iris-picker").css({position:"absolute",top:-180}),a("#lasso-toolbar--color-pick").iris({palettes:!0,change:function(b,c){a("#lasso-toolbar--color-pick").css("color",c.color.toString()),a("#lasso-toolbar--color-set").css("color",c.color.toString())}}),a("#lasso-toolbar--color-pick").mousedown(function(b){"lasso-toolbar--color-pick"==b.target.id&&a("#lasso-toolbar--color-pick").iris("toggle"),b.stopPropagation()}),a("#lasso-toolbar--color-set").mousedown(function(){a("#lasso-toolbar--color-pick").iris("hide"),articleMedium.element.contentEditable=!0;var b=y(a("#lasso-toolbar--color-pick").css("color"));return articleMedium.invokeElement("span",{style:"color:"+b+";"}),!1})),lasso_editor.showAlignment&&(a("#lasso-toolbar--right-align").mousedown(function(){var a=articleMedium.html.textElementsAtCaret();if(a)for(i=0;i'+window.selRange+"");var c=window.selRange.startContainer.parentNode,d=c.localName;if("a"==d){var e=a(window.selRange.startContainer.parentNode);e.replaceWith(e[0].innerHTML)}return window.selRange=null,a("#lasso-toolbar--link").removeClass("link--drop-up"),!1},document.getElementById("lasso-toolbar--html__insert").onmousedown=function(){articleMedium.element.contentEditable=!0,b(window.selRange);var c,d=window.selRange.startContainer;c=d.localName;var e=a(d),f=a("#lasso-toolbar--html__inner").text();return f=a(f),f.attr("contenteditable","true"),"p"==c?(f.insertAfter(e),e.remove()):(d=d.parentNode,c=d.localName,"p"==c?f.insertAfter(e):articleMedium.insertHtml(f.text())),window.selRange=null,a("#lasso-toolbar--html").removeClass("html--drop-up"),!1},lasso_editor.enableAutoSave&&(lasso_editor.intervalID=window.setInterval(z,6e4)),a(document).keyup(function(b){27==b.keyCode&&(a("#lasso-toolbar--link").hasClass("link--drop-up")?a("#lasso-toolbar--link").removeClass("link--drop-up"):a("#lasso-toolbar--html").hasClass("html--drop-up")?a("#lasso-toolbar--html").removeClass("html--drop-up"):A())}),jQuery(document).on("click","#lasso--exit",function(a){a.preventDefault(),A()}),a(document).keydown(function(b){return"115"!=b.which&&"83"!=b.which||!b.ctrlKey&&!b.metaKey?!0:(b.preventDefault(),a(".lasso-editing #lasso--save").trigger("click"),!1)});var B=function(){!a(".aesop-timeline").length>0&&a("body").append('
    ').addClass("has-timeline"),!a(".aesop-timeline .scroll-nav").length>0&&(a(".aesop-entry-content").scrollNav({sections:".aesop-timeline-stop",arrowKeys:!0,insertTarget:".aesop-timeline",insertLocation:"appendTo",showTopLink:!1,showHeadline:!1,scrollOffset:0}),a(".aesop-timeline-stop").each(function(){var b=a(this).attr("data-title");a(this).text(b).append(q)}))},C=function(){a(".aesop-video-component").fitVids()},D=t?t:[29.76,-95.38],E=s?s:12,F=lasso_editor.mapTileProvider,G=function(){function a(a,b){var c=m(a,b);jQuery('input[name="ase-map-component-start-point"]').remove(),jQuery(".lasso--map-form__footer").append(''),jQuery("#lasso-map-address").val(a+", "+b)}function b(a){jQuery('input[name="ase-map-component-zoom"]').remove(),jQuery(".lasso--map-form__footer").append('')}function c(a){k(a.target)}function d(b){var c=b.target.getCenter();a(f(c.lat),f(c.lng))}function e(a){b(a.target.getZoom())}function f(a){return Math.round(100*a)/100}function g(a){var b,d={type:"Feature",properties:{},geometry:{type:"Point",coordinates:[a.latlng.lat,a.latlng.lng]}};L.geoJson(d,{pointToLayer:function(d,e){return b=L.marker(a.latlng,{title:"Resource Location",alt:"Resource Location",riseOnHover:!0,draggable:!0}).bindPopup(" "),b.on("popupopen",h),b.on("dragend",c),b}}).addTo(p),j(b._leaflet_id,l(a.latlng.lat,a.latlng.lng,"Location Title"))}function h(){var a=this;jQuery(".marker-delete-button:visible").click(function(){jQuery('input[data-marker="'+a._leaflet_id+'"]').remove(),p.removeLayer(a)}),jQuery(".marker-update-button:visible").click(function(b){var c=b.target.previousElementSibling.value,d=l(a._latlng.lat,a._latlng.lng,c);jQuery('input[data-marker="'+a._leaflet_id+'"]').val(d),a.options.title=c,a.closePopup(),a.bindPopup(" ")})}function i(a,b){return marker=L.marker(a,{title:b,alt:b,riseOnHover:!0,draggable:!0}).bindPopup(" "),marker.on("popupopen",h),marker.on("dragend",c),marker}function j(a,b){jQuery(".lasso--map-form__footer").append('')}function k(a){var b=l(a._latlng.lat,a._latlng.lng,a.options.title);jQuery('input[data-marker="'+a._leaflet_id+'"]').val(b)}function l(a,b,c){return encodeURIComponent(JSON.stringify({lat:a,lng:b,title:c}))}function m(a,b){return encodeURIComponent(JSON.stringify({lat:a,lng:b}))}var n=D.lat?D.lat:29.76,o=D.lng?D.lng:-95.38,p=L.map("aesop-map-component",{scrollWheelZoom:!1,zoom:E,center:[n,o]});a(D[0],D[1]),jQuery("#lasso-map-address").geocomplete().bind("geocode:result",function(b,c){var d=c.geometry.location.k,e=c.geometry.location.B;p.panTo(new L.LatLng(d,e)),a(d,e)}),L.tileLayer(F,{maxZoom:E}).addTo(p),r.forEach(function(a){i([a.lat,a.lng],a.title).addTo(p),j(marker._leaflet_id,l(a.lat,a.lng,a.title))}),p.on("click",g),p.on("dragend",d),p.on("zoomend",e)};a("#"+c).sortable({opacity:.65,placeholder:"lasso-drop-zone",handle:".lasso-drag",cursor:"move",tolerance:"pointer",refreshPositions:!0,helper:function(b,c){var d=c.context,e=a(d).attr("data-component-type");return a('
    ')},beforeStop:function(a,b){draggedItem=b.item},receive:function(){a("#lasso-toolbar--components").removeClass("toolbar--drop-up");var b,c=draggedItem.context,d=a(c).attr("data-type");"draggable"==origin&&("wpimg"==d?(b=a(l[d].content).prepend(p),a(c).replaceWith(b)):(b=a(l[d].content).prepend(q).attr({"data-component-type":d}),a(c).replaceWith(b)),"map"==d&&G(),"timeline_stop"==d&&B(),"video"==d&&C(),a(b).find(".lasso-settings").trigger("click"))}}),a("#lasso-toolbar--components__list li").draggable({axis:"y",helper:"clone",cursor:"move",connectToSortable:"#"+c,start:function(b){origin="draggable";var c=b.currentTarget,d=a(c).attr("data-type");a(this).addClass(d)}})})}),function(a){a(document).ready(function(){var b=function(){a("body").removeClass("lasso-modal-open"),a("#lasso--post-settings__modal, #lasso--modal__overlay").remove()};jQuery(document).on("click","#lasso--post-settings",function(b){b.preventDefault(),a("body").toggleClass("lasso-modal-open"),a("body").append(lasso_editor.component_modal);var c=function(a){var b;return 100==a?b="draft":200==a?b="publish":"draft"==a?b=100:"publish"==a&&(b=200),b};a("#lasso--slider").slider({value:c(lasso_editor.post_status),min:100,max:200,step:100,animate:"fast",slide:function(b,d){a('input[name="status"]').val(c(d.value)),a(".lasso--postsettings__footer").slideDown(),100==d.value?a(".story-status").removeClass("story-status-publish").addClass("story-status-draft"):200==d.value&&a(".story-status").removeClass("story-status-draft").addClass("story-status-publish")}}),a('input[name="status"]').val(c(a("#lasso--slider").slider("value"))),a(".lasso--modal__trigger-footer").on("keyup",function(){a(".lasso--postsettings__footer").slideDown()});var d=a("#lasso--cat-select"),e=a("#lasso--tag-select");d.tagit({placeholderText:"search categories...",availableTags:lasso_editor.postCategories}),d.on("change",function(b){a(".lasso--postsettings__footer").slideDown()}),e.tagit({placeholderText:"search tags...",availableTags:lasso_editor.postTags}),e.on("change",function(b){a(".lasso--postsettings__footer").slideDown()}),modalResizer()}),jQuery(document).on("click","#lasso--modal__close, #lasso--modal__overlay, .lasso--postsettings-cancel",function(a){a.preventDefault(),b()}),a(document).keyup(function(a){27==a.keyCode&&b()});jQuery(document).on("submit","#lasso--postsettings__form",function(b){b.preventDefault();var c=a(this);a(this).find('input[type="submit"]').val(lasso_editor.strings.saving);var d=c.serialize();a.post(lasso_editor.ajaxurl,d,function(b){console.log(b),1==b.success?(a('input[type="submit"]').addClass("saved"),a('input[type="submit"]').val(lasso_editor.strings.saved),location.reload(),window.location.replace(lasso_editor.permalink)):(alert("error"),console.log(b))}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}),a(document).on("click",".lasso--modal__tabs li",function(b){b.preventDefault();var c=a(this),d=c.data("addon-name"),e="not-visible",f="visible";a(".lasso--modal__tabs li").removeClass("active-tab"),c.addClass("active-tab"),a(".lasso--modal__content").removeClass(f).addClass(e),c.closest(".lasso--modal__inner").find('div[data-addon-content="'+d+'"]').removeClass(e).addClass(f),modalResizer()})})}(jQuery),function(a){a(document).ready(function(){var b=function(){a("body").removeClass("lasso-sidebar-open")};a("body").on("click","#"+lasso_editor.editor,function(){b()});var c,d=function(){var b=a("#lasso--component__settings");b.height(a(window).height()),a(window).resize(function(){b.height(a(window).height())})};a(document).on("click","#lasso-component--settings__trigger",function(){var b=a("#lasso--component__settings");a(this);if(c=a(this).parent().parent().hasClass("aesop-map-component")?a(this).parent().parent().find(".aesop-component"):a(this).closest(".aesop-component"),window.component=c,j=c.data(),a("body").toggleClass("lasso-sidebar-open"),b.find('input[name="unique"]').val(j.unique),d(),b.html(lasso_editor.component_options[j.componentType]),b.find(".component_type").val(j.componentType),a(".lasso-buttoninsert-wrap").fadeIn(600),b.perfectScrollbar("destroy"),b.perfectScrollbar(),b.find(".lasso-option").each(function(){var b=a(this).data("option"),c=a(this).find(".lasso-generator-attr");if("gallery-type"==b){var d=function(b){"grid"==b?(a(".ase-gallery-opts--thumb").fadeOut(),a(".ase-gallery-opts--photoset").fadeOut(),a(".ase-gallery-opts--grid").fadeIn()):a(".ase-gallery-opts--grid").fadeOut(),"thumbnail"==b?(a(".ase-gallery-opts--grid").fadeOut(),a(".ase-gallery-opts--photoset").fadeOut(),a(".ase-gallery-opts--thumb").fadeIn()):a(".ase-gallery-opts--thumb").fadeOut(),"photoset"==b?(a(".ase-gallery-opts--grid").fadeOut(),a(".ase-gallery-opts--thumb").fadeOut(),a(".ase-gallery-opts--photoset").fadeIn()):a(".ase-gallery-opts--photoset").fadeOut()};a(c).each(function(){a(this).val()==j.galleryType&&(a(this).parent().addClass("selected"),a(this).prop("checked",!0),d(a(this).val()),a("#ase_gallery_type").val(a(this).val()))})}else a(c[0]).val(j[b])}),c.hasClass("aesop-content-component"))var e=c.find(".aesop-content-comp-wrap").attr("id"),f=a("#"+e);else var f=a("#"+c.attr("id"));if(a("html, body").animate({scrollTop:f.length?f.offset().top-50:!1},400),a(this).parent().parent().hasClass("empty-gallery")&&b.addClass("gallery-no-images"),a(this).parent().parent().hasClass("aesop-gallery-component")){var g=(a(this),lasso_editor.ajaxurl),h=(a("#lasso--component-settings-form.gallery"),lasso_editor.getGallImgNonce),i=j.id,j={action:"process_gallery_get-images",post_id:i,nonce:h};a.post(g,j,function(b){a("#lasso--gallery__images").html(b.data.html);var c=a("#ase-gallery-images");c.ready(function(){c.sortable({containment:"parent",cursor:"move",opacity:.8,placeholder:"ase-gallery-drop-zone",forcePlaceholderSize:!0,update:function(){var b=a(this).sortable("toArray");a("#ase_gallery_ids").val(b)},create:function(){var b=a(this).sortable("toArray");a("#ase_gallery_ids").val(b)}})})}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}}).on("click","#lasso-upload-img",function(b){b.preventDefault(),className=b.currentTarget.parentElement.className;var d=a('input[name="component_type"]').val();"undefined"!=typeof lasso_file_frame&&lasso_file_frame.close(),lasso_file_frame=wp.media.frames.file_frame=wp.media({title:"Select Image",button:{text:"Insert Image"},multiple:!1}),lasso_file_frame.on("select",function(){var b=lasso_file_frame.state().get("selection").first().toJSON();a(".lasso-generator-attr-media_upload").attr("value",b.url),"parallax"==d?c.find(".aesop-parallax-sc-img").attr("src",b.url):"quote"==d?c.css({"background-image":"url("+b.url+")"}):"image"==d?c.find(".aesop-image-component-image > img").attr("src",b.url):"character"==d?c.find(".aesop-character-avatar").attr("src",b.url):"chapter"==d&&c.find(".aesop-article-chapter").css({"background-image":"url("+b.url+")"})}),lasso_file_frame.open()}),jQuery(document).on("click","#lasso--sidebar__close",function(c){c.preventDefault(),b(),a("#lasso--component__settings").perfectScrollbar("destroy")})})}(jQuery),function(a){a(document).ready(function(){function b(b,c,d){b.find(".lasso-video-id > #lasso-generator-attr-id").on("change",function(){video_id=a(this).val(),"vimeo"==d?c.find("iframe").attr("src","//player.vimeo.com/video/"+video_id+" "):"youtube"==d&&c.find("iframe").attr("src","//www.youtube.com/embed/"+video_id+"?rel=0&wmode=transparent")})}a(document).on("click","#lasso-component--settings__trigger",function(){var c=a("#lasso--component__settings");c.find("#lasso-generator-attr-background").on("change",function(){component.css({"background-color":a(this).val()})}),c.find("#lasso-generator-attr-text").on("change",function(){component.css({color:a(this).val()})}),c.find("#lasso-generator-attr-quote").on("keyup",function(){component.find("blockquote span").text(a(this).val())}),c.find("#lasso-generator-attr-cite").on("keyup",function(){var b=component.find("blockquote cite");0==b.length?component.find("blockquote").append(''+a(this).val()+""):component.find("blockquote cite").text(a(this).val())}),c.find(".lasso-quote-width > #lasso-generator-attr-width").on("keyup",function(){component.css("width",a(this).val())}),c.find(".lasso-quote-type #lasso-generator-attr-type").on("change",function(){var b=a(this).val();"pull"==b&&component.css("background-color","transparent"),component.removeClass("aesop-quote-type-block aesop-quote-type-pull"),component.addClass("aesop-quote-type-"+a(this).val()+" ")}),c.find(".lasso-quote-align #lasso-generator-attr-align").on("change",function(){var b=a(this).val();"left"==b?(component.removeClass("aesop-component-align-right aesop-component-align-center"),component.find("blockquote").removeClass("aesop-component-align-right aesop-component-align-center")):"right"==b?(component.removeClass("aesop-component-align-left aesop-component-align-center"),component.find("blockquote").removeClass("aesop-component-align-left aesop-component-align-center")):"center"==b&&(component.removeClass("aesop-component-align-left aesop-component-align-right"),component.find("blockquote").removeClass("aesop-component-align-left aesop-component-align-right")),component.addClass("aesop-component-align-"+a(this).val()+" "),component.find("blockquote").addClass("aesop-component-align-"+a(this).val()+" ")}),c.find(".lasso-parallax-caption > #lasso-generator-attr-caption").on("keyup",function(){var b=component.find(".aesop-parallax-sc-caption-wrap");0==b.length?component.find("img").after('
    '+a(this).val()+"
    "):component.find(".aesop-parallax-sc-caption-wrap").text(a(this).val())}),c.find(".lasso-parallax-captionposition > #lasso-generator-attr-captionposition").on("change",function(){var b=a(this).val();"bottom-left"==b?component.find(".aesop-parallax-sc-caption-wrap").removeClass("bottom-right top-left top-right"):"bottom-right"==b?component.find(".aesop-parallax-sc-caption-wrap").removeClass("bottom-left top-left top-right"):"top-left"==b?component.find(".aesop-parallax-sc-caption-wrap").removeClass("bottom-right top-right bottom-left"):"top-right"==b&&component.find(".aesop-parallax-sc-caption-wrap").removeClass("bottom-right bottom-left top-left"),component.find(".aesop-parallax-sc-caption-wrap").addClass(b)}),c.find(".lasso-image-caption > #lasso-generator-attr-caption").on("keyup",function(){var b=component.find(".aesop-image-component-caption");0==b.length?component.find("img").after('

    '+a(this).val()+"

    "):component.find(".aesop-image-component-caption").text(a(this).val())}),c.find(".lasso-image-imgwidth > #lasso-generator-attr-imgwidth").on("keyup",function(){component.find(".aesop-image-component-image").css("max-width",a(this).val())}),c.find(".lasso-image-align > #lasso-generator-attr-align").on("change",function(){var b=a(this).val();"left"==b?component.find(".aesop-image-component-image").removeClass("aesop-component-align-right aesop-component-align-center"):"right"==b?component.find(".aesop-image-component-image").removeClass("aesop-component-align-left aesop-component-align-center"):"center"==b&&component.find(".aesop-image-component-image").removeClass("aesop-component-align-left aesop-component-align-right"),component.find(".aesop-image-component-image").addClass("aesop-component-align-"+a(this).val()+" ")}),c.find(".lasso-image-captionposition > #lasso-generator-attr-captionposition").on("change",function(){var b=a(this).val();"left"==b?component.find(".aesop-image-component-image").removeClass("aesop-image-component-caption-right aesop-image-component-caption-center"):"right"==b?component.find(".aesop-image-component-image").removeClass("aesop-image-component-caption-left aesop-image-component-caption-center"):"center"==b&&component.find(".aesop-image-component-image").removeClass("aesop-image-component-caption-left aesop-image-component-caption-right"),component.find(".lasso-image-component-image").addClass("lasso-image-component-caption-"+b+" ")}),c.find(".lasso-image-offset > #lasso-generator-attr-offset").on("keyup",function(){a(this).val();component.find(".aesop-image-component-image").hasClass("aesop-component-align-left")?component.find(".aesop-image-component-image").css("margin-left",a(this).val()):component.find(".aesop-image-component-image").css("margin-right",a(this).val())}),c.find(".lasso-character-name > #lasso-generator-attr-name").on("keyup",function(){component.find(".aesop-character-title").text(a(this).val())}),c.find(".lasso-character-caption > #lasso-generator-attr-caption").on("keyup",function(){component.find(".aesop-character-cap").text(a(this).val())}),c.find(".lasso-character-align > #lasso-generator-attr-align").on("change",function(){var b=a(this).val();"left"==b?component.removeClass("aesop-component-align-right aesop-component-align-center"):"center"==b&&component.removeClass("aesop-component-align-left aesop-component-align-right"),component.addClass("aesop-component-align-"+a(this).val()+" ")}),c.find(".lasso-chapter-title > #lasso-generator-attr-title").on("keyup",function(){component.find(".aesop-cover-title span").text(a(this).val())}),c.find(".lasso-chapter-subtitle > #lasso-generator-attr-subtitle").on("keyup",function(){component.find(".aesop-cover-title small").text(a(this).val())}),c.find(".lasso-video-src > #lasso-generator-attr-src").on("change blur",function(){val=a(this).val(),"vimeo"==val?(component.find("iframe").attr("src","//player.vimeo.com/video/"+val+" "),b(c,component,"vimeo")):"youtube"==val&&(component.find("iframe").attr("src","//www.youtube.com/embed/"+val+"?rel=0&wmode=transparent"),b(c,component,"youtube"))}),c.find(".lasso-video-id > #lasso-generator-attr-id").on("keyup",function(){t=a(".lasso-video-src > #lasso-generator-attr-src").val(),val=a(this).val(),"vimeo"==t?component.find("iframe").attr("src","//player.vimeo.com/video/"+val+" "):"youtube"==t&&component.find("iframe").attr("src","//www.youtube.com/embed/"+val+"?rel=0&wmode=transparent")}),c.find(".lasso-video-width > #lasso-generator-attr-width").on("keyup",function(){component.find(".aesop-video-container").css("max-width",a(this).val())}),c.find(".lasso-content-background > #lasso-generator-attr-background").on("change",function(){component.find(".aesop-content-comp-wrap").css({"background-color":a(this).val()})}),c.find(".lasso-content-color > #lasso-generator-attr-color").on("change",function(){component.find(".aesop-content-comp-wrap").css({color:a(this).val()})}),c.find(".lasso-content-height > #lasso-generator-attr-height").on("keyup",function(){val=a(this).val(),component.find(".aesop-content-comp-wrap").css({"min-height":a(this).val()})}),c.find(".lasso-content-columns > #lasso-generator-attr-columns").on("change",function(){val=a(this).val(),"1"==val?component.find(".aesop-content-comp-wrap").removeClass("aesop-content-comp-columns-2 aesop-content-comp-columns-3 aesop-content-comp-columns-4").addClass("aesop-content-comp-columns-1"):"2"==val?component.find(".aesop-content-comp-wrap").removeClass("aesop-content-comp-columns-1 aesop-content-comp-columns-3 aesop-content-comp-columns-4").addClass("aesop-content-comp-columns-2"):"3"==val?component.find(".aesop-content-comp-wrap").removeClass("aesop-content-comp-columns-1 aesop-content-comp-columns-2 aesop-content-comp-columns-4").addClass("aesop-content-comp-columns-3"):"4"==val&&component.find(".aesop-content-comp-wrap").removeClass("aesop-content-comp-columns-1 aesop-content-comp-columns-2 aesop-content-comp-columns-3").addClass("aesop-content-comp-columns-4")})})})}(jQuery),jQuery(function(a){function b(){if(window.getSelection){if(sel=window.getSelection(),sel.getRangeAt&&sel.rangeCount)return sel.getRangeAt(0)}else if(document.selection&&document.selection.createRange)return document.selection.createRange();return null}function c(a){a&&(window.getSelection?(sel=window.getSelection(),sel.removeAllRanges(),sel.addRange(a)):document.selection&&a.select&&a.select())}var d=function(){return 600<=a(window).width()?!0:!1},f=function(){return d()?"up":"down"};a(document).on("click","#lasso-toolbar--components",function(b){a(this).toggleClass("toolbar--drop-"+f());var c=a(this).find("ul");if(a(this).hasClass("toolbar--drop-"+f())?a(c).show():a(c).hide(),a("#lasso-toolbar--html").removeClass("html--drop-"+f()),a("#lasso-toolbar--link").removeClass("link--drop-"+f()),lasso_editor.isMobile)a(c).css({dropUp:e,top:40});else{var e=a(c).height(),g=15;1==d()&&a(c).css({dropUp:e,top:-(e+g)})}}),jQuery(document).on("mousedown","#lasso-toolbar--html",function(){if(!a(this).hasClass("html--drop-"+f())){var c=document.getElementById(lasso_editor.editor);window.selRange=b(),("undefined"==typeof window.selRange||null==window.selRange)&&(c.highlight(),window.selRange=b())}}),jQuery(document).on("focusout","#lasso-toolbar--html__inner",function(){c(window.selRange)}),jQuery(document).on("focus","#lasso-toolbar--html__inner",function(){0!=a(b().commonAncestorContainer).parents("#lasso--content").length&&(window.selRange=b())}),a(document).on("click","#lasso-toolbar--html",function(b){a(this).toggleClass("html--drop-"+f()),a("#lasso-toolbar--components").removeClass("toolbar--drop-"+f()),a("#lasso-toolbar--link").removeClass("link--drop-"+f()),jQuery(document).on("click","#lasso-toolbar--html__wrap",function(){return!1}),a(this).find("#lasso-toolbar--html__inner").focus()}),jQuery(document).on("click",".lasso-toolbar--html__cancel",function(){a(this).closest("li").removeClass("html--drop-"+f())});var g=function(b){return a("#lasso-toolbar--html__inner").text(b)};jQuery(document).on("click","#lasso-html--h2",function(a){a.preventDefault(),g("

    H2 Heading

    ")}),jQuery(document).on("click","#lasso-html--h3",function(a){a.preventDefault(),g("

    H3 Heading

    ")}),jQuery(document).on("click","#lasso-html--ul",function(a){a.preventDefault(),g("
    • Item
    ")}),jQuery(document).on("click","#lasso-html--ol",function(a){a.preventDefault(),g("
    1. Item
    ")}),jQuery(document).on("mousedown","#lasso-toolbar--link",function(){if(!a(this).hasClass("link--drop-up")){var c=document.getElementById(lasso_editor.editor);window.selRange=b(),("undefined"==typeof window.selRange||null==window.selRange)&&(c.highlight(),window.selRange=b())}}),jQuery(document).on("focusout","#lasso-toolbar--link__inner",function(){c(window.selRange)}),jQuery(document).on("focus","#lasso-toolbar--link__inner",function(){0!=a(b().commonAncestorContainer).parents("#lasso--content").length&&(window.selRange=b())}),a(document).on("click","#lasso-toolbar--link",function(b){a(this).toggleClass("link--drop-"+f()),a("#lasso-toolbar--components").removeClass("toolbar--drop-"+f()),a("#lasso-toolbar--html").removeClass("html--drop-"+f()),jQuery(document).on("click","#lasso-toolbar--link__wrap",function(){return!1}),a(this).find("#lasso-toolbar--link__inner").focus()}),jQuery(document).on("click",".lasso-editing .lasso-link",function(){e.preventDefault(),jQuery(document).on("click","#lasso-toolbar--link__wrap",function(){return!1});var b=a(this).attr("href");a("#lasso-toolbar--link").addClass("link--drop-"+f()),a("#lasso-toolbar--link__inner").text(b)}),jQuery(document).on("click",".lasso-delete",function(b){b.preventDefault();var c=a(this);swal({title:"Delete this component?",type:"warning",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:"Yes, delete it!",closeOnConfirm:!0 -},function(){c.closest(".aesop-component").remove(),c.closest(".lasso-component").remove()})}),jQuery(document).on("click",".lasso-clone",function(b){var c=a(this);b.preventDefault(),c.closest(".aesop-component").clone().insertAfter(a(this).parent().parent()).hide().fadeIn(),c.closest(".lasso-component").clone().insertAfter(a(this).parent().parent()).hide().fadeIn()})}),jQuery(document).ready(function(a){var b=lasso_editor.ajaxurl,c=a(".lasso--controls__right a"),d=lasso_editor.editor,e=lasso_editor.postid,f=a("#"+d).html(),g="You have unsaved changes!";noWarningReload=!1,jQuery(document).on("change","#"+d,function(){var b=a(this),c=b.html();f!==c&&localStorage.setItem("lasso_backup_"+e,c)}),window.onbeforeunload=function(){return localStorage.getItem("lasso_backup_"+e)&&lasso_editor.userCanEdit?g:void 0},window.onunload=function(){localStorage.getItem("lasso_backup_"+e)&&lasso_editor.userCanEdit&&localStorage.clear()},jQuery(".lasso--controls__right a:not(#lasso--exit)").on("click",function(e){function f(b,c){for(var d=a.parseHTML(b),e="",f=0;f":d[f].outerHTML}return e}function g(){a.post(b,k,function(b){1==b.success?(a(c).removeClass("being-saved").addClass("lasso--saved"),h.hasClass("lasso-publish-post")&&h.remove(),setTimeout(function(){a(c).removeClass("lasso--saved"),h.hasClass("lasso-publish-post")&&location.reload()},1200),localStorage.removeItem("lasso_backup_"+j),lasso_editor.dirtyByComponent=!1):a(c).removeClass("being-saved").addClass("lasso--error")}).fail(function(b,d){var e=a(b.responseText).filter("title").get(0);alert(a(e).text()+"\n"+EditusFormatAJAXErrorMessage(b,d)),a(c).removeClass("being-saved").addClass("lasso--error")})}e.preventDefault();var h=a(this);a(".lasso--wpimg__wrap").each(function(){a(this).hasClass("wp-caption")||a(this).children().unwrap(),a(".lasso-component--controls").remove()}),a(".lasso-component").each(function(){a(".lasso-component--controls").remove()}),a("#lasso--map-form").each(function(){var b=a(this);b.find(".lasso-component--controls, .lasso--map-form__footer ").remove(),b.children().unwrap()}),a(".scroll-nav__section").each(function(){a(this).children().unwrap()}),a("#lasso--notice").remove();var i=a("#"+d).html(),j=h.closest("#lasso--controls").data("post-id");a(this).addClass("being-saved");var k={action:h.hasClass("lasso-publish-post")?"process_save_publish-content":"process_save_content",author:lasso_editor.author,content:h.hasClass("shortcodify-enabled")?f(i):i,post_id:j,nonce:lasso_editor.nonce};h.hasClass("lasso-publish-post")?swal({title:lasso_editor.strings.publishPost,type:"info",text:!1,showCancelButton:!0,confirmButtonColor:"#5bc0de",confirmButtonText:lasso_editor.strings.publishYes,closeOnConfirm:!0},function(){g()}):g()})}),function(a){"use strict";function b(b){var c={action:"process_gallery_swap",gallery_id:b,nonce:lasso_editor.swapGallNonce};a.post(lasso_editor.ajaxurl,c,function(a){1==a.success&&window.component.replaceWith(a.data.gallery)}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}function c(){var b=g.sortable("toArray");a("#ase_gallery_ids").val(b)}function d(b,d){var e="";a("#ase-gallery-images").append(e),g.sortable("refresh"),c()}function e(b,d,e){var f="";a(e).replaceWith(f),g.sortable("refresh"),c()}jQuery(document).on("click","#lasso--gallery__create",function(b){b.preventDefault(),a(this).closest("form").addClass("creating-gallery"),a(".ase-gallery-opts--create-gallery").fadeIn(),a(".ase-gallery-opts--edit-gallery").fadeOut(1),a("#ase-gallery-images li").remove(),a("#lasso--gallery__create").remove(),a(".ase-gallery-opts--edit-gallery").text(lasso_editor.strings.addNewGallery),a(".ase-gallery-opts--edit-gallery .lasso-option-desc").text("Select new images to create a gallery with.")});var f,g=a("#ase-gallery-images");jQuery(document).on("click","#lasso--gallery__selectImages",function(b){return b.preventDefault(),f?void f.open():(f=wp.media.frames.file_frame=wp.media({title:lasso_editor.strings.chooseImages,button:{text:lasso_editor.strings.addImages},multiple:!0}),f.on("select",function(){var b=f.state().get("selection");if(b){b.each(function(a){var b=a.id,c=a.attributes.sizes.thumbnail.url;d(b,c)});var c=b.map(function(a){var a=a.toJSON();return a.id}).join(",");a("#ase_gallery_ids").val(c),a(".has-galleries > #lasso--gallery__save").fadeIn(),a("#lasso--gallery__selectImages").remove()}}),void f.open())}),jQuery(document).on("change",".lasso-gallery-id #lasso-generator-attr-id",function(){b(a(this).val());var c={action:"process_gallery_get-images",post_id:a(this).val(),nonce:lasso_editor.getGallImgNonce};a.post(lasso_editor.ajaxurl,c,function(b){a("#lasso--gallery__images").html(b.data.html);var c=a("#ase-gallery-images");c.ready(function(){c.sortable({containment:"parent",cursor:"move",opacity:.8,placeholder:"ase-gallery-drop-zone",forcePlaceholderSize:!0,update:function(){var b=a(this).sortable("toArray");a("#ase_gallery_ids").val(b)},create:function(){var b=a(this).sortable("toArray");a("#ase_gallery_ids").val(b)}})})}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}),a(document).on("click",".ase-gallery-image > i.dashicons-no-alt",function(){a(this).parent().remove(),g.sortable("refresh"),c()});var h=!1;a(document).on("click","#ase-gallery-add-image",function(b){b.preventDefault();if(h=a(this),wp.media.frames.ase_frame)return void wp.media.frames.ase_frame.open();wp.media.frames.ase_frame=wp.media({title:lasso_editor.strings.selectGallery,multiple:!0,library:{type:"image"},button:{text:lasso_editor.strings.useSelectedImages}});var c=function(){var a=wp.media.frames.ase_frame.state().get("selection");a&&a.each(function(a){var b=a.id,c=a.attributes.sizes.thumbnail.url;d(b,c)})};wp.media.frames.ase_frame.on("select",c),wp.media.frames.ase_frame.open()});var i=function(){var b;a(document).on("click",".ase-gallery-image > i.dashicons-edit",function(c){c.preventDefault();if(b=a(this),wp.media.frames.ase_edit_frame)return void wp.media.frames.ase_edit_frame.open();wp.revisions,wp.media.frames.ase_edit_frame=wp.media({title:lasso_editor.strings.editImage,multiple:!1,library:{type:"image"},button:{text:lasso_editor.strings.updateSelectedImg}});var d=function(){var a=wp.media.frames.ase_edit_frame.state().get("selection");a&&a.each(function(a){var c=a.id,d=a.attributes.sizes.thumbnail.url;e(c,d,b.parent())})};wp.media.frames.ase_edit_frame.on("select",d),wp.media.frames.ase_edit_frame.on("open",function(){var a=wp.media.frames.ase_edit_frame.state().get("selection"),c=wp.media.attachment(b.parent().attr("id"));c.fetch(),a.add(c?[c]:[])}),wp.media.frames.ase_edit_frame.open()})};i(),c()}(jQuery),function(a){a(document).ready(function(a){var b=function(b){"grid"==b?(a(".ase-gallery-opts--thumb").fadeOut(),a(".ase-gallery-opts--photoset").fadeOut(),a(".ase-gallery-opts--grid").fadeIn()):a(".ase-gallery-opts--grid").fadeOut(),"thumbnail"==b?(a(".ase-gallery-opts--grid").fadeOut(),a(".ase-gallery-opts--photoset").fadeOut(),a(".ase-gallery-opts--thumb").fadeIn()):a(".ase-gallery-opts--thumb").fadeOut(),"photoset"==b?(a(".ase-gallery-opts--grid").fadeOut(),a(".ase-gallery-opts--thumb").fadeOut(),a(".ase-gallery-opts--photoset").fadeIn()):a(".ase-gallery-opts--photoset").fadeOut()};a(".ase-gallery-type-radio").each(function(){if(a(this).is(":checked")){a(this).parent().addClass("selected");var c=a(this).val();b(c)}}),jQuery(document).on("click",".ase-gallery-layout-label",function(){a(".ase-gallery-layout-label").removeClass("selected"),a(this).addClass("selected");var c=a(this).find("input").val();b(c),a("#ase_gallery_type").val(c)})})}(jQuery),function(a){jQuery(document).on("submit","#lasso--map-form",function(b){b.preventDefault();var c=a(this);a(this).find('input[type="submit"]').val("Saving...").addClass("being-saved");var d=c.serialize();a.post(lasso_editor.ajaxurl,d,function(a){1==a.success?(c.find('input[type="submit"]').val("Saved"),c.removeClass("being-saved").addClass("lasso--saved"),setTimeout(function(){c.find('input[type="submit"]').val("Save Locations").removeClass("lasso-saved")},1200)):c.removeClass("being-saved").addClass("lasso--error")})})}(jQuery),function(a){"use strict";jQuery(document).on("click","#lasso--featImgSave a",function(b){b.preventDefault();var c=a(this),d=a("#lasso--save-status"),e={action:"process_upload-image_upload",postid:lasso_editor.postid,image_id:c.data("featimg-id"),nonce:lasso_editor.featImgNonce};d.removeClass("not-visible").addClass("visible lasso--animate__spin"),a.post(lasso_editor.ajaxurl,e,function(b){b&&(console.log("response"),a("#lasso--featImgSave").css("opacity",0),d.removeClass("lasso--animate__spin lasso-icon-spinner6").addClass("lasso-icon-check"),setTimeout(function(){d.removeClass("lasso--animate__spin lasso-icon-check").addClass("lasso-icon-spinner6 not-visible")},500))}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})});var b,c;a(document).on("click","#lasso--featImgUpload > a",function(d){d.preventDefault(),c=d.currentTarget.parentElement.className;var e=a("#lasso--featImgSave a");return b?void b.open():(b=wp.media.frames.file_frame=wp.media({title:lasso_editor.strings.chooseImage,button:{text:lasso_editor.strings.updateImage},multiple:!1}),b.on("select",function(){var c=b.state().get("selection").first().toJSON();a("body").addClass("lasso--post-thumb-applied"),a("article").removeClass("no-post-thumbnail").addClass("has-post-thumbnail"),a(lasso_editor.featImgClass).css({"background-image":"url("+c.url+")"}),e.attr("data-featimg-id",c.id).trigger("click"),a(".no-post-cover-note").remove()}),void b.open())}),a(document).on("click","#lasso--featImgDelete > a",function(b){b.preventDefault();var c=a(this),d={action:"process_upload-image_delete",postid:lasso_editor.postid,nonce:lasso_editor.featImgNonce};swal({title:lasso_editor.strings.removeFeatImg,type:"warning",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:lasso_editor.strings.deleteYes,closeOnConfirm:!0},function(){a.post(lasso_editor.ajaxurl,d,function(b){1==b.success&&(a("body").addClass("lasso--post-thumb-removed"),a("article").removeClass("has-post-thumbnail").addClass("no-post-thumbnail"),a("#lasso--featImgDelete").addClass("lasso--featImg--controlHidden"),c.closest("ul").removeClass("lasso--featImg--has-thumb"),a(lasso_editor.featImgClass).css({"background-image":"url()"}))})})});var d;a(document).on("click","#lasso--post-thumb__add",function(b){b.preventDefault();var c=a(this),e=a("#lasso--featImgSave a");return d?void d.open():(d=wp.media.frames.featimg_frame=wp.media({title:lasso_editor.strings.chooseImage,button:{text:lasso_editor.strings.updateImage},multiple:!1}),d.on("select",function(){var b=d.state().get("selection").first().toJSON(),f=c.closest(".lasso--post-thumb").find("img");f.attr("src",b.url),e.attr("data-featimg-id",b.id).trigger("click"),a("#lasso--postsettings__form").removeClass("no-thumbnail").addClass("has-thumbnail"),f.removeAttr("srcset"),noWarningReload=!0}),void d.open())}).on("click","#lasso--post-thumb__delete",function(b){b.preventDefault();var c=a(this),d={action:"process_upload-image_delete",postid:lasso_editor.postid,nonce:lasso_editor.featImgNonce};swal({title:lasso_editor.strings.removeFeatImg,type:"warning",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:lasso_editor.strings.deleteYes,closeOnConfirm:!0},function(){a.post(lasso_editor.ajaxurl,d,function(b){if(1==b.success){var d=c.closest(".lasso--post-thumb").data("default-thumb");c.closest(".lasso--postsettings__left").find("img").attr("src",d),c.closest(".lasso--postsettings__left").find("img").removeAttr("srcset"),a("#lasso--postsettings__form").removeClass("has-thumbnail").addClass("no-thumbnail"),noWarningReload=!0}})})})}(jQuery),function(a){function b(b){var c={action:"process_gallery_swap",gallery_id:b,nonce:lasso_editor.swapGallNonce};a.post(lasso_editor.ajaxurl,c,function(a){1==a.success&&window.component.replaceWith(a.data.gallery)})}jQuery(document).on("submit","#lasso--component-settings-form",function(c){c.preventDefault();var d=window.component,e=d.data(),f=a("#lasso-generator-insert"),g=a("#lasso--component-settings-form"),h=a(this);f.val(lasso_editor.strings.saving),h.find(".lasso-generator-attr").each(function(){var b=a(this).closest(".lasso-option").data("option");d.attr("data-"+b,a(this).val()),d.data(b,a(this).val())});var i=function(a){return delete a.sortableItem,a},j=function(b,c,d){var e=function(a){f.addClass("saved"),1==a?f.val(lasso_editor.strings.galleryCreated):f.val(lasso_editor.strings.saved)};1==b?setTimeout(function(){e()},500):1==d?(g.addClass("hide-all-fields").prepend('
    Gallery Created! Save your post and refresh the page to access this new gallery.
    '),setTimeout(function(){e(!0)},500)):e(),setTimeout(function(){a("body").removeClass("lasso-sidebar-open")},c),lasso_editor.dirtyByComponent=!0};if("gallery"==e.componentType){var k={action:g.hasClass("creating-gallery")?"process_gallery_create":"process_gallery_update",postid:e.id,unique:e.unique,fields:i(e),gallery_type:a("#ase_gallery_type").val(),gallery_ids:a("#ase_gallery_ids").val(),nonce:a("#lasso-generator-nonce").val()};g.hasClass("creating-gallery")&&(k.edgallerytitle=document.getElementById("lasso--gallery__galleryname").value),a.post(lasso_editor.ajaxurl,k,function(a){"gallery-created"==a.data.message?(j(!1,1e3,!0),b(a.data.id)):"gallery-updated"==a.data.message?(j(!1,1e3),g.before(lasso_editor.refreshRequired)):alert("error")}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}else j(!0,1200)})}(jQuery),function(a){a(document).ready(function(){var b=function(){a("body").removeClass("lasso-modal-open"),a(".lasso--modal, #lasso--modal__overlay").remove(),noWarningReload&&location.reload()};jQuery(document).on("click","#lasso--post-new",function(b){b.preventDefault(),a("body").toggleClass("lasso-modal-open"),a("body").append(lasso_editor.newPostModal),a(".lasso--modal__trigger-footer").on("keyup",function(){a(".lasso--postsettings__footer").slideDown()}),modalResizer()}),jQuery(document).on("click","#lasso--modal__close, #lasso--modal__overlay, .lasso--postsettings-cancel",function(a){a.preventDefault(),b()}),a(document).keyup(function(a){27==a.keyCode&&b()});jQuery(document).on("submit","#lasso--postnew__form",function(b){b.preventDefault();var c=a(this);a(this).find('input[type="submit"]').val(lasso_editor.strings.adding);var d=c.serialize();a.post(lasso_editor.ajaxurl,d,function(b){1==b.success?(a('input[type="submit"]').addClass("saved"),a('input[type="submit"]').val(lasso_editor.strings.added),window.location.replace(b.data.postlink)):alert("error")})})}),jQuery(document).on("change","#lasso--select-type",function(){var b=a(this).val();a('input[name="object"]').val(b),a(this).closest(".story-slug-option").find("label span:not(.lasso-util--help)").text(b)})}(jQuery),function(a){a(document).ready(function(){a(lasso_editor.titleClass).on("blur",function(){var b=a(this),c={action:"process_title-update_post",postid:lasso_editor.postid,title:a.trim(b.text()),nonce:lasso_editor.titleNonce};a.post(lasso_editor.ajaxurl,c,function(a){if(1==a.success){var c="lasso-title-saved";b.addClass(c),setTimeout(function(){b.removeClass(c)},500)}}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})})})}(jQuery),function(a){a(document).ready(function(){var b,c;a(document).on("click","#lasso--wpimg-edit",function(d){d.preventDefault();var e=a(this),f=a(this).parent().next("img").attr("class").match(/\d+/);c=d.currentTarget.parentElement.className,b=wp.media.frames.ase_edit_frame=wp.media({title:lasso_editor.strings.selectImage,button:{text:lasso_editor.strings.insertImage},multiple:!1}),b.on("open",function(){var a=b.state().get("selection"),c=wp.media.attachment(f);c.fetch(),a.add(c?[c]:[])}),b.on("select",function(){var c=b.state().get("selection").first().toJSON(),d=void 0===c.sizes.large?c.sizes.full.url:c.sizes.large.url;a(e).parent().next("img").attr({src:d,alt:c.alt,"class":"aligncenter size-large wp-image-"+c.id})}),b.open()})})}(jQuery),function(a){a(document).on("submit","#lasso--post-form",function(b){b.preventDefault();var c=a(this),d=c.find('input[type="submit"]'),e=lasso_editor.strings,f=c.serialize();d.val(e.saving),a.post(lasso_editor.ajaxurl,f,function(a){1==a.success&&(d.val(e.saved).addClass("saved"),console.log(a),setTimeout(function(){d.removeClass("saved"),d.val(e.save)},1e3))}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})})}(jQuery),function(a){jQuery(document).ready(function(a){modalResizer=function(){var b=a(".lasso--modal"),c=b.height(),d=a(window).height(),e=a(".lasso--modal").hasClass("lasso--tour__modal")?0:30;b.css({top:(d-c-e)/2})},a(".lasso--modal").imagesLoaded(function(){modalResizer()}),jQuery(window).resize(function(){modalResizer()})})}(jQuery),function(a,b,c,d,e){function f(){a("#lasso--loading").remove()}function g(){a(p).perfectScrollbar({suppressScrollX:!0})}function h(b){"page"==b?(capable=lasso_editor.edit_others_pages,I=capable?i(b,D):i(b,D,lasso_editor.author),F=new wp.api.collections.Pages(I)):(capable=lasso_editor.edit_others_posts,I=capable?i(b,D):i(b,D,lasso_editor.author),F=new wp.api.collections.Posts(I)),F.fetch(I).done(function(){if(a("#lasso--load-more").remove(),F.length>0){var c=F.state.currentPage;c-=1;var e=a('
    ');F.each(function(a){e.append(n({post:a.attributes,settings:d}))}),a(p).append(e),a(p).append(z),a(".lasso--post-filtering").removeClass("not-visible").addClass("visible"),a("#lasso--load-more").attr("data-post-type",b).removeClass("lasso--btn-loading"),g()}else a(p).append(v),setTimeout(function(){a("#lasso--end-posts").fadeOut("slow")},1e3);f()}).fail(function(){a("#lasso--loading").remove(),a(p).append(w)})}function i(a,b,c){return I={data:{page:b,type:a,filter:{post_status:["publish","draft","pending"],posts_per_page:7,author:c}}}}function j(){a(B).remove()}function k(b){a(p).children().remove(),h(b),a("#lasso--search-field").val("").focusout(),a("#lasso--results-found").parent().css("opacity",0),a(C).remove(),j()}var l,m=a("#lasso-tmpl--post"),n=c.template(m.html()),o=(new wp.api.collections.Posts,new wp.api.collections.Pages,a("#lasso--post-all")),p="#lasso--post-list",q=lasso_editor.strings.loading,r=lasso_editor.strings.loadMore,s=lasso_editor.strings.noPostsFound,t=lasso_editor.strings.fetchFail,u=a("body"),v='
  • '+s+"
  • ",w='
  • '+t+"
  • ",x=lasso_editor.noResultsDiv,y='
    ',z=''+r+"",A='',B="#lasso--clear-search",C="#lasso--helper",D=1,E="post",F=!1,G=null,H=d.root,I={data:{page:D,filter:{post_status:["publish","draft","pending"]}}};a(o).on("click",function(a){a.preventDefault(),u.toggleClass("lasso-modal-open"),u.append(lasso_editor.allPostModal),h("post"),modalResizer()}),a(u).on("click","#lasso--load-more",function(b){b.preventDefault(),type=a(this).attr("data-post-type"),a(this).addClass("lasso--btn-loading").text(q),D++,E=type,h(type)}).on("click",".lasso--show-objects",function(b){b.preventDefault(),a(".lasso--show-objects").removeClass("active"),a(this).addClass("active"),a("#lasso--post-list").empty(),type=a(this).data("post-type"),D=1,G=null,a("#lasso--load-more").attr("data-post-type",type),a(p).prepend(y),h(type)}).on("click","#lasso--post__delete",function(b){b.preventDefault();var c=a(this);swal({title:lasso_editor.strings.deletePost,type:"error",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:lasso_editor.strings.deleteYes,closeOnConfirm:!0},function(){var b={action:"process_delete_post",postid:c.closest("a").data("postid"),nonce:lasso_editor.deletePost};a.post(lasso_editor.ajaxurl,b,function(a){1==a.success&&c.closest("li").fadeOut().remove()}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})})}).on("keyup","#lasso--search-field",function(b){clearTimeout(l);var c=b.which,e=this,f=a.trim(a(this).val()),h=f==a(e).val(),i=""!==f,k=a(".active.lasso--show-objects").data("post-type"),m=H+"/"+k+"s?filter[s]="+f+"&filter[posts_per_page]=50",o="#lasso--search-field",q=a("#lasso--results-found"),r=lasso_editor.strings.helperText,s=''+r+"";l=setTimeout(function(){return h||i?(2!=f.length||a(C).length||(j(),a(o).after(s)),void((f.length>=3||f.length>=3&&13==c)&&(a(p).prepend(y),a(C).fadeOut().remove(),j(),a.getJSON(m,function(b){a(p).children().remove(),q.parent().css("opacity",1),0==b.length?(q.text("0"),a("#lasso--empty-results").length||a(p).prepend(x),j()):(a(B).length||a(o).after(A),q.text(b.length),a.each(b,function(c){a(p).append(n({post:b[c],settings:d}))}),g())})))):!1},600)}).on("click","#lasso--search__toggle",function(b){b.preventDefault();var c=a("#lasso--search-field");a(".lasso--search").toggleClass("lasso--search__visible"),c.focus(),a(this).parent().hasClass("lasso--search__visible")||""===c.val()||k("post")}).on("click",B,function(a){a.preventDefault(),k("post")})}(jQuery,Backbone,_,WP_API_Settings),function(a){a(document).ready(function(){destroyModal=function(){a("body").removeClass("lasso-modal-open"),a("#lasso--tour__modal,#lasso--tour__modal ~ #lasso--modal__overlay").remove()},jQuery(document).on("click",'#lasso--tour__modal input[type="submit"]',function(b){b.preventDefault();a(this);if(a("#hide_tour").is(":checked")){var c={action:"process_tour_hide",nonce:a(this).data("nonce")};a.post(lasso_editor.ajaxurl,c,function(a){1==a.success&&destroyModal()}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}else destroyModal()})})}(jQuery),function(a){a(document).ready(function(){function b(){a("#lasso--loading").remove()}function c(){a("body").data("revision")&&slider.slider("value",a("body").data("revision"))}function d(){a("#lasso--notice").length||a(g.article_object).before('
    '+g.strings.editingBackup+"
    ")}function e(){a("body").removeClass(function(a,b){return(b.match(/(^|\s)lasso--revision-count-\S+/g)||[]).join(" ")})}var f,g=lasso_editor;revisionList=a("#lasso--revision-list");var h=function(){a("body").removeClass("lasso-modal-open"),a("#lasso--revision__modal").remove(),a("#lasso--post-revisions").show()},i=function(b){b in f&&(revision=f[b],a(g.titleClass).html(revision.post_title),a(g.article_object).html(revision.post_content),a("body").attr("data-revision",b))};a("#lasso--post-revisions").on("click",function(d){d.preventDefault(),a(this).hide(),a("body").append(g.revisionModal),innerModal=a("#lasso--revision__modal .lasso--modal__inner"),innerModal.draggable({cursor:"move",opacity:.8}),data={action:"process_revision_get",postid:g.postid,nonce:g.nonce},a.post(g.ajaxurl,data,function(d){if(1==d.success)if(revisionList=a("#lasso--revision-list"),slider=a("#lasso--slider"),lassoHide=a("#lasso--hide"),e(),b(),lassoHide.show(),"object"==typeof d.data&&d.data.length){f=d.data;var h=1==f.length?1:f.length-1;1!==f.length?(a.each(f,function(a,b){revisionList.append('
  • '+b.modified_time+"
  • ")}),slider.slider({min:0,max:h,animate:"fast",value:0,zindex:999,slide:function(a,b){i(b.value)}}),a(".lasso--jump-revision").on("click",function(b){b.preventDefault();var c=a(this).data("revision");slider.slider("value",c),i(c)}),revisionList.attr("data-count",h+1)):(lassoHide.hide(),innerModal.append(g.noRevisionsDiv)),a("body").addClass("lasso--revision-count-"+f.length),c(),modalResizer()}else a("#lasso--hide").hide(),innerModal.append(g.noRevisionsDiv),modalResizer();else alert("error")}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))}),modalResizer()}),a(document).on("click","#lasso--select-revision",function(b){b.preventDefault(),h(),a("#lasso--edit").trigger("click"),d()}).on("click","#lasso--close-modal",function(a){a.preventDefault(),h()}),a(document).keyup(function(a){27==a.keyCode&&h()})})}(jQuery); +},function(){c.closest(".aesop-component").remove(),c.closest(".lasso-component").remove()})}),jQuery(document).on("click",".lasso-clone",function(b){var c=a(this);b.preventDefault(),c.closest(".aesop-component").clone().insertAfter(a(this).parent().parent()).hide().fadeIn(),c.closest(".lasso-component").clone().insertAfter(a(this).parent().parent()).hide().fadeIn()})}),jQuery(document).ready(function(a){var b=lasso_editor.ajaxurl,c=a(".lasso--controls__right a"),d=lasso_editor.editor,e=lasso_editor.postid,f=a("#"+d).html(),g="You have unsaved changes!";noWarningReload=!1,jQuery(document).on("change","#"+d,function(){var b=a(this),c=b.html();f!==c&&localStorage.setItem("lasso_backup_"+e,c)}),window.onbeforeunload=function(){return localStorage.getItem("lasso_backup_"+e)&&lasso_editor.userCanEdit?g:void 0},window.onunload=function(){localStorage.getItem("lasso_backup_"+e)&&lasso_editor.userCanEdit&&localStorage.clear()},jQuery(".lasso--controls__right a:not(#lasso--exit)").on("click",function(e){function f(b,c){for(var d=a.parseHTML(b),e="",f=0;f":d[f].outerHTML}return e}function g(){a.post(b,k,function(b){1==b.success?(a(c).removeClass("being-saved").addClass("lasso--saved"),h.hasClass("lasso-publish-post")&&h.remove(),setTimeout(function(){a(c).removeClass("lasso--saved"),h.hasClass("lasso-publish-post")&&location.reload()},1200),localStorage.removeItem("lasso_backup_"+j),lasso_editor.dirtyByComponent=!1):a(c).removeClass("being-saved").addClass("lasso--error")}).fail(function(b,d){var e=a(b.responseText).filter("title").get(0);alert(a(e).text()+"\n"+EditusFormatAJAXErrorMessage(b,d)),a(c).removeClass("being-saved").addClass("lasso--error")})}e.preventDefault();var h=a(this);a(".lasso--wpimg__wrap").each(function(){a(this).hasClass("wp-caption")||a(this).children().unwrap(),a(".lasso-component--controls").remove()}),a(".lasso-component").each(function(){a(".lasso-component--controls").remove()}),a("#lasso--map-form").each(function(){var b=a(this);b.find(".lasso-component--controls, .lasso--map-form__footer ").remove(),b.children().unwrap()}),a(".scroll-nav__section").each(function(){a(this).children().unwrap()}),a("#lasso--notice").remove();var i=a("#"+d).html(),j=h.closest("#lasso--controls").data("post-id");a(this).addClass("being-saved");var k={action:h.hasClass("lasso-publish-post")?"process_save_publish-content":"process_save_content",author:lasso_editor.author,content:h.hasClass("shortcodify-enabled")?f(i):i,post_id:j,nonce:lasso_editor.nonce};h.hasClass("lasso-publish-post")?swal({title:lasso_editor.strings.publishPost,type:"info",text:!1,showCancelButton:!0,confirmButtonColor:"#5bc0de",confirmButtonText:lasso_editor.strings.publishYes,closeOnConfirm:!0},function(){g()}):g()})}),function(a){"use strict";function b(a){var b={componentType:"gallery",id:a};window.get_aesop_component_ajax(b)}function c(){if(g=a("#lasso--gallery__images #ase-gallery-images"),g.length){var b=g.sortable("toArray");a("#ase_gallery_ids").val(b)}}function d(b,d){var e="";a("#ase-gallery-images").append(e),g.sortable("refresh"),c()}function e(b,d,e){var f="";a(e).replaceWith(f),g.sortable("refresh"),c()}jQuery(document).on("click","#lasso--gallery__create",function(b){b.preventDefault(),a(this).closest("form").addClass("creating-gallery"),a(".ase-gallery-opts--create-gallery").fadeIn(),a(".ase-gallery-opts--edit-gallery").fadeOut(1),a("#ase-gallery-images li").remove(),a("#lasso--gallery__create").remove(),a(".ase-gallery-opts--edit-gallery").text(lasso_editor.strings.addNewGallery),a(".ase-gallery-opts--edit-gallery .lasso-option-desc").text("Select new images to create a gallery with.")});var f,g=a("#ase-gallery-images");jQuery(document).on("click","#lasso--gallery__selectImages",function(b){return b.preventDefault(),f?void f.open():(f=wp.media.frames.file_frame=wp.media({title:lasso_editor.strings.chooseImages,button:{text:lasso_editor.strings.addImages},multiple:!0}),f.on("select",function(){var b=f.state().get("selection");if(b){b.each(function(a){var b=a.id,c=a.attributes.sizes.thumbnail.url;d(b,c)});var c=b.map(function(a){var a=a.toJSON();return a.id}).join(",");a("#ase_gallery_ids").val(c),a(".has-galleries > #lasso--gallery__save").fadeIn(),a("#lasso--gallery__selectImages").remove()}}),void f.open())}),jQuery(document).on("change",".lasso-gallery-id #lasso-generator-attr-id",function(){b(a(this).val());var c={action:"process_gallery_get-images",post_id:a(this).val(),nonce:lasso_editor.getGallImgNonce};a.post(lasso_editor.ajaxurl,c,function(b){a("#lasso--gallery__images").html(b.data.html);var c=a("#ase-gallery-images");c.ready(function(){c.sortable({containment:"parent",cursor:"move",opacity:.8,placeholder:"ase-gallery-drop-zone",forcePlaceholderSize:!0,update:function(){var b=a(this).sortable("toArray");a("#ase_gallery_ids").val(b)},create:function(){var b=a(this).sortable("toArray");a("#ase_gallery_ids").val(b)}})})}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}),a(document).on("click",".ase-gallery-image > i.dashicons-no-alt",function(){a(this).parent().remove(),g.sortable("refresh"),c()});var h=!1;a(document).on("click","#ase-gallery-add-image",function(b){b.preventDefault();if(h=a(this),wp.media.frames.ase_frame)return void wp.media.frames.ase_frame.open();wp.media.frames.ase_frame=wp.media({title:lasso_editor.strings.selectGallery,multiple:!0,library:{type:"image"},button:{text:lasso_editor.strings.useSelectedImages}});var c=function(){var a=wp.media.frames.ase_frame.state().get("selection");a&&a.each(function(a){var b=a.id,c=a.attributes.sizes.thumbnail.url;d(b,c)})};wp.media.frames.ase_frame.on("select",c),wp.media.frames.ase_frame.open()});var i=function(){var b;a(document).on("click",".ase-gallery-image > i.dashicons-edit",function(c){c.preventDefault();if(b=a(this),wp.media.frames.ase_edit_frame)return void wp.media.frames.ase_edit_frame.open();wp.revisions,wp.media.frames.ase_edit_frame=wp.media({title:lasso_editor.strings.editImage,multiple:!1,library:{type:"image"},button:{text:lasso_editor.strings.updateSelectedImg}});var d=function(){var a=wp.media.frames.ase_edit_frame.state().get("selection");a&&a.each(function(a){var c=a.id,d=a.attributes.sizes.thumbnail.url;e(c,d,b.parent())})};wp.media.frames.ase_edit_frame.on("select",d),wp.media.frames.ase_edit_frame.on("open",function(){var a=wp.media.frames.ase_edit_frame.state().get("selection"),c=wp.media.attachment(b.parent().attr("id"));c.fetch(),a.add(c?[c]:[])}),wp.media.frames.ase_edit_frame.open()})};i(),c()}(jQuery),function(a){a(document).ready(function(a){var b=function(b){"grid"==b?(a(".ase-gallery-opts--thumb").fadeOut(),a(".ase-gallery-opts--photoset").fadeOut(),a(".ase-gallery-opts--grid").fadeIn()):a(".ase-gallery-opts--grid").fadeOut(),"thumbnail"==b?(a(".ase-gallery-opts--grid").fadeOut(),a(".ase-gallery-opts--photoset").fadeOut(),a(".ase-gallery-opts--thumb").fadeIn()):a(".ase-gallery-opts--thumb").fadeOut(),"photoset"==b?(a(".ase-gallery-opts--grid").fadeOut(),a(".ase-gallery-opts--thumb").fadeOut(),a(".ase-gallery-opts--photoset").fadeIn()):a(".ase-gallery-opts--photoset").fadeOut()};a(".ase-gallery-type-radio").each(function(){if(a(this).is(":checked")){a(this).parent().addClass("selected");var c=a(this).val();b(c)}}),jQuery(document).on("click",".ase-gallery-layout-label",function(){a(".ase-gallery-layout-label").removeClass("selected"),a(this).addClass("selected");var c=a(this).find("input").val();b(c),a("#ase_gallery_type").val(c)})})}(jQuery),function(a){jQuery(document).on("submit","#lasso--map-form",function(b){b.preventDefault();var c=a(this);a(this).find('input[type="submit"]').val("Saving...").addClass("being-saved");var d=c.serialize();a.post(lasso_editor.ajaxurl,d,function(a){1==a.success?(c.find('input[type="submit"]').val("Saved"),c.removeClass("being-saved").addClass("lasso--saved"),setTimeout(function(){c.find('input[type="submit"]').val("Save Locations").removeClass("lasso-saved")},1200)):c.removeClass("being-saved").addClass("lasso--error")})})}(jQuery),function(a){"use strict";jQuery(document).on("click","#lasso--featImgSave a",function(b){b.preventDefault();var c=a(this),d=a("#lasso--save-status"),e={action:"process_upload-image_upload",postid:lasso_editor.postid,image_id:c.data("featimg-id"),nonce:lasso_editor.featImgNonce};d.removeClass("not-visible").addClass("visible lasso--animate__spin"),a.post(lasso_editor.ajaxurl,e,function(b){b&&(console.log("response"),a("#lasso--featImgSave").css("opacity",0),d.removeClass("lasso--animate__spin lasso-icon-spinner6").addClass("lasso-icon-check"),setTimeout(function(){d.removeClass("lasso--animate__spin lasso-icon-check").addClass("lasso-icon-spinner6 not-visible")},500))}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})});var b,c;a(document).on("click","#lasso--featImgUpload > a",function(d){d.preventDefault(),c=d.currentTarget.parentElement.className;var e=a("#lasso--featImgSave a");return b?void b.open():(b=wp.media.frames.file_frame=wp.media({title:lasso_editor.strings.chooseImage,button:{text:lasso_editor.strings.updateImage},multiple:!1}),b.on("select",function(){var c=b.state().get("selection").first().toJSON();a("body").addClass("lasso--post-thumb-applied"),a("article").removeClass("no-post-thumbnail").addClass("has-post-thumbnail"),a(lasso_editor.featImgClass).css({"background-image":"url("+c.url+")"}),e.attr("data-featimg-id",c.id).trigger("click"),a(".no-post-cover-note").remove()}),void b.open())}),a(document).on("click","#lasso--featImgDelete > a",function(b){b.preventDefault();var c=a(this),d={action:"process_upload-image_delete",postid:lasso_editor.postid,nonce:lasso_editor.featImgNonce};swal({title:lasso_editor.strings.removeFeatImg,type:"warning",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:lasso_editor.strings.deleteYes,closeOnConfirm:!0},function(){a.post(lasso_editor.ajaxurl,d,function(b){1==b.success&&(a("body").addClass("lasso--post-thumb-removed"),a("article").removeClass("has-post-thumbnail").addClass("no-post-thumbnail"),a("#lasso--featImgDelete").addClass("lasso--featImg--controlHidden"),c.closest("ul").removeClass("lasso--featImg--has-thumb"),a(lasso_editor.featImgClass).css({"background-image":"url()"}))})})});var d;a(document).on("click","#lasso--post-thumb__add",function(b){b.preventDefault();var c=a(this),e=a("#lasso--featImgSave a");return d?void d.open():(d=wp.media.frames.featimg_frame=wp.media({title:lasso_editor.strings.chooseImage,button:{text:lasso_editor.strings.updateImage},multiple:!1}),d.on("select",function(){var b=d.state().get("selection").first().toJSON(),f=c.closest(".lasso--post-thumb").find("img");f.attr("src",b.url),e.attr("data-featimg-id",b.id).trigger("click"),a("#lasso--postsettings__form").removeClass("no-thumbnail").addClass("has-thumbnail"),f.removeAttr("srcset"),noWarningReload=!0}),void d.open())}).on("click","#lasso--post-thumb__delete",function(b){b.preventDefault();var c=a(this),d={action:"process_upload-image_delete",postid:lasso_editor.postid,nonce:lasso_editor.featImgNonce};swal({title:lasso_editor.strings.removeFeatImg,type:"warning",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:lasso_editor.strings.deleteYes,closeOnConfirm:!0},function(){a.post(lasso_editor.ajaxurl,d,function(b){if(1==b.success){var d=c.closest(".lasso--post-thumb").data("default-thumb");c.closest(".lasso--postsettings__left").find("img").attr("src",d),c.closest(".lasso--postsettings__left").find("img").removeAttr("srcset"),a("#lasso--postsettings__form").removeClass("has-thumbnail").addClass("no-thumbnail"),noWarningReload=!0}})})})}(jQuery),function(a){window.get_aesop_component_ajax=function(b){var c={action:"get_aesop_component",code:"aesop_"+b.componentType};for(var d in b)b.hasOwnProperty(d)&&"componentType"!=d&&"sortableItem"!=d&&(c[d]=b[d]);jQuery.post(lasso_editor.ajaxurl2,c,function(b){if(b){var c=a(b);window.component.replaceWith(c),window.component=c,a(".aesop-component").each(function(){if(!a(".lasso-component--toolbar").length>0)if(a(this).hasClass("aesop-map-component")){var b=a(this);b.wrap('
    ').before(lassoDragHandle)}else a(this).append(lasso_editor.handle)})}else alert("error")})},jQuery(document).on("submit","#lasso--component-settings-form",function(b){b.preventDefault();var c=window.component,d=c.data(),e=a("#lasso-generator-insert"),f=a("#lasso--component-settings-form"),g=a(this);e.val(lasso_editor.strings.saving),g.find(".lasso-generator-attr").each(function(){var b=a(this).closest(".lasso-option").data("option");c.attr("data-"+b,a(this).val()),c.data(b,a(this).val())});var h=function(a){return delete a.sortableItem,a},i=function(b,c,d){var g=function(a){e.addClass("saved"),1==a?e.val(lasso_editor.strings.galleryCreated):e.val(lasso_editor.strings.saved)};1==b?setTimeout(function(){g()},500):1==d?(f.addClass("hide-all-fields").prepend('
    Gallery Created! Save your post and refresh the page to access this new gallery.
    '),setTimeout(function(){g(!0)},500)):g(),setTimeout(function(){a("body").removeClass("lasso-sidebar-open")},c),lasso_editor.dirtyByComponent=!0};if("gallery"==d.componentType){var j={action:f.hasClass("creating-gallery")?"process_gallery_create":"process_gallery_update",postid:d.id,unique:d.unique,fields:h(d),gallery_type:a("#ase_gallery_type").val(),gallery_ids:a("#ase_gallery_ids").val(),nonce:a("#lasso-generator-nonce").val()};f.hasClass("creating-gallery")&&(j.edgallerytitle=document.getElementById("lasso--gallery__galleryname").value),a.post(lasso_editor.ajaxurl,j,function(a){"gallery-created"==a.data.message?(i(!1,1e3,!0),d.id=a.data.id):"gallery-updated"==a.data.message?(i(!1,1e3),f.before(lasso_editor.refreshRequired)):alert("error"),window.get_aesop_component_ajax(d)}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}else i(!0,1200);("image"==d.componentType||"quote"==d.componentType||"parallax"==d.componentType||"chapter"==d.componentType||"character"==d.componentType||"collection"==d.componentType)&&window.get_aesop_component_ajax(d)})}(jQuery),function(a){a(document).ready(function(){var b=function(){a("body").removeClass("lasso-modal-open"),a(".lasso--modal, #lasso--modal__overlay").remove(),noWarningReload&&location.reload()};jQuery(document).on("click","#lasso--post-new",function(b){b.preventDefault(),a("body").toggleClass("lasso-modal-open"),a("body").append(lasso_editor.newPostModal),a(".lasso--modal__trigger-footer").on("keyup",function(){a(".lasso--postsettings__footer").slideDown()}),modalResizer()}),jQuery(document).on("click","#lasso--modal__close, #lasso--modal__overlay, .lasso--postsettings-cancel",function(a){a.preventDefault(),b()}),a(document).keyup(function(a){27==a.keyCode&&b()});jQuery(document).on("submit","#lasso--postnew__form",function(b){b.preventDefault();var c=a(this);a(this).find('input[type="submit"]').val(lasso_editor.strings.adding);var d=c.serialize();a.post(lasso_editor.ajaxurl,d,function(b){1==b.success?(a('input[type="submit"]').addClass("saved"),a('input[type="submit"]').val(lasso_editor.strings.added),window.location.replace(b.data.postlink)):alert("error")})})}),jQuery(document).on("change","#lasso--select-type",function(){var b=a(this).val();a('input[name="object"]').val(b),a(this).closest(".story-slug-option").find("label span:not(.lasso-util--help)").text(b)})}(jQuery),function(a){a(document).ready(function(){a(lasso_editor.titleClass).on("blur",function(){var b=a(this),c={action:"process_title-update_post",postid:lasso_editor.postid,title:a.trim(b.text()),nonce:lasso_editor.titleNonce};a.post(lasso_editor.ajaxurl,c,function(a){if(1==a.success){var c="lasso-title-saved";b.addClass(c),setTimeout(function(){b.removeClass(c)},500)}}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})})})}(jQuery),function(a){a(document).ready(function(){var b,c;a(document).on("click","#lasso--wpimg-edit",function(d){d.preventDefault();var e=a(this),f=a(this).parent().next("img").attr("class").match(/\d+/);c=d.currentTarget.parentElement.className,b=wp.media.frames.ase_edit_frame=wp.media({title:lasso_editor.strings.selectImage,button:{text:lasso_editor.strings.insertImage},multiple:!1}),b.on("open",function(){var a=b.state().get("selection"),c=wp.media.attachment(f);c.fetch(),a.add(c?[c]:[])}),b.on("select",function(){var c=b.state().get("selection").first().toJSON(),d=void 0===c.sizes.large?c.sizes.full.url:c.sizes.large.url;a(e).parent().next("img").attr({src:d,alt:c.alt,"class":"aligncenter size-large wp-image-"+c.id})}),b.open()})})}(jQuery),function(a){a(document).on("submit","#lasso--post-form",function(b){b.preventDefault();var c=a(this),d=c.find('input[type="submit"]'),e=lasso_editor.strings,f=c.serialize();d.val(e.saving),a.post(lasso_editor.ajaxurl,f,function(a){1==a.success&&(d.val(e.saved).addClass("saved"),console.log(a),setTimeout(function(){d.removeClass("saved"),d.val(e.save)},1e3))}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})})}(jQuery),function(a){jQuery(document).ready(function(a){modalResizer=function(){var b=a(".lasso--modal"),c=b.height(),d=a(window).height(),e=a(".lasso--modal").hasClass("lasso--tour__modal")?0:30;b.css({top:(d-c-e)/2})},a(".lasso--modal").imagesLoaded(function(){modalResizer()}),jQuery(window).resize(function(){modalResizer()})})}(jQuery),function(a,b,c,d,e){function f(){a("#lasso--loading").remove()}function g(){a(p).perfectScrollbar({suppressScrollX:!0})}function h(b){"page"==b?(capable=lasso_editor.edit_others_pages,I=capable?i(b,D):i(b,D,lasso_editor.author),F=new wp.api.collections.Pages(I)):(capable=lasso_editor.edit_others_posts,I=capable?i(b,D):i(b,D,lasso_editor.author),F=new wp.api.collections.Posts(I)),F.fetch(I).done(function(){if(a("#lasso--load-more").remove(),F.length>0){var c=F.state.currentPage;c-=1;var e=a('
    ');F.each(function(a){e.append(n({post:a.attributes,settings:d}))}),a(p).append(e),a(p).append(z),a(".lasso--post-filtering").removeClass("not-visible").addClass("visible"),a("#lasso--load-more").attr("data-post-type",b).removeClass("lasso--btn-loading"),g()}else a(p).append(v),setTimeout(function(){a("#lasso--end-posts").fadeOut("slow")},1e3);f()}).fail(function(){a("#lasso--loading").remove(),a(p).append(w)})}function i(a,b,c){return I={data:{page:b,type:a,filter:{post_status:["publish","draft","pending"],posts_per_page:7,author:c}}}}function j(){a(B).remove()}function k(b){a(p).children().remove(),h(b),a("#lasso--search-field").val("").focusout(),a("#lasso--results-found").parent().css("opacity",0),a(C).remove(),j()}var l,m=a("#lasso-tmpl--post"),n=c.template(m.html()),o=(new wp.api.collections.Posts,new wp.api.collections.Pages,a("#lasso--post-all")),p="#lasso--post-list",q=lasso_editor.strings.loading,r=lasso_editor.strings.loadMore,s=lasso_editor.strings.noPostsFound,t=lasso_editor.strings.fetchFail,u=a("body"),v='
  • '+s+"
  • ",w='
  • '+t+"
  • ",x=lasso_editor.noResultsDiv,y='
    ',z=''+r+"",A='',B="#lasso--clear-search",C="#lasso--helper",D=1,E="post",F=!1,G=null,H=d.root,I={data:{page:D,filter:{post_status:["publish","draft","pending"]}}};a(o).on("click",function(a){a.preventDefault(),u.toggleClass("lasso-modal-open"),u.append(lasso_editor.allPostModal),h("post"),modalResizer()}),a(u).on("click","#lasso--load-more",function(b){b.preventDefault(),type=a(this).attr("data-post-type"),a(this).addClass("lasso--btn-loading").text(q),D++,E=type,h(type)}).on("click",".lasso--show-objects",function(b){b.preventDefault(),a(".lasso--show-objects").removeClass("active"),a(this).addClass("active"),a("#lasso--post-list").empty(),type=a(this).data("post-type"),D=1,G=null,a("#lasso--load-more").attr("data-post-type",type),a(p).prepend(y),h(type)}).on("click","#lasso--post__delete",function(b){b.preventDefault();var c=a(this);swal({title:lasso_editor.strings.deletePost,type:"error",text:!1,showCancelButton:!0,confirmButtonColor:"#d9534f",confirmButtonText:lasso_editor.strings.deleteYes,closeOnConfirm:!0},function(){var b={action:"process_delete_post",postid:c.closest("a").data("postid"),nonce:lasso_editor.deletePost};a.post(lasso_editor.ajaxurl,b,function(a){1==a.success&&c.closest("li").fadeOut().remove()}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})})}).on("keyup","#lasso--search-field",function(b){clearTimeout(l);var c=b.which,e=this,f=a.trim(a(this).val()),h=f==a(e).val(),i=""!==f,k=a(".active.lasso--show-objects").data("post-type"),m=H+"/"+k+"s?filter[s]="+f+"&filter[posts_per_page]=50",o="#lasso--search-field",q=a("#lasso--results-found"),r=lasso_editor.strings.helperText,s=''+r+"";l=setTimeout(function(){return h||i?(2!=f.length||a(C).length||(j(),a(o).after(s)),void((f.length>=3||f.length>=3&&13==c)&&(a(p).prepend(y),a(C).fadeOut().remove(),j(),a.getJSON(m,function(b){a(p).children().remove(),q.parent().css("opacity",1),0==b.length?(q.text("0"),a("#lasso--empty-results").length||a(p).prepend(x),j()):(a(B).length||a(o).after(A),q.text(b.length),a.each(b,function(c){a(p).append(n({post:b[c],settings:d}))}),g())})))):!1},600)}).on("click","#lasso--search__toggle",function(b){b.preventDefault();var c=a("#lasso--search-field");a(".lasso--search").toggleClass("lasso--search__visible"),c.focus(),a(this).parent().hasClass("lasso--search__visible")||""===c.val()||k("post")}).on("click",B,function(a){a.preventDefault(),k("post")})}(jQuery,Backbone,_,WP_API_Settings),function(a){a(document).ready(function(){destroyModal=function(){a("body").removeClass("lasso-modal-open"),a("#lasso--tour__modal,#lasso--tour__modal ~ #lasso--modal__overlay").remove()},jQuery(document).on("click",'#lasso--tour__modal input[type="submit"]',function(b){b.preventDefault();a(this);if(a("#hide_tour").is(":checked")){var c={action:"process_tour_hide",nonce:a(this).data("nonce")};a.post(lasso_editor.ajaxurl,c,function(a){1==a.success&&destroyModal()}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))})}else destroyModal()})})}(jQuery),function(a){a(document).ready(function(){function b(){a("#lasso--loading").remove()}function c(){a("body").data("revision")&&slider.slider("value",a("body").data("revision"))}function d(){a("#lasso--notice").length||a(g.article_object).before('
    '+g.strings.editingBackup+"
    ")}function e(){a("body").removeClass(function(a,b){return(b.match(/(^|\s)lasso--revision-count-\S+/g)||[]).join(" ")})}var f,g=lasso_editor;revisionList=a("#lasso--revision-list");var h=function(){a("body").removeClass("lasso-modal-open"),a("#lasso--revision__modal").remove(),a("#lasso--post-revisions").show()},i=function(b){b in f&&(revision=f[b],a(g.titleClass).html(revision.post_title),a(g.article_object).html(revision.post_content),a("body").attr("data-revision",b))};a("#lasso--post-revisions").on("click",function(d){d.preventDefault(),a(this).hide(),a("body").append(g.revisionModal),innerModal=a("#lasso--revision__modal .lasso--modal__inner"),innerModal.draggable({cursor:"move",opacity:.8}),data={action:"process_revision_get",postid:g.postid,nonce:g.nonce},a.post(g.ajaxurl,data,function(d){if(1==d.success)if(revisionList=a("#lasso--revision-list"),slider=a("#lasso--slider"),lassoHide=a("#lasso--hide"),e(),b(),lassoHide.show(),"object"==typeof d.data&&d.data.length){f=d.data;var h=1==f.length?1:f.length-1;1!==f.length?(a.each(f,function(a,b){revisionList.append('
  • '+b.modified_time+"
  • ")}),slider.slider({min:0,max:h,animate:"fast",value:0,zindex:999,slide:function(a,b){i(b.value)}}),a(".lasso--jump-revision").on("click",function(b){b.preventDefault();var c=a(this).data("revision");slider.slider("value",c),i(c)}),revisionList.attr("data-count",h+1)):(lassoHide.hide(),innerModal.append(g.noRevisionsDiv)),a("body").addClass("lasso--revision-count-"+f.length),c(),modalResizer()}else a("#lasso--hide").hide(),innerModal.append(g.noRevisionsDiv),modalResizer();else alert("error")}).fail(function(b,c){var d=a(b.responseText).filter("title").get(0);alert(a(d).text()+"\n"+EditusFormatAJAXErrorMessage(b,c))}),modalResizer()}),a(document).on("click","#lasso--select-revision",function(b){b.preventDefault(),h(),a("#lasso--edit").trigger("click"),d()}).on("click","#lasso--close-modal",function(a){a.preventDefault(),h()}),a(document).keyup(function(a){27==a.keyCode&&h()})})}(jQuery); //# sourceMappingURL=lasso.js.map \ No newline at end of file diff --git a/public/assets/js/source/process-gallery.js b/public/assets/js/source/process-gallery.js index 8325020..64d6bc5 100644 --- a/public/assets/js/source/process-gallery.js +++ b/public/assets/js/source/process-gallery.js @@ -137,21 +137,11 @@ }); function editus_gallery_swap(galleryID){ - var data = { - action: 'process_gallery_swap', - gallery_id: galleryID, - nonce: lasso_editor.swapGallNonce - } - - $.post( lasso_editor.ajaxurl, data, function(response) { - if( true == response.success ) { - // window.component is the current component being edited - window.component.replaceWith( response.data.gallery ); - } - }).fail(function(xhr, err) { - var responseTitle= $(xhr.responseText).filter('title').get(0); - alert($(responseTitle).text() + "\n" + EditusFormatAJAXErrorMessage(xhr, err) ); - }); + var data = { + componentType: 'gallery', + id: galleryID + }; + window.get_aesop_component_ajax(data); } /////////// @@ -175,8 +165,11 @@ } function ase_encode_gallery_items(){ - var imageArray = gallery.sortable('toArray'); - $('#ase_gallery_ids').val( imageArray ); + gallery = $('#lasso--gallery__images #ase-gallery-images'); + if (gallery.length) { + var imageArray = gallery.sortable('toArray'); + $('#ase_gallery_ids').val( imageArray ); + } } // inserting gallery items diff --git a/public/assets/js/source/process-save-component.js b/public/assets/js/source/process-save-component.js index b8fb68e..719bded 100644 --- a/public/assets/js/source/process-save-component.js +++ b/public/assets/js/source/process-save-component.js @@ -1,6 +1,53 @@ (function( $ ) { var form; + // get updated aesop componets through ajax calls (global function) + window.get_aesop_component_ajax = function(cdata) + { + var data = { + action: 'get_aesop_component', + code: 'aesop_'+cdata['componentType'] + }; + for ( var index in cdata ) { + // Don't accept componentType as a param + if ( !cdata.hasOwnProperty(index) || index == 'componentType' || index =='sortableItem') { + continue; + } + data[index] = cdata[index]; + } + + jQuery.post(lasso_editor.ajaxurl2, data, function(response) { + if( response ){ + var $a = $(response); + window.component.replaceWith($a); + window.component = $a; + $('.aesop-component').each(function(){ + + // if there's no toolbar present + if ( !$('.lasso-component--toolbar').length > 0 ) { + + // if this is a map then we need to first wrap it so that we can drag the map around + if ( $(this).hasClass('aesop-map-component') ) { + + var $this = $(this) + + // so wrap it with a aesop-compoentn aesop-map-component div + // @todo - note once a map is inserted it can't be edited after saving again. a user has to delete the existin map and add a new map + // to + //$this.wrap('').before( lassoDragHandle ).after( lassoMapForm ); + $this.wrap('
    ').before( lassoDragHandle ); + + } else { + + $(this).append( lasso_editor.handle ); + } + } + }); + } else { + alert("error"); + } + }); + } //$('#lasso--component-settings-form').live('submit', function(e) { jQuery(document).on('submit', '#lasso--component-settings-form', function(e){ @@ -36,53 +83,6 @@ return cdata; } - - // get updated aesop componets through ajax calls - var get_aesop_component_ajax = function(cdata) - { - var data = { - action: 'get_aesop_component', - code: 'aesop_'+cdata['componentType'] - }; - for ( var index in cdata ) { - // Don't accept componentType as a param - if ( !cdata.hasOwnProperty(index) || index == 'componentType' || index =='sortableItem') { - continue; - } - data[index] = cdata[index]; - } - - jQuery.post(lasso_editor.ajaxurl2, data, function(response) { - if( response ){ - debugger; - $component.replaceWith(response); - $('.aesop-component').each(function(){ - - // if there's no toolbar present - if ( !$('.lasso-component--toolbar').length > 0 ) { - - // if this is a map then we need to first wrap it so that we can drag the map around - if ( $(this).hasClass('aesop-map-component') ) { - - var $this = $(this) - - // so wrap it with a aesop-compoentn aesop-map-component div - // @todo - note once a map is inserted it can't be edited after saving again. a user has to delete the existin map and add a new map - // to - //$this.wrap('').before( lassoDragHandle ).after( lassoMapForm ); - $this.wrap('
    ').before( lassoDragHandle ); - - } else { - - $(this).append( lasso_editor.handle ); - } - } - }); - } else { - alert("error"); - } - }); - } /** * @@ -150,7 +150,8 @@ if ( 'gallery-created' == response.data.message ) { saveSequence( false, 1000, true ); - editus_gallery_swap(response.data.id); + // load the new gallery + cdata['id'] = response.data.id; } else if ( 'gallery-updated' == response.data.message ) { @@ -162,6 +163,7 @@ alert( 'error' ); } + window.get_aesop_component_ajax(cdata); }).fail(function(xhr, err) { var responseTitle= $(xhr.responseText).filter('title').get(0); @@ -175,24 +177,10 @@ } if ( 'image' == cdata['componentType'] || 'quote' == cdata['componentType'] || 'parallax' == cdata['componentType'] || 'chapter' == cdata['componentType'] || - 'character' == cdata['componentType']) { - get_aesop_component_ajax(cdata); + 'character' == cdata['componentType'] || 'collection' == cdata['componentType']) { + window.get_aesop_component_ajax(cdata); } }); - function editus_gallery_swap(galleryID){ - var data = { - action: 'process_gallery_swap', - gallery_id: galleryID, - nonce: lasso_editor.swapGallNonce - } - - $.post( lasso_editor.ajaxurl, data, function(response) { - if( true == response.success ) { - // window.component is the current component being edited - window.component.replaceWith( response.data.gallery ); - } - }); - } })( jQuery ); diff --git a/public/includes/lasso.php b/public/includes/lasso.php index 31b62fc..74e5935 100755 --- a/public/includes/lasso.php +++ b/public/includes/lasso.php @@ -292,6 +292,11 @@ public function get_aesop_component() echo aesop_character_shortcode($atts); } + if ($code == "aesop_collection") { + require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); + echo aesop_collection_shortcode($atts); + } + if ($code == "aesop_chapter") { require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); echo aesop_chapter_shortcode($atts); @@ -299,7 +304,7 @@ public function get_aesop_component() if ($code == "aesop_gallery") { require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); - echo do_shortcode( '[aesop_gallery id="'.$atts["id"]."]"); + echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); } exit;