Version Description
- 09 December 2020 =
- Developer: jQuery updates for WordPress 5.6.
Download this release
Release Info
Developer | SiteOrigin |
Plugin | Page Builder by SiteOrigin |
Version | 2.11.8 |
Comparing to | |
See all releases |
Code changes from version 2.11.7 to 2.11.8
- compat/js/siteorigin-panels-layout-block.js +6 -2
- compat/js/siteorigin-panels-layout-block.min.js +1 -1
- js/siteorigin-panels.js +125 -124
- js/siteorigin-panels.min.js +2 -2
- js/styling.js +4 -4
- js/styling.min.js +1 -1
- readme.txt +6 -3
- settings/admin-settings.js +18 -11
- settings/admin-settings.min.js +1 -1
- siteorigin-panels.php +2 -2
- tpl/js-templates.php +2 -2
compat/js/siteorigin-panels-layout-block.js
CHANGED
@@ -244,7 +244,9 @@ function (_wp$element$Component) {
|
|
244 |
};
|
245 |
|
246 |
if (this.state.editing) {
|
247 |
-
return React.createElement(wp.element.Fragment, null, React.createElement(wp.
|
|
|
|
|
248 |
icon: "visibility",
|
249 |
className: "components-icon-button components-toolbar__control",
|
250 |
label: wp.i18n.__('Preview layout.', 'siteorigin-panels'),
|
@@ -256,7 +258,9 @@ function (_wp$element$Component) {
|
|
256 |
}));
|
257 |
} else {
|
258 |
var loadingPreview = this.state.loadingPreview;
|
259 |
-
return React.createElement(wp.element.Fragment, null, React.createElement(wp.
|
|
|
|
|
260 |
icon: "edit",
|
261 |
className: "components-icon-button components-toolbar__control",
|
262 |
label: wp.i18n.__('Edit layout.', 'siteorigin-panels'),
|
244 |
};
|
245 |
|
246 |
if (this.state.editing) {
|
247 |
+
return React.createElement(wp.element.Fragment, null, React.createElement(wp.blockEditor.BlockControls, null, React.createElement(wp.components.Toolbar, {
|
248 |
+
label: wp.i18n.__('Page Builder Mode.', 'siteorigin-panels')
|
249 |
+
}, React.createElement(wp.components.ToolbarButton, {
|
250 |
icon: "visibility",
|
251 |
className: "components-icon-button components-toolbar__control",
|
252 |
label: wp.i18n.__('Preview layout.', 'siteorigin-panels'),
|
258 |
}));
|
259 |
} else {
|
260 |
var loadingPreview = this.state.loadingPreview;
|
261 |
+
return React.createElement(wp.element.Fragment, null, React.createElement(wp.blockEditor.BlockControls, null, React.createElement(wp.components.Toolbar, {
|
262 |
+
label: wp.i18n.__('Page Builder Mode.', 'siteorigin-panels')
|
263 |
+
}, React.createElement(wp.components.ToolbarButton, {
|
264 |
icon: "edit",
|
265 |
className: "components-icon-button components-toolbar__control",
|
266 |
label: wp.i18n.__('Edit layout.', 'siteorigin-panels'),
|
compat/js/siteorigin-panels-layout-block.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}return function(){var n,i=_getPrototypeOf(e);if(t()){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var SiteOriginPanelsLayoutBlock=function(e){_inherits(n,wp.element.Component);var t=_createSuper(n);function n(e){var i;_classCallCheck(this,n),i=t.call(this,e);var o="edit"===window.soPanelsBlockEditorAdmin.defaultMode||lodash.isEmpty(e.panelsData);return i.state={editing:o,loadingPreview:!o,previewHtml:"",previewInitialized:!o},i.panelsContainer=wp.element.createRef(),i.previewContainer=wp.element.createRef(),i.panelsInitialized=!1,i}return _createClass(n,[{key:"componentDidMount",value:function(){this.isStillMounted=!0,this.state.editing?this.setupPanels():this.state.editing||this.previewInitialized||(this.fetchPreview(this.props),this.fetchPreview=lodash.debounce(this.fetchPreview,500))}},{key:"componentWillUnmount",value:function(){this.isStillMounted=!1,this.builderView&&this.builderView.off("content_change")}},{key:"componentDidUpdate",value:function(e){this.state.editing&&!this.panelsInitialized?this.setupPanels():this.state.loadingPreview?(this.fetchPreview(this.props),this.fetchPreview=lodash.debounce(this.fetchPreview,500)):this.state.previewInitialized||(jQuery(document).trigger("panels_setup_preview"),this.setState({previewInitialized:!0}))}},{key:"setupPanels",value:function(){var e=this,t=jQuery(this.panelsContainer.current),n={editorType:"standalone",loadLiveEditor:!1,postId:window.soPanelsBlockEditorAdmin.postId,liveEditorPreview:window.soPanelsBlockEditorAdmin.liveEditor},i=new panels.model.builder;this.builderView=new panels.view.builder({model:i,config:n});var o=JSON.parse(JSON.stringify(jQuery.extend({},this.props.panelsData))),r=function(){lodash.isFunction(e.props.onRowOrWidgetMouseDown)&&e.props.onRowOrWidgetMouseDown();jQuery(document).on("mouseup",(function t(){jQuery(document).off("mouseup",t),lodash.isFunction(e.props.onRowOrWidgetMouseUp)&&e.props.onRowOrWidgetMouseUp()}))};this.builderView.on("row_added",(function(){e.builderView.$(".so-row-move").off("mousedown",r),e.builderView.$(".so-row-move").on("mousedown",r),e.builderView.$(".so-widget").off("mousedown",r),e.builderView.$(".so-widget").on("mousedown",r)})),this.builderView.on("widget_added",(function(){e.builderView.$(".so-widget").off("mousedown",r),e.builderView.$(".so-widget").on("mousedown",r)})),this.builderView.render().attach({container:t}).setData(o),this.builderView.trigger("builder_resize"),this.builderView.on("content_change",(function(){var t=e.builderView.getData();e.panelsDataChanged=!lodash.isEqual(o,t),e.panelsDataChanged&&(e.props.onContentChange&&lodash.isFunction(e.props.onContentChange)&&e.props.onContentChange(t),e.setState({loadingPreview:!0,previewHtml:""}))})),jQuery(document).trigger("panels_setup",this.builderView),void 0===window.soPanelsBuilderView&&(window.soPanelsBuilderView=[]),window.soPanelsBuilderView.push(this.builderView),this.panelsInitialized=!0}},{key:"fetchPreview",value:function(e){var t=this;if(this.isStillMounted){this.setState({previewInitialized:!1});var n=this.currentFetchRequest=jQuery.post({url:window.soPanelsBlockEditorAdmin.previewUrl,data:{action:"so_panels_layout_block_preview",panelsData:JSON.stringify(e.panelsData)}}).then((function(e){t.isStillMounted&&n===t.currentFetchRequest&&e&&t.setState({previewHtml:e,loadingPreview:!1,previewInitialized:!1})}));return n}}},{key:"render",value:function(){var e=this,t=this.props.panelsData;if(this.state.editing)return React.createElement(wp.element.Fragment,null,React.createElement(wp.
|
1 |
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}return function(){var n,i=_getPrototypeOf(e);if(t()){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var SiteOriginPanelsLayoutBlock=function(e){_inherits(n,wp.element.Component);var t=_createSuper(n);function n(e){var i;_classCallCheck(this,n),i=t.call(this,e);var o="edit"===window.soPanelsBlockEditorAdmin.defaultMode||lodash.isEmpty(e.panelsData);return i.state={editing:o,loadingPreview:!o,previewHtml:"",previewInitialized:!o},i.panelsContainer=wp.element.createRef(),i.previewContainer=wp.element.createRef(),i.panelsInitialized=!1,i}return _createClass(n,[{key:"componentDidMount",value:function(){this.isStillMounted=!0,this.state.editing?this.setupPanels():this.state.editing||this.previewInitialized||(this.fetchPreview(this.props),this.fetchPreview=lodash.debounce(this.fetchPreview,500))}},{key:"componentWillUnmount",value:function(){this.isStillMounted=!1,this.builderView&&this.builderView.off("content_change")}},{key:"componentDidUpdate",value:function(e){this.state.editing&&!this.panelsInitialized?this.setupPanels():this.state.loadingPreview?(this.fetchPreview(this.props),this.fetchPreview=lodash.debounce(this.fetchPreview,500)):this.state.previewInitialized||(jQuery(document).trigger("panels_setup_preview"),this.setState({previewInitialized:!0}))}},{key:"setupPanels",value:function(){var e=this,t=jQuery(this.panelsContainer.current),n={editorType:"standalone",loadLiveEditor:!1,postId:window.soPanelsBlockEditorAdmin.postId,liveEditorPreview:window.soPanelsBlockEditorAdmin.liveEditor},i=new panels.model.builder;this.builderView=new panels.view.builder({model:i,config:n});var o=JSON.parse(JSON.stringify(jQuery.extend({},this.props.panelsData))),r=function(){lodash.isFunction(e.props.onRowOrWidgetMouseDown)&&e.props.onRowOrWidgetMouseDown();jQuery(document).on("mouseup",(function t(){jQuery(document).off("mouseup",t),lodash.isFunction(e.props.onRowOrWidgetMouseUp)&&e.props.onRowOrWidgetMouseUp()}))};this.builderView.on("row_added",(function(){e.builderView.$(".so-row-move").off("mousedown",r),e.builderView.$(".so-row-move").on("mousedown",r),e.builderView.$(".so-widget").off("mousedown",r),e.builderView.$(".so-widget").on("mousedown",r)})),this.builderView.on("widget_added",(function(){e.builderView.$(".so-widget").off("mousedown",r),e.builderView.$(".so-widget").on("mousedown",r)})),this.builderView.render().attach({container:t}).setData(o),this.builderView.trigger("builder_resize"),this.builderView.on("content_change",(function(){var t=e.builderView.getData();e.panelsDataChanged=!lodash.isEqual(o,t),e.panelsDataChanged&&(e.props.onContentChange&&lodash.isFunction(e.props.onContentChange)&&e.props.onContentChange(t),e.setState({loadingPreview:!0,previewHtml:""}))})),jQuery(document).trigger("panels_setup",this.builderView),void 0===window.soPanelsBuilderView&&(window.soPanelsBuilderView=[]),window.soPanelsBuilderView.push(this.builderView),this.panelsInitialized=!0}},{key:"fetchPreview",value:function(e){var t=this;if(this.isStillMounted){this.setState({previewInitialized:!1});var n=this.currentFetchRequest=jQuery.post({url:window.soPanelsBlockEditorAdmin.previewUrl,data:{action:"so_panels_layout_block_preview",panelsData:JSON.stringify(e.panelsData)}}).then((function(e){t.isStillMounted&&n===t.currentFetchRequest&&e&&t.setState({previewHtml:e,loadingPreview:!1,previewInitialized:!1})}));return n}}},{key:"render",value:function(){var e=this,t=this.props.panelsData;if(this.state.editing)return React.createElement(wp.element.Fragment,null,React.createElement(wp.blockEditor.BlockControls,null,React.createElement(wp.components.Toolbar,{label:wp.i18n.__("Page Builder Mode.","siteorigin-panels")},React.createElement(wp.components.ToolbarButton,{icon:"visibility",className:"components-icon-button components-toolbar__control",label:wp.i18n.__("Preview layout.","siteorigin-panels"),onClick:function(){t&&e.setState({editing:!1,loadingPreview:!e.state.previewHtml,previewInitialized:!1})}}))),React.createElement("div",{key:"layout-block",className:"siteorigin-panels-layout-block-container",ref:this.panelsContainer}));var n=this.state.loadingPreview;return React.createElement(wp.element.Fragment,null,React.createElement(wp.blockEditor.BlockControls,null,React.createElement(wp.components.Toolbar,{label:wp.i18n.__("Page Builder Mode.","siteorigin-panels")},React.createElement(wp.components.ToolbarButton,{icon:"edit",className:"components-icon-button components-toolbar__control",label:wp.i18n.__("Edit layout.","siteorigin-panels"),onClick:function(){e.panelsInitialized=!1,e.setState({editing:!0})}}))),React.createElement("div",{key:"preview",className:"so-panels-block-layout-preview-container"},n?React.createElement("div",{className:"so-panels-spinner-container"},React.createElement("span",null,React.createElement(wp.components.Spinner,null))):React.createElement("div",{className:"so-panels-raw-html-container",ref:this.previewContainer},React.createElement(wp.element.RawHTML,null,this.state.previewHtml))))}}]),n}(),hasLayoutCategory=wp.blocks.getCategories().some((function(e){return"layout"===e.slug}));wp.blocks.registerBlockType("siteorigin-panels/layout-block",{title:wp.i18n.__("SiteOrigin Layout","siteorigin-panels"),description:wp.i18n.__("Build a layout using SiteOrigin's Page Builder.","siteorigin-panels"),icon:function(){return React.createElement("span",{className:"siteorigin-panels-block-icon"})},category:hasLayoutCategory?"layout":"design",keywords:["page builder","column,grid","panel"],supports:{html:!1},attributes:{panelsData:{type:"object"},contentPreview:{type:"string"}},edit:function(e){var t=e.attributes,n=e.setAttributes,i=e.toggleSelection;return React.createElement(SiteOriginPanelsLayoutBlock,{panelsData:t.panelsData,onContentChange:function(e){lodash.isEmpty(e.widgets)||(wp.data.dispatch("core/editor").lockPostSaving(),jQuery.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content_json",panels_data:JSON.stringify(e),post_id:wp.data.select("core/editor").getCurrentPostId()},(function(e){var t={};""!==e.sanitized_panels_data&&(t.panelsData=e.sanitized_panels_data),""!==e.preview&&(t.contentPreview=e.preview),n(t),wp.data.dispatch("core/editor").unlockPostSaving()})))},onRowOrWidgetMouseDown:function(){i(!1)},onRowOrWidgetMouseUp:function(){i(!0)}})},save:function(e){var t=e.attributes;return t.hasOwnProperty("contentPreview")?React.createElement(wp.element.RawHTML,null,t.contentPreview):null}}),function(e){window.soPanelsBlockEditorAdmin.showAddButton&&e((function(){setTimeout((function(){var t=wp.data.dispatch("core/editor"),n=wp.data.select("core/editor"),i=e("#siteorigin-panels-add-layout-block-button").html(),o=e(i).insertAfter(".editor-writing-flow > div:first, .block-editor-writing-flow > div:not([tabindex])");o.on("click",(function(){var e=wp.blocks.createBlock("siteorigin-panels/layout-block",{});if(n.isEditedPostEmpty()){var i=n.getBlocks();i.length?t.replaceBlock(i[0].clientId,e):t.insertBlock(e)}else t.insertBlock(e)}));var r=function(){wp.data.select("core/editor").isEditedPostEmpty()?o.show():o.hide()};wp.data.subscribe(r),r()}),100)}))}(jQuery),jQuery(document).on("click",".block-editor-post-preview__button-resize",(function(e){jQuery(this).hasClass("has-icon")||jQuery(window).trigger("resize")}));
|
js/siteorigin-panels.js
CHANGED
@@ -187,7 +187,7 @@ module.exports = panels.view.dialog.extend( {
|
|
187 |
// Render the dialog and attach it to the builder interface
|
188 |
this.renderDialog( this.parseDialogContent( $( '#siteorigin-panels-dialog-history' ).html(), {} ) );
|
189 |
|
190 |
-
this.$( 'iframe.siteorigin-panels-history-iframe' ).
|
191 |
var $$ = $( this );
|
192 |
$$.show();
|
193 |
|
@@ -256,7 +256,7 @@ module.exports = panels.view.dialog.extend( {
|
|
256 |
.prependTo( c );
|
257 |
|
258 |
// Handle loading and selecting
|
259 |
-
c.find( '.history-entry' ).
|
260 |
var $$ = jQuery( this );
|
261 |
c.find( '.history-entry' ).not( $$ ).removeClass( 'so-selected' );
|
262 |
$$.addClass( 'so-selected' );
|
@@ -289,7 +289,7 @@ module.exports = panels.view.dialog.extend( {
|
|
289 |
|
290 |
this.$( 'form.history-form input[name="live_editor_panels_data"]' ).val( entry.get( 'data' ) );
|
291 |
this.$( 'form.history-form input[name="live_editor_post_ID"]' ).val( this.builder.config.postId );
|
292 |
-
this.$( 'form.history-form' ).submit
|
293 |
},
|
294 |
|
295 |
/**
|
@@ -414,7 +414,7 @@ module.exports = panels.view.dialog.extend( {
|
|
414 |
var thisView = this;
|
415 |
|
416 |
this.on( 'open_dialog', function () {
|
417 |
-
thisView.$( '.so-sidebar-tabs li a' ).first().click
|
418 |
thisView.$( '.so-status' ).removeClass( 'so-panels-loading' );
|
419 |
} );
|
420 |
|
@@ -503,7 +503,7 @@ module.exports = panels.view.dialog.extend( {
|
|
503 |
uploadUi.find( '.progress-precent' ).css( 'width', '0%' );
|
504 |
},
|
505 |
FilesAdded: function ( uploader ) {
|
506 |
-
uploadUi.find( '.file-browse-button' ).blur
|
507 |
uploadUi.find( '.drag-upload-area' ).removeClass( 'file-dragover' );
|
508 |
uploadUi.find( '.progress-bar' ).fadeIn( 'fast' );
|
509 |
thisView.$( '.js-so-selected-file' ).text( panelsOptions.loc.prebuilt_loading );
|
@@ -551,7 +551,7 @@ module.exports = panels.view.dialog.extend( {
|
|
551 |
} );
|
552 |
|
553 |
// Handle exporting the file
|
554 |
-
c.find( '.so-export' ).
|
555 |
var $$ = $( this );
|
556 |
var panelsData = thisView.builder.model.getPanelsData();
|
557 |
var postName = $( 'input[name="post_title"], .editor-post-title__input' ).val();
|
@@ -602,7 +602,7 @@ module.exports = panels.view.dialog.extend( {
|
|
602 |
if ( type.match('^directory-') && ! panelsOptions.directory_enabled ) {
|
603 |
// Display the button to enable the prebuilt layout
|
604 |
c.removeClass( 'so-panels-loading' ).html( $( '#siteorigin-panels-directory-enable' ).html() );
|
605 |
-
c.find( '.so-panels-enable-directory' ).
|
606 |
e.preventDefault();
|
607 |
// Sent the query to enable the directory, then enable the directory
|
608 |
$.get(
|
@@ -646,7 +646,7 @@ module.exports = panels.view.dialog.extend( {
|
|
646 |
if ( page <= 1 ) {
|
647 |
prev.addClass( 'button-disabled' );
|
648 |
} else {
|
649 |
-
prev.
|
650 |
e.preventDefault();
|
651 |
thisView.displayLayoutDirectory( search, page - 1, thisView.currentTab );
|
652 |
} );
|
@@ -655,7 +655,7 @@ module.exports = panels.view.dialog.extend( {
|
|
655 |
if ( page === data.max_num_pages || data.max_num_pages === 0 ) {
|
656 |
next.addClass( 'button-disabled' );
|
657 |
} else {
|
658 |
-
next.
|
659 |
e.preventDefault();
|
660 |
thisView.displayLayoutDirectory( search, page + 1, thisView.currentTab );
|
661 |
} );
|
@@ -668,7 +668,7 @@ module.exports = panels.view.dialog.extend( {
|
|
668 |
|
669 |
if ( $$.data( 'src' ) !== '' ) {
|
670 |
// Set the initial height
|
671 |
-
var $img = $( '<img/>' ).attr( 'src', $$.data( 'src' ) ).
|
672 |
$a.removeClass( 'so-loading' ).css( 'height', 'auto' );
|
673 |
$img.appendTo( $a ).hide().fadeIn( 'fast' );
|
674 |
} );
|
@@ -946,7 +946,7 @@ module.exports = panels.view.dialog.extend({
|
|
946 |
}
|
947 |
}
|
948 |
|
949 |
-
this.$('input.so-row-field').keyup
|
950 |
$(this).trigger('change');
|
951 |
});
|
952 |
|
@@ -1049,7 +1049,7 @@ module.exports = panels.view.dialog.extend({
|
|
1049 |
handle = $('<div class="resize-handle"></div>');
|
1050 |
handle
|
1051 |
.appendTo(newCell)
|
1052 |
-
.dblclick
|
1053 |
var prevCellModel = thisDialog.row.cells.at(i - 1);
|
1054 |
var t = cellModel.get('weight') + prevCellModel.get('weight');
|
1055 |
cellModel.set('weight', t / 2);
|
@@ -1108,10 +1108,10 @@ module.exports = panels.view.dialog.extend({
|
|
1108 |
|
1109 |
var helperLeft = ui.helper.offset().left - rowPreview.offset().left - 6;
|
1110 |
|
1111 |
-
$(this).data('newCellClone').css('width', rowPreview.width() * ncw)
|
1112 |
.find('.preview-cell-weight').html(Math.round(ncw * 1000) / 10);
|
1113 |
|
1114 |
-
$(this).data('prevCellClone').css('width', rowPreview.width() * pcw)
|
1115 |
.find('.preview-cell-weight').html(Math.round(pcw * 1000) / 10);
|
1116 |
},
|
1117 |
stop: function (e, ui) {
|
@@ -1141,7 +1141,7 @@ module.exports = panels.view.dialog.extend({
|
|
1141 |
});
|
1142 |
}
|
1143 |
|
1144 |
-
newCell.click(
|
1145 |
|
1146 |
if ( ! ( $(event.target).is('.preview-cell') || $(event.target).is('.preview-cell-in') ) ) {
|
1147 |
return;
|
@@ -1156,7 +1156,7 @@ module.exports = panels.view.dialog.extend({
|
|
1156 |
}.bind(this));
|
1157 |
|
1158 |
// Make this row weight click editable
|
1159 |
-
newCell.find('.preview-cell-weight').click(
|
1160 |
|
1161 |
// Disable the draggable while entering values
|
1162 |
thisDialog.$('.resize-handle').css('pointer-event', 'none').draggable('disable');
|
@@ -1165,10 +1165,10 @@ module.exports = panels.view.dialog.extend({
|
|
1165 |
var $$ = jQuery(this).hide();
|
1166 |
$('<input type="text" class="preview-cell-weight-input no-user-interacted" />')
|
1167 |
.val(parseFloat($$.html())).insertAfter($$)
|
1168 |
-
.focus
|
1169 |
clearTimeout(timeout);
|
1170 |
})
|
1171 |
-
.keyup(
|
1172 |
if (e.keyCode !== 9) {
|
1173 |
// Only register the interaction if the user didn't press tab
|
1174 |
$(this).removeClass('no-user-interacted');
|
@@ -1177,10 +1177,10 @@ module.exports = panels.view.dialog.extend({
|
|
1177 |
// Enter is clicked
|
1178 |
if (e.keyCode === 13) {
|
1179 |
e.preventDefault();
|
1180 |
-
$(this).blur
|
1181 |
}
|
1182 |
})
|
1183 |
-
.keydown(
|
1184 |
if (e.keyCode === 9) {
|
1185 |
e.preventDefault();
|
1186 |
|
@@ -1188,13 +1188,13 @@ module.exports = panels.view.dialog.extend({
|
|
1188 |
var inputs = rowPreview.find('.preview-cell-weight-input');
|
1189 |
var i = inputs.index($(this));
|
1190 |
if (i === inputs.length - 1) {
|
1191 |
-
inputs.eq(0).focus
|
1192 |
} else {
|
1193 |
-
inputs.eq(i + 1).focus
|
1194 |
}
|
1195 |
}
|
1196 |
})
|
1197 |
-
.blur
|
1198 |
rowPreview.find('.preview-cell-weight-input').each(function (i, el) {
|
1199 |
if (isNaN(parseFloat($(el).val()))) {
|
1200 |
$(el).val(Math.floor(thisDialog.row.cells.at(i).get('weight') * 1000) / 10);
|
@@ -1277,12 +1277,12 @@ module.exports = panels.view.dialog.extend({
|
|
1277 |
|
1278 |
}, 100);
|
1279 |
})
|
1280 |
-
.click
|
1281 |
-
$(this).select
|
1282 |
});
|
1283 |
});
|
1284 |
|
1285 |
-
$(this).siblings('.preview-cell-weight-input').select
|
1286 |
|
1287 |
});
|
1288 |
|
@@ -1940,7 +1940,7 @@ module.exports = panels.view.dialog.extend( {
|
|
1940 |
|
1941 |
this.on( 'open_dialog_complete', function () {
|
1942 |
// Clear the search and re-filter the widgets when we open the dialog
|
1943 |
-
this.$( '.so-sidebar-search' ).val( '' ).focus
|
1944 |
this.balanceWidgetHeights();
|
1945 |
} );
|
1946 |
|
@@ -1963,7 +1963,7 @@ module.exports = panels.view.dialog.extend( {
|
|
1963 |
widget.icon = 'dashicons dashicons-admin-generic';
|
1964 |
}
|
1965 |
|
1966 |
-
$( '<span class="widget-icon"
|
1967 |
|
1968 |
$w.data( 'class', widget.class ).appendTo( this.$( '.widget-type-list' ) );
|
1969 |
}, this );
|
@@ -1981,7 +1981,7 @@ module.exports = panels.view.dialog.extend( {
|
|
1981 |
this.initTabs();
|
1982 |
|
1983 |
var thisDialog = this;
|
1984 |
-
$( window ).
|
1985 |
thisDialog.balanceWidgetHeights();
|
1986 |
} );
|
1987 |
},
|
@@ -2013,7 +2013,7 @@ module.exports = panels.view.dialog.extend( {
|
|
2013 |
if( e.which === 13 ) {
|
2014 |
var visibleWidgets = this.$( '.widget-type-list .widget-type:visible' );
|
2015 |
if( visibleWidgets.length === 1 ) {
|
2016 |
-
visibleWidgets.click
|
2017 |
}
|
2018 |
}
|
2019 |
else {
|
@@ -2497,7 +2497,7 @@ module.exports = function ( config, force ) {
|
|
2497 |
if ( isWidget || $$.data('mode') === 'dialog' ) {
|
2498 |
// Set up the dialog opening
|
2499 |
builderView.setDialogParents( panelsOptions.loc.layout_widget, builderView.dialog );
|
2500 |
-
$$.find( '.siteorigin-panels-display-builder' ).
|
2501 |
e.preventDefault();
|
2502 |
builderView.dialog.openDialog();
|
2503 |
} );
|
@@ -2651,7 +2651,7 @@ jQuery( function ( $ ) {
|
|
2651 |
.attachToEditor();
|
2652 |
|
2653 |
// When the form is submitted, update the panels data
|
2654 |
-
form.
|
2655 |
// Refresh the data
|
2656 |
builderModel.refreshPanelsData();
|
2657 |
} );
|
@@ -2683,7 +2683,7 @@ jQuery( function ( $ ) {
|
|
2683 |
if ( e.which === 27 ) {
|
2684 |
// Trigger a click on the last visible Page Builder window
|
2685 |
$( '.so-panels-dialog-wrapper, .so-panels-live-editor' ).filter(':visible')
|
2686 |
-
.last().find('.so-title-bar .so-close, .live-editor-close').click
|
2687 |
}
|
2688 |
});
|
2689 |
} );
|
@@ -3058,9 +3058,8 @@ module.exports = Backbone.Model.extend({
|
|
3058 |
return $el.html();
|
3059 |
}
|
3060 |
|
3061 |
-
var i;
|
3062 |
-
|
3063 |
-
if( jQuery.trim( $divs.eq(i).text() ) != jQuery.trim( $divs.eq(i+1).text() ) ) {
|
3064 |
break;
|
3065 |
}
|
3066 |
}
|
@@ -3609,7 +3608,7 @@ module.exports = Backbone.Model.extend( {
|
|
3609 |
values[titleFields[i]] !== 'on' &&
|
3610 |
values[titleFields[i]] !== 'true' &&
|
3611 |
values[titleFields[i]] !== 'false' &&
|
3612 |
-
titleFields[i][0] !== '_' && !
|
3613 |
) {
|
3614 |
var title = values[titleFields[i]];
|
3615 |
title = title.replace( /<\/?[^>]+(>|$)/g, "" );
|
@@ -3727,7 +3726,7 @@ module.exports = Backbone.View.extend( {
|
|
3727 |
left: position.left + 1,
|
3728 |
top: position.top + 1
|
3729 |
} ).show();
|
3730 |
-
this.$( '.so-search-wrapper input' ).focus
|
3731 |
},
|
3732 |
|
3733 |
closeMenu: function () {
|
@@ -3794,13 +3793,13 @@ module.exports = Backbone.View.extend( {
|
|
3794 |
} ) ).attr( 'id', 'panels-menu-section-' + id );
|
3795 |
this.$el.append( section );
|
3796 |
|
3797 |
-
section.find( '.so-item:not(.so-confirm)' ).
|
3798 |
var $$ = $( this );
|
3799 |
callback( $$.data( 'key' ) );
|
3800 |
thisView.closeMenu();
|
3801 |
} );
|
3802 |
|
3803 |
-
section.find( '.so-item.so-confirm' ).
|
3804 |
var $$ = $( this );
|
3805 |
|
3806 |
if ( $$.hasClass( 'so-confirming' ) ) {
|
@@ -4038,7 +4037,7 @@ module.exports = Backbone.View.extend( {
|
|
4038 |
this.listenTo( this.model.get( 'rows' ), 'add', this.onAddRow );
|
4039 |
|
4040 |
// Reflow the entire builder when ever the
|
4041 |
-
$( window ).
|
4042 |
if ( e.target === window ) {
|
4043 |
builder.trigger( 'builder_resize' );
|
4044 |
}
|
@@ -4181,7 +4180,7 @@ module.exports = Backbone.View.extend( {
|
|
4181 |
// Handle switching between the page builder and other tabs
|
4182 |
$( '#wp-content-wrap .wp-editor-tabs' )
|
4183 |
.find( '.wp-switch-editor' )
|
4184 |
-
.
|
4185 |
e.preventDefault();
|
4186 |
$( '#wp-content-editor-container' ).show();
|
4187 |
|
@@ -4194,7 +4193,7 @@ module.exports = Backbone.View.extend( {
|
|
4194 |
} ).end()
|
4195 |
.append(
|
4196 |
$( '<button type="button" id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">' + metabox.find( 'h2.hndle' ).html() + '</button>' )
|
4197 |
-
.
|
4198 |
if ( thisView.displayAttachedBuilder( { confirm: true } ) ) {
|
4199 |
e.preventDefault();
|
4200 |
}
|
@@ -4203,7 +4202,7 @@ module.exports = Backbone.View.extend( {
|
|
4203 |
|
4204 |
// Switch back to the standard editor
|
4205 |
if ( this.supports( 'revertToEditor' ) ) {
|
4206 |
-
metabox.find( '.so-switch-to-standard' ).
|
4207 |
e.preventDefault();
|
4208 |
|
4209 |
if ( !confirm( panelsOptions.loc.confirm_stop_builder ) ) {
|
@@ -4219,7 +4218,7 @@ module.exports = Backbone.View.extend( {
|
|
4219 |
metabox.hide();
|
4220 |
|
4221 |
// Resize to trigger reflow of WordPress editor stuff
|
4222 |
-
$( window ).resize
|
4223 |
|
4224 |
thisView.attachedVisible = false;
|
4225 |
thisView.trigger( 'hide_builder' );
|
@@ -4248,7 +4247,7 @@ module.exports = Backbone.View.extend( {
|
|
4248 |
width: '100%',
|
4249 |
position: 'absolute'
|
4250 |
} );
|
4251 |
-
thisView.$el.css( 'padding-top', toolbar.outerHeight() );
|
4252 |
return;
|
4253 |
}
|
4254 |
|
@@ -4268,26 +4267,26 @@ module.exports = Backbone.View.extend( {
|
|
4268 |
// The toolbar needs to stick to the top, over the interface
|
4269 |
toolbar.css( {
|
4270 |
top: $( '#wpadminbar' ).outerHeight(),
|
4271 |
-
left: thisView.$el.offset().left,
|
4272 |
-
width: thisView.$el.outerWidth(),
|
4273 |
position: 'fixed'
|
4274 |
} );
|
4275 |
}
|
4276 |
} else {
|
4277 |
// The toolbar needs to be at the top or bottom of the interface
|
4278 |
toolbar.css( {
|
4279 |
-
top: Math.min( Math.max( newTop, 0 ), thisView.$el.outerHeight() - toolbar.outerHeight() + 20 ),
|
4280 |
left: 0,
|
4281 |
width: '100%',
|
4282 |
position: 'absolute'
|
4283 |
} );
|
4284 |
}
|
4285 |
|
4286 |
-
thisView.$el.css( 'padding-top', toolbar.outerHeight() );
|
4287 |
};
|
4288 |
|
4289 |
this.on( 'builder_resize', stickToolbar, this );
|
4290 |
-
$( document ).
|
4291 |
stickToolbar();
|
4292 |
|
4293 |
this.trigger( 'builder_attached_to_editor' );
|
@@ -4328,8 +4327,8 @@ module.exports = Backbone.View.extend( {
|
|
4328 |
this.metabox.show().find( '> .inside' ).show();
|
4329 |
|
4330 |
// Triggers full refresh
|
4331 |
-
$( window ).resize
|
4332 |
-
$( document ).scroll
|
4333 |
|
4334 |
// Make sure the word count is visible
|
4335 |
this.attachedVisible = true;
|
@@ -4504,7 +4503,7 @@ module.exports = Backbone.View.extend( {
|
|
4504 |
}
|
4505 |
|
4506 |
this.refreshSortable();
|
4507 |
-
rowView.
|
4508 |
this.trigger( 'row_added' );
|
4509 |
},
|
4510 |
|
@@ -4790,8 +4789,8 @@ module.exports = Backbone.View.extend( {
|
|
4790 |
event = events[ i ];
|
4791 |
|
4792 |
// Wrap the call
|
4793 |
-
$( window ).
|
4794 |
-
$( window ).bind( 'scroll', function
|
4795 |
if ( !this.attachedVisible ) {
|
4796 |
event.handler( e );
|
4797 |
}
|
@@ -5036,7 +5035,7 @@ module.exports = Backbone.View.extend( {
|
|
5036 |
helper: function ( e, el ) {
|
5037 |
var helper = el.clone()
|
5038 |
.css( {
|
5039 |
-
'width': el.outerWidth(),
|
5040 |
'z-index': 10000,
|
5041 |
'position': 'fixed'
|
5042 |
} )
|
@@ -5108,9 +5107,9 @@ module.exports = Backbone.View.extend( {
|
|
5108 |
var prevCellClone = previousCell.$el.clone().appendTo( ui.helper ).css( {
|
5109 |
position: 'absolute',
|
5110 |
top: '0',
|
5111 |
-
width: previousCell.$el.outerWidth(),
|
5112 |
right: 5,
|
5113 |
-
height: previousCell.$el.outerHeight()
|
5114 |
} );
|
5115 |
prevCellClone.find( '.resize-handle' ).remove();
|
5116 |
|
@@ -5133,10 +5132,10 @@ module.exports = Backbone.View.extend( {
|
|
5133 |
) / containerWidth
|
5134 |
);
|
5135 |
|
5136 |
-
$( this ).data( 'newCellClone' ).css( 'width', containerWidth * ncw )
|
5137 |
.find( '.preview-cell-weight' ).html( Math.round( ncw * 1000 ) / 10 );
|
5138 |
|
5139 |
-
$( this ).data( 'prevCellClone' ).css( 'width', containerWidth * pcw )
|
5140 |
.find( '.preview-cell-weight' ).html( Math.round( pcw * 1000 ) / 10 );
|
5141 |
},
|
5142 |
stop: function ( e, ui ) {
|
@@ -5160,10 +5159,10 @@ module.exports = Backbone.View.extend( {
|
|
5160 |
cellView.row.builder.addHistoryEntry( 'cell_resized' );
|
5161 |
cellView.model.set( 'weight', ncw );
|
5162 |
previousCell.model.set( 'weight', pcw );
|
5163 |
-
cellView.row.
|
5164 |
}
|
5165 |
|
5166 |
-
ui.helper.css( 'left', - handle.outerWidth() / 2 );
|
5167 |
|
5168 |
// Refresh the panels data
|
5169 |
cellView.row.builder.model.refreshPanelsData();
|
@@ -5212,7 +5211,7 @@ module.exports = Backbone.View.extend( {
|
|
5212 |
}
|
5213 |
|
5214 |
this.refreshSortable();
|
5215 |
-
this.row.
|
5216 |
this.row.builder.trigger( 'widget_added', view );
|
5217 |
},
|
5218 |
|
@@ -5451,7 +5450,7 @@ module.exports = Backbone.View.extend( {
|
|
5451 |
if ( this.parentDialog !== false ) {
|
5452 |
// Add a link to the parent dialog as a sort of crumbtrail.
|
5453 |
var dialogParent = $( '<h3 class="so-parent-link"></h3>' ).html( this.parentDialog.text + '<div class="so-separator"></div>' );
|
5454 |
-
dialogParent.
|
5455 |
e.preventDefault();
|
5456 |
this.closeDialog();
|
5457 |
this.parentDialog.dialog.openDialog();
|
@@ -5501,7 +5500,7 @@ module.exports = Backbone.View.extend( {
|
|
5501 |
}
|
5502 |
|
5503 |
var thisDialog = this;
|
5504 |
-
tabs.
|
5505 |
e.preventDefault();
|
5506 |
var $$ = $( this );
|
5507 |
|
@@ -5523,14 +5522,14 @@ module.exports = Backbone.View.extend( {
|
|
5523 |
} );
|
5524 |
|
5525 |
// Trigger a click on the first tab
|
5526 |
-
this.$( '.so-sidebar-tabs li a' ).first().click
|
5527 |
return this;
|
5528 |
},
|
5529 |
|
5530 |
initToolbar: function () {
|
5531 |
// Trigger simplified click event for elements marked as toolbar buttons.
|
5532 |
var buttons = this.$( '.so-toolbar .so-buttons .so-toolbar-button' );
|
5533 |
-
buttons.
|
5534 |
e.preventDefault();
|
5535 |
|
5536 |
this.trigger( 'button_click', $( e.currentTarget ) );
|
@@ -5538,7 +5537,7 @@ module.exports = Backbone.View.extend( {
|
|
5538 |
|
5539 |
// Handle showing and hiding the dropdown list items
|
5540 |
var $dropdowns = this.$( '.so-toolbar .so-buttons .so-dropdown-button' );
|
5541 |
-
$dropdowns.
|
5542 |
e.preventDefault();
|
5543 |
var $dropdownButton = $( e.currentTarget );
|
5544 |
var $dropdownList = $dropdownButton.siblings( '.so-dropdown-links-wrapper' );
|
@@ -5552,7 +5551,7 @@ module.exports = Backbone.View.extend( {
|
|
5552 |
|
5553 |
// Hide dropdown list on click anywhere, unless it's a dropdown option which requires confirmation in it's
|
5554 |
// unconfirmed state.
|
5555 |
-
$( 'html' ).
|
5556 |
this.$( '.so-dropdown-links-wrapper' ).not( '.hidden' ).each( function ( index, el ) {
|
5557 |
var $dropdownList = $( el );
|
5558 |
var $trgt = $( e.target );
|
@@ -5573,33 +5572,33 @@ module.exports = Backbone.View.extend( {
|
|
5573 |
initEditableLabel: function(){
|
5574 |
var $editElt = this.$( '.so-title-bar .so-title-editable' );
|
5575 |
|
5576 |
-
$editElt.
|
5577 |
-
|
5578 |
-
|
5579 |
-
|
5580 |
-
|
5581 |
-
|
5582 |
-
|
5583 |
-
|
5584 |
-
|
5585 |
-
|
5586 |
-
|
5587 |
-
|
5588 |
-
|
5589 |
-
|
5590 |
-
|
5591 |
-
|
5592 |
-
|
5593 |
-
|
5594 |
-
|
5595 |
-
|
5596 |
-
|
5597 |
-
}.bind( this ) );
|
5598 |
|
5599 |
-
|
5600 |
-
|
5601 |
-
|
5602 |
-
|
|
|
5603 |
},
|
5604 |
|
5605 |
/**
|
@@ -5973,10 +5972,10 @@ module.exports = Backbone.View.extend( {
|
|
5973 |
|
5974 |
var isMouseDown = false;
|
5975 |
$( document )
|
5976 |
-
.
|
5977 |
isMouseDown = true;
|
5978 |
} )
|
5979 |
-
.
|
5980 |
isMouseDown = false;
|
5981 |
} );
|
5982 |
|
@@ -6081,7 +6080,7 @@ module.exports = Backbone.View.extend( {
|
|
6081 |
closeAndSave: function(){
|
6082 |
this.close();
|
6083 |
// Finds the submit input for saving without publishing draft posts.
|
6084 |
-
$('#submitdiv input[type="submit"][name="save"]').click
|
6085 |
},
|
6086 |
|
6087 |
/**
|
@@ -6207,7 +6206,7 @@ module.exports = Backbone.View.extend( {
|
|
6207 |
var iframeId = 'siteorigin-panels-live-preview-' + this.previewFrameId;
|
6208 |
|
6209 |
// Remove the old preview frame
|
6210 |
-
this.previewIframe = $('<iframe src="' + url + '"
|
6211 |
.attr( {
|
6212 |
'id' : iframeId,
|
6213 |
'name' : iframeId,
|
@@ -6217,7 +6216,7 @@ module.exports = Backbone.View.extend( {
|
|
6217 |
this.setupPreviewFrame( this.previewIframe );
|
6218 |
|
6219 |
// We can use a normal POST form submit
|
6220 |
-
var tempForm = $('<form id="soPostToPreviewFrame" method="post"
|
6221 |
.attr( {
|
6222 |
id: iframeId,
|
6223 |
target: this.previewIframe.attr('id'),
|
@@ -6235,7 +6234,7 @@ module.exports = Backbone.View.extend( {
|
|
6235 |
} );
|
6236 |
|
6237 |
tempForm
|
6238 |
-
.submit
|
6239 |
.remove();
|
6240 |
|
6241 |
this.previewFrameId++;
|
@@ -6298,23 +6297,23 @@ module.exports = Backbone.View.extend( {
|
|
6298 |
.css( {
|
6299 |
'cursor': 'pointer'
|
6300 |
} )
|
6301 |
-
.
|
6302 |
widgetEdit.parent().addClass( 'so-hovered' );
|
6303 |
thisView.highlightElement( $$ );
|
6304 |
} )
|
6305 |
-
.
|
6306 |
widgetEdit.parent().removeClass( 'so-hovered' );
|
6307 |
thisView.resetHighlights();
|
6308 |
} )
|
6309 |
-
.
|
6310 |
e.preventDefault();
|
6311 |
// When we click a widget, send that click to the form
|
6312 |
-
widgetEdit.find( '.title h4' ).click
|
6313 |
} );
|
6314 |
} );
|
6315 |
|
6316 |
// Prevent default clicks inside the preview iframe
|
6317 |
-
$iframeContents.find( "a" ).css( {'pointer-events': 'none'} ).
|
6318 |
e.preventDefault();
|
6319 |
} );
|
6320 |
|
@@ -6376,7 +6375,7 @@ module.exports = Backbone.View.extend( {
|
|
6376 |
this.listenTo(rowCells, 'add', this.handleCellAdd );
|
6377 |
this.listenTo(rowCells, 'remove', this.handleCellRemove );
|
6378 |
|
6379 |
-
this.listenTo( this.model, 'reweight_cells', this.
|
6380 |
this.listenTo( this.model, 'destroy', this.onModelDestroy );
|
6381 |
|
6382 |
var thisView = this;
|
@@ -6437,15 +6436,16 @@ module.exports = Backbone.View.extend( {
|
|
6437 |
this.$('.so-row-toolbar .so-row-move' ).remove();
|
6438 |
this.$el.addClass('so-row-no-move');
|
6439 |
}
|
6440 |
-
|
|
|
6441 |
this.$('.so-row-toolbar' ).remove();
|
6442 |
}
|
6443 |
|
6444 |
// Resize the rows when ever the widget sortable moves
|
6445 |
-
this.listenTo( this.builder, 'widget_sortable_move', this.
|
6446 |
-
this.listenTo( this.builder, 'builder_resize', this.
|
6447 |
|
6448 |
-
this.
|
6449 |
|
6450 |
return this;
|
6451 |
},
|
@@ -6462,7 +6462,7 @@ module.exports = Backbone.View.extend( {
|
|
6462 |
*
|
6463 |
* @param e
|
6464 |
*/
|
6465 |
-
|
6466 |
// Don't resize this
|
6467 |
if ( ! this.$el.is( ':visible' ) ) {
|
6468 |
return;
|
@@ -6487,8 +6487,8 @@ module.exports = Backbone.View.extend( {
|
|
6487 |
} );
|
6488 |
|
6489 |
// Resize all the grids and cell wrappers
|
6490 |
-
this.$( '.so-cells .cell-wrapper' ).css( 'min-height', Math.max( height, 63 ) );
|
6491 |
-
this.$( '.so-cells .resize-handle' ).css( 'height', this.$( '.so-cells .cell-wrapper' ).outerHeight() );
|
6492 |
},
|
6493 |
|
6494 |
/**
|
@@ -6864,7 +6864,7 @@ module.exports = Backbone.View.extend( {
|
|
6864 |
this.$( '.style-section-wrapper' ).each( function () {
|
6865 |
var $s = $( this );
|
6866 |
|
6867 |
-
$s.find( '.style-section-head' ).
|
6868 |
e.preventDefault();
|
6869 |
$s.find( '.style-section-fields' ).slideToggle( 'fast' );
|
6870 |
} );
|
@@ -6885,7 +6885,7 @@ module.exports = Backbone.View.extend( {
|
|
6885 |
var frame = null;
|
6886 |
var $s = $( this );
|
6887 |
|
6888 |
-
$s.find( '.so-image-selector' ).
|
6889 |
e.preventDefault();
|
6890 |
|
6891 |
if ( frame === null ) {
|
@@ -6934,7 +6934,7 @@ module.exports = Backbone.View.extend( {
|
|
6934 |
} );
|
6935 |
|
6936 |
// Handle clicking on remove
|
6937 |
-
$s.find( '.remove-image' ).
|
6938 |
e.preventDefault();
|
6939 |
$s.find( '.current-image' ).css( 'background-image', 'none' );
|
6940 |
$s.find( '.so-image-selector > input' ).val( '' );
|
@@ -6950,8 +6950,8 @@ module.exports = Backbone.View.extend( {
|
|
6950 |
var unit = $$.find( 'select' );
|
6951 |
var hidden = $$.find( 'input[type="hidden"]' );
|
6952 |
|
6953 |
-
text.
|
6954 |
-
$(this).select
|
6955 |
} );
|
6956 |
|
6957 |
/**
|
@@ -7053,8 +7053,8 @@ module.exports = Backbone.View.extend( {
|
|
7053 |
};
|
7054 |
|
7055 |
// Set the value when ever anything changes
|
7056 |
-
text.
|
7057 |
-
unit.
|
7058 |
} );
|
7059 |
}
|
7060 |
|
@@ -7120,7 +7120,8 @@ module.exports = Backbone.View.extend( {
|
|
7120 |
if( ! this.cell.row.builder.supports( 'moveWidget' ) ) {
|
7121 |
this.$el.addClass('so-widget-no-move');
|
7122 |
}
|
7123 |
-
|
|
|
7124 |
this.$( '.actions' ).remove();
|
7125 |
}
|
7126 |
|
@@ -7245,7 +7246,7 @@ module.exports = Backbone.View.extend( {
|
|
7245 |
this.cell.row.builder.addHistoryEntry( 'widget_deleted' );
|
7246 |
|
7247 |
this.$el.fadeOut( 'fast', function () {
|
7248 |
-
this.cell.row.
|
7249 |
this.model.destroy();
|
7250 |
this.cell.row.builder.model.refreshPanelsData();
|
7251 |
this.remove();
|
187 |
// Render the dialog and attach it to the builder interface
|
188 |
this.renderDialog( this.parseDialogContent( $( '#siteorigin-panels-dialog-history' ).html(), {} ) );
|
189 |
|
190 |
+
this.$( 'iframe.siteorigin-panels-history-iframe' ).on( 'load', function () {
|
191 |
var $$ = $( this );
|
192 |
$$.show();
|
193 |
|
256 |
.prependTo( c );
|
257 |
|
258 |
// Handle loading and selecting
|
259 |
+
c.find( '.history-entry' ).on( 'click', function() {
|
260 |
var $$ = jQuery( this );
|
261 |
c.find( '.history-entry' ).not( $$ ).removeClass( 'so-selected' );
|
262 |
$$.addClass( 'so-selected' );
|
289 |
|
290 |
this.$( 'form.history-form input[name="live_editor_panels_data"]' ).val( entry.get( 'data' ) );
|
291 |
this.$( 'form.history-form input[name="live_editor_post_ID"]' ).val( this.builder.config.postId );
|
292 |
+
this.$( 'form.history-form' ).trigger( 'submit' );
|
293 |
},
|
294 |
|
295 |
/**
|
414 |
var thisView = this;
|
415 |
|
416 |
this.on( 'open_dialog', function () {
|
417 |
+
thisView.$( '.so-sidebar-tabs li a' ).first().trigger( 'click' );
|
418 |
thisView.$( '.so-status' ).removeClass( 'so-panels-loading' );
|
419 |
} );
|
420 |
|
503 |
uploadUi.find( '.progress-precent' ).css( 'width', '0%' );
|
504 |
},
|
505 |
FilesAdded: function ( uploader ) {
|
506 |
+
uploadUi.find( '.file-browse-button' ).trigger( 'blur' );
|
507 |
uploadUi.find( '.drag-upload-area' ).removeClass( 'file-dragover' );
|
508 |
uploadUi.find( '.progress-bar' ).fadeIn( 'fast' );
|
509 |
thisView.$( '.js-so-selected-file' ).text( panelsOptions.loc.prebuilt_loading );
|
551 |
} );
|
552 |
|
553 |
// Handle exporting the file
|
554 |
+
c.find( '.so-export' ).on( 'submit', function( e ) {
|
555 |
var $$ = $( this );
|
556 |
var panelsData = thisView.builder.model.getPanelsData();
|
557 |
var postName = $( 'input[name="post_title"], .editor-post-title__input' ).val();
|
602 |
if ( type.match('^directory-') && ! panelsOptions.directory_enabled ) {
|
603 |
// Display the button to enable the prebuilt layout
|
604 |
c.removeClass( 'so-panels-loading' ).html( $( '#siteorigin-panels-directory-enable' ).html() );
|
605 |
+
c.find( '.so-panels-enable-directory' ).on( 'click', function( e ) {
|
606 |
e.preventDefault();
|
607 |
// Sent the query to enable the directory, then enable the directory
|
608 |
$.get(
|
646 |
if ( page <= 1 ) {
|
647 |
prev.addClass( 'button-disabled' );
|
648 |
} else {
|
649 |
+
prev.on( 'click', function( e ) {
|
650 |
e.preventDefault();
|
651 |
thisView.displayLayoutDirectory( search, page - 1, thisView.currentTab );
|
652 |
} );
|
655 |
if ( page === data.max_num_pages || data.max_num_pages === 0 ) {
|
656 |
next.addClass( 'button-disabled' );
|
657 |
} else {
|
658 |
+
next.on( 'click', function( e ) {
|
659 |
e.preventDefault();
|
660 |
thisView.displayLayoutDirectory( search, page + 1, thisView.currentTab );
|
661 |
} );
|
668 |
|
669 |
if ( $$.data( 'src' ) !== '' ) {
|
670 |
// Set the initial height
|
671 |
+
var $img = $( '<img/>' ).attr( 'src', $$.data( 'src' ) ).on( 'load', function () {
|
672 |
$a.removeClass( 'so-loading' ).css( 'height', 'auto' );
|
673 |
$img.appendTo( $a ).hide().fadeIn( 'fast' );
|
674 |
} );
|
946 |
}
|
947 |
}
|
948 |
|
949 |
+
this.$( 'input.so-row-field' ).on( 'keyup', function() {
|
950 |
$(this).trigger('change');
|
951 |
});
|
952 |
|
1049 |
handle = $('<div class="resize-handle"></div>');
|
1050 |
handle
|
1051 |
.appendTo(newCell)
|
1052 |
+
.on( 'dblclick', function () {
|
1053 |
var prevCellModel = thisDialog.row.cells.at(i - 1);
|
1054 |
var t = cellModel.get('weight') + prevCellModel.get('weight');
|
1055 |
cellModel.set('weight', t / 2);
|
1108 |
|
1109 |
var helperLeft = ui.helper.offset().left - rowPreview.offset().left - 6;
|
1110 |
|
1111 |
+
$( this ).data( 'newCellClone' ).css( 'width', rowPreview.width() * ncw + 'px' )
|
1112 |
.find('.preview-cell-weight').html(Math.round(ncw * 1000) / 10);
|
1113 |
|
1114 |
+
$( this ).data( 'prevCellClone' ).css( 'width', rowPreview.width() * pcw + 'px' )
|
1115 |
.find('.preview-cell-weight').html(Math.round(pcw * 1000) / 10);
|
1116 |
},
|
1117 |
stop: function (e, ui) {
|
1141 |
});
|
1142 |
}
|
1143 |
|
1144 |
+
newCell.on( 'click', function( event ) {
|
1145 |
|
1146 |
if ( ! ( $(event.target).is('.preview-cell') || $(event.target).is('.preview-cell-in') ) ) {
|
1147 |
return;
|
1156 |
}.bind(this));
|
1157 |
|
1158 |
// Make this row weight click editable
|
1159 |
+
newCell.find( '.preview-cell-weight' ).on( 'click', function( ci ) {
|
1160 |
|
1161 |
// Disable the draggable while entering values
|
1162 |
thisDialog.$('.resize-handle').css('pointer-event', 'none').draggable('disable');
|
1165 |
var $$ = jQuery(this).hide();
|
1166 |
$('<input type="text" class="preview-cell-weight-input no-user-interacted" />')
|
1167 |
.val(parseFloat($$.html())).insertAfter($$)
|
1168 |
+
.on( 'focus', function() {
|
1169 |
clearTimeout(timeout);
|
1170 |
})
|
1171 |
+
.on( 'keyup', function( e ) {
|
1172 |
if (e.keyCode !== 9) {
|
1173 |
// Only register the interaction if the user didn't press tab
|
1174 |
$(this).removeClass('no-user-interacted');
|
1177 |
// Enter is clicked
|
1178 |
if (e.keyCode === 13) {
|
1179 |
e.preventDefault();
|
1180 |
+
$( this ).trigger( 'blur' );
|
1181 |
}
|
1182 |
})
|
1183 |
+
.on( 'keydown', function( e ) {
|
1184 |
if (e.keyCode === 9) {
|
1185 |
e.preventDefault();
|
1186 |
|
1188 |
var inputs = rowPreview.find('.preview-cell-weight-input');
|
1189 |
var i = inputs.index($(this));
|
1190 |
if (i === inputs.length - 1) {
|
1191 |
+
inputs.eq( 0 ).trigger( 'focus' ).trigger( 'select' );
|
1192 |
} else {
|
1193 |
+
inputs.eq( i + 1 ).trigger( 'focus' ).trigger( 'select' );
|
1194 |
}
|
1195 |
}
|
1196 |
})
|
1197 |
+
.on( 'blur', function() {
|
1198 |
rowPreview.find('.preview-cell-weight-input').each(function (i, el) {
|
1199 |
if (isNaN(parseFloat($(el).val()))) {
|
1200 |
$(el).val(Math.floor(thisDialog.row.cells.at(i).get('weight') * 1000) / 10);
|
1277 |
|
1278 |
}, 100);
|
1279 |
})
|
1280 |
+
.on( 'click', function () {
|
1281 |
+
$( this ).trigger( 'select' );
|
1282 |
});
|
1283 |
});
|
1284 |
|
1285 |
+
$(this).siblings( '.preview-cell-weight-input' ).trigger( 'select');
|
1286 |
|
1287 |
});
|
1288 |
|
1940 |
|
1941 |
this.on( 'open_dialog_complete', function () {
|
1942 |
// Clear the search and re-filter the widgets when we open the dialog
|
1943 |
+
this.$( '.so-sidebar-search' ).val( '' ).trigger( 'focus' );
|
1944 |
this.balanceWidgetHeights();
|
1945 |
} );
|
1946 |
|
1963 |
widget.icon = 'dashicons dashicons-admin-generic';
|
1964 |
}
|
1965 |
|
1966 |
+
$( '<span class="widget-icon"></span>' ).addClass( widget.icon ).prependTo( $w.find( '.widget-type-wrapper' ) );
|
1967 |
|
1968 |
$w.data( 'class', widget.class ).appendTo( this.$( '.widget-type-list' ) );
|
1969 |
}, this );
|
1981 |
this.initTabs();
|
1982 |
|
1983 |
var thisDialog = this;
|
1984 |
+
$( window ).on( 'resize', function() {
|
1985 |
thisDialog.balanceWidgetHeights();
|
1986 |
} );
|
1987 |
},
|
2013 |
if( e.which === 13 ) {
|
2014 |
var visibleWidgets = this.$( '.widget-type-list .widget-type:visible' );
|
2015 |
if( visibleWidgets.length === 1 ) {
|
2016 |
+
visibleWidgets.trigger( 'click' );
|
2017 |
}
|
2018 |
}
|
2019 |
else {
|
2497 |
if ( isWidget || $$.data('mode') === 'dialog' ) {
|
2498 |
// Set up the dialog opening
|
2499 |
builderView.setDialogParents( panelsOptions.loc.layout_widget, builderView.dialog );
|
2500 |
+
$$.find( '.siteorigin-panels-display-builder' ).on( 'click', function( e ) {
|
2501 |
e.preventDefault();
|
2502 |
builderView.dialog.openDialog();
|
2503 |
} );
|
2651 |
.attachToEditor();
|
2652 |
|
2653 |
// When the form is submitted, update the panels data
|
2654 |
+
form.on( 'submit', function() {
|
2655 |
// Refresh the data
|
2656 |
builderModel.refreshPanelsData();
|
2657 |
} );
|
2683 |
if ( e.which === 27 ) {
|
2684 |
// Trigger a click on the last visible Page Builder window
|
2685 |
$( '.so-panels-dialog-wrapper, .so-panels-live-editor' ).filter(':visible')
|
2686 |
+
.last().find('.so-title-bar .so-close, .live-editor-close').trigger( 'click' );
|
2687 |
}
|
2688 |
});
|
2689 |
} );
|
3058 |
return $el.html();
|
3059 |
}
|
3060 |
|
3061 |
+
for ( var i = 0; i < $divs.length - 1; i++ ) {
|
3062 |
+
if ( $divs.eq( i ).text().trim() != $divs.eq( i + 1 ).text().trim() ) {
|
|
|
3063 |
break;
|
3064 |
}
|
3065 |
}
|
3608 |
values[titleFields[i]] !== 'on' &&
|
3609 |
values[titleFields[i]] !== 'true' &&
|
3610 |
values[titleFields[i]] !== 'false' &&
|
3611 |
+
titleFields[i][0] !== '_' && ! _.isFinite( values[titleFields[i]] )
|
3612 |
) {
|
3613 |
var title = values[titleFields[i]];
|
3614 |
title = title.replace( /<\/?[^>]+(>|$)/g, "" );
|
3726 |
left: position.left + 1,
|
3727 |
top: position.top + 1
|
3728 |
} ).show();
|
3729 |
+
this.$( '.so-search-wrapper input' ).trigger( 'focus' );
|
3730 |
},
|
3731 |
|
3732 |
closeMenu: function () {
|
3793 |
} ) ).attr( 'id', 'panels-menu-section-' + id );
|
3794 |
this.$el.append( section );
|
3795 |
|
3796 |
+
section.find( '.so-item:not(.so-confirm)' ).on( 'click', function() {
|
3797 |
var $$ = $( this );
|
3798 |
callback( $$.data( 'key' ) );
|
3799 |
thisView.closeMenu();
|
3800 |
} );
|
3801 |
|
3802 |
+
section.find( '.so-item.so-confirm' ).on( 'click', function() {
|
3803 |
var $$ = $( this );
|
3804 |
|
3805 |
if ( $$.hasClass( 'so-confirming' ) ) {
|
4037 |
this.listenTo( this.model.get( 'rows' ), 'add', this.onAddRow );
|
4038 |
|
4039 |
// Reflow the entire builder when ever the
|
4040 |
+
$( window ).on( 'resize', function( e ) {
|
4041 |
if ( e.target === window ) {
|
4042 |
builder.trigger( 'builder_resize' );
|
4043 |
}
|
4180 |
// Handle switching between the page builder and other tabs
|
4181 |
$( '#wp-content-wrap .wp-editor-tabs' )
|
4182 |
.find( '.wp-switch-editor' )
|
4183 |
+
.on( 'click', function( e ) {
|
4184 |
e.preventDefault();
|
4185 |
$( '#wp-content-editor-container' ).show();
|
4186 |
|
4193 |
} ).end()
|
4194 |
.append(
|
4195 |
$( '<button type="button" id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">' + metabox.find( 'h2.hndle' ).html() + '</button>' )
|
4196 |
+
.on( 'click', function( e ) {
|
4197 |
if ( thisView.displayAttachedBuilder( { confirm: true } ) ) {
|
4198 |
e.preventDefault();
|
4199 |
}
|
4202 |
|
4203 |
// Switch back to the standard editor
|
4204 |
if ( this.supports( 'revertToEditor' ) ) {
|
4205 |
+
metabox.find( '.so-switch-to-standard' ).on( 'click', function( e ) {
|
4206 |
e.preventDefault();
|
4207 |
|
4208 |
if ( !confirm( panelsOptions.loc.confirm_stop_builder ) ) {
|
4218 |
metabox.hide();
|
4219 |
|
4220 |
// Resize to trigger reflow of WordPress editor stuff
|
4221 |
+
$( window ).trigger( 'resize');
|
4222 |
|
4223 |
thisView.attachedVisible = false;
|
4224 |
thisView.trigger( 'hide_builder' );
|
4247 |
width: '100%',
|
4248 |
position: 'absolute'
|
4249 |
} );
|
4250 |
+
thisView.$el.css( 'padding-top', toolbar.outerHeight() + 'px' );
|
4251 |
return;
|
4252 |
}
|
4253 |
|
4267 |
// The toolbar needs to stick to the top, over the interface
|
4268 |
toolbar.css( {
|
4269 |
top: $( '#wpadminbar' ).outerHeight(),
|
4270 |
+
left: thisView.$el.offset().left + 'px',
|
4271 |
+
width: thisView.$el.outerWidth() + 'px',
|
4272 |
position: 'fixed'
|
4273 |
} );
|
4274 |
}
|
4275 |
} else {
|
4276 |
// The toolbar needs to be at the top or bottom of the interface
|
4277 |
toolbar.css( {
|
4278 |
+
top: Math.min( Math.max( newTop, 0 ), thisView.$el.outerHeight() - toolbar.outerHeight() + 20 ) + 'px',
|
4279 |
left: 0,
|
4280 |
width: '100%',
|
4281 |
position: 'absolute'
|
4282 |
} );
|
4283 |
}
|
4284 |
|
4285 |
+
thisView.$el.css( 'padding-top', toolbar.outerHeight() + 'px' );
|
4286 |
};
|
4287 |
|
4288 |
this.on( 'builder_resize', stickToolbar, this );
|
4289 |
+
$( document ).on( 'scroll', stickToolbar );
|
4290 |
stickToolbar();
|
4291 |
|
4292 |
this.trigger( 'builder_attached_to_editor' );
|
4327 |
this.metabox.show().find( '> .inside' ).show();
|
4328 |
|
4329 |
// Triggers full refresh
|
4330 |
+
$( window ).trigger( 'resize' );
|
4331 |
+
$( document ).trigger( 'scroll' );
|
4332 |
|
4333 |
// Make sure the word count is visible
|
4334 |
this.attachedVisible = true;
|
4503 |
}
|
4504 |
|
4505 |
this.refreshSortable();
|
4506 |
+
rowView.resizeRow();
|
4507 |
this.trigger( 'row_added' );
|
4508 |
},
|
4509 |
|
4789 |
event = events[ i ];
|
4790 |
|
4791 |
// Wrap the call
|
4792 |
+
$( window ).off( 'scroll', event.handler );
|
4793 |
+
$( window ).bind( 'scroll', function( e ) {
|
4794 |
if ( !this.attachedVisible ) {
|
4795 |
event.handler( e );
|
4796 |
}
|
5035 |
helper: function ( e, el ) {
|
5036 |
var helper = el.clone()
|
5037 |
.css( {
|
5038 |
+
'width': el.outerWidth() + 'px',
|
5039 |
'z-index': 10000,
|
5040 |
'position': 'fixed'
|
5041 |
} )
|
5107 |
var prevCellClone = previousCell.$el.clone().appendTo( ui.helper ).css( {
|
5108 |
position: 'absolute',
|
5109 |
top: '0',
|
5110 |
+
width: previousCell.$el.outerWidth() + 'px',
|
5111 |
right: 5,
|
5112 |
+
height: previousCell.$el.outerHeight() + 'px',
|
5113 |
} );
|
5114 |
prevCellClone.find( '.resize-handle' ).remove();
|
5115 |
|
5132 |
) / containerWidth
|
5133 |
);
|
5134 |
|
5135 |
+
$( this ).data( 'newCellClone' ).css( 'width', containerWidth * ncw + 'px' )
|
5136 |
.find( '.preview-cell-weight' ).html( Math.round( ncw * 1000 ) / 10 );
|
5137 |
|
5138 |
+
$( this ).data( 'prevCellClone' ).css( 'width', containerWidth * pcw + 'px' )
|
5139 |
.find( '.preview-cell-weight' ).html( Math.round( pcw * 1000 ) / 10 );
|
5140 |
},
|
5141 |
stop: function ( e, ui ) {
|
5159 |
cellView.row.builder.addHistoryEntry( 'cell_resized' );
|
5160 |
cellView.model.set( 'weight', ncw );
|
5161 |
previousCell.model.set( 'weight', pcw );
|
5162 |
+
cellView.row.resizeRow();
|
5163 |
}
|
5164 |
|
5165 |
+
ui.helper.css( 'left', - handle.outerWidth() / 2 + 'px' );
|
5166 |
|
5167 |
// Refresh the panels data
|
5168 |
cellView.row.builder.model.refreshPanelsData();
|
5211 |
}
|
5212 |
|
5213 |
this.refreshSortable();
|
5214 |
+
this.row.resizeRow();
|
5215 |
this.row.builder.trigger( 'widget_added', view );
|
5216 |
},
|
5217 |
|
5450 |
if ( this.parentDialog !== false ) {
|
5451 |
// Add a link to the parent dialog as a sort of crumbtrail.
|
5452 |
var dialogParent = $( '<h3 class="so-parent-link"></h3>' ).html( this.parentDialog.text + '<div class="so-separator"></div>' );
|
5453 |
+
dialogParent.on( 'click', function( e ) {
|
5454 |
e.preventDefault();
|
5455 |
this.closeDialog();
|
5456 |
this.parentDialog.dialog.openDialog();
|
5500 |
}
|
5501 |
|
5502 |
var thisDialog = this;
|
5503 |
+
tabs.on( 'click', function( e ) {
|
5504 |
e.preventDefault();
|
5505 |
var $$ = $( this );
|
5506 |
|
5522 |
} );
|
5523 |
|
5524 |
// Trigger a click on the first tab
|
5525 |
+
this.$( '.so-sidebar-tabs li a' ).first().trigger( 'click' );
|
5526 |
return this;
|
5527 |
},
|
5528 |
|
5529 |
initToolbar: function () {
|
5530 |
// Trigger simplified click event for elements marked as toolbar buttons.
|
5531 |
var buttons = this.$( '.so-toolbar .so-buttons .so-toolbar-button' );
|
5532 |
+
buttons.on( 'click', function( e ) {
|
5533 |
e.preventDefault();
|
5534 |
|
5535 |
this.trigger( 'button_click', $( e.currentTarget ) );
|
5537 |
|
5538 |
// Handle showing and hiding the dropdown list items
|
5539 |
var $dropdowns = this.$( '.so-toolbar .so-buttons .so-dropdown-button' );
|
5540 |
+
$dropdowns.on( 'click', function( e ) {
|
5541 |
e.preventDefault();
|
5542 |
var $dropdownButton = $( e.currentTarget );
|
5543 |
var $dropdownList = $dropdownButton.siblings( '.so-dropdown-links-wrapper' );
|
5551 |
|
5552 |
// Hide dropdown list on click anywhere, unless it's a dropdown option which requires confirmation in it's
|
5553 |
// unconfirmed state.
|
5554 |
+
$( 'html' ).on( 'click', function( e ) {
|
5555 |
this.$( '.so-dropdown-links-wrapper' ).not( '.hidden' ).each( function ( index, el ) {
|
5556 |
var $dropdownList = $( el );
|
5557 |
var $trgt = $( e.target );
|
5572 |
initEditableLabel: function(){
|
5573 |
var $editElt = this.$( '.so-title-bar .so-title-editable' );
|
5574 |
|
5575 |
+
$editElt.on( 'keypress', function ( event ) {
|
5576 |
+
var enterPressed = event.type === 'keypress' && event.keyCode === 13;
|
5577 |
+
if ( enterPressed ) {
|
5578 |
+
// Need to make sure tab focus is on another element, otherwise pressing enter multiple times refocuses
|
5579 |
+
// the element and allows newlines.
|
5580 |
+
var tabbables = $( ':tabbable' );
|
5581 |
+
var curTabIndex = tabbables.index( $editElt );
|
5582 |
+
tabbables.eq( curTabIndex + 1 ).trigger( 'focus' );
|
5583 |
+
// After the above, we're somehow left with the first letter of text selected,
|
5584 |
+
// so this removes the selection.
|
5585 |
+
window.getSelection().removeAllRanges();
|
5586 |
+
}
|
5587 |
+
return ! enterPressed;
|
5588 |
+
} )
|
5589 |
+
.on( 'blur', function () {
|
5590 |
+
var newValue = $editElt.text().replace( /^\s+|\s+$/gm, '' );
|
5591 |
+
var oldValue = $editElt.data( 'original-value' ).replace( /^\s+|\s+$/gm, '' );
|
5592 |
+
if ( newValue !== oldValue ) {
|
5593 |
+
$editElt.text( newValue );
|
5594 |
+
this.trigger( 'edit_label', newValue );
|
5595 |
+
}
|
|
|
5596 |
|
5597 |
+
}.bind( this ) )
|
5598 |
+
.on( 'focus', function() {
|
5599 |
+
$editElt.data( 'original-value', $editElt.text() );
|
5600 |
+
panels.helpers.utils.selectElementContents( this );
|
5601 |
+
} );
|
5602 |
},
|
5603 |
|
5604 |
/**
|
5972 |
|
5973 |
var isMouseDown = false;
|
5974 |
$( document )
|
5975 |
+
.on( 'mousedown', function() {
|
5976 |
isMouseDown = true;
|
5977 |
} )
|
5978 |
+
.on( 'mouseup', function() {
|
5979 |
isMouseDown = false;
|
5980 |
} );
|
5981 |
|
6080 |
closeAndSave: function(){
|
6081 |
this.close();
|
6082 |
// Finds the submit input for saving without publishing draft posts.
|
6083 |
+
$( '#submitdiv input[type="submit"][name="save"]' ).trigger( 'click' );
|
6084 |
},
|
6085 |
|
6086 |
/**
|
6206 |
var iframeId = 'siteorigin-panels-live-preview-' + this.previewFrameId;
|
6207 |
|
6208 |
// Remove the old preview frame
|
6209 |
+
this.previewIframe = $( '<iframe src="' + url + '"></iframe>' )
|
6210 |
.attr( {
|
6211 |
'id' : iframeId,
|
6212 |
'name' : iframeId,
|
6216 |
this.setupPreviewFrame( this.previewIframe );
|
6217 |
|
6218 |
// We can use a normal POST form submit
|
6219 |
+
var tempForm = $( '<form id="soPostToPreviewFrame" method="post"></form>' )
|
6220 |
.attr( {
|
6221 |
id: iframeId,
|
6222 |
target: this.previewIframe.attr('id'),
|
6234 |
} );
|
6235 |
|
6236 |
tempForm
|
6237 |
+
.trigger( 'submit' )
|
6238 |
.remove();
|
6239 |
|
6240 |
this.previewFrameId++;
|
6297 |
.css( {
|
6298 |
'cursor': 'pointer'
|
6299 |
} )
|
6300 |
+
.on( 'mouseenter', function() {
|
6301 |
widgetEdit.parent().addClass( 'so-hovered' );
|
6302 |
thisView.highlightElement( $$ );
|
6303 |
} )
|
6304 |
+
.on( 'mouseleave', function() {
|
6305 |
widgetEdit.parent().removeClass( 'so-hovered' );
|
6306 |
thisView.resetHighlights();
|
6307 |
} )
|
6308 |
+
.on( 'click', function( e ) {
|
6309 |
e.preventDefault();
|
6310 |
// When we click a widget, send that click to the form
|
6311 |
+
widgetEdit.find( '.title h4' ).trigger( 'click' );
|
6312 |
} );
|
6313 |
} );
|
6314 |
|
6315 |
// Prevent default clicks inside the preview iframe
|
6316 |
+
$iframeContents.find( "a" ).css( {'pointer-events': 'none'} ).on( 'click', function( e ) {
|
6317 |
e.preventDefault();
|
6318 |
} );
|
6319 |
|
6375 |
this.listenTo(rowCells, 'add', this.handleCellAdd );
|
6376 |
this.listenTo(rowCells, 'remove', this.handleCellRemove );
|
6377 |
|
6378 |
+
this.listenTo( this.model, 'reweight_cells', this.resizeRow );
|
6379 |
this.listenTo( this.model, 'destroy', this.onModelDestroy );
|
6380 |
|
6381 |
var thisView = this;
|
6436 |
this.$('.so-row-toolbar .so-row-move' ).remove();
|
6437 |
this.$el.addClass('so-row-no-move');
|
6438 |
}
|
6439 |
+
|
6440 |
+
if ( ! this.$('.so-row-toolbar').html().trim().length ) {
|
6441 |
this.$('.so-row-toolbar' ).remove();
|
6442 |
}
|
6443 |
|
6444 |
// Resize the rows when ever the widget sortable moves
|
6445 |
+
this.listenTo( this.builder, 'widget_sortable_move', this.resizeRow );
|
6446 |
+
this.listenTo( this.builder, 'builder_resize', this.resizeRow );
|
6447 |
|
6448 |
+
this.resizeRow();
|
6449 |
|
6450 |
return this;
|
6451 |
},
|
6462 |
*
|
6463 |
* @param e
|
6464 |
*/
|
6465 |
+
resizeRow: function( e ) {
|
6466 |
// Don't resize this
|
6467 |
if ( ! this.$el.is( ':visible' ) ) {
|
6468 |
return;
|
6487 |
} );
|
6488 |
|
6489 |
// Resize all the grids and cell wrappers
|
6490 |
+
this.$( '.so-cells .cell-wrapper' ).css( 'min-height', Math.max( height, 63 ) + 'px' );
|
6491 |
+
this.$( '.so-cells .resize-handle' ).css( 'height', this.$( '.so-cells .cell-wrapper' ).outerHeight() + 'px' );
|
6492 |
},
|
6493 |
|
6494 |
/**
|
6864 |
this.$( '.style-section-wrapper' ).each( function () {
|
6865 |
var $s = $( this );
|
6866 |
|
6867 |
+
$s.find( '.style-section-head' ).on( 'click', function( e ) {
|
6868 |
e.preventDefault();
|
6869 |
$s.find( '.style-section-fields' ).slideToggle( 'fast' );
|
6870 |
} );
|
6885 |
var frame = null;
|
6886 |
var $s = $( this );
|
6887 |
|
6888 |
+
$s.find( '.so-image-selector' ).on( 'click', function( e ) {
|
6889 |
e.preventDefault();
|
6890 |
|
6891 |
if ( frame === null ) {
|
6934 |
} );
|
6935 |
|
6936 |
// Handle clicking on remove
|
6937 |
+
$s.find( '.remove-image' ).on( 'click', function( e ) {
|
6938 |
e.preventDefault();
|
6939 |
$s.find( '.current-image' ).css( 'background-image', 'none' );
|
6940 |
$s.find( '.so-image-selector > input' ).val( '' );
|
6950 |
var unit = $$.find( 'select' );
|
6951 |
var hidden = $$.find( 'input[type="hidden"]' );
|
6952 |
|
6953 |
+
text.on( 'focus', function(){
|
6954 |
+
$( this ).trigger( 'select' );
|
6955 |
} );
|
6956 |
|
6957 |
/**
|
7053 |
};
|
7054 |
|
7055 |
// Set the value when ever anything changes
|
7056 |
+
text.on( 'change', setValue );
|
7057 |
+
unit.on( 'change', setValue );
|
7058 |
} );
|
7059 |
}
|
7060 |
|
7120 |
if( ! this.cell.row.builder.supports( 'moveWidget' ) ) {
|
7121 |
this.$el.addClass('so-widget-no-move');
|
7122 |
}
|
7123 |
+
|
7124 |
+
if ( ! this.$('.actions').html().trim().length ) {
|
7125 |
this.$( '.actions' ).remove();
|
7126 |
}
|
7127 |
|
7246 |
this.cell.row.builder.addHistoryEntry( 'widget_deleted' );
|
7247 |
|
7248 |
this.$el.fadeOut( 'fast', function () {
|
7249 |
+
this.cell.row.resizeRow();
|
7250 |
this.model.destroy();
|
7251 |
this.cell.row.builder.model.refreshPanelsData();
|
7252 |
this.remove();
|
js/siteorigin-panels.min.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
!function e(t,i,s){function l(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(o)return o(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var h=i[n]={exports:{}};t[n][0].call(h.exports,(function(e){return l(t[n][1][e]||e)}),h,h.exports,e,t,i,s)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<s.length;n++)l(s[n]);return l}({1:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each((function(t){e+=t.get("weight")})),e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){_.isEmpty(t)&&(t=this.builder.getPanelsData());var i=new s.model.historyEntry({text:e,data:JSON.stringify(t),time:parseInt((new Date).getTime()/1e3),collection:this});this.add(i)},onAddEntry:function(e){if(this.models.length>1){var t=this.at(this.models.length-2);(e.get("text")===t.get("text")&&e.get("time")-t.get("time")<15||e.get("data")===t.get("data"))&&(this.remove(e),t.set("count",t.get("count")+1))}for(;this.models.length>this.maxSize;)this.shift()}})},{}],3:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.row,empty:function(){for(var e;;){if(!(e=this.collection.first()))break;e.destroy()}}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){}})},{}],5:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-builder").html(),{})),this.$(".so-content .siteorigin-panels-builder").append(this.builder.$el)},initializeDialog:function(){var e=this;this.once("open_dialog_complete",(function(){e.builder.initSortable()})),this.on("open_dialog_complete",(function(){e.builder.trigger("builder_resize")}))}})},{}],6:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-history-entry").html())),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-history",dialogIcon:"history",events:{"click .so-close":"closeDialog","click .so-restore":"restoreSelectedEntry"},initializeDialog:function(){this.entries=new s.collection.historyEntries,this.on("open_dialog",this.setCurrentEntry,this),this.on("open_dialog",this.renderHistoryEntries,this)},render:function(){var e=this;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load((function(){var t=l(this);t.show(),t.contents().scrollTop(e.previewScrollTop)}))},setRevertEntry:function(e){this.revertEntry=new s.model.historyEntry({data:JSON.stringify(e.getPanelsData()),time:parseInt((new Date).getTime()/1e3)})},setCurrentEntry:function(){this.currentEntry=new s.model.historyEntry({data:JSON.stringify(this.builder.model.getPanelsData()),time:parseInt((new Date).getTime()/1e3)}),this.selectedEntry=this.currentEntry,this.previewEntry(this.currentEntry),this.$(".so-buttons .so-restore").addClass("disabled")},renderHistoryEntries:function(){var e=this,t=this.$(".history-entries").empty();this.currentEntry.get("data")===this.revertEntry.get("data")&&_.isEmpty(this.entries.models)||l(this.historyEntryTemplate({title:panelsOptions.loc.history.revert,count:1})).data("historyEntry",this.revertEntry).prependTo(t),this.entries.each((function(i){var s=e.historyEntryTemplate({title:panelsOptions.loc.history[i.get("text")],count:i.get("count")});l(s).data("historyEntry",i).prependTo(t)})),l(this.historyEntryTemplate({title:panelsOptions.loc.history.current,count:1})).data("historyEntry",this.currentEntry).addClass("so-selected").prependTo(t),t.find(".history-entry").click((function(){var i=jQuery(this);t.find(".history-entry").not(i).removeClass("so-selected"),i.addClass("so-selected");var s=i.data("historyEntry");e.selectedEntry=s,e.selectedEntry.cid!==e.currentEntry.cid?e.$(".so-buttons .so-restore").removeClass("disabled"):e.$(".so-buttons .so-restore").addClass("disabled"),e.previewEntry(s)})),this.updateEntryTimes()},previewEntry:function(e){var t=this.$("iframe.siteorigin-panels-history-iframe");t.hide(),this.previewScrollTop=t.contents().scrollTop(),this.$('form.history-form input[name="live_editor_panels_data"]').val(e.get("data")),this.$('form.history-form input[name="live_editor_post_ID"]').val(this.builder.config.postId),this.$("form.history-form").submit()},restoreSelectedEntry:function(){return!this.$(".so-buttons .so-restore").hasClass("disabled")&&(this.currentEntry.get("data")===this.selectedEntry.get("data")?(this.closeDialog(),!1):("restore"!==this.selectedEntry.get("text")&&this.builder.addHistoryEntry("restore",this.builder.model.getPanelsData()),this.builder.model.loadPanelsData(JSON.parse(this.selectedEntry.get("data"))),this.closeDialog(),!1))},updateEntryTimes:function(){var e=this;this.$(".history-entries .history-entry").each((function(){var t=jQuery(this),i=t.find(".timesince"),s=t.data("historyEntry");i.html(e.timeSince(s.get("time")))}))},timeSince:function(e){var t,i=parseInt((new Date).getTime()/1e3)-e,s=[];return i>3600&&(1===(t=Math.floor(i/3600))?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(1===(t=Math.floor(i/60))?s.push(panelsOptions.loc.time.minute.replace("%d",t)):s.push(panelsOptions.loc.time.minutes.replace("%d",t)),i-=60*t),i>0&&(1===i?s.push(panelsOptions.loc.time.second.replace("%d",i)):s.push(panelsOptions.loc.time.seconds.replace("%d",i))),_.isEmpty(s)?panelsOptions.loc.time.now:panelsOptions.loc.time.ago.replace("%s",s.slice(0,2).join(", "))}})},{}],7:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-directory-items").html())),builder:null,dialogClass:"so-panels-dialog-prebuilt-layouts",dialogIcon:"layouts",layoutCache:{},currentTab:!1,directoryPage:1,events:{"click .so-close":"closeDialog","click .so-sidebar-tabs li a":"tabClickHandler","click .so-content .layout":"layoutClickHandler","keyup .so-sidebar-search":"searchHandler","click .so-screenshot, .so-title":"directoryItemClickHandler"},initializeDialog:function(){var e=this;this.on("open_dialog",(function(){e.$(".so-sidebar-tabs li a").first().click(),e.$(".so-status").removeClass("so-panels-loading")})),this.on("button_click",this.toolbarButtonClick,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-prebuilt").html(),{})),this.initToolbar()},tabClickHandler:function(e){e.preventDefault(),this.selectedLayoutItem=null,this.uploadedLayout=null,this.updateButtonState(!1),this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=l(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");this.$(".so-content").empty(),this.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),this.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(l("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui"),s=new plupload.Uploader({runtimes:"html5,silverlight,flash,html4",browse_button:i.find(".file-browse-button").get(0),container:i.get(0),drop_element:i.find(".drag-upload-area").get(0),file_data_name:"panels_import_data",multiple_queues:!1,max_file_size:panelsOptions.plupload.max_file_size,url:panelsOptions.plupload.url,flash_swf_url:panelsOptions.plupload.flash_swf_url,silverlight_xap_url:panelsOptions.plupload.silverlight_xap_url,filters:[{title:panelsOptions.plupload.filter_title,extensions:"json"}],multipart_params:{action:"so_panels_import_layout"},init:{PostInit:function(e){e.features.dragdrop&&i.addClass("has-drag-drop"),i.find(".progress-precent").css("width","0%")},FilesAdded:function(e){i.find(".file-browse-button").blur(),i.find(".drag-upload-area").removeClass("file-dragover"),i.find(".progress-bar").fadeIn("fast"),t.$(".js-so-selected-file").text(panelsOptions.loc.prebuilt_loading),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,s,l){var o=JSON.parse(l.response);_.isUndefined(o.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=o,i.find(".progress-bar").hide(),t.$(".js-so-selected-file").text(panelsOptions.loc.ready_to_insert.replace("%s",s.name)),t.updateButtonState(!0))},Error:function(){alert(panelsOptions.plupload.error_message)}}});s.init(),/Edge\/\d./i.test(navigator.userAgent)&&setTimeout((function(){s.refresh()}),250),i.find(".drag-upload-area").on("dragover",(function(){l(this).addClass("file-dragover")})).on("dragleave",(function(){l(this).removeClass("file-dragover")})),e.find(".so-export").submit((function(e){var i=l(this),s=t.builder.model.getPanelsData(),o=l('input[name="post_title"], .editor-post-title__input').val();if(o){if(l(".block-editor-page").length){var n=t.getCurrentBlockPosition();n>=0&&(o+="-"+n)}}else o=l('input[name="post_ID"]').val();s.name=o,i.find('input[name="panels_export_data"]').val(JSON.stringify(s))}))},getCurrentBlockPosition:function(){var e=wp.data.select("core/block-editor").getSelectedBlockClientId();return wp.data.select("core/block-editor").getBlocks().findIndex((function(t){return t.clientId===e}))},displayLayoutDirectory:function(e,t,i){var s=this,o=this.$(".so-content").empty().addClass("so-panels-loading");if(void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory-siteorigin"),i.match("^directory-")&&!panelsOptions.directory_enabled)return o.removeClass("so-panels-loading").html(l("#siteorigin-panels-directory-enable").html()),void o.find(".so-panels-enable-directory").click((function(n){n.preventDefault(),l.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},(function(){})),panelsOptions.directory_enabled=!0,o.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t,i)}));l.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i,builderType:this.builder.config.builderType},(function(n){if(s.currentTab===i){o.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=o.find(".so-previous"),r=o.find(".so-next");t<=1?a.addClass("button-disabled"):a.click((function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)})),t===n.max_num_pages||0===n.max_num_pages?r.addClass("button-disabled"):r.click((function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)})),o.find(".so-screenshot").each((function(){var e=l(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=l("<img/>").attr("src",e.data("src")).load((function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")}));else l("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")})),o.find(".so-directory-browse").html(n.title)}}),"json")},directoryItemClickHandler:function(e){var t=this.$(e.target).closest(".so-directory-item");this.$(".so-directory-items").find(".selected").removeClass("selected"),t.addClass("selected"),this.selectedLayoutItem={lid:t.data("layout-id"),type:t.data("layout-type")},this.updateButtonState(!0)},toolbarButtonClick:function(e){if(!this.canAddLayout())return!1;var t=e.data("value");if(_.isUndefined(t))return!1;if(this.updateButtonState(!1),e.hasClass("so-needs-confirm")&&!e.hasClass("so-confirmed")){if(this.updateButtonState(!0),e.hasClass("so-confirming"))return;e.addClass("so-confirming");var i=e.html();return e.html('<span class="dashicons dashicons-yes"></span>'+e.data("confirm")),setTimeout((function(){e.removeClass("so-confirmed").html(i)}),2500),setTimeout((function(){e.removeClass("so-confirming"),e.addClass("so-confirmed")}),200),!1}this.addingLayout=!0,"import"===this.currentTab?this.addLayoutToBuilder(this.uploadedLayout,t):this.loadSelectedLayout().then(function(e){this.addLayoutToBuilder(e,t)}.bind(this))},canAddLayout:function(){return(this.selectedLayoutItem||this.uploadedLayout)&&!this.addingLayout},loadSelectedLayout:function(){this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0);var e=_.extend(this.selectedLayoutItem,{action:"so_panels_get_layout",builderType:this.builder.config.builderType}),t=new l.Deferred;return l.get(panelsOptions.ajaxurl,e,function(e){var i="";e.success?t.resolve(e.data):(i=e.data.message,t.reject(e.data)),this.setStatusMessage(i,!1,!e.success),this.updateButtonState(!0)}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(l(e.currentTarget).val(),1,this.currentTab)},updateButtonState:function(e){e=e&&(this.selectedLayoutItem||this.uploadedLayout);var t=this.$(".so-import-layout");t.prop("disabled",!e),e?t.removeClass("disabled"):t.addClass("disabled")},addLayoutToBuilder:function(e,t){this.builder.addHistoryEntry("prebuilt_loaded"),this.builder.model.loadPanelsData(e,t),this.addingLayout=!1,this.closeDialog()}})},{}],8:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-row-cell-preview").html())),editableLabel:!0,events:{"click .so-close":"closeDialog","click .so-toolbar .so-save":"saveHandler","click .so-toolbar .so-insert":"insertHandler","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler","change .row-set-form > *":"setCellsFromForm","click .row-set-form button.set-row":"setCellsFromForm"},rowView:null,dialogIcon:"add-row",dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:null,style:{}},cellStylesCache:[],initializeDialog:function(){this.on("open_dialog",(function(){_.isUndefined(this.model)||_.isEmpty(this.model.get("cells"))?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview(),this.renderStyles(),this.openSelectedCellStyles()}),this),this.row={cells:new s.collection.cells([{weight:.5},{weight:.5}]),style:{}},this.dialogFormsLoaded=0;var e=this;this.on("form_loaded styles_loaded",(function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})),this.on("close_dialog",this.closeHandler),this.on("edit_label",function(e){if(e!==panelsOptions.loc.row.add&&e!==panelsOptions.loc.row.edit||(e=""),this.model.set("label",e),_.isEmpty(e)){var t="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.$(".so-title").text(t)}}.bind(this))},setRowDialogType:function(e){this.dialogType=e},render:function(){var e="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-row").html(),{title:e,dialogType:this.dialogType}));var t=this.$(".so-title");return this.model.has("label")&&!_.isEmpty(this.model.get("label"))&&t.text(this.model.get("label")),this.$(".so-edit-title").val(t.text()),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove(),_.isUndefined(this.model)||(this.$('input[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction"))),this.$("input.so-row-field").keyup((function(){l(this).trigger("change")})),this},renderStyles:function(){this.styles&&(this.styles.off("styles_loaded"),this.styles.remove()),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("row",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this});var e=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(e),this.styles.on("styles_loaded",(function(t){t||(this.styles.remove(),0===e.children().length&&(e.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),e.hide()))}),this)},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.get("cells").clone(),style:{},ratio:this.model.get("ratio"),ratio_direction:this.model.get("ratio_direction")},this.$('input[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction")),this.clearCellStylesCache(),this)},regenerateRowPreview:function(){var e,t=this,i=this.$(".row-preview"),s=this.getSelectedCellIndex();i.empty(),this.row.cells.each((function(o,n){var a=l(this.cellPreviewTemplate({weight:o.get("weight")}));i.append(a),n==s&&a.find(".preview-cell-in").addClass("cell-selected");var r,d=a.prev();d.length&&((r=l('<div class="resize-handle"></div>')).appendTo(a).dblclick((function(){var e=t.row.cells.at(n-1),i=o.get("weight")+e.get("weight");o.set("weight",i/2),e.set("weight",i/2),t.scaleRowWidths()})),r.draggable({axis:"x",containment:i,start:function(e,t){var i=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),left:6,height:a.outerHeight()});i.find(".resize-handle").remove();var s=d.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:d.outerWidth(),right:6,height:d.outerHeight()});s.find(".resize-handle").remove(),l(this).data({newCellClone:i,prevCellClone:s}),a.find("> .preview-cell-in").css("visibility","hidden"),d.find("> .preview-cell-in").css("visibility","hidden")},drag:function(e,s){var o=t.row.cells.at(n).get("weight"),a=t.row.cells.at(n-1).get("weight"),r=o-(s.position.left+6)/i.width(),d=a+(s.position.left+6)/i.width();s.helper.offset().left,i.offset().left;l(this).data("newCellClone").css("width",i.width()*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10),l(this).data("prevCellClone").css("width",i.width()*d).find(".preview-cell-weight").html(Math.round(1e3*d)/10)},stop:function(e,s){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove(),a.find(".preview-cell-in").css("visibility","visible"),d.find(".preview-cell-in").css("visibility","visible");var o=(s.position.left+6)/i.width(),r=t.row.cells.at(n),h=t.row.cells.at(n-1);r.get("weight")-o>.02&&h.get("weight")+o>.02&&(r.set("weight",r.get("weight")-o),h.set("weight",h.get("weight")+o)),t.scaleRowWidths(),s.helper.css("left",-6)}})),a.click(function(e){if(l(e.target).is(".preview-cell")||l(e.target).is(".preview-cell-in")){var t=l(e.target);t.closest(".row-preview").find(".preview-cell .preview-cell-in").removeClass("cell-selected"),t.addClass("cell-selected"),this.openSelectedCellStyles()}}.bind(this)),a.find(".preview-cell-weight").click((function(s){t.$(".resize-handle").css("pointer-event","none").draggable("disable"),i.find(".preview-cell-weight").each((function(){var s=jQuery(this).hide();l('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(s.html())).insertAfter(s).focus((function(){clearTimeout(e)})).keyup((function(e){9!==e.keyCode&&l(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),l(this).blur())})).keydown((function(e){if(9===e.keyCode){e.preventDefault();var t=i.find(".preview-cell-weight-input"),s=t.index(l(this));s===t.length-1?t.eq(0).focus().select():t.eq(s+1).focus().select()}})).blur((function(){i.find(".preview-cell-weight-input").each((function(e,i){isNaN(parseFloat(l(i).val()))&&l(i).val(Math.floor(1e3*t.row.cells.at(e).get("weight"))/10)})),e=setTimeout((function(){if(0===i.find(".preview-cell-weight-input").length)return!1;var e=[],s=[],o=0,n=0;if(i.find(".preview-cell-weight-input").each((function(i,a){var r=parseFloat(l(a).val());r=isNaN(r)?1/t.row.cells.length:Math.round(10*r)/1e3;var d=!l(a).hasClass("no-user-interacted");e.push(r),s.push(d),d?o+=r:n+=r})),o>0&&n>0&&1-o>0)for(var a=0;a<e.length;a++)s[a]||(e[a]=e[a]/n*(1-o));var r=_.reduce(e,(function(e,t){return e+t}));e=e.map((function(e){return e/r})),Math.min.apply(Math,e)>.01&&t.row.cells.each((function(t,i){t.set("weight",e[i])})),i.find(".preview-cell").each((function(e,i){var s=t.row.cells.at(e).get("weight");l(i).animate({width:Math.round(1e3*s)/10+"%"},250),l(i).find(".preview-cell-weight-input").val(Math.round(1e3*s)/10)})),i.find(".preview-cell").css("overflow","visible"),setTimeout(t.regenerateRowPreview.bind(t),260)}),100)})).click((function(){l(this).select()}))})),l(this).siblings(".preview-cell-weight-input").select()}))}),this),this.trigger("form_loaded",this)},getSelectedCellIndex:function(){var e=-1;return this.$(".preview-cell .preview-cell-in").each((function(t,i){l(i).is(".cell-selected")&&(e=t)})),e},openSelectedCellStyles:function(){if(!_.isUndefined(this.cellStyles)){if(this.cellStyles.stylesLoaded){var e={};try{e=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",e)}this.cellStyles.detach()}if(this.cellStyles=this.getSelectedCellStyles(),this.cellStyles){var t=this.$(".so-sidebar.so-right-sidebar");this.cellStyles.attach(t),this.cellStyles.on("styles_loaded",(function(e){e&&(t.closest(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"),t.show())}))}},getSelectedCellStyles:function(){var e=this.getSelectedCellIndex();if(e>-1){var t=this.cellStylesCache[e];t||((t=new s.view.styles).model=this.row.cells.at(e),t.render("cell",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this,index:e}),this.cellStylesCache[e]=t)}return t},clearCellStylesCache:function(){this.cellStylesCache.forEach((function(e){e.remove(),e.off("styles_loaded")})),this.cellStylesCache=[]},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each((function(t,i){var s=e.row.cells.at(t);l(i).css("width",100*s.get("weight")+"%").find(".preview-cell-weight").html(Math.round(1e3*s.get("weight"))/10)}))},setCellsFromForm:function(){try{var e={cells:parseInt(this.$('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$('.row-set-form select[name="ratio"]').val()),direction:this.$('.row-set-form select[name="ratio_direction"]').val()};_.isNaN(e.cells)&&(e.cells=1),isNaN(e.ratio)&&(e.ratio=1),e.cells<1?(e.cells=1,this.$('.row-set-form input[name="cells"]').val(e.cells)):e.cells>12&&(e.cells=12,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form select[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,o=1,n=0;n<e.cells;n++)t.push(o),o*=e.ratio;var a=_.reduce(t,(function(e,t){return e+t}));if(t=_.map(t,(function(e){return e/a})),t=_.filter(t,(function(e){return e>.01})),"left"===e.direction&&(t=t.reverse()),this.row.cells=new s.collection.cells(this.row.cells.first(t.length)),_.each(t,function(e,t){var i=this.row.cells.at(t);i?i.set("weight",e):(i=new s.model.cell({weight:e,row:this.model}),this.row.cells.add(i))}.bind(this)),this.row.ratio=e.ratio,this.row.ratio_direction=e.direction,i)this.regenerateRowPreview();else{var r=this;this.$(".preview-cell").each((function(e,t){var i=r.row.cells.at(e).get("weight");l(t).animate({width:Math.round(1e3*i)/10+"%"},250),l(t).find(".preview-cell-weight").html(Math.round(1e3*i)/10)})),this.$(".preview-cell").css("overflow","visible"),setTimeout(r.regenerateRowPreview.bind(r),260)}}catch(e){console.log("Error setting cells - "+e.message)}this.$(".row-set-form .so-button-row-set").removeClass("button-primary")},tabClickHandler:function(e){"#row-layout"===e.attr("href")?this.$(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"):this.$(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar")},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),_.isEmpty(this.model)||(this.model.setCells(this.row.cells),this.model.set("ratio",this.row.ratio),this.model.set("ratio_direction",this.row.ratio_direction)),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-row-styles").style}catch(e){console.log("Error retrieving row styles - "+e.message)}this.model.set("style",t)}if(!_.isUndefined(this.cellStyles)&&this.cellStyles.stylesLoaded){t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.updateModel();var e=this.builder.getActiveCell({createCell:!1}),t={};return null!==e&&(t.at=this.builder.model.get("rows").indexOf(e.row)+1),this.model.collection=this.builder.model.get("rows"),this.builder.model.get("rows").add(this.model,t),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},deleteHandler:function(){return this.rowView.visualDestroyModel(),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1},closeHandler:function(){this.clearCellStylesCache(),_.isUndefined(this.cellStyles)||(this.cellStyles=void 0)}})},{}],9:[function(e,t,i){var s=window.panels,l=jQuery,o=e("../view/widgets/js-widget");t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widget-sidebar-widget").html())),dialogClass:"so-panels-dialog-edit-widget",dialogIcon:"add-widget",widgetView:!1,savingWidget:!1,editableLabel:!0,events:{"click .so-close":"saveHandler","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler"},initializeDialog:function(){var e=this;this.listenTo(this.model,"change:values",this.handleChangeValues),this.listenTo(this.model,"destroy",this.remove),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",(function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})),this.on("edit_label",function(e){e===panelsOptions.widgets[this.model.get("class")].title&&(e=""),this.model.set("label",e),_.isEmpty(e)&&this.$(".so-title").text(this.model.getWidgetField("title"))}.bind(this))},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm();var e=this.model.getWidgetField("title");this.$(".so-title .widget-name").html(e),this.$(".so-edit-title").val(e),this.builder.supports("addWidget")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteWidget")||this.$(".so-buttons .so-delete").remove(),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this});var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",(function(e){e||(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())}),this)},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(0===i)return!1;do{if(t=e.eq(--i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog()}while(!_.isUndefined(t)&&i>0);return!1},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(i===e.length-1)return!1;do{if(t=e.eq(++i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog()}while(!_.isUndefined(t));return!1},loadForm:function(){if(this.$("> *").length){this.$(".so-content").addClass("so-panels-loading");var e={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")},t=this.$(".so-content");l.post(panelsOptions.ajaxurl,e,null,"html").done(function(e){var i=e.replace(/{\$id}/g,this.model.cid);t.removeClass("so-panels-loading").html(i),this.trigger("form_loaded",this),this.$(".panel-dialog").trigger("panelsopen"),this.on("close_dialog",this.updateModel,this),t.find("> .widget-content").length>0&&o.addWidget(t,this.model.widget_id)}.bind(this)).fail((function(e){var i;i=e&&e.responseText?e.responseText:panelsOptions.forms.loadingFailed,t.removeClass("so-panels-loading").html(i)}))}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();t=_.isUndefined(t.widgets)?{}:(t=t.widgets)[Object.keys(t)[0]],this.model.setValues(t),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var i={};try{i=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(e){}this.model.set("style",i)}this.savingWidget=!1,e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHandler:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.widgetView.visualDestroyModel(),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.widgetView.duplicateHandler(),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{"../view/widgets/js-widget":32}],10:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widgets-widget").html())),filter:{},dialogClass:"so-panels-dialog-add-widget",dialogIcon:"add-widget",events:{"click .so-close":"closeDialog","click .widget-type":"widgetClickHandler","keyup .so-sidebar-search":"searchHandler"},initializeDialog:function(){this.on("open_dialog",(function(){this.filter.search="",this.filterWidgets(this.filter)}),this),this.on("open_dialog_complete",(function(){this.$(".so-sidebar-search").val("").focus(),this.balanceWidgetHeights()})),this.on("tab_click",this.tabClickHandler,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,(function(e){var t=l(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),l('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e.class).appendTo(this.$(".widget-type-list"))}),this);var e=this.$(".so-sidebar-tabs");_.each(panelsOptions.widget_dialog_tabs,(function(t,i){l(this.dialogTabTemplate({title:t.title,tab:i})).data({message:t.message,filter:t.filter}).appendTo(e)}),this),this.initTabs();var t=this;l(window).resize((function(){t.balanceWidgetHeights()}))},tabClickHandler:function(e){this.filter=e.parent().data("filter"),this.filter.search=this.$(".so-sidebar-search").val();var t=e.parent().data("message");return _.isEmpty(t)&&(t=""),this.$(".so-toolbar .so-status").html(t),this.filterWidgets(this.filter),!1},searchHandler:function(e){if(13===e.which){var t=this.$(".widget-type-list .widget-type:visible");1===t.length&&t.click()}else this.filter.search=l(e.target).val().trim(),this.filterWidgets(this.filter)},filterWidgets:function(e){_.isUndefined(e)&&(e={}),_.isUndefined(e.groups)&&(e.groups=""),this.$(".widget-type-list .widget-type").each((function(){var t,i=l(this),s=i.data("class"),o=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];(t=!!_.isEmpty(e.groups)||null!==o&&!_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups)))&&(_.isUndefined(e.search)||""===e.search||-1===o.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()})),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.trigger("before_user_adds_widget"),this.builder.addHistoryEntry("widget_added");var t=l(e.currentTarget),i=new s.model.widget({class:t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.get("widgets").add(i),this.closeDialog(),this.builder.model.refreshPanelsData(),this.builder.trigger("after_user_adds_widget",i)},balanceWidgetHeights:function(e){var t=[[]],i=null,s=Math.round(this.$(".widget-type").parent().width()/this.$(".widget-type").width());this.$(".widget-type").css("clear","none").filter(":visible").each((function(e,t){e%s==0&&0!==e&&l(t).css("clear","both")})),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each((function(e,s){var o=l(s);null!==i&&i.position().top!==o.position().top&&(t[t.length]=[]),i=o,t[t.length-1].push(o)})),_.each(t,(function(e,t){var i=_.max(e.map((function(e){return e.height()})));_.each(e,(function(e){e.height(i)}))}))}})},{}],11:[function(e,t,i){t.exports={canCopyPaste:function(){return"undefined"!=typeof Storage&&panelsOptions.user},setModel:function(e){if(!this.canCopyPaste())return!1;var t=panels.helpers.serialize.serialize(e);return e instanceof panels.model.row?t.thingType="row-model":e instanceof panels.model.widget&&(t.thingType="widget-model"),localStorage["panels_clipboard_"+panelsOptions.user]=JSON.stringify(t),!0},isModel:function(e){if(!this.canCopyPaste())return!1;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&((t=JSON.parse(t)).thingType&&t.thingType===e)},getModel:function(e){if(!this.canCopyPaste())return null;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&(t=JSON.parse(t)).thingType&&t.thingType===e?panels.helpers.serialize.unserialize(t,t.thingType,null):null}}},{}],12:[function(e,t,i){t.exports={isBlockEditor:function(){return void 0!==wp.blocks},isClassicEditor:function(e){return e.attachedToEditor&&e.$el.is(":visible")}}},{}],13:[function(e,t,i){t.exports={lock:function(){if("hidden"!==jQuery("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];jQuery("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlock:function(){if("hidden"===jQuery("body").css("overflow")&&!jQuery(".so-panels-dialog-wrapper").is(":visible")&&!jQuery(".so-panels-live-editor").is(":visible")){jQuery("body").css("overflow","visible");var e=jQuery("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}}},{}],14:[function(e,t,i){t.exports={serialize:function(e){var t;if(e instanceof Backbone.Model){var i={};for(var s in e.attributes)if(e.attributes.hasOwnProperty(s)){if("builder"===s||"collection"===s)continue;(t=e.attributes[s])instanceof Backbone.Model||t instanceof Backbone.Collection?i[s]=this.serialize(t):i[s]=t}return i}if(e instanceof Backbone.Collection){for(var l=[],o=0;o<e.models.length;o++)(t=e.models[o])instanceof Backbone.Model||t instanceof Backbone.Collection?l.push(this.serialize(t)):l.push(t);return l}},unserialize:function(e,t,i){var s;switch(t){case"row-model":(s=new panels.model.row).builder=i;var l={style:e.style};e.hasOwnProperty("label")&&(l.label=e.label),e.hasOwnProperty("color_label")&&(l.color_label=e.color_label),s.set(l),s.setCells(this.unserialize(e.cells,"cell-collection",s));break;case"cell-model":(s=new panels.model.cell).row=i,s.set("weight",e.weight),s.set("style",e.style),s.set("widgets",this.unserialize(e.widgets,"widget-collection",s));break;case"widget-model":for(var o in(s=new panels.model.widget).cell=i,e)e.hasOwnProperty(o)&&s.set(o,e[o]);s.set("widget_id",panels.helpers.utils.generateUUID());break;case"cell-collection":s=new panels.collection.cells;for(var n=0;n<e.length;n++)s.push(this.unserialize(e[n],"cell-model",i));break;case"widget-collection":s=new panels.collection.widgets;for(n=0;n<e.length;n++)s.push(this.unserialize(e[n],"widget-model",i));break;default:console.log("Unknown Thing - "+t)}return s}}},{}],15:[function(e,t,i){t.exports={generateUUID:function(){var e=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)}))},processTemplate:function(e){return _.isUndefined(e)||_.isNull(e)?"":e=(e=(e=e.replace(/{{%/g,"<%")).replace(/%}}/g,"%>")).trim()},selectElementContents:function(e){var t=document.createRange();t.selectNodeContents(e);var i=window.getSelection();i.removeAllRanges(),i.addRange(t)}}},{}],16:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=function(e,t){return this.each((function(){var i=jQuery(this);if(!i.data("soPanelsBuilderWidgetInitialized")||t){var o=i.closest("form").find(".widget-id").val(),n=l.extend(!0,{builderSupports:i.data("builder-supports")},e);if(_.isUndefined(o)||!(o.indexOf("__i__")>-1)){var a=new s.model.builder,r=new s.view.builder({model:a,config:n}),d=i.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(d)||(d.on("close_dialog",(function(){a.refreshPanelsData()})),d.on("open_dialog_complete",(function(){r.trigger("builder_resize")})),d.model.on("destroy",(function(){a.emptyRows().destroy()})),r.setDialogParents(panelsOptions.loc.layout_widget,d));var h=Boolean(i.closest(".widget-content").length);r.render().attach({container:i,dialog:h||"dialog"===i.data("mode"),type:i.data("type")}).setDataField(i.find("input.panels-data")),h||"dialog"===i.data("mode")?(r.setDialogParents(panelsOptions.loc.layout_widget,r.dialog),i.find(".siteorigin-panels-display-builder").click((function(e){e.preventDefault(),r.dialog.openDialog()}))):i.find(".siteorigin-panels-display-builder").parent().remove(),l(document).trigger("panels_setup",r),i.data("soPanelsBuilderWidgetInitialized",!0)}}}))}},{}],17:[function(e,t,i){
|
2 |
/**
|
3 |
* Everything we need for SiteOrigin Page Builder.
|
4 |
*
|
5 |
* @copyright Greg Priday 2013 - 2016 - <https://siteorigin.com/>
|
6 |
* @license GPL 3.0 http://www.gnu.org/licenses/gpl.html
|
7 |
*/
|
8 |
-
var s={};window.panels=s,window.siteoriginPanels=s,s.helpers={},s.helpers.clipboard=e("./helpers/clipboard"),s.helpers.utils=e("./helpers/utils"),s.helpers.editor=e("./helpers/editor"),s.helpers.serialize=e("./helpers/serialize"),s.helpers.pageScroll=e("./helpers/page-scroll"),s.model={},s.model.widget=e("./model/widget"),s.model.cell=e("./model/cell"),s.model.row=e("./model/row"),s.model.builder=e("./model/builder"),s.model.historyEntry=e("./model/history-entry"),s.collection={},s.collection.widgets=e("./collection/widgets"),s.collection.cells=e("./collection/cells"),s.collection.rows=e("./collection/rows"),s.collection.historyEntries=e("./collection/history-entries"),s.view={},s.view.widget=e("./view/widget"),s.view.cell=e("./view/cell"),s.view.row=e("./view/row"),s.view.builder=e("./view/builder"),s.view.dialog=e("./view/dialog"),s.view.styles=e("./view/styles"),s.view.liveEditor=e("./view/live-editor"),s.dialog={},s.dialog.builder=e("./dialog/builder"),s.dialog.widgets=e("./dialog/widgets"),s.dialog.widget=e("./dialog/widget"),s.dialog.prebuilt=e("./dialog/prebuilt"),s.dialog.row=e("./dialog/row"),s.dialog.history=e("./dialog/history"),s.utils={},s.utils.menu=e("./utils/menu"),jQuery.fn.soPanelsSetupBuilderWidget=e("./jquery/setup-builder-widget"),jQuery((function(e){var t,i,s,l,o=e("#siteorigin-panels-metabox");if(s=e("form#post"),o.length&&s.length)t=o,i=o.find(".siteorigin-panels-data-field"),l={editorType:"tinyMCE",postId:e("#post_ID").val(),editorId:"#content",builderType:o.data("builder-type"),builderSupports:o.data("builder-supports"),loadOnAttach:panelsOptions.loadOnAttach&&1==e("#auto_draft").val(),loadLiveEditor:1==o.data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var n=e(".siteorigin-panels-builder-form");t=n.find(".siteorigin-panels-builder-container"),i=n.find('input[name="panels_data"]'),s=n,l={editorType:"standalone",postId:n.data("post-id"),editorId:"#post_content",builderType:n.data("type"),builderSupports:n.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:n.data("preview-url")}}if(!_.isUndefined(t)){var a=window.siteoriginPanels,r=new a.model.builder,d=new a.view.builder({model:r,config:l});e(document).trigger("before_panels_setup",d),d.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit((function(){r.refreshPanelsData()})),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",d,window.panels),window.soPanelsBuilderView=d}e(document).on("widget-added",(function(t,i){e(i).find(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})),e("body").hasClass("wp-customizer")||e((function(){e(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})),e(window).on("keyup",(function(t){27===t.which&&e(".so-panels-dialog-wrapper, .so-panels-live-editor").filter(":visible").last().find(".so-title-bar .so-close, .live-editor-close").click()}))}))},{"./collection/cells":1,"./collection/history-entries":2,"./collection/rows":3,"./collection/widgets":4,"./dialog/builder":5,"./dialog/history":6,"./dialog/prebuilt":7,"./dialog/row":8,"./dialog/widget":9,"./dialog/widgets":10,"./helpers/clipboard":11,"./helpers/editor":12,"./helpers/page-scroll":13,"./helpers/serialize":14,"./helpers/utils":15,"./jquery/setup-builder-widget":16,"./model/builder":18,"./model/cell":19,"./model/history-entry":20,"./model/row":21,"./model/widget":22,"./utils/menu":23,"./view/builder":24,"./view/cell":25,"./view/dialog":26,"./view/live-editor":27,"./view/row":28,"./view/styles":29,"./view/widget":30}],18:[function(e,t,i){t.exports=Backbone.Model.extend({layoutPosition:{BEFORE:"before",AFTER:"after",REPLACE:"replace"},rows:{},defaults:{data:{widgets:[],grids:[],grid_cells:[]}},initialize:function(){this.set("rows",new panels.collection.rows)},addRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var s=new panels.collection.cells(t);e=_.extend({collection:this.get("rows"),cells:s},e);var l=new panels.model.row(e);return l.builder=this,this.get("rows").add(l,i),l},loadPanelsData:function(e,t){try{t===this.layoutPosition.BEFORE?e=this.concatPanelsData(e,this.getPanelsData()):t===this.layoutPosition.AFTER&&(e=this.concatPanelsData(this.getPanelsData(),e)),this.emptyRows(),this.set("data",JSON.parse(JSON.stringify(e)),{silent:!0});var i,s=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var l=0;l<e.grid_cells.length;l++)i=parseInt(e.grid_cells[l].grid),_.isUndefined(s[i])&&(s[i]=[]),s[i].push(e.grid_cells[l]);var o=this;if(_.each(s,(function(t,i){var s={};_.isUndefined(e.grids[i].style)||(s.style=e.grids[i].style),_.isUndefined(e.grids[i].ratio)||(s.ratio=e.grids[i].ratio),_.isUndefined(e.grids[i].ratio_direction)||(s.ratio_direction=e.grids[i].ratio_direction),_.isUndefined(e.grids[i].color_label)||(s.color_label=e.grids[i].color_label),_.isUndefined(e.grids[i].label)||(s.label=e.grids[i].label),o.addRow(s,t,{noAnimate:!0})})),_.isUndefined(e.widgets))return;_.each(e.widgets,(function(e){var t=null;_.isUndefined(e.panels_info)?(t=e.info,delete e.info):(t=e.panels_info,delete e.panels_info);var i=o.get("rows").at(parseInt(t.grid)).get("cells").at(parseInt(t.cell)),s=new panels.model.widget({class:t.class,values:e});_.isUndefined(t.style)||s.set("style",t.style),_.isUndefined(t.read_only)||s.set("read_only",t.read_only),_.isUndefined(t.widget_id)?s.set("widget_id",panels.helpers.utils.generateUUID()):s.set("widget_id",t.widget_id),_.isUndefined(t.label)||s.set("label",t.label),s.cell=i,i.get("widgets").add(s,{noAnimate:!0})})),this.trigger("load_panels_data")}catch(e){console.log("Error loading data: "+e.message)}},concatPanelsData:function(e,t){if(_.isUndefined(t)||_.isUndefined(t.grids)||_.isEmpty(t.grids)||_.isUndefined(t.grid_cells)||_.isEmpty(t.grid_cells))return e;if(_.isUndefined(e)||_.isUndefined(e.grids)||_.isEmpty(e.grids))return t;var i,s=e.grids.length,l=_.isUndefined(e.widgets)?0:e.widgets.length,o={grids:[],grid_cells:[],widgets:[]};for(o.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(o.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(o.widgets=e.widgets.slice()),i=0;i<t.grid_cells.length;i++){var n=t.grid_cells[i];n.grid=parseInt(n.grid)+s,o.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(i=0;i<t.widgets.length;i++){var a=t.widgets[i];a.panels_info.grid=parseInt(a.panels_info.grid)+s,a.panels_info.id=parseInt(a.panels_info.id)+l,o.widgets.push(a)}return o},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.get("rows").each((function(i,s){i.get("cells").each((function(i,l){i.get("widgets").each((function(i,o){var n={class:i.get("class"),raw:i.get("raw"),grid:s,cell:l,id:t++,widget_id:i.get("widget_id"),style:i.get("style"),label:i.get("label")};_.isEmpty(n.widget_id)&&(n.widget_id=panels.helpers.utils.generateUUID());var a=_.extend(_.clone(i.get("values")),{panels_info:n});e.widgets.push(a)})),e.grid_cells.push({grid:s,index:l,weight:i.get("weight"),style:i.get("style")})})),e.grids.push({cells:i.get("cells").length,style:i.get("style"),ratio:i.get("ratio"),ratio_direction:i.get("ratio_direction"),color_label:i.get("color_label"),label:i.get("label")})})),e},refreshPanelsData:function(e){e=_.extend({silent:!1},e);var t=this.get("data"),i=this.getPanelsData();this.set("data",i,{silent:!0}),e.silent||JSON.stringify(i)===JSON.stringify(t)||(this.trigger("change"),this.trigger("change:data"),this.trigger("refresh_panels_data",i,e))},emptyRows:function(){return _.invoke(this.get("rows").toArray(),"destroy"),this.get("rows").reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},getPanelsDataFromHtml:function(e,t){var i,s=this,l=jQuery('<div id="wrapper">'+e+"</div>");if(l.find(".panel-layout .panel-grid").length){var o={grids:[],grid_cells:[],widgets:[]},n=new RegExp(panelsOptions.siteoriginWidgetRegex,"i"),a=(i=document.createElement("div"),function(e){return e&&"string"==typeof e&&(e=(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,"")).replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,""),i.innerHTML=e,e=i.textContent,i.textContent=""),e}),r=function(e){var t,i=e.find("div");if(!i.length)return e.html();for(t=0;t<i.length-1&&jQuery.trim(i.eq(t).text())==jQuery.trim(i.eq(t+1).text());t++);var s=i.eq(t).find(".widget-title:header"),l="";return s.length&&(l=s.html(),s.remove()),{title:l,text:i.eq(t).html()}},d=l.find(".panel-layout").eq(0),h=function(e,t){return jQuery(t).closest(".panel-layout").is(d)};return l.find("> .panel-layout > .panel-grid").filter(h).each((function(e,i){var l=jQuery(i),d=l.find(".panel-grid-cell").filter(h);o.grids.push({cells:d.length,style:l.data("style"),ratio:l.data("ratio"),ratio_direction:l.data("ratio-direction"),color_label:l.data("color-label"),label:l.data("label")}),d.each((function(i,l){var d=jQuery(l),c=d.find(".so-panel").filter(h);o.grid_cells.push({grid:e,weight:_.isUndefined(d.data("weight"))?1:parseFloat(d.data("weight")),style:d.data("style")}),c.each((function(l,d){var h=jQuery(d),c=h.find(".panel-widget-style").length?h.find(".panel-widget-style").html():h.html(),u={grid:e,cell:i,style:h.data("style"),raw:!1,label:h.data("label")};c=c.trim();var p=n.exec(c);if(!_.isNull(p)&&""===c.replace(n,"").trim()){try{var g=/class="(.*?)"/.exec(p[3]),f=jQuery(p[5]),w=JSON.parse(a(f.val())).instance;u.class=g[1].replace(/\\\\+/g,"\\"),u.raw=!1,w.panels_info=u,o.widgets.push(w)}catch(e){u.class=t,o.widgets.push(_.extend(r(h),{filter:"1",type:"visual",panels_info:u}))}return!0}return-1!==c.indexOf("panel-layout")&&jQuery("<div>"+c+"</div>").find(".panel-layout .panel-grid").length?(u.class="SiteOrigin_Panels_Widgets_Layout",o.widgets.push({panels_data:s.getPanelsDataFromHtml(c,t),panels_info:u}),!0):(u.class=t,o.widgets.push(_.extend(r(h),{filter:"1",type:"visual",panels_info:u})),!0)}))}))})),l.find(".panel-layout").remove(),l.find("style[data-panels-style-for-post]").remove(),l.html().replace(/^\s+|\s+$/gm,"").length&&(o.grids.push({cells:1,style:{}}),o.grid_cells.push({grid:o.grids.length-1,weight:1}),o.widgets.push({filter:"1",text:l.html().replace(/^\s+|\s+$/gm,""),title:"",type:"visual",panels_info:{class:t,raw:!1,grid:o.grids.length-1,cell:0}})),o}return{grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:e,title:"",type:"visual",panels_info:{class:t,raw:!1,grid:0,cell:0}}]}}})},{}],19:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0,style:{}},indexes:null,initialize:function(){this.set("widgets",new panels.collection.widgets),this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.get("widgets").toArray(),"destroy"),this.get("widgets").reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.row),t=_.extend({cloneWidgets:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.get("cells"),{silent:!0}),i.row=e,t.cloneWidgets&&this.get("widgets").each((function(e){i.get("widgets").add(e.clone(i,t),{silent:!0})})),i}})},{}],20:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],21:[function(e,t,i){t.exports=Backbone.Model.extend({builder:null,defaults:{style:{}},indexes:null,initialize:function(){_.isEmpty(this.get("cells"))?this.set("cells",new panels.collection.cells):this.get("cells").each(function(e){e.row=this}.bind(this)),this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this.get("cells")||new panels.collection.cells,i=[];t.each((function(s,l){var o=e.at(l);if(o)s.set("weight",o.get("weight"));else{for(var n=t.at(e.length-1),a=s.get("widgets").models.slice(),r=0;r<a.length;r++)a[r].moveToCell(n,{silent:!1});i.push(s)}})),_.each(i,(function(e){t.remove(e)})),e.length>t.length&&_.each(e.slice(t.length,e.length),function(e){e.set({collection:t}),e.row=this,t.add(e)}.bind(this)),this.reweightCells()},reweightCells:function(){var e=0,t=this.get("cells");t.each((function(t){e+=t.get("weight")})),t.each((function(t){t.set("weight",t.get("weight")/e)})),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.get("cells").toArray(),"destroy"),this.get("cells").reset()},clone:function(e){_.isUndefined(e)&&(e=this.builder);var t=new this.constructor(this.attributes);t.set("collection",e.get("rows"),{silent:!0}),t.builder=e;var i=new panels.collection.cells;return this.get("cells").each((function(e){i.add(e.clone(t),{silent:!0})})),t.set("cells",i),t}})},{}],22:[function(e,t,i){t.exports=Backbone.Model.extend({cell:null,defaults:{class:null,missing:!1,values:{},raw:!1,style:{},read_only:!1,widget_id:""},indexes:null,initialize:function(){var e=this.get("class");!_.isUndefined(panelsOptions.widgets[e])&&panelsOptions.widgets[e].installed||this.set("missing",!0)},getWidgetField:function(e){return _.isUndefined(panelsOptions.widgets[this.get("class")])?"title"===e||"description"===e?panelsOptions.loc.missing_widget[e]:"":this.has("label")&&!_.isEmpty(this.get("label"))?this.get("label"):panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t,i){return t=_.extend({silent:!0},t),this.cell=e,this.collection.remove(this,t),e.get("widgets").add(this,_.extend({at:i},t)),this.trigger("move_to_cell",e,i),this},setValues:function(e){var t=!1;JSON.stringify(e)!==JSON.stringify(this.get("values"))&&(t=!0),this.set("values",e,{silent:!0}),t&&(this.trigger("change",this),this.trigger("change:values"))},clone:function(e,t){_.isUndefined(e)&&(e=this.cell);var i=new this.constructor(this.attributes),s=JSON.parse(JSON.stringify(this.get("values"))),l=function(e){return _.each(e,(function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&l(e[i])})),e};return s=l(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("widget_id",""),i.set("values",s,{silent:!0}),i.set("collection",e.get("widgets"),{silent:!0}),i.cell=e,i.isDuplicate=!0,i},getTitle:function(){var e=panelsOptions.widgets[this.get("class")];if(_.isUndefined(e))return this.get("class").replace(/_/g," ");if(!_.isUndefined(e.panels_title)&&!1===e.panels_title)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)"_"!==s.charAt(0)&&"so_sidebar_emulator_id"!==s&&"option_name"!==s&&t.hasOwnProperty(s)&&i.push(s);for(var l in i=_.uniq(i))if(!_.isUndefined(t[i[l]])&&_.isString(t[i[l]])&&""!==t[i[l]]&&"on"!==t[i[l]]&&"true"!==t[i[l]]&&"false"!==t[i[l]]&&"_"!==i[l][0]&&!jQuery.isNumeric(t[i[l]])){var o=t[i[l]],n=(o=o.replace(/<\/?[^>]+(>|$)/g,"")).split(" ");return(n=n.slice(0,20)).join(" ")}return this.getWidgetField("description")}})},{}],23:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({wrapperTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu").html())),sectionTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu-section").html())),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;l(window).on("contextmenu",(function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):!!e.active||(e.active=!1,e.trigger("activate_context",t,e),void(e.active&&(t.preventDefault(),e.openMenu({left:t.pageX,top:t.pageY}))))}))},render:function(){this.setElement(this.wrapperTemplate())},attach:function(){this.$el.appendTo("body")},openMenu:function(e){this.trigger("open_menu"),l(window).on("keyup",{menu:this},this.keyboardListen),l(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",l(window).height()-20),e.left+this.$el.outerWidth()+10>=l(window).width()&&(e.left=l(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-l(window).scrollTop()+10>=l(window).height()&&(e.top=l(window).height()+l(window).scrollTop()-this.$el.outerHeight()-10),e.left<=0&&(e.left=10),this.$el.css({left:e.left+1,top:e.top+1}).show(),this.$(".so-search-wrapper input").focus()},closeMenu:function(){this.trigger("close_menu"),l(window).off("keyup",this.keyboardListen),l(window).off("click",this.clickOutsideListen),this.active=!1,this.$el.empty().hide()},keyboardListen:function(e){var t=e.data.menu;switch(e.which){case 27:t.closeMenu()}},clickOutsideListen:function(e){var t=e.data.menu;3!==e.which&&t.$el.is(":visible")&&!t.isOverEl(t.$el,e)&&t.closeMenu()},addSection:function(e,t,i,s){var o=this;t=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},t);var n=l(this.sectionTemplate({settings:t,items:i})).attr("id","panels-menu-section-"+e);this.$el.append(n),n.find(".so-item:not(.so-confirm)").click((function(){var e=l(this);s(e.data("key")),o.closeMenu()})),n.find(".so-item.so-confirm").click((function(){var e=l(this);if(e.hasClass("so-confirming"))return s(e.data("key")),void o.closeMenu();e.data("original-text",e.html()).addClass("so-confirming").html('<span class="dashicons dashicons-yes"></span> '+panelsOptions.loc.dropdown_confirm),setTimeout((function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))}),2500)})),n.data("settings",t).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},hasSection:function(e){return this.$el.find("#panels-menu-section-"+e).length>0},searchKeyUp:function(e){var t=l(e.currentTarget),i=t.closest(".so-section"),s=i.data("settings");if(38===e.which||40===e.which){var o=i.find("ul li:visible"),n=o.filter(".so-active").eq(0);if(n.length){o.removeClass("so-active");var a=o.index(n);38===e.which?n=a-1<0?o.last():o.eq(a-1):40===e.which&&(n=a+1>=o.length?o.first():o.eq(a+1))}else 38===e.which?n=o.last():40===e.which&&(n=o.first());return n.addClass("so-active"),!1}if(13===e.which)return 1===i.find("ul li:visible").length?(i.find("ul li:visible").trigger("click"),!1):(i.find("ul li.so-active:visible").trigger("click"),!1);if(""===t.val())if(s.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<s.defaultDisplay.length;r++)i.find('.so-item[data-key="'+s.defaultDisplay[r]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each((function(){var e=l(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()}));i.find(".so-item:visible:gt("+(s.display-1)+")").hide(),0===i.find(".so-item:visible").length&&""!==t.val()?i.find(".so-no-results").show():i.find(".so-no-results").hide()},isOverEl:function(e,t){var i=[[e.offset().left,e.offset().top],[e.offset().left+e.outerWidth(),e.offset().top+e.outerHeight()]];return t.pageX>=i[0][0]&&t.pageX<=i[1][0]&&t.pageY>=i[0][1]&&t.pageY<=i[1][1]}})},{}],24:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder").html())),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",contentPreview:"",attachedToEditor:!1,attachedVisible:!1,liveEditor:void 0,menu:!1,activeCell:null,events:{"click .so-tool-button.so-widget-add":"displayAddWidgetDialog","click .so-tool-button.so-row-add":"displayAddRowDialog","click .so-tool-button.so-prebuilt-add":"displayAddPrebuiltDialog","click .so-tool-button.so-history":"displayHistoryDialog","click .so-tool-button.so-live-editor":"displayLiveEditor"},rows:null,initialize:function(e){var t=this;return this.config=_.extend({loadLiveEditor:!1,builderSupports:{}},e.config),this.config.builderSupports=_.extend({addRow:!0,editRow:!0,deleteRow:!0,moveRow:!0,addWidget:!0,editWidget:!0,deleteWidget:!0,moveWidget:!0,prebuilt:!0,history:!0,liveEditor:!0,revertToEditor:!0},this.config.builderSupports),e.config.loadLiveEditor&&this.on("builder_live_editor_added",(function(){this.displayLiveEditor()})),this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},$panelsMetabox=l("#siteorigin-panels-metabox"),$panelsMetabox.length&&(this.contentPreview=l.parseHTML($panelsMetabox.data("preview-markup"))),_.each(this.dialogs,(function(e,i,s){s[i].setBuilder(t)})),this.dialogs.row.setRowDialogType("create"),this.listenTo(this.model.get("rows"),"add",this.onAddRow),l(window).resize((function(e){e.target===window&&t.trigger("builder_resize")})),this.listenTo(this.model,"change:data load_panels_data",this.storeModelData),this.listenTo(this.model,"change:data load_panels_data",this.toggleWelcomeDisplay),this.on("builder_attached_to_editor",this.handleContentChange,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("hide_builder",this.handleHideBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.on("display_builder",this.wrapEditorExpandAdjust,this),this.menu=new s.utils.menu({}),this.listenTo(this.menu,"activate_context",this.activateContextMenu),this.config.loadOnAttach&&this.on("builder_attached_to_editor",(function(){this.displayAttachedBuilder({confirm:!1})}),this),this},render:function(){return this.setElement(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){(e=_.extend({container:!1,dialog:!1},e)).dialog?(this.dialog=new s.dialog.builder,this.dialog.builder=this):(this.$el.appendTo(e.container),this.metabox=e.container.closest(".postbox"),this.initSortable(),this.trigger("attached_to_container",e.container)),this.trigger("builder_attached"),this.supports("liveEditor")&&this.addLiveEditor(),this.supports("history")&&this.addHistoryBrowser();var t=this.$(".so-builder-toolbar"),i=this.$(".so-panels-welcome-message"),l=panelsOptions.loc.welcomeMessage,o=[];this.supports("addWidget")?o.push(l.addWidgetButton):t.find(".so-widget-add").hide(),this.supports("addRow")?o.push(l.addRowButton):t.find(".so-row-add").hide(),this.supports("prebuilt")?o.push(l.addPrebuiltButton):t.find(".so-prebuilt-add").hide();var n="";3===o.length?n=l.threeEnabled:2===o.length?n=l.twoEnabled:1===o.length?n=l.oneEnabled:0===o.length&&(n=l.addingDisabled);var a=_.template(s.helpers.utils.processTemplate(n))({items:o})+" "+l.docsMessage;return i.find(".so-message-wrapper").html(a),this},attachToEditor:function(){if("tinyMCE"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;l("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click((function(e){e.preventDefault(),l("#wp-content-editor-container").show(),l("#wp-content-wrap").removeClass("panels-active"),l("#content-resize-handle").show(),t.trigger("hide_builder")})).end().append(l('<button type="button" id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find("h2.hndle").html()+"</button>").click((function(e){t.displayAttachedBuilder({confirm:!0})&&e.preventDefault()}))),this.supports("revertToEditor")&&e.find(".so-switch-to-standard").click((function(i){i.preventDefault(),confirm(panelsOptions.loc.confirm_stop_builder)&&(t.addHistoryEntry("back_to_editor"),t.model.loadPanelsData(!1),l("#wp-content-wrap").show(),e.hide(),l(window).resize(),t.attachedVisible=!1,t.trigger("hide_builder"))})).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)&&this.supports("revertToEditor")||this.displayAttachedBuilder({confirm:!1});var s=function(){var e=t.$(".so-builder-toolbar");if(t.$el.hasClass("so-display-narrow"))return e.css({top:0,left:0,width:"100%",position:"absolute"}),void t.$el.css("padding-top",e.outerHeight());var i=l(window).scrollTop()-t.$el.offset().top;"fixed"===l("#wpadminbar").css("position")&&(i+=l("#wpadminbar").outerHeight());var s=0,o=t.$el.outerHeight()-e.outerHeight()+20;i>s&&i<o?"fixed"!==e.css("position")&&e.css({top:l("#wpadminbar").outerHeight(),left:t.$el.offset().left,width:t.$el.outerWidth(),position:"fixed"}):e.css({top:Math.min(Math.max(i,0),t.$el.outerHeight()-e.outerHeight()+20),left:0,width:"100%",position:"absolute"}),t.$el.css("padding-top",e.outerHeight())};return this.on("builder_resize",s,this),l(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},displayAttachedBuilder:function(e){if((e=_.extend({confirm:!0},e)).confirm){var t="undefined"!=typeof tinyMCE&&tinyMCE.get("content");if(""!==(t&&_.isFunction(t.getContent)?t.getContent():l("textarea#content").val())&&!confirm(panelsOptions.loc.confirm_use_builder))return!1}return l("#wp-content-wrap").hide(),l("#editor-expand-toggle").on("change.editor-expand",(function(){l(this).prop("checked")||l("#wp-content-wrap").hide()})),this.metabox.show().find("> .inside").show(),l(window).resize(),l(document).scroll(),this.attachedVisible=!0,this.trigger("display_builder"),!0},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this,t=e.$el.attr("id");return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",connectWith:"#"+t+".so-rows-container,.block-editor .so-rows-container",axis:"y",tolerance:"pointer",scroll:!1,remove:function(t,i){e.model.get("rows").remove(l(i.item).data("view").model,{silent:!0}),e.model.refreshPanelsData()},receive:function(t,i){e.model.get("rows").add(l(i.item).data("view").model,{silent:!0,at:l(i.item).index()}),e.model.refreshPanelsData()},stop:function(t,i){var s=l(i.item),o=s.data("view"),n=e.model.get("rows");n.get(o.model)&&(e.addHistoryEntry("row_moved"),n.remove(o.model,{silent:!0}),n.add(o.model,{silent:!0,at:s.index()}),o.trigger("move",s.index()),e.model.refreshPanelsData())}}),this},refreshSortable:function(){_.isNull(this.rowsSortable)||this.rowsSortable.sortable("refresh")},setDataField:function(e,t){if(t=_.extend({load:!0},t),this.dataField=e,this.dataField.data("builder",this),t.load&&""!==e.val()){var i=this.dataField.val();try{i=JSON.parse(i)}catch(e){console.log("Failed to parse Page Builder layout data from supplied data field."),i={}}this.setData(i)}return this},setData:function(e){this.model.loadPanelsData(e),this.currentData=e,this.toggleWelcomeDisplay()},getData:function(){return this.model.get("data")},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));l(this.dataField).val()!==e&&(l(this.dataField).val(e),l(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.row({model:e});l.builder=this,l.render(),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".so-rows-container")):l.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),l.resize(),this.trigger("row_added")},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){var e=new s.model.row,t=new s.collection.cells([{weight:.5},{weight:.5}]);t.each((function(t){t.row=e})),e.set("cells",t),e.builder=this.model,this.dialogs.row.setRowModel(e),this.dialogs.row.openDialog()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},pasteRowHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.addHistoryEntry("row_pasted"),e.builder=this.model,this.model.get("rows").add(e,{at:this.model.get("rows").indexOf(this.model)+1}),this.model.refreshPanelsData())},getActiveCell:function(e){if(e=_.extend({createCell:!0},e),!this.model.get("rows").length){if(!e.createCell)return null;this.model.addRow({},[{weight:1}],{noAnimate:!0})}var t=this.activeCell;return _.isEmpty(t)||-1===this.model.get("rows").indexOf(t.model.row)?this.model.get("rows").last().get("cells").first():t.model},addLiveEditor:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.liveEditor=new s.view.liveEditor({builder:this,previewUrl:this.config.liveEditorPreview}),this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this.trigger("builder_live_editor_added"),this)},displayLiveEditor:function(){_.isUndefined(this.liveEditor)||this.liveEditor.open()},addHistoryBrowser:function(){if(_.isEmpty(this.config.liveEditorPreview))return this;this.dialogs.history=new s.dialog.history,this.dialogs.history.builder=this,this.dialogs.history.entries.builder=this.model,this.dialogs.history.setRevertEntry(this.model),this.$(".so-builder-toolbar .so-history").show()},addHistoryEntry:function(e,t){_.isUndefined(t)&&(t=null),_.isUndefined(this.dialogs.history)||this.dialogs.history.entries.addEntry(e,t)},supports:function(e){return"rowAction"===e?this.supports("addRow")||this.supports("editRow")||this.supports("deleteRow"):"widgetAction"===e?this.supports("addWidget")||this.supports("editWidget")||this.supports("deleteWidget"):!_.isUndefined(this.config.builderSupports[e])&&this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&(s.helpers.editor.isBlockEditor()||s.helpers.editor.isClassicEditor(this))){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||l.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content_json",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){this.contentPreview&&""!==e.post_content&&this.updateEditorContent(e.post_content),""!==e.preview&&(this.contentPreview=e.preview)}.bind(this))}},updateEditorContent:function(e){if("tinyMCE"!==this.config.editorType||"undefined"==typeof tinyMCE||_.isNull(tinyMCE.get("content"))){l(this.config.editorId).val(e).trigger("change").trigger("keyup")}else{var t=tinyMCE.get("content");t.setContent(e),t.fire("change"),t.fire("keyup")}this.triggerSeoChange()},triggerSeoChange:function(){"undefined"==typeof YoastSEO||_.isNull(YoastSEO)||_.isNull(YoastSEO.app.refresh)||YoastSEO.app.refresh(),"undefined"==typeof rankMathEditor||_.isNull(rankMathEditor)||_.isNull(rankMathEditor.refresh)||rankMathEditor.refresh("content")},handleDisplayBuilder:function(){var e="undefined"!=typeof tinyMCE&&tinyMCE.get("content"),t=e&&_.isFunction(e.getContent)?e.getContent():l("textarea#content").val();if((_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){var i=panelsOptions.text_widget;if(_.isEmpty(i))return;this.model.loadPanelsData(this.model.getPanelsDataFromHtml(t,i)),this.model.trigger("change"),this.model.trigger("change:data")}l("#post-status-info").addClass("for-siteorigin-panels")},handleHideBuilder:function(){l("#post-status-info").show().removeClass("for-siteorigin-panels")},wrapEditorExpandAdjust:function(){try{for(var e,t=(l.hasData(window)&&l._data(window)).events.scroll,i=0;i<t.length;i++)if("editor-expand"===t[i].namespace){e=t[i],l(window).unbind("scroll",e.handler),l(window).bind("scroll",function(t){this.attachedVisible||e.handler(t)}.bind(this));break}}catch(e){return}},handleBuilderSizing:function(){var e=this.$el.width();return e?(e<575?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow"),this):this},setDialogParents:function(e,t){_.each(this.dialogs,(function(i,s,l){l[s].setParent(e,t)})),this.on("add_dialog",(function(i){i.setParent(e,t)}),this)},toggleWelcomeDisplay:function(){this.model.get("rows").isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){if(l.contains(this.$el.get(0),e.target)){var i=l([]).add(this.$(".so-panels-welcome-message:visible")).add(this.$(".so-rows-container > .so-row-container")).add(this.$(".so-cells > .cell")).add(this.$(".cell-wrapper > .so-widget")).filter((function(i){return t.isOverEl(l(this),e)})),s=i.last().data("view");void 0!==s&&void 0!==s.buildContextualMenu?s.buildContextualMenu(e,t):i.last().hasClass("so-panels-welcome-message")&&this.buildContextualMenu(e,t)}},buildContextualMenu:function(e,t){var i={};this.supports("addRow")&&(i.add_row={title:panelsOptions.loc.contextual.add_row}),s.helpers.clipboard.canCopyPaste()&&s.helpers.clipboard.isModel("row-model")&&this.supports("addRow")&&(i.paste_row={title:panelsOptions.loc.contextual.row_paste}),_.isEmpty(i)||t.addSection("builder-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},i,function(e){switch(e){case"add_row":this.displayAddRowDialog();break;case"paste_row":this.pasteRowHandler()}}.bind(this))}})},{}],25:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-cell").html())),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.listenTo(this.model.get("widgets"),"add",this.onAddWidget)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.get("cells").totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.get("widgets").each((function(e){var i=new s.view.widget({model:e});i.cell=t,i.render(),i.$el.appendTo(t.$(".widgets-container"))})),this.initSortable(),this.initResizable(),this},initSortable:function(){if(!this.row.builder.supports("moveWidget"))return this;var e=this,t=e.row.builder,i=t.$el.attr("id"),s=t.model;return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+i+" .so-cells .cell .widgets-container,.block-editor .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},remove:function(t,i){e.model.get("widgets").remove(l(i.item).data("view").model,{silent:!0}),s.refreshPanelsData()},receive:function(t,i){var o=l(i.item).data("view");o.cell=e;var n=o.model;n.cell=e.model,e.model.get("widgets").add(n,{silent:!0,at:l(i.item).index()}),s.refreshPanelsData()},stop:function(t,i){var o=l(i.item),n=o.data("view"),a=o.closest(".cell").data("view");e.model.get("widgets").get(n.model)&&(e.row.builder.addHistoryEntry("widget_moved"),n.model.moveToCell(a.model,{},o.index()),n.cell=a,s.refreshPanelsData())},helper:function(e,t){var i=t.clone().css({width:t.outerWidth(),"z-index":1e4,position:"fixed"}).addClass("widget-being-dragged").appendTo("body");return t.outerWidth()>720&&i.animate({"margin-left":e.pageX-t.offset().left-240,width:480},"fast"),i}}),this},refreshSortable:function(){_.isNull(this.widgetSortable)||this.widgetSortable.sortable("refresh")},initResizable:function(){if(!this.row.builder.supports("editRow"))return this;var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;return t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var o=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});o.find(".resize-handle").remove();var n=e.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:e.$el.outerWidth(),right:5,height:e.$el.outerHeight()});n.find(".resize-handle").remove(),l(this).data({newCellClone:o,prevCellClone:n})}},drag:function(i,o){var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;l(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),l(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,o){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),o.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.widget({model:e});l.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),l.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".widgets-container")):l.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),this.row.resize(),this.row.builder.trigger("widget_added",l)},handleCellClick:function(e){this.row.builder.$el.find(".so-cells .cell").removeClass("cell-selected"),this.row.builder.activeCell!==this||this.model.get("widgets").length?(this.$el.addClass("cell-selected"),this.row.builder.activeCell=this):this.row.builder.activeCell=null},pasteHandler:function(){var e=s.helpers.clipboard.getModel("widget-model");!_.isEmpty(e)&&e instanceof s.model.widget&&(this.row.builder.addHistoryEntry("widget_pasted"),e.cell=this.model,this.model.get("widgets").add(e),this.row.builder.model.refreshPanelsData())},buildContextualMenu:function(e,t){var i=this;t.hasSection("add-widget-below")||t.addSection("add-widget-cell",{sectionTitle:panelsOptions.loc.contextual.add_widget_cell,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,(function(e){i.row.builder.trigger("before_user_adds_widget"),i.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=i.model,t.cell.get("widgets").add(t),i.row.builder.model.refreshPanelsData(),i.row.builder.trigger("after_user_adds_widget",t)}));var l={};this.row.builder.supports("addWidget")&&s.helpers.clipboard.isModel("widget-model")&&(l.paste={title:panelsOptions.loc.contextual.cell_paste_widget}),_.isEmpty(l)||t.addSection("cell-actions",{sectionTitle:panelsOptions.loc.contextual.cell_actions,search:!1},l,function(e){switch(e){case"paste":this.pasteHandler()}this.row.builder.model.refreshPanelsData()}.bind(this)),this.row.buildContextualMenu(e,t)}})},{}],26:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({dialogTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog").html())),dialogTabTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-tab").html())),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",dialogIcon:"",parentDialog:!1,dialogOpen:!1,editableLabel:!1,events:{"click .so-close":"closeDialog","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext"},initialize:function(){this.once("open_dialog",this.render),this.once("open_dialog",this.attach),this.once("open_dialog",this.setDialogClass),this.trigger("initialize_dialog",this),_.isUndefined(this.initializeDialog)||this.initializeDialog(),_.bindAll(this,"initSidebars","hasSidebar","onResize","toggleLeftSideBar","toggleRightSideBar")},getNextDialog:function(){return null},getPrevDialog:function(){return null},setDialogClass:function(){""!==this.dialogClass&&this.$(".so-panels-dialog").addClass(this.dialogClass)},setBuilder:function(e){return this.builder=e,e.trigger("add_dialog",this,this.builder),this},attach:function(){return this.$el.appendTo("body"),this},parseDialogContent:function(e,t){t=_.extend({cid:this.cid},t);var i=l(_.template(s.helpers.utils.processTemplate(e))(t)),o={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(o.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(o.right_sidebar=i.find(".right-sidebar").html()),o},renderDialog:function(e){if(e=_.extend({editableLabel:this.editableLabel,dialogIcon:this.dialogIcon},e),this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),!1!==this.parentDialog){var t=l('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');t.click(function(e){e.preventDefault(),this.closeDialog(),this.parentDialog.dialog.openDialog()}.bind(this)),this.$(".so-title-bar .so-title").before(t)}return this.$(".so-title-bar .so-title-editable").length&&this.initEditableLabel(),setTimeout(this.initSidebars,1),this},initSidebars:function(){var e=this.$(".so-show-left-sidebar").hide(),t=this.$(".so-show-right-sidebar").hide(),i=this.hasSidebar("left"),s=this.hasSidebar("right");(i||s)&&(l(window).on("resize",this.onResize),i&&(e.show(),e.on("click",this.toggleLeftSideBar)),s&&(t.show(),t.on("click",this.toggleRightSideBar))),this.onResize()},initTabs:function(){var e=this.$(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click((function(e){e.preventDefault();var i=l(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var s=i.attr("href");if(!_.isUndefined(s)&&"#"===s.charAt(0)){var o=s.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).show()}t.trigger("tab_click",i)})),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){this.$(".so-toolbar .so-buttons .so-toolbar-button").click(function(e){e.preventDefault(),this.trigger("button_click",l(e.currentTarget))}.bind(this)),this.$(".so-toolbar .so-buttons .so-dropdown-button").click(function(e){e.preventDefault();var t=l(e.currentTarget).siblings(".so-dropdown-links-wrapper");t.is(".hidden")?t.removeClass("hidden"):t.addClass("hidden")}.bind(this)),l("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each((function(t,i){var s=l(i),o=l(e.target);0!==o.length&&(o.is(".so-needs-confirm")&&!o.is(".so-confirmed")||o.is(".so-dropdown-button"))||s.addClass("hidden")}))}.bind(this))},initEditableLabel:function(){var e=this.$(".so-title-bar .so-title-editable");e.keypress((function(t){var i="keypress"===t.type&&13===t.keyCode;if(i){var s=l(":tabbable"),o=s.index(e);s.eq(o+1).focus(),window.getSelection().removeAllRanges()}return!i})).blur(function(){var t=e.text().replace(/^\s+|\s+$/gm,"");t!==e.data("original-value").replace(/^\s+|\s+$/gm,"")&&(e.text(t),this.trigger("edit_label",t))}.bind(this)),e.focus((function(){e.data("original-value",e.text()),s.helpers.utils.selectElementContents(this)}))},setupDialog:function(){this.openDialog(),this.closeDialog()},refreshDialogNav:function(){this.$(".so-title-bar .so-nav").show().removeClass("so-disabled");var e=this.getNextDialog(),t=this.$(".so-title-bar .so-next"),i=this.getPrevDialog(),s=this.$(".so-title-bar .so-previous");null===e?t.hide():!1===e&&t.addClass("so-disabled"),null===i?s.hide():!1===i&&s.addClass("so-disabled")},openDialog:function(e){(e=_.extend({silent:!1},e)).silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),s.helpers.pageScroll.lock(),this.onResize(),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this),l(document).trigger("open_dialog",this))},closeDialog:function(e){(e=_.extend({silent:!1},e)).silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),s.helpers.pageScroll.unlock(),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&!1!==e&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&!1!==e&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),s={};return i.find("[name]").each((function(){var e=l(this);try{var i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(_.isEmpty(i))return!0;_.isUndefined(i[2])?t=e.attr("name"):(t=i[2].split("][")).unshift(i[1]),t=t.map((function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e}));var o=s,n=null,a=!!_.isString(e.attr("type"))&&e.attr("type").toLowerCase();if("checkbox"===a)n=e.is(":checked")?""===e.val()||e.val():null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("SELECT"===e.prop("tagName")){var r=e.find("option:selected");1===r.length?n=e.find("option:selected").val():r.length>1&&(n=_.map(e.find("option:selected"),(function(e,t){return l(e).val()})))}else n=e.val();if(!_.isUndefined(e.data("panels-filter")))switch(e.data("panels-filter")){case"json_parse":try{n=JSON.parse(n)}catch(e){n=""}}if(null!==n)for(var d=0;d<t.length;d++)d===t.length-1?""===t[d]?o.push(n):o[t[d]]=n:(_.isUndefined(o[t[d]])&&(""===t[d+1]?o[t[d]]=[]:o[t[d]]={}),o=o[t[d]])}catch(t){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+t.message)}})),s},setStatusMessage:function(e,t,i){var s=i?'<span class="dashicons dashicons-warning"></span>'+e:e;this.$(".so-toolbar .so-status").html(s),!_.isUndefined(t)&&t?this.$(".so-toolbar .so-status").addClass("so-panels-loading"):this.$(".so-toolbar .so-status").removeClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}},onResize:function(){var e=window.matchMedia("(max-width: 980px)");["left","right"].forEach(function(t){var i=this.$(".so-"+t+"-sidebar"),s=this.$(".so-show-"+t+"-sidebar");this.hasSidebar(t)?(s.hide(),e.matches?(s.show(),s.closest(".so-title-bar").addClass("so-has-"+t+"-button"),i.hide(),i.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-"+t+"-sidebar")):(s.hide(),s.closest(".so-title-bar").removeClass("so-has-"+t+"-button"),i.show(),i.closest(".so-panels-dialog").addClass("so-panels-dialog-has-"+t+"-sidebar"))):(i.hide(),s.hide())}.bind(this))},hasSidebar:function(e){return this.$(".so-"+e+"-sidebar").children().length>0},toggleLeftSideBar:function(){this.toggleSidebar("left")},toggleRightSideBar:function(){this.toggleSidebar("right")},toggleSidebar:function(e){var t=this.$(".so-"+e+"-sidebar");t.is(":visible")?t.hide():t.show()}})},{}],27:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-live-editor").html())),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-save":"closeAndSave","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){e=_.extend({builder:!1,previewUrl:!1},e),_.isEmpty(e.previewUrl)&&(e.previewUrl=panelsOptions.ajaxurl+"&action=so_panels_live_editor_preview"),this.builder=e.builder,this.previewUrl=e.previewUrl,this.listenTo(this.builder.model,"refresh_panels_data",this.handleRefreshData),this.listenTo(this.builder.model,"load_panels_data",this.handleLoadData)},render:function(){if(this.setElement(this.template()),this.$el.hide(),l("#submitdiv #save-post").length>0){var e=this.$el.find(".live-editor-save");e.text(e.data("save"))}var t=!1;l(document).mousedown((function(){t=!0})).mouseup((function(){t=!1}));var i=this;return this.$el.on("mouseenter",".so-widget-wrapper",(function(){var e=l(this).data("live-editor-preview-widget");t||void 0===e||!e.length||i.$(".so-preview-overlay").is(":visible")||(i.highlightElement(e),i.scrollToElement(e))})),this.$el.on("mouseleave",".so-widget-wrapper",function(){this.resetHighlights()}.bind(this)),this.listenTo(this.builder,"open_dialog",(function(){this.resetHighlights()})),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),s.helpers.pageScroll.lock(),this.$el.is(":visible"))return this;if(this.$el.show(),this.refreshPreview(this.builder.model.getPanelsData()),this.originalContainer=this.builder.$el.parent(),this.builder.$el.appendTo(this.$(".so-live-editor-builder")),this.builder.$(".so-tool-button.so-live-editor").hide(),this.builder.trigger("builder_resize"),"auto-draft"===l("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===l('#title[name="post_title"]').val()&&l('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),l(document).one("heartbeat-tick.autosave",(function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())})),wp.autosave.server.triggerSave())}},close:function(){if(!this.$el.is(":visible"))return this;this.$el.hide(),s.helpers.pageScroll.unlock(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),this.builder.trigger("builder_resize")},closeAndSave:function(){this.close(),l('#submitdiv input[type="submit"][name="save"]').click()},collapse:function(){this.$el.toggleClass("so-collapsed")},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout),this.previewIframe.contents().find("body").find(".panel-grid .panel-grid-cell .so-panel").filter((function(){return 0===l(this).parents(".so-panel").length})).not(e).addClass("so-panels-faded"),e.removeClass("so-panels-faded").addClass("so-panels-highlighted")},resetHighlights:function(){var e=this.previewIframe.contents().find("body");this.resetHighlightTimeout=setTimeout((function(){e.find(".panel-grid .panel-grid-cell .so-panel").removeClass("so-panels-faded so-panels-highlighted")}),100)},scrollToElement:function(e){this.$(".so-preview iframe")[0].contentWindow.liveEditorScrollTo(e)},handleRefreshData:function(e){if(!this.$el.is(":visible"))return this;this.refreshPreview(e)},handleLoadData:function(){if(!this.$el.is(":visible"))return this;this.refreshPreview(this.builder.model.getPanelsData())},refreshPreview:function(e){var t=this.loadTimes.length?_.reduce(this.loadTimes,(function(e,t){return e+t}),0)/this.loadTimes.length:1e3;_.isNull(this.previewIframe)||this.$(".so-preview-overlay").is(":visible")||(this.previewScrollTop=this.previewIframe.contents().scrollTop()),this.$(".so-preview-overlay").show(),this.$(".so-preview-overlay .so-loading-bar").clearQueue().css("width","0%").animate({width:"100%"},parseInt(t)+100),this.postToIframe({live_editor_panels_data:JSON.stringify(e),live_editor_post_ID:this.builder.config.postId},this.previewUrl,this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var s="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=l('<iframe src="'+t+'" />').attr({id:s,name:s}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var o=l('<form id="soPostToPreviewFrame" method="post" />').attr({id:s,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return l.each(e,(function(e,t){l('<input type="hidden" />').attr({name:e,value:t}).appendTo(o)})),o.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",(function(){var e=l(this),i=e.contents();if(!e.data("iframeready")){e.data("iframeready",!0),void 0!==e.data("load-start")&&(t.loadTimes.unshift((new Date).getTime()-e.data("load-start")),_.isEmpty(t.loadTimes)||(t.loadTimes=t.loadTimes.slice(0,4))),l(".live-editor-mode.so-active").length&&(l(".so-panels-live-editor .so-preview iframe").css("transition","none"),t.mobileToggle()),setTimeout((function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide(),l(".so-panels-live-editor .so-preview iframe").css("transition","all .2s ease")}),100);var s=i.find("#pl-"+t.builder.config.postId);s.find(".panel-grid .panel-grid-cell .so-panel").filter((function(){return l(this).closest(".panel-layout").is(s)})).each((function(e,i){var s=l(i),o=t.$(".so-live-editor-builder .so-widget-wrapper").eq(s.data("index"));o.data("live-editor-preview-widget",s),s.css({cursor:"pointer"}).mouseenter((function(){o.parent().addClass("so-hovered"),t.highlightElement(s)})).mouseleave((function(){o.parent().removeClass("so-hovered"),t.resetHighlights()})).click((function(e){e.preventDefault(),o.find(".title h4").click()}))})),i.find("a").css({"pointer-events":"none"}).click((function(e){e.preventDefault()}))}})).on("load",(function(){var e=l(this);e.data("iframeready")||e.trigger("iframeready")}))},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=l(void 0!==e?e.currentTarget:".live-editor-mode.so-active");this.$(".live-editor-mode").not(t).removeClass("so-active"),t.addClass("so-active"),this.$el.removeClass("live-editor-desktop-mode live-editor-tablet-mode live-editor-mobile-mode").addClass("live-editor-"+t.data("mode")+"-mode").find("iframe").css("width",t.data("width"))}})},{}],28:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-row").html())),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler","click .so-row-color":"rowColorChangeHandler"},builder:null,dialog:null,initialize:function(){var e=this.model.get("cells");this.listenTo(e,"add",this.handleCellAdd),this.listenTo(e,"remove",this.handleCellRemove),this.listenTo(this.model,"reweight_cells",this.resize),this.listenTo(this.model,"destroy",this.onModelDestroy);var t=this;e.each((function(e){t.listenTo(e.get("widgets"),"add",t.resize)})),e.on("add",(function(e){t.listenTo(e.get("widgets"),"add",t.resize)}),this),this.listenTo(this.model,"change:label",this.onLabelChange)},render:function(){var e=this.model.has("color_label")?this.model.get("color_label"):1,t=this.model.has("label")?this.model.get("label"):"";this.setElement(this.template({rowColorLabel:e,rowLabel:t})),this.$el.data("view",this);var i=this;return this.model.get("cells").each((function(e){var t=new s.view.cell({model:e});t.row=i,t.render(),t.$el.appendTo(i.$(".so-cells"))})),this.builder.supports("rowAction")?(this.builder.supports("editRow")||(this.$(".so-row-toolbar .so-dropdown-links-wrapper .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addRow")||(this.$(".so-row-toolbar .so-dropdown-links-wrapper .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteRow")||(this.$(".so-row-toolbar .so-dropdown-links-wrapper .so-row-delete").parent().remove(),this.$el.addClass("so-row-no-delete"))):(this.$(".so-row-toolbar .so-dropdown-wrapper").remove(),this.$el.addClass("so-row-no-actions")),this.builder.supports("moveRow")||(this.$(".so-row-toolbar .so-row-move").remove(),this.$el.addClass("so-row-no-move")),l.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.listenTo(this.builder,"widget_sortable_move",this.resize),this.listenTo(this.builder,"builder_resize",this.resize),this.resize(),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},resize:function(e){if(this.$el.is(":visible")){this.$(".so-cells .cell-wrapper").css("min-height",0),this.$(".so-cells .resize-handle").css("height",0);var t=0;this.$(".so-cells .cell").each((function(){t=Math.max(t,l(this).height()),l(this).css("width",100*l(this).data("view").model.get("weight")+"%")})),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,63)),this.$(".so-cells .resize-handle").css("height",this.$(".so-cells .cell-wrapper").outerHeight())}},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.builder.addHistoryEntry("row_deleted");var e=this;this.$el.fadeOut("normal",(function(){e.model.destroy(),e.builder.model.refreshPanelsData()}))},onLabelChange:function(e,t){0==this.$(".so-row-label").length?this.$(".so-row-toolbar").prepend('<h3 class="so-row-label">'+t+"</h3>"):this.$(".so-row-label").text(t)},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},pasteHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.builder.addHistoryEntry("row_pasted"),e.builder=this.builder.model,this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData())},confirmedDeleteHandler:function(e){var t=l(e.target);if(t.hasClass("dashicons")&&(t=t.parent()),t.hasClass("so-confirmed"))this.visualDestroyModel();else{var i=t.html();t.addClass("so-confirmed").html('<span class="dashicons dashicons-yes"></span>'+panelsOptions.loc.dropdown_confirm),setTimeout((function(){t.removeClass("so-confirmed").html(i)}),2500)}},editSettingsHandler:function(){if(this.builder.supports("editRow"))return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model),this.dialog.rowView=this),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},rowColorChangeHandler:function(e){this.$(".so-row-color").removeClass("so-row-color-selected");var t=l(e.target),i=t.data("color-label"),s=this.model.has("color_label")?this.model.get("color_label"):1;t.addClass("so-row-color-selected"),this.$el.removeClass("so-row-color-"+s),this.$el.addClass("so-row-color-"+i),this.model.set("color_label",i)},handleCellAdd:function(e){var t=new s.view.cell({model:e});t.row=this,t.render(),t.$el.appendTo(this.$(".so-cells"))},handleCellRemove:function(e){this.$(".so-cells > .cell").each((function(){var t=l(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()}))},buildContextualMenu:function(e,t){for(var i=[],l=1;l<5;l++)i.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection("add-row",{sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},i,function(e){this.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,i=[],l=0;l<t;l++)i.push({weight:100/t});var o=new s.model.row({collection:this.collection}),n=new s.collection.cells(i);n.each((function(e){e.row=o})),o.setCells(n),o.builder=this.builder.model,this.builder.model.get("rows").add(o,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()}.bind(this));var o={};this.builder.supports("editRow")&&(o.edit={title:panelsOptions.loc.contextual.row_edit}),s.helpers.clipboard.canCopyPaste()&&(o.copy={title:panelsOptions.loc.contextual.row_copy},this.builder.supports("addRow")&&s.helpers.clipboard.isModel("row-model")&&(o.paste={title:panelsOptions.loc.contextual.row_paste})),this.builder.supports("addRow")&&(o.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(o.delete={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(o)||t.addSection("row-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},o,function(e){switch(e){case"edit":this.editSettingsHandler();break;case"copy":this.copyHandler();break;case"paste":this.pasteHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this))}})},{}],29:[function(e,t,i){window.panels;var s=jQuery;t.exports=Backbone.View.extend({stylesLoaded:!1,initialize:function(){},render:function(e,t,i){if(!_.isUndefined(e)){i=_.extend({builderType:"",dialog:null},i),this.$el.addClass("so-visual-styles so-"+e+"-styles so-panels-loading");var l={builderType:i.builderType};return"cell"===e&&(l.index=i.index),s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify(l),postId:t},null,"html").done(function(e){this.$el.html(e),this.setupFields(),this.stylesLoaded=!0,this.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}.bind(this)).fail(function(e){var t;t=e&&e.responseText?e.responseText:panelsOptions.forms.loadingFailed,this.$el.html(t)}.bind(this)).always(function(){this.$el.removeClass("so-panels-loading")}.bind(this)),this}},attach:function(e){e.append(this.$el)},detach:function(){this.$el.detach()},setupFields:function(){this.$(".style-section-wrapper").each((function(){var e=s(this);e.find(".style-section-head").click((function(t){t.preventDefault(),e.find(".style-section-fields").slideToggle("fast")}))})),_.isUndefined(s.fn.wpColorPicker)||(_.isObject(panelsOptions.wpColorPickerOptions.palettes)&&!s.isArray(panelsOptions.wpColorPickerOptions.palettes)&&(panelsOptions.wpColorPickerOptions.palettes=s.map(panelsOptions.wpColorPickerOptions.palettes,(function(e){return e}))),this.$(".so-wp-color-field").wpColorPicker(panelsOptions.wpColorPickerOptions)),this.$(".style-field-image").each((function(){var e=null,t=s(this);t.find(".so-image-selector").click((function(i){i.preventDefault(),null===e&&(e=wp.media({title:"choose",library:{type:"image"},button:{text:"Done",close:!0}})).on("select",(function(){var i=e.state().get("selection").first().attributes,s=i.url;if(!_.isUndefined(i.sizes))try{s=i.sizes.thumbnail.url}catch(e){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find(".so-image-selector > input").val(i.id),t.find(".remove-image").removeClass("hidden")})),e.open()})),t.find(".remove-image").click((function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find(".so-image-selector > input").val(""),t.find(".remove-image").addClass("hidden")}))})),this.$(".style-field-measurement").each((function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),l=e.find('input[type="hidden"]');t.focus((function(){s(this).select()}));!function(e){if(""!==e){var o=/(?:([0-9\.,\-]+)(.*))+/,n=l.val().split(" "),a=[];for(var r in n){var d=o.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}1===t.length?t.val(a.join(" ")):(1===a.length?a=[a[0],a[0],a[0],a[0]]:2===a.length?a=[a[0],a[1],a[0],a[1]]:3===a.length&&(a=[a[0],a[1],a[2],a[1]]),t.each((function(e,t){s(t).val(a[e])})))}}(l.val());var o=function(e){if(1===t.length){var o=t.val().split(" ").filter((function(e){return""!==e})).map((function(e){return e+i.val()})).join(" ");l.val(o)}else{var n=s(e.target),a=[],r=[],d=[];t.each((function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;a.push(i),null===i?r.push(e):d.push(e)})),3===r.length&&d[0]===t.index(n)&&(t.val(n.val()),a=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(a)===JSON.stringify([null,null,null,null])?l.val(""):l.val(a.map((function(e){return(null===e?0:e)+i.val()})).join(" "))}};t.change(o),i.change(o)}))}})},{}],30:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-widget").html())),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","touchend .widget-edit":"editHandler","click .title h4":"editHandler","touchend .title h4":"editHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.listenTo(this.model,"destroy",this.onModelDestroy),this.listenTo(this.model,"change:values",this.onModelChange),this.listenTo(this.model,"change:label",this.onLabelChange)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle(),widget_class:this.model.attributes.class})),this.$el.data("view",this),this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")||(this.$(".actions .widget-edit").remove(),this.$el.addClass("so-widget-no-edit")),this.cell.row.builder.supports("addWidget")||(this.$(".actions .widget-duplicate").remove(),this.$el.addClass("so-widget-no-duplicate")),this.cell.row.builder.supports("deleteWidget")||(this.$(".actions .widget-delete").remove(),this.$el.addClass("so-widget-no-delete")),this.cell.row.builder.supports("moveWidget")||this.$el.addClass("so-widget-no-move"),l.trim(this.$(".actions").html()).length||this.$(".actions").remove(),this.model.get("read_only")&&this.$el.addClass("so-widget-read-only"),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}return this.listenTo(this.cell.row.builder,"after_user_adds_widget",this.afterUserAddsWidgetHandler),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},getEditDialog:function(){return null===this.dialog&&(this.dialog=new s.dialog.widget({model:this.model}),this.dialog.setBuilder(this.cell.row.builder),this.dialog.widgetView=this),this.dialog},editHandler:function(){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.getEditDialog().openDialog(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.get("widgets").add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},deleteHandler:function(){return this.visualDestroyModel(),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onLabelChange:function(e){this.$(".title > h4").text(e.getWidgetField("title"))},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){return this.cell.row.builder.addHistoryEntry("widget_deleted"),this.$el.fadeOut("fast",function(){this.cell.row.resize(),this.model.destroy(),this.cell.row.builder.model.refreshPanelsData(),this.remove()}.bind(this)),this},buildContextualMenu:function(e,t){this.cell.row.builder.supports("addWidget")&&t.addSection("add-widget-below",{sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){this.cell.row.builder.trigger("before_user_adds_widget"),this.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=this.cell.model,this.cell.model.get("widgets").add(t,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this.cell.row.builder.trigger("after_user_adds_widget",t)}.bind(this));var i={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(i.edit={title:panelsOptions.loc.contextual.widget_edit}),s.helpers.clipboard.canCopyPaste()&&(i.copy={title:panelsOptions.loc.contextual.widget_copy}),this.cell.row.builder.supports("addWidget")&&(i.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(i.delete={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(i)||t.addSection("widget-actions",{sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},i,function(e){switch(e){case"edit":this.editHandler();break;case"copy":this.copyHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this)),this.cell.buildContextualMenu(e,t)},afterUserAddsWidgetHandler:function(e){this.model===e&&panelsOptions.instant_open&&setTimeout(this.editHandler.bind(this),350)}})},{}],31:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.customHtmlWidgets,o=s("<div></div>"),n=t.find(".widget-content:first");n.before(o);var a=new l.CustomHtmlWidgetControl({el:o,syncContainer:n});return a.initializeEditor(),a.editor.codemirror.refresh(),a}};t.exports=l},{}],32:[function(e,t,i){var s=e("./custom-html-widget"),l=e("./media-widget"),o=e("./text-widget"),n={CUSTOM_HTML:"custom_html",MEDIA_AUDIO:"media_audio",MEDIA_GALLERY:"media_gallery",MEDIA_IMAGE:"media_image",MEDIA_VIDEO:"media_video",TEXT:"text",addWidget:function(e,t){var i,n=e.find("> .id_base").val();switch(n){case this.CUSTOM_HTML:i=s;break;case this.MEDIA_AUDIO:case this.MEDIA_GALLERY:case this.MEDIA_IMAGE:case this.MEDIA_VIDEO:i=l;break;case this.TEXT:i=o}i.addWidget(n,e,t)}};t.exports=n},{"./custom-html-widget":31,"./media-widget":33,"./text-widget":34}],33:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.mediaWidgets,o=l.controlConstructors[e];if(o){var n=l.modelConstructors[e]||l.MediaWidgetModel,a=t.find("> .widget-content"),r=s('<div class="media-widget-control"></div>');a.before(r);var d={};a.find(".media-widget-instance-property").each((function(){var e=s(this);d[e.data("property")]=e.val()})),d.widget_id=i;var h=new o({el:r,syncContainer:a,model:new n(d)});return h.render(),h}}};t.exports=l},{}],34:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.textWidgets,o={},n=t.find(".visual");if(n.length>0){if(!n.val())return null;var a=s("<div></div>"),r=t.find(".widget-content:first");r.before(a),o={el:a,syncContainer:r}}else o={el:t};var d=new l.TextWidgetControl(o),h=wp.oldEditor?wp.oldEditor:wp.editor;return h&&h.hasOwnProperty("autop")&&(wp.editor.autop=h.autop,wp.editor.removep=h.removep,wp.editor.initialize=h.initialize),d.initializeEditor(),d}};t.exports=l},{}]},{},[17]);
|
1 |
+
!function e(t,i,s){function l(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(o)return o(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var h=i[n]={exports:{}};t[n][0].call(h.exports,(function(e){return l(t[n][1][e]||e)}),h,h.exports,e,t,i,s)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<s.length;n++)l(s[n]);return l}({1:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each((function(t){e+=t.get("weight")})),e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){_.isEmpty(t)&&(t=this.builder.getPanelsData());var i=new s.model.historyEntry({text:e,data:JSON.stringify(t),time:parseInt((new Date).getTime()/1e3),collection:this});this.add(i)},onAddEntry:function(e){if(this.models.length>1){var t=this.at(this.models.length-2);(e.get("text")===t.get("text")&&e.get("time")-t.get("time")<15||e.get("data")===t.get("data"))&&(this.remove(e),t.set("count",t.get("count")+1))}for(;this.models.length>this.maxSize;)this.shift()}})},{}],3:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.row,empty:function(){for(var e;;){if(!(e=this.collection.first()))break;e.destroy()}}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){}})},{}],5:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-builder").html(),{})),this.$(".so-content .siteorigin-panels-builder").append(this.builder.$el)},initializeDialog:function(){var e=this;this.once("open_dialog_complete",(function(){e.builder.initSortable()})),this.on("open_dialog_complete",(function(){e.builder.trigger("builder_resize")}))}})},{}],6:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-history-entry").html())),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-history",dialogIcon:"history",events:{"click .so-close":"closeDialog","click .so-restore":"restoreSelectedEntry"},initializeDialog:function(){this.entries=new s.collection.historyEntries,this.on("open_dialog",this.setCurrentEntry,this),this.on("open_dialog",this.renderHistoryEntries,this)},render:function(){var e=this;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").on("load",(function(){var t=l(this);t.show(),t.contents().scrollTop(e.previewScrollTop)}))},setRevertEntry:function(e){this.revertEntry=new s.model.historyEntry({data:JSON.stringify(e.getPanelsData()),time:parseInt((new Date).getTime()/1e3)})},setCurrentEntry:function(){this.currentEntry=new s.model.historyEntry({data:JSON.stringify(this.builder.model.getPanelsData()),time:parseInt((new Date).getTime()/1e3)}),this.selectedEntry=this.currentEntry,this.previewEntry(this.currentEntry),this.$(".so-buttons .so-restore").addClass("disabled")},renderHistoryEntries:function(){var e=this,t=this.$(".history-entries").empty();this.currentEntry.get("data")===this.revertEntry.get("data")&&_.isEmpty(this.entries.models)||l(this.historyEntryTemplate({title:panelsOptions.loc.history.revert,count:1})).data("historyEntry",this.revertEntry).prependTo(t),this.entries.each((function(i){var s=e.historyEntryTemplate({title:panelsOptions.loc.history[i.get("text")],count:i.get("count")});l(s).data("historyEntry",i).prependTo(t)})),l(this.historyEntryTemplate({title:panelsOptions.loc.history.current,count:1})).data("historyEntry",this.currentEntry).addClass("so-selected").prependTo(t),t.find(".history-entry").on("click",(function(){var i=jQuery(this);t.find(".history-entry").not(i).removeClass("so-selected"),i.addClass("so-selected");var s=i.data("historyEntry");e.selectedEntry=s,e.selectedEntry.cid!==e.currentEntry.cid?e.$(".so-buttons .so-restore").removeClass("disabled"):e.$(".so-buttons .so-restore").addClass("disabled"),e.previewEntry(s)})),this.updateEntryTimes()},previewEntry:function(e){var t=this.$("iframe.siteorigin-panels-history-iframe");t.hide(),this.previewScrollTop=t.contents().scrollTop(),this.$('form.history-form input[name="live_editor_panels_data"]').val(e.get("data")),this.$('form.history-form input[name="live_editor_post_ID"]').val(this.builder.config.postId),this.$("form.history-form").trigger("submit")},restoreSelectedEntry:function(){return!this.$(".so-buttons .so-restore").hasClass("disabled")&&(this.currentEntry.get("data")===this.selectedEntry.get("data")?(this.closeDialog(),!1):("restore"!==this.selectedEntry.get("text")&&this.builder.addHistoryEntry("restore",this.builder.model.getPanelsData()),this.builder.model.loadPanelsData(JSON.parse(this.selectedEntry.get("data"))),this.closeDialog(),!1))},updateEntryTimes:function(){var e=this;this.$(".history-entries .history-entry").each((function(){var t=jQuery(this),i=t.find(".timesince"),s=t.data("historyEntry");i.html(e.timeSince(s.get("time")))}))},timeSince:function(e){var t,i=parseInt((new Date).getTime()/1e3)-e,s=[];return i>3600&&(1===(t=Math.floor(i/3600))?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(1===(t=Math.floor(i/60))?s.push(panelsOptions.loc.time.minute.replace("%d",t)):s.push(panelsOptions.loc.time.minutes.replace("%d",t)),i-=60*t),i>0&&(1===i?s.push(panelsOptions.loc.time.second.replace("%d",i)):s.push(panelsOptions.loc.time.seconds.replace("%d",i))),_.isEmpty(s)?panelsOptions.loc.time.now:panelsOptions.loc.time.ago.replace("%s",s.slice(0,2).join(", "))}})},{}],7:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-directory-items").html())),builder:null,dialogClass:"so-panels-dialog-prebuilt-layouts",dialogIcon:"layouts",layoutCache:{},currentTab:!1,directoryPage:1,events:{"click .so-close":"closeDialog","click .so-sidebar-tabs li a":"tabClickHandler","click .so-content .layout":"layoutClickHandler","keyup .so-sidebar-search":"searchHandler","click .so-screenshot, .so-title":"directoryItemClickHandler"},initializeDialog:function(){var e=this;this.on("open_dialog",(function(){e.$(".so-sidebar-tabs li a").first().trigger("click"),e.$(".so-status").removeClass("so-panels-loading")})),this.on("button_click",this.toolbarButtonClick,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-prebuilt").html(),{})),this.initToolbar()},tabClickHandler:function(e){e.preventDefault(),this.selectedLayoutItem=null,this.uploadedLayout=null,this.updateButtonState(!1),this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=l(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");this.$(".so-content").empty(),this.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),this.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(l("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui"),s=new plupload.Uploader({runtimes:"html5,silverlight,flash,html4",browse_button:i.find(".file-browse-button").get(0),container:i.get(0),drop_element:i.find(".drag-upload-area").get(0),file_data_name:"panels_import_data",multiple_queues:!1,max_file_size:panelsOptions.plupload.max_file_size,url:panelsOptions.plupload.url,flash_swf_url:panelsOptions.plupload.flash_swf_url,silverlight_xap_url:panelsOptions.plupload.silverlight_xap_url,filters:[{title:panelsOptions.plupload.filter_title,extensions:"json"}],multipart_params:{action:"so_panels_import_layout"},init:{PostInit:function(e){e.features.dragdrop&&i.addClass("has-drag-drop"),i.find(".progress-precent").css("width","0%")},FilesAdded:function(e){i.find(".file-browse-button").trigger("blur"),i.find(".drag-upload-area").removeClass("file-dragover"),i.find(".progress-bar").fadeIn("fast"),t.$(".js-so-selected-file").text(panelsOptions.loc.prebuilt_loading),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,s,l){var o=JSON.parse(l.response);_.isUndefined(o.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=o,i.find(".progress-bar").hide(),t.$(".js-so-selected-file").text(panelsOptions.loc.ready_to_insert.replace("%s",s.name)),t.updateButtonState(!0))},Error:function(){alert(panelsOptions.plupload.error_message)}}});s.init(),/Edge\/\d./i.test(navigator.userAgent)&&setTimeout((function(){s.refresh()}),250),i.find(".drag-upload-area").on("dragover",(function(){l(this).addClass("file-dragover")})).on("dragleave",(function(){l(this).removeClass("file-dragover")})),e.find(".so-export").on("submit",(function(e){var i=l(this),s=t.builder.model.getPanelsData(),o=l('input[name="post_title"], .editor-post-title__input').val();if(o){if(l(".block-editor-page").length){var n=t.getCurrentBlockPosition();n>=0&&(o+="-"+n)}}else o=l('input[name="post_ID"]').val();s.name=o,i.find('input[name="panels_export_data"]').val(JSON.stringify(s))}))},getCurrentBlockPosition:function(){var e=wp.data.select("core/block-editor").getSelectedBlockClientId();return wp.data.select("core/block-editor").getBlocks().findIndex((function(t){return t.clientId===e}))},displayLayoutDirectory:function(e,t,i){var s=this,o=this.$(".so-content").empty().addClass("so-panels-loading");if(void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory-siteorigin"),i.match("^directory-")&&!panelsOptions.directory_enabled)return o.removeClass("so-panels-loading").html(l("#siteorigin-panels-directory-enable").html()),void o.find(".so-panels-enable-directory").on("click",(function(n){n.preventDefault(),l.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},(function(){})),panelsOptions.directory_enabled=!0,o.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t,i)}));l.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i,builderType:this.builder.config.builderType},(function(n){if(s.currentTab===i){o.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=o.find(".so-previous"),r=o.find(".so-next");t<=1?a.addClass("button-disabled"):a.on("click",(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)})),t===n.max_num_pages||0===n.max_num_pages?r.addClass("button-disabled"):r.on("click",(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)})),o.find(".so-screenshot").each((function(){var e=l(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=l("<img/>").attr("src",e.data("src")).on("load",(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")}));else l("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")})),o.find(".so-directory-browse").html(n.title)}}),"json")},directoryItemClickHandler:function(e){var t=this.$(e.target).closest(".so-directory-item");this.$(".so-directory-items").find(".selected").removeClass("selected"),t.addClass("selected"),this.selectedLayoutItem={lid:t.data("layout-id"),type:t.data("layout-type")},this.updateButtonState(!0)},toolbarButtonClick:function(e){if(!this.canAddLayout())return!1;var t=e.data("value");if(_.isUndefined(t))return!1;if(this.updateButtonState(!1),e.hasClass("so-needs-confirm")&&!e.hasClass("so-confirmed")){if(this.updateButtonState(!0),e.hasClass("so-confirming"))return;e.addClass("so-confirming");var i=e.html();return e.html('<span class="dashicons dashicons-yes"></span>'+e.data("confirm")),setTimeout((function(){e.removeClass("so-confirmed").html(i)}),2500),setTimeout((function(){e.removeClass("so-confirming"),e.addClass("so-confirmed")}),200),!1}this.addingLayout=!0,"import"===this.currentTab?this.addLayoutToBuilder(this.uploadedLayout,t):this.loadSelectedLayout().then(function(e){this.addLayoutToBuilder(e,t)}.bind(this))},canAddLayout:function(){return(this.selectedLayoutItem||this.uploadedLayout)&&!this.addingLayout},loadSelectedLayout:function(){this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0);var e=_.extend(this.selectedLayoutItem,{action:"so_panels_get_layout",builderType:this.builder.config.builderType}),t=new l.Deferred;return l.get(panelsOptions.ajaxurl,e,function(e){var i="";e.success?t.resolve(e.data):(i=e.data.message,t.reject(e.data)),this.setStatusMessage(i,!1,!e.success),this.updateButtonState(!0)}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(l(e.currentTarget).val(),1,this.currentTab)},updateButtonState:function(e){e=e&&(this.selectedLayoutItem||this.uploadedLayout);var t=this.$(".so-import-layout");t.prop("disabled",!e),e?t.removeClass("disabled"):t.addClass("disabled")},addLayoutToBuilder:function(e,t){this.builder.addHistoryEntry("prebuilt_loaded"),this.builder.model.loadPanelsData(e,t),this.addingLayout=!1,this.closeDialog()}})},{}],8:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-row-cell-preview").html())),editableLabel:!0,events:{"click .so-close":"closeDialog","click .so-toolbar .so-save":"saveHandler","click .so-toolbar .so-insert":"insertHandler","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler","change .row-set-form > *":"setCellsFromForm","click .row-set-form button.set-row":"setCellsFromForm"},rowView:null,dialogIcon:"add-row",dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:null,style:{}},cellStylesCache:[],initializeDialog:function(){this.on("open_dialog",(function(){_.isUndefined(this.model)||_.isEmpty(this.model.get("cells"))?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview(),this.renderStyles(),this.openSelectedCellStyles()}),this),this.row={cells:new s.collection.cells([{weight:.5},{weight:.5}]),style:{}},this.dialogFormsLoaded=0;var e=this;this.on("form_loaded styles_loaded",(function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})),this.on("close_dialog",this.closeHandler),this.on("edit_label",function(e){if(e!==panelsOptions.loc.row.add&&e!==panelsOptions.loc.row.edit||(e=""),this.model.set("label",e),_.isEmpty(e)){var t="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.$(".so-title").text(t)}}.bind(this))},setRowDialogType:function(e){this.dialogType=e},render:function(){var e="create"===this.dialogType?panelsOptions.loc.row.add:panelsOptions.loc.row.edit;this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-row").html(),{title:e,dialogType:this.dialogType}));var t=this.$(".so-title");return this.model.has("label")&&!_.isEmpty(this.model.get("label"))&&t.text(this.model.get("label")),this.$(".so-edit-title").val(t.text()),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove(),_.isUndefined(this.model)||(this.$('input[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction"))),this.$("input.so-row-field").on("keyup",(function(){l(this).trigger("change")})),this},renderStyles:function(){this.styles&&(this.styles.off("styles_loaded"),this.styles.remove()),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("row",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this});var e=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(e),this.styles.on("styles_loaded",(function(t){t||(this.styles.remove(),0===e.children().length&&(e.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),e.hide()))}),this)},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.get("cells").clone(),style:{},ratio:this.model.get("ratio"),ratio_direction:this.model.get("ratio_direction")},this.$('input[name="cells"].so-row-field').val(this.model.get("cells").length),this.model.has("ratio")&&this.$('select[name="ratio"].so-row-field').val(this.model.get("ratio")),this.model.has("ratio_direction")&&this.$('select[name="ratio_direction"].so-row-field').val(this.model.get("ratio_direction")),this.clearCellStylesCache(),this)},regenerateRowPreview:function(){var e,t=this,i=this.$(".row-preview"),s=this.getSelectedCellIndex();i.empty(),this.row.cells.each((function(o,n){var a=l(this.cellPreviewTemplate({weight:o.get("weight")}));i.append(a),n==s&&a.find(".preview-cell-in").addClass("cell-selected");var r,d=a.prev();d.length&&((r=l('<div class="resize-handle"></div>')).appendTo(a).on("dblclick",(function(){var e=t.row.cells.at(n-1),i=o.get("weight")+e.get("weight");o.set("weight",i/2),e.set("weight",i/2),t.scaleRowWidths()})),r.draggable({axis:"x",containment:i,start:function(e,t){var i=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),left:6,height:a.outerHeight()});i.find(".resize-handle").remove();var s=d.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:d.outerWidth(),right:6,height:d.outerHeight()});s.find(".resize-handle").remove(),l(this).data({newCellClone:i,prevCellClone:s}),a.find("> .preview-cell-in").css("visibility","hidden"),d.find("> .preview-cell-in").css("visibility","hidden")},drag:function(e,s){var o=t.row.cells.at(n).get("weight"),a=t.row.cells.at(n-1).get("weight"),r=o-(s.position.left+6)/i.width(),d=a+(s.position.left+6)/i.width();s.helper.offset().left,i.offset().left;l(this).data("newCellClone").css("width",i.width()*r+"px").find(".preview-cell-weight").html(Math.round(1e3*r)/10),l(this).data("prevCellClone").css("width",i.width()*d+"px").find(".preview-cell-weight").html(Math.round(1e3*d)/10)},stop:function(e,s){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove(),a.find(".preview-cell-in").css("visibility","visible"),d.find(".preview-cell-in").css("visibility","visible");var o=(s.position.left+6)/i.width(),r=t.row.cells.at(n),h=t.row.cells.at(n-1);r.get("weight")-o>.02&&h.get("weight")+o>.02&&(r.set("weight",r.get("weight")-o),h.set("weight",h.get("weight")+o)),t.scaleRowWidths(),s.helper.css("left",-6)}})),a.on("click",function(e){if(l(e.target).is(".preview-cell")||l(e.target).is(".preview-cell-in")){var t=l(e.target);t.closest(".row-preview").find(".preview-cell .preview-cell-in").removeClass("cell-selected"),t.addClass("cell-selected"),this.openSelectedCellStyles()}}.bind(this)),a.find(".preview-cell-weight").on("click",(function(s){t.$(".resize-handle").css("pointer-event","none").draggable("disable"),i.find(".preview-cell-weight").each((function(){var s=jQuery(this).hide();l('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(s.html())).insertAfter(s).on("focus",(function(){clearTimeout(e)})).on("keyup",(function(e){9!==e.keyCode&&l(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),l(this).trigger("blur"))})).on("keydown",(function(e){if(9===e.keyCode){e.preventDefault();var t=i.find(".preview-cell-weight-input"),s=t.index(l(this));s===t.length-1?t.eq(0).trigger("focus").trigger("select"):t.eq(s+1).trigger("focus").trigger("select")}})).on("blur",(function(){i.find(".preview-cell-weight-input").each((function(e,i){isNaN(parseFloat(l(i).val()))&&l(i).val(Math.floor(1e3*t.row.cells.at(e).get("weight"))/10)})),e=setTimeout((function(){if(0===i.find(".preview-cell-weight-input").length)return!1;var e=[],s=[],o=0,n=0;if(i.find(".preview-cell-weight-input").each((function(i,a){var r=parseFloat(l(a).val());r=isNaN(r)?1/t.row.cells.length:Math.round(10*r)/1e3;var d=!l(a).hasClass("no-user-interacted");e.push(r),s.push(d),d?o+=r:n+=r})),o>0&&n>0&&1-o>0)for(var a=0;a<e.length;a++)s[a]||(e[a]=e[a]/n*(1-o));var r=_.reduce(e,(function(e,t){return e+t}));e=e.map((function(e){return e/r})),Math.min.apply(Math,e)>.01&&t.row.cells.each((function(t,i){t.set("weight",e[i])})),i.find(".preview-cell").each((function(e,i){var s=t.row.cells.at(e).get("weight");l(i).animate({width:Math.round(1e3*s)/10+"%"},250),l(i).find(".preview-cell-weight-input").val(Math.round(1e3*s)/10)})),i.find(".preview-cell").css("overflow","visible"),setTimeout(t.regenerateRowPreview.bind(t),260)}),100)})).on("click",(function(){l(this).trigger("select")}))})),l(this).siblings(".preview-cell-weight-input").trigger("select")}))}),this),this.trigger("form_loaded",this)},getSelectedCellIndex:function(){var e=-1;return this.$(".preview-cell .preview-cell-in").each((function(t,i){l(i).is(".cell-selected")&&(e=t)})),e},openSelectedCellStyles:function(){if(!_.isUndefined(this.cellStyles)){if(this.cellStyles.stylesLoaded){var e={};try{e=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",e)}this.cellStyles.detach()}if(this.cellStyles=this.getSelectedCellStyles(),this.cellStyles){var t=this.$(".so-sidebar.so-right-sidebar");this.cellStyles.attach(t),this.cellStyles.on("styles_loaded",(function(e){e&&(t.closest(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"),t.show())}))}},getSelectedCellStyles:function(){var e=this.getSelectedCellIndex();if(e>-1){var t=this.cellStylesCache[e];t||((t=new s.view.styles).model=this.row.cells.at(e),t.render("cell",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this,index:e}),this.cellStylesCache[e]=t)}return t},clearCellStylesCache:function(){this.cellStylesCache.forEach((function(e){e.remove(),e.off("styles_loaded")})),this.cellStylesCache=[]},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each((function(t,i){var s=e.row.cells.at(t);l(i).css("width",100*s.get("weight")+"%").find(".preview-cell-weight").html(Math.round(1e3*s.get("weight"))/10)}))},setCellsFromForm:function(){try{var e={cells:parseInt(this.$('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$('.row-set-form select[name="ratio"]').val()),direction:this.$('.row-set-form select[name="ratio_direction"]').val()};_.isNaN(e.cells)&&(e.cells=1),isNaN(e.ratio)&&(e.ratio=1),e.cells<1?(e.cells=1,this.$('.row-set-form input[name="cells"]').val(e.cells)):e.cells>12&&(e.cells=12,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form select[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,o=1,n=0;n<e.cells;n++)t.push(o),o*=e.ratio;var a=_.reduce(t,(function(e,t){return e+t}));if(t=_.map(t,(function(e){return e/a})),t=_.filter(t,(function(e){return e>.01})),"left"===e.direction&&(t=t.reverse()),this.row.cells=new s.collection.cells(this.row.cells.first(t.length)),_.each(t,function(e,t){var i=this.row.cells.at(t);i?i.set("weight",e):(i=new s.model.cell({weight:e,row:this.model}),this.row.cells.add(i))}.bind(this)),this.row.ratio=e.ratio,this.row.ratio_direction=e.direction,i)this.regenerateRowPreview();else{var r=this;this.$(".preview-cell").each((function(e,t){var i=r.row.cells.at(e).get("weight");l(t).animate({width:Math.round(1e3*i)/10+"%"},250),l(t).find(".preview-cell-weight").html(Math.round(1e3*i)/10)})),this.$(".preview-cell").css("overflow","visible"),setTimeout(r.regenerateRowPreview.bind(r),260)}}catch(e){console.log("Error setting cells - "+e.message)}this.$(".row-set-form .so-button-row-set").removeClass("button-primary")},tabClickHandler:function(e){"#row-layout"===e.attr("href")?this.$(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"):this.$(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar")},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),_.isEmpty(this.model)||(this.model.setCells(this.row.cells),this.model.set("ratio",this.row.ratio),this.model.set("ratio_direction",this.row.ratio_direction)),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-row-styles").style}catch(e){console.log("Error retrieving row styles - "+e.message)}this.model.set("style",t)}if(!_.isUndefined(this.cellStyles)&&this.cellStyles.stylesLoaded){t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles.so-cell-styles").style}catch(e){console.log("Error retrieving cell styles - "+e.message)}this.cellStyles.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.updateModel();var e=this.builder.getActiveCell({createCell:!1}),t={};return null!==e&&(t.at=this.builder.model.get("rows").indexOf(e.row)+1),this.model.collection=this.builder.model.get("rows"),this.builder.model.get("rows").add(this.model,t),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},deleteHandler:function(){return this.rowView.visualDestroyModel(),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1},closeHandler:function(){this.clearCellStylesCache(),_.isUndefined(this.cellStyles)||(this.cellStyles=void 0)}})},{}],9:[function(e,t,i){var s=window.panels,l=jQuery,o=e("../view/widgets/js-widget");t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widget-sidebar-widget").html())),dialogClass:"so-panels-dialog-edit-widget",dialogIcon:"add-widget",widgetView:!1,savingWidget:!1,editableLabel:!0,events:{"click .so-close":"saveHandler","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler"},initializeDialog:function(){var e=this;this.listenTo(this.model,"change:values",this.handleChangeValues),this.listenTo(this.model,"destroy",this.remove),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",(function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})),this.on("edit_label",function(e){e===panelsOptions.widgets[this.model.get("class")].title&&(e=""),this.model.set("label",e),_.isEmpty(e)&&this.$(".so-title").text(this.model.getWidgetField("title"))}.bind(this))},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm();var e=this.model.getWidgetField("title");this.$(".so-title .widget-name").html(e),this.$(".so-edit-title").val(e),this.builder.supports("addWidget")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteWidget")||this.$(".so-buttons .so-delete").remove(),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",this.builder.config.postId,{builderType:this.builder.config.builderType,dialog:this});var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",(function(e){e||(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())}),this)},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(0===i)return!1;do{if(t=e.eq(--i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog()}while(!_.isUndefined(t)&&i>0);return!1},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(i===e.length-1)return!1;do{if(t=e.eq(++i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog()}while(!_.isUndefined(t));return!1},loadForm:function(){if(this.$("> *").length){this.$(".so-content").addClass("so-panels-loading");var e={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")},t=this.$(".so-content");l.post(panelsOptions.ajaxurl,e,null,"html").done(function(e){var i=e.replace(/{\$id}/g,this.model.cid);t.removeClass("so-panels-loading").html(i),this.trigger("form_loaded",this),this.$(".panel-dialog").trigger("panelsopen"),this.on("close_dialog",this.updateModel,this),t.find("> .widget-content").length>0&&o.addWidget(t,this.model.widget_id)}.bind(this)).fail((function(e){var i;i=e&&e.responseText?e.responseText:panelsOptions.forms.loadingFailed,t.removeClass("so-panels-loading").html(i)}))}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();t=_.isUndefined(t.widgets)?{}:(t=t.widgets)[Object.keys(t)[0]],this.model.setValues(t),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var i={};try{i=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(e){}this.model.set("style",i)}this.savingWidget=!1,e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHandler:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.widgetView.visualDestroyModel(),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.widgetView.duplicateHandler(),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{"../view/widgets/js-widget":32}],10:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-widgets-widget").html())),filter:{},dialogClass:"so-panels-dialog-add-widget",dialogIcon:"add-widget",events:{"click .so-close":"closeDialog","click .widget-type":"widgetClickHandler","keyup .so-sidebar-search":"searchHandler"},initializeDialog:function(){this.on("open_dialog",(function(){this.filter.search="",this.filterWidgets(this.filter)}),this),this.on("open_dialog_complete",(function(){this.$(".so-sidebar-search").val("").trigger("focus"),this.balanceWidgetHeights()})),this.on("tab_click",this.tabClickHandler,this)},render:function(){this.renderDialog(this.parseDialogContent(l("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,(function(e){var t=l(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),l('<span class="widget-icon"></span>').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e.class).appendTo(this.$(".widget-type-list"))}),this);var e=this.$(".so-sidebar-tabs");_.each(panelsOptions.widget_dialog_tabs,(function(t,i){l(this.dialogTabTemplate({title:t.title,tab:i})).data({message:t.message,filter:t.filter}).appendTo(e)}),this),this.initTabs();var t=this;l(window).on("resize",(function(){t.balanceWidgetHeights()}))},tabClickHandler:function(e){this.filter=e.parent().data("filter"),this.filter.search=this.$(".so-sidebar-search").val();var t=e.parent().data("message");return _.isEmpty(t)&&(t=""),this.$(".so-toolbar .so-status").html(t),this.filterWidgets(this.filter),!1},searchHandler:function(e){if(13===e.which){var t=this.$(".widget-type-list .widget-type:visible");1===t.length&&t.trigger("click")}else this.filter.search=l(e.target).val().trim(),this.filterWidgets(this.filter)},filterWidgets:function(e){_.isUndefined(e)&&(e={}),_.isUndefined(e.groups)&&(e.groups=""),this.$(".widget-type-list .widget-type").each((function(){var t,i=l(this),s=i.data("class"),o=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];(t=!!_.isEmpty(e.groups)||null!==o&&!_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups)))&&(_.isUndefined(e.search)||""===e.search||-1===o.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()})),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.trigger("before_user_adds_widget"),this.builder.addHistoryEntry("widget_added");var t=l(e.currentTarget),i=new s.model.widget({class:t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.get("widgets").add(i),this.closeDialog(),this.builder.model.refreshPanelsData(),this.builder.trigger("after_user_adds_widget",i)},balanceWidgetHeights:function(e){var t=[[]],i=null,s=Math.round(this.$(".widget-type").parent().width()/this.$(".widget-type").width());this.$(".widget-type").css("clear","none").filter(":visible").each((function(e,t){e%s==0&&0!==e&&l(t).css("clear","both")})),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each((function(e,s){var o=l(s);null!==i&&i.position().top!==o.position().top&&(t[t.length]=[]),i=o,t[t.length-1].push(o)})),_.each(t,(function(e,t){var i=_.max(e.map((function(e){return e.height()})));_.each(e,(function(e){e.height(i)}))}))}})},{}],11:[function(e,t,i){t.exports={canCopyPaste:function(){return"undefined"!=typeof Storage&&panelsOptions.user},setModel:function(e){if(!this.canCopyPaste())return!1;var t=panels.helpers.serialize.serialize(e);return e instanceof panels.model.row?t.thingType="row-model":e instanceof panels.model.widget&&(t.thingType="widget-model"),localStorage["panels_clipboard_"+panelsOptions.user]=JSON.stringify(t),!0},isModel:function(e){if(!this.canCopyPaste())return!1;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&((t=JSON.parse(t)).thingType&&t.thingType===e)},getModel:function(e){if(!this.canCopyPaste())return null;var t=localStorage["panels_clipboard_"+panelsOptions.user];return void 0!==t&&(t=JSON.parse(t)).thingType&&t.thingType===e?panels.helpers.serialize.unserialize(t,t.thingType,null):null}}},{}],12:[function(e,t,i){t.exports={isBlockEditor:function(){return void 0!==wp.blocks},isClassicEditor:function(e){return e.attachedToEditor&&e.$el.is(":visible")}}},{}],13:[function(e,t,i){t.exports={lock:function(){if("hidden"!==jQuery("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];jQuery("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlock:function(){if("hidden"===jQuery("body").css("overflow")&&!jQuery(".so-panels-dialog-wrapper").is(":visible")&&!jQuery(".so-panels-live-editor").is(":visible")){jQuery("body").css("overflow","visible");var e=jQuery("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}}},{}],14:[function(e,t,i){t.exports={serialize:function(e){var t;if(e instanceof Backbone.Model){var i={};for(var s in e.attributes)if(e.attributes.hasOwnProperty(s)){if("builder"===s||"collection"===s)continue;(t=e.attributes[s])instanceof Backbone.Model||t instanceof Backbone.Collection?i[s]=this.serialize(t):i[s]=t}return i}if(e instanceof Backbone.Collection){for(var l=[],o=0;o<e.models.length;o++)(t=e.models[o])instanceof Backbone.Model||t instanceof Backbone.Collection?l.push(this.serialize(t)):l.push(t);return l}},unserialize:function(e,t,i){var s;switch(t){case"row-model":(s=new panels.model.row).builder=i;var l={style:e.style};e.hasOwnProperty("label")&&(l.label=e.label),e.hasOwnProperty("color_label")&&(l.color_label=e.color_label),s.set(l),s.setCells(this.unserialize(e.cells,"cell-collection",s));break;case"cell-model":(s=new panels.model.cell).row=i,s.set("weight",e.weight),s.set("style",e.style),s.set("widgets",this.unserialize(e.widgets,"widget-collection",s));break;case"widget-model":for(var o in(s=new panels.model.widget).cell=i,e)e.hasOwnProperty(o)&&s.set(o,e[o]);s.set("widget_id",panels.helpers.utils.generateUUID());break;case"cell-collection":s=new panels.collection.cells;for(var n=0;n<e.length;n++)s.push(this.unserialize(e[n],"cell-model",i));break;case"widget-collection":s=new panels.collection.widgets;for(n=0;n<e.length;n++)s.push(this.unserialize(e[n],"widget-model",i));break;default:console.log("Unknown Thing - "+t)}return s}}},{}],15:[function(e,t,i){t.exports={generateUUID:function(){var e=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)}))},processTemplate:function(e){return _.isUndefined(e)||_.isNull(e)?"":e=(e=(e=e.replace(/{{%/g,"<%")).replace(/%}}/g,"%>")).trim()},selectElementContents:function(e){var t=document.createRange();t.selectNodeContents(e);var i=window.getSelection();i.removeAllRanges(),i.addRange(t)}}},{}],16:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=function(e,t){return this.each((function(){var i=jQuery(this);if(!i.data("soPanelsBuilderWidgetInitialized")||t){var o=i.closest("form").find(".widget-id").val(),n=l.extend(!0,{builderSupports:i.data("builder-supports")},e);if(_.isUndefined(o)||!(o.indexOf("__i__")>-1)){var a=new s.model.builder,r=new s.view.builder({model:a,config:n}),d=i.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(d)||(d.on("close_dialog",(function(){a.refreshPanelsData()})),d.on("open_dialog_complete",(function(){r.trigger("builder_resize")})),d.model.on("destroy",(function(){a.emptyRows().destroy()})),r.setDialogParents(panelsOptions.loc.layout_widget,d));var h=Boolean(i.closest(".widget-content").length);r.render().attach({container:i,dialog:h||"dialog"===i.data("mode"),type:i.data("type")}).setDataField(i.find("input.panels-data")),h||"dialog"===i.data("mode")?(r.setDialogParents(panelsOptions.loc.layout_widget,r.dialog),i.find(".siteorigin-panels-display-builder").on("click",(function(e){e.preventDefault(),r.dialog.openDialog()}))):i.find(".siteorigin-panels-display-builder").parent().remove(),l(document).trigger("panels_setup",r),i.data("soPanelsBuilderWidgetInitialized",!0)}}}))}},{}],17:[function(e,t,i){
|
2 |
/**
|
3 |
* Everything we need for SiteOrigin Page Builder.
|
4 |
*
|
5 |
* @copyright Greg Priday 2013 - 2016 - <https://siteorigin.com/>
|
6 |
* @license GPL 3.0 http://www.gnu.org/licenses/gpl.html
|
7 |
*/
|
8 |
+
var s={};window.panels=s,window.siteoriginPanels=s,s.helpers={},s.helpers.clipboard=e("./helpers/clipboard"),s.helpers.utils=e("./helpers/utils"),s.helpers.editor=e("./helpers/editor"),s.helpers.serialize=e("./helpers/serialize"),s.helpers.pageScroll=e("./helpers/page-scroll"),s.model={},s.model.widget=e("./model/widget"),s.model.cell=e("./model/cell"),s.model.row=e("./model/row"),s.model.builder=e("./model/builder"),s.model.historyEntry=e("./model/history-entry"),s.collection={},s.collection.widgets=e("./collection/widgets"),s.collection.cells=e("./collection/cells"),s.collection.rows=e("./collection/rows"),s.collection.historyEntries=e("./collection/history-entries"),s.view={},s.view.widget=e("./view/widget"),s.view.cell=e("./view/cell"),s.view.row=e("./view/row"),s.view.builder=e("./view/builder"),s.view.dialog=e("./view/dialog"),s.view.styles=e("./view/styles"),s.view.liveEditor=e("./view/live-editor"),s.dialog={},s.dialog.builder=e("./dialog/builder"),s.dialog.widgets=e("./dialog/widgets"),s.dialog.widget=e("./dialog/widget"),s.dialog.prebuilt=e("./dialog/prebuilt"),s.dialog.row=e("./dialog/row"),s.dialog.history=e("./dialog/history"),s.utils={},s.utils.menu=e("./utils/menu"),jQuery.fn.soPanelsSetupBuilderWidget=e("./jquery/setup-builder-widget"),jQuery((function(e){var t,i,s,l,o=e("#siteorigin-panels-metabox");if(s=e("form#post"),o.length&&s.length)t=o,i=o.find(".siteorigin-panels-data-field"),l={editorType:"tinyMCE",postId:e("#post_ID").val(),editorId:"#content",builderType:o.data("builder-type"),builderSupports:o.data("builder-supports"),loadOnAttach:panelsOptions.loadOnAttach&&1==e("#auto_draft").val(),loadLiveEditor:1==o.data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var n=e(".siteorigin-panels-builder-form");t=n.find(".siteorigin-panels-builder-container"),i=n.find('input[name="panels_data"]'),s=n,l={editorType:"standalone",postId:n.data("post-id"),editorId:"#post_content",builderType:n.data("type"),builderSupports:n.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:n.data("preview-url")}}if(!_.isUndefined(t)){var a=window.siteoriginPanels,r=new a.model.builder,d=new a.view.builder({model:r,config:l});e(document).trigger("before_panels_setup",d),d.render().attach({container:t}).setDataField(i).attachToEditor(),s.on("submit",(function(){r.refreshPanelsData()})),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",d,window.panels),window.soPanelsBuilderView=d}e(document).on("widget-added",(function(t,i){e(i).find(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})),e("body").hasClass("wp-customizer")||e((function(){e(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})),e(window).on("keyup",(function(t){27===t.which&&e(".so-panels-dialog-wrapper, .so-panels-live-editor").filter(":visible").last().find(".so-title-bar .so-close, .live-editor-close").trigger("click")}))}))},{"./collection/cells":1,"./collection/history-entries":2,"./collection/rows":3,"./collection/widgets":4,"./dialog/builder":5,"./dialog/history":6,"./dialog/prebuilt":7,"./dialog/row":8,"./dialog/widget":9,"./dialog/widgets":10,"./helpers/clipboard":11,"./helpers/editor":12,"./helpers/page-scroll":13,"./helpers/serialize":14,"./helpers/utils":15,"./jquery/setup-builder-widget":16,"./model/builder":18,"./model/cell":19,"./model/history-entry":20,"./model/row":21,"./model/widget":22,"./utils/menu":23,"./view/builder":24,"./view/cell":25,"./view/dialog":26,"./view/live-editor":27,"./view/row":28,"./view/styles":29,"./view/widget":30}],18:[function(e,t,i){t.exports=Backbone.Model.extend({layoutPosition:{BEFORE:"before",AFTER:"after",REPLACE:"replace"},rows:{},defaults:{data:{widgets:[],grids:[],grid_cells:[]}},initialize:function(){this.set("rows",new panels.collection.rows)},addRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var s=new panels.collection.cells(t);e=_.extend({collection:this.get("rows"),cells:s},e);var l=new panels.model.row(e);return l.builder=this,this.get("rows").add(l,i),l},loadPanelsData:function(e,t){try{t===this.layoutPosition.BEFORE?e=this.concatPanelsData(e,this.getPanelsData()):t===this.layoutPosition.AFTER&&(e=this.concatPanelsData(this.getPanelsData(),e)),this.emptyRows(),this.set("data",JSON.parse(JSON.stringify(e)),{silent:!0});var i,s=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var l=0;l<e.grid_cells.length;l++)i=parseInt(e.grid_cells[l].grid),_.isUndefined(s[i])&&(s[i]=[]),s[i].push(e.grid_cells[l]);var o=this;if(_.each(s,(function(t,i){var s={};_.isUndefined(e.grids[i].style)||(s.style=e.grids[i].style),_.isUndefined(e.grids[i].ratio)||(s.ratio=e.grids[i].ratio),_.isUndefined(e.grids[i].ratio_direction)||(s.ratio_direction=e.grids[i].ratio_direction),_.isUndefined(e.grids[i].color_label)||(s.color_label=e.grids[i].color_label),_.isUndefined(e.grids[i].label)||(s.label=e.grids[i].label),o.addRow(s,t,{noAnimate:!0})})),_.isUndefined(e.widgets))return;_.each(e.widgets,(function(e){var t=null;_.isUndefined(e.panels_info)?(t=e.info,delete e.info):(t=e.panels_info,delete e.panels_info);var i=o.get("rows").at(parseInt(t.grid)).get("cells").at(parseInt(t.cell)),s=new panels.model.widget({class:t.class,values:e});_.isUndefined(t.style)||s.set("style",t.style),_.isUndefined(t.read_only)||s.set("read_only",t.read_only),_.isUndefined(t.widget_id)?s.set("widget_id",panels.helpers.utils.generateUUID()):s.set("widget_id",t.widget_id),_.isUndefined(t.label)||s.set("label",t.label),s.cell=i,i.get("widgets").add(s,{noAnimate:!0})})),this.trigger("load_panels_data")}catch(e){console.log("Error loading data: "+e.message)}},concatPanelsData:function(e,t){if(_.isUndefined(t)||_.isUndefined(t.grids)||_.isEmpty(t.grids)||_.isUndefined(t.grid_cells)||_.isEmpty(t.grid_cells))return e;if(_.isUndefined(e)||_.isUndefined(e.grids)||_.isEmpty(e.grids))return t;var i,s=e.grids.length,l=_.isUndefined(e.widgets)?0:e.widgets.length,o={grids:[],grid_cells:[],widgets:[]};for(o.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(o.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(o.widgets=e.widgets.slice()),i=0;i<t.grid_cells.length;i++){var n=t.grid_cells[i];n.grid=parseInt(n.grid)+s,o.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(i=0;i<t.widgets.length;i++){var a=t.widgets[i];a.panels_info.grid=parseInt(a.panels_info.grid)+s,a.panels_info.id=parseInt(a.panels_info.id)+l,o.widgets.push(a)}return o},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.get("rows").each((function(i,s){i.get("cells").each((function(i,l){i.get("widgets").each((function(i,o){var n={class:i.get("class"),raw:i.get("raw"),grid:s,cell:l,id:t++,widget_id:i.get("widget_id"),style:i.get("style"),label:i.get("label")};_.isEmpty(n.widget_id)&&(n.widget_id=panels.helpers.utils.generateUUID());var a=_.extend(_.clone(i.get("values")),{panels_info:n});e.widgets.push(a)})),e.grid_cells.push({grid:s,index:l,weight:i.get("weight"),style:i.get("style")})})),e.grids.push({cells:i.get("cells").length,style:i.get("style"),ratio:i.get("ratio"),ratio_direction:i.get("ratio_direction"),color_label:i.get("color_label"),label:i.get("label")})})),e},refreshPanelsData:function(e){e=_.extend({silent:!1},e);var t=this.get("data"),i=this.getPanelsData();this.set("data",i,{silent:!0}),e.silent||JSON.stringify(i)===JSON.stringify(t)||(this.trigger("change"),this.trigger("change:data"),this.trigger("refresh_panels_data",i,e))},emptyRows:function(){return _.invoke(this.get("rows").toArray(),"destroy"),this.get("rows").reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},getPanelsDataFromHtml:function(e,t){var i,s=this,l=jQuery('<div id="wrapper">'+e+"</div>");if(l.find(".panel-layout .panel-grid").length){var o={grids:[],grid_cells:[],widgets:[]},n=new RegExp(panelsOptions.siteoriginWidgetRegex,"i"),a=(i=document.createElement("div"),function(e){return e&&"string"==typeof e&&(e=(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,"")).replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,""),i.innerHTML=e,e=i.textContent,i.textContent=""),e}),r=function(e){var t=e.find("div");if(!t.length)return e.html();for(var i=0;i<t.length-1&&t.eq(i).text().trim()==t.eq(i+1).text().trim();i++);var s=t.eq(i).find(".widget-title:header"),l="";return s.length&&(l=s.html(),s.remove()),{title:l,text:t.eq(i).html()}},d=l.find(".panel-layout").eq(0),h=function(e,t){return jQuery(t).closest(".panel-layout").is(d)};return l.find("> .panel-layout > .panel-grid").filter(h).each((function(e,i){var l=jQuery(i),d=l.find(".panel-grid-cell").filter(h);o.grids.push({cells:d.length,style:l.data("style"),ratio:l.data("ratio"),ratio_direction:l.data("ratio-direction"),color_label:l.data("color-label"),label:l.data("label")}),d.each((function(i,l){var d=jQuery(l),c=d.find(".so-panel").filter(h);o.grid_cells.push({grid:e,weight:_.isUndefined(d.data("weight"))?1:parseFloat(d.data("weight")),style:d.data("style")}),c.each((function(l,d){var h=jQuery(d),c=h.find(".panel-widget-style").length?h.find(".panel-widget-style").html():h.html(),u={grid:e,cell:i,style:h.data("style"),raw:!1,label:h.data("label")};c=c.trim();var p=n.exec(c);if(!_.isNull(p)&&""===c.replace(n,"").trim()){try{var g=/class="(.*?)"/.exec(p[3]),f=jQuery(p[5]),w=JSON.parse(a(f.val())).instance;u.class=g[1].replace(/\\\\+/g,"\\"),u.raw=!1,w.panels_info=u,o.widgets.push(w)}catch(e){u.class=t,o.widgets.push(_.extend(r(h),{filter:"1",type:"visual",panels_info:u}))}return!0}return-1!==c.indexOf("panel-layout")&&jQuery("<div>"+c+"</div>").find(".panel-layout .panel-grid").length?(u.class="SiteOrigin_Panels_Widgets_Layout",o.widgets.push({panels_data:s.getPanelsDataFromHtml(c,t),panels_info:u}),!0):(u.class=t,o.widgets.push(_.extend(r(h),{filter:"1",type:"visual",panels_info:u})),!0)}))}))})),l.find(".panel-layout").remove(),l.find("style[data-panels-style-for-post]").remove(),l.html().replace(/^\s+|\s+$/gm,"").length&&(o.grids.push({cells:1,style:{}}),o.grid_cells.push({grid:o.grids.length-1,weight:1}),o.widgets.push({filter:"1",text:l.html().replace(/^\s+|\s+$/gm,""),title:"",type:"visual",panels_info:{class:t,raw:!1,grid:o.grids.length-1,cell:0}})),o}return{grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:e,title:"",type:"visual",panels_info:{class:t,raw:!1,grid:0,cell:0}}]}}})},{}],19:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0,style:{}},indexes:null,initialize:function(){this.set("widgets",new panels.collection.widgets),this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.get("widgets").toArray(),"destroy"),this.get("widgets").reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.row),t=_.extend({cloneWidgets:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.get("cells"),{silent:!0}),i.row=e,t.cloneWidgets&&this.get("widgets").each((function(e){i.get("widgets").add(e.clone(i,t),{silent:!0})})),i}})},{}],20:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],21:[function(e,t,i){t.exports=Backbone.Model.extend({builder:null,defaults:{style:{}},indexes:null,initialize:function(){_.isEmpty(this.get("cells"))?this.set("cells",new panels.collection.cells):this.get("cells").each(function(e){e.row=this}.bind(this)),this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this.get("cells")||new panels.collection.cells,i=[];t.each((function(s,l){var o=e.at(l);if(o)s.set("weight",o.get("weight"));else{for(var n=t.at(e.length-1),a=s.get("widgets").models.slice(),r=0;r<a.length;r++)a[r].moveToCell(n,{silent:!1});i.push(s)}})),_.each(i,(function(e){t.remove(e)})),e.length>t.length&&_.each(e.slice(t.length,e.length),function(e){e.set({collection:t}),e.row=this,t.add(e)}.bind(this)),this.reweightCells()},reweightCells:function(){var e=0,t=this.get("cells");t.each((function(t){e+=t.get("weight")})),t.each((function(t){t.set("weight",t.get("weight")/e)})),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.get("cells").toArray(),"destroy"),this.get("cells").reset()},clone:function(e){_.isUndefined(e)&&(e=this.builder);var t=new this.constructor(this.attributes);t.set("collection",e.get("rows"),{silent:!0}),t.builder=e;var i=new panels.collection.cells;return this.get("cells").each((function(e){i.add(e.clone(t),{silent:!0})})),t.set("cells",i),t}})},{}],22:[function(e,t,i){t.exports=Backbone.Model.extend({cell:null,defaults:{class:null,missing:!1,values:{},raw:!1,style:{},read_only:!1,widget_id:""},indexes:null,initialize:function(){var e=this.get("class");!_.isUndefined(panelsOptions.widgets[e])&&panelsOptions.widgets[e].installed||this.set("missing",!0)},getWidgetField:function(e){return _.isUndefined(panelsOptions.widgets[this.get("class")])?"title"===e||"description"===e?panelsOptions.loc.missing_widget[e]:"":this.has("label")&&!_.isEmpty(this.get("label"))?this.get("label"):panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t,i){return t=_.extend({silent:!0},t),this.cell=e,this.collection.remove(this,t),e.get("widgets").add(this,_.extend({at:i},t)),this.trigger("move_to_cell",e,i),this},setValues:function(e){var t=!1;JSON.stringify(e)!==JSON.stringify(this.get("values"))&&(t=!0),this.set("values",e,{silent:!0}),t&&(this.trigger("change",this),this.trigger("change:values"))},clone:function(e,t){_.isUndefined(e)&&(e=this.cell);var i=new this.constructor(this.attributes),s=JSON.parse(JSON.stringify(this.get("values"))),l=function(e){return _.each(e,(function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&l(e[i])})),e};return s=l(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("widget_id",""),i.set("values",s,{silent:!0}),i.set("collection",e.get("widgets"),{silent:!0}),i.cell=e,i.isDuplicate=!0,i},getTitle:function(){var e=panelsOptions.widgets[this.get("class")];if(_.isUndefined(e))return this.get("class").replace(/_/g," ");if(!_.isUndefined(e.panels_title)&&!1===e.panels_title)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)"_"!==s.charAt(0)&&"so_sidebar_emulator_id"!==s&&"option_name"!==s&&t.hasOwnProperty(s)&&i.push(s);for(var l in i=_.uniq(i))if(!_.isUndefined(t[i[l]])&&_.isString(t[i[l]])&&""!==t[i[l]]&&"on"!==t[i[l]]&&"true"!==t[i[l]]&&"false"!==t[i[l]]&&"_"!==i[l][0]&&!_.isFinite(t[i[l]])){var o=t[i[l]],n=(o=o.replace(/<\/?[^>]+(>|$)/g,"")).split(" ");return(n=n.slice(0,20)).join(" ")}return this.getWidgetField("description")}})},{}],23:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({wrapperTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu").html())),sectionTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-context-menu-section").html())),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;l(window).on("contextmenu",(function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):!!e.active||(e.active=!1,e.trigger("activate_context",t,e),void(e.active&&(t.preventDefault(),e.openMenu({left:t.pageX,top:t.pageY}))))}))},render:function(){this.setElement(this.wrapperTemplate())},attach:function(){this.$el.appendTo("body")},openMenu:function(e){this.trigger("open_menu"),l(window).on("keyup",{menu:this},this.keyboardListen),l(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",l(window).height()-20),e.left+this.$el.outerWidth()+10>=l(window).width()&&(e.left=l(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-l(window).scrollTop()+10>=l(window).height()&&(e.top=l(window).height()+l(window).scrollTop()-this.$el.outerHeight()-10),e.left<=0&&(e.left=10),this.$el.css({left:e.left+1,top:e.top+1}).show(),this.$(".so-search-wrapper input").trigger("focus")},closeMenu:function(){this.trigger("close_menu"),l(window).off("keyup",this.keyboardListen),l(window).off("click",this.clickOutsideListen),this.active=!1,this.$el.empty().hide()},keyboardListen:function(e){var t=e.data.menu;switch(e.which){case 27:t.closeMenu()}},clickOutsideListen:function(e){var t=e.data.menu;3!==e.which&&t.$el.is(":visible")&&!t.isOverEl(t.$el,e)&&t.closeMenu()},addSection:function(e,t,i,s){var o=this;t=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},t);var n=l(this.sectionTemplate({settings:t,items:i})).attr("id","panels-menu-section-"+e);this.$el.append(n),n.find(".so-item:not(.so-confirm)").on("click",(function(){var e=l(this);s(e.data("key")),o.closeMenu()})),n.find(".so-item.so-confirm").on("click",(function(){var e=l(this);if(e.hasClass("so-confirming"))return s(e.data("key")),void o.closeMenu();e.data("original-text",e.html()).addClass("so-confirming").html('<span class="dashicons dashicons-yes"></span> '+panelsOptions.loc.dropdown_confirm),setTimeout((function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))}),2500)})),n.data("settings",t).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},hasSection:function(e){return this.$el.find("#panels-menu-section-"+e).length>0},searchKeyUp:function(e){var t=l(e.currentTarget),i=t.closest(".so-section"),s=i.data("settings");if(38===e.which||40===e.which){var o=i.find("ul li:visible"),n=o.filter(".so-active").eq(0);if(n.length){o.removeClass("so-active");var a=o.index(n);38===e.which?n=a-1<0?o.last():o.eq(a-1):40===e.which&&(n=a+1>=o.length?o.first():o.eq(a+1))}else 38===e.which?n=o.last():40===e.which&&(n=o.first());return n.addClass("so-active"),!1}if(13===e.which)return 1===i.find("ul li:visible").length?(i.find("ul li:visible").trigger("click"),!1):(i.find("ul li.so-active:visible").trigger("click"),!1);if(""===t.val())if(s.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<s.defaultDisplay.length;r++)i.find('.so-item[data-key="'+s.defaultDisplay[r]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each((function(){var e=l(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()}));i.find(".so-item:visible:gt("+(s.display-1)+")").hide(),0===i.find(".so-item:visible").length&&""!==t.val()?i.find(".so-no-results").show():i.find(".so-no-results").hide()},isOverEl:function(e,t){var i=[[e.offset().left,e.offset().top],[e.offset().left+e.outerWidth(),e.offset().top+e.outerHeight()]];return t.pageX>=i[0][0]&&t.pageX<=i[1][0]&&t.pageY>=i[0][1]&&t.pageY<=i[1][1]}})},{}],24:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder").html())),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",contentPreview:"",attachedToEditor:!1,attachedVisible:!1,liveEditor:void 0,menu:!1,activeCell:null,events:{"click .so-tool-button.so-widget-add":"displayAddWidgetDialog","click .so-tool-button.so-row-add":"displayAddRowDialog","click .so-tool-button.so-prebuilt-add":"displayAddPrebuiltDialog","click .so-tool-button.so-history":"displayHistoryDialog","click .so-tool-button.so-live-editor":"displayLiveEditor"},rows:null,initialize:function(e){var t=this;return this.config=_.extend({loadLiveEditor:!1,builderSupports:{}},e.config),this.config.builderSupports=_.extend({addRow:!0,editRow:!0,deleteRow:!0,moveRow:!0,addWidget:!0,editWidget:!0,deleteWidget:!0,moveWidget:!0,prebuilt:!0,history:!0,liveEditor:!0,revertToEditor:!0},this.config.builderSupports),e.config.loadLiveEditor&&this.on("builder_live_editor_added",(function(){this.displayLiveEditor()})),this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},$panelsMetabox=l("#siteorigin-panels-metabox"),$panelsMetabox.length&&(this.contentPreview=l.parseHTML($panelsMetabox.data("preview-markup"))),_.each(this.dialogs,(function(e,i,s){s[i].setBuilder(t)})),this.dialogs.row.setRowDialogType("create"),this.listenTo(this.model.get("rows"),"add",this.onAddRow),l(window).on("resize",(function(e){e.target===window&&t.trigger("builder_resize")})),this.listenTo(this.model,"change:data load_panels_data",this.storeModelData),this.listenTo(this.model,"change:data load_panels_data",this.toggleWelcomeDisplay),this.on("builder_attached_to_editor",this.handleContentChange,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("hide_builder",this.handleHideBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.on("display_builder",this.wrapEditorExpandAdjust,this),this.menu=new s.utils.menu({}),this.listenTo(this.menu,"activate_context",this.activateContextMenu),this.config.loadOnAttach&&this.on("builder_attached_to_editor",(function(){this.displayAttachedBuilder({confirm:!1})}),this),this},render:function(){return this.setElement(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){(e=_.extend({container:!1,dialog:!1},e)).dialog?(this.dialog=new s.dialog.builder,this.dialog.builder=this):(this.$el.appendTo(e.container),this.metabox=e.container.closest(".postbox"),this.initSortable(),this.trigger("attached_to_container",e.container)),this.trigger("builder_attached"),this.supports("liveEditor")&&this.addLiveEditor(),this.supports("history")&&this.addHistoryBrowser();var t=this.$(".so-builder-toolbar"),i=this.$(".so-panels-welcome-message"),l=panelsOptions.loc.welcomeMessage,o=[];this.supports("addWidget")?o.push(l.addWidgetButton):t.find(".so-widget-add").hide(),this.supports("addRow")?o.push(l.addRowButton):t.find(".so-row-add").hide(),this.supports("prebuilt")?o.push(l.addPrebuiltButton):t.find(".so-prebuilt-add").hide();var n="";3===o.length?n=l.threeEnabled:2===o.length?n=l.twoEnabled:1===o.length?n=l.oneEnabled:0===o.length&&(n=l.addingDisabled);var a=_.template(s.helpers.utils.processTemplate(n))({items:o})+" "+l.docsMessage;return i.find(".so-message-wrapper").html(a),this},attachToEditor:function(){if("tinyMCE"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;l("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").on("click",(function(e){e.preventDefault(),l("#wp-content-editor-container").show(),l("#wp-content-wrap").removeClass("panels-active"),l("#content-resize-handle").show(),t.trigger("hide_builder")})).end().append(l('<button type="button" id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find("h2.hndle").html()+"</button>").on("click",(function(e){t.displayAttachedBuilder({confirm:!0})&&e.preventDefault()}))),this.supports("revertToEditor")&&e.find(".so-switch-to-standard").on("click",(function(i){i.preventDefault(),confirm(panelsOptions.loc.confirm_stop_builder)&&(t.addHistoryEntry("back_to_editor"),t.model.loadPanelsData(!1),l("#wp-content-wrap").show(),e.hide(),l(window).trigger("resize"),t.attachedVisible=!1,t.trigger("hide_builder"))})).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)&&this.supports("revertToEditor")||this.displayAttachedBuilder({confirm:!1});var s=function(){var e=t.$(".so-builder-toolbar");if(t.$el.hasClass("so-display-narrow"))return e.css({top:0,left:0,width:"100%",position:"absolute"}),void t.$el.css("padding-top",e.outerHeight()+"px");var i=l(window).scrollTop()-t.$el.offset().top;"fixed"===l("#wpadminbar").css("position")&&(i+=l("#wpadminbar").outerHeight());var s=0,o=t.$el.outerHeight()-e.outerHeight()+20;i>s&&i<o?"fixed"!==e.css("position")&&e.css({top:l("#wpadminbar").outerHeight(),left:t.$el.offset().left+"px",width:t.$el.outerWidth()+"px",position:"fixed"}):e.css({top:Math.min(Math.max(i,0),t.$el.outerHeight()-e.outerHeight()+20)+"px",left:0,width:"100%",position:"absolute"}),t.$el.css("padding-top",e.outerHeight()+"px")};return this.on("builder_resize",s,this),l(document).on("scroll",s),s(),this.trigger("builder_attached_to_editor"),this},displayAttachedBuilder:function(e){if((e=_.extend({confirm:!0},e)).confirm){var t="undefined"!=typeof tinyMCE&&tinyMCE.get("content");if(""!==(t&&_.isFunction(t.getContent)?t.getContent():l("textarea#content").val())&&!confirm(panelsOptions.loc.confirm_use_builder))return!1}return l("#wp-content-wrap").hide(),l("#editor-expand-toggle").on("change.editor-expand",(function(){l(this).prop("checked")||l("#wp-content-wrap").hide()})),this.metabox.show().find("> .inside").show(),l(window).trigger("resize"),l(document).trigger("scroll"),this.attachedVisible=!0,this.trigger("display_builder"),!0},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this,t=e.$el.attr("id");return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",connectWith:"#"+t+".so-rows-container,.block-editor .so-rows-container",axis:"y",tolerance:"pointer",scroll:!1,remove:function(t,i){e.model.get("rows").remove(l(i.item).data("view").model,{silent:!0}),e.model.refreshPanelsData()},receive:function(t,i){e.model.get("rows").add(l(i.item).data("view").model,{silent:!0,at:l(i.item).index()}),e.model.refreshPanelsData()},stop:function(t,i){var s=l(i.item),o=s.data("view"),n=e.model.get("rows");n.get(o.model)&&(e.addHistoryEntry("row_moved"),n.remove(o.model,{silent:!0}),n.add(o.model,{silent:!0,at:s.index()}),o.trigger("move",s.index()),e.model.refreshPanelsData())}}),this},refreshSortable:function(){_.isNull(this.rowsSortable)||this.rowsSortable.sortable("refresh")},setDataField:function(e,t){if(t=_.extend({load:!0},t),this.dataField=e,this.dataField.data("builder",this),t.load&&""!==e.val()){var i=this.dataField.val();try{i=JSON.parse(i)}catch(e){console.log("Failed to parse Page Builder layout data from supplied data field."),i={}}this.setData(i)}return this},setData:function(e){this.model.loadPanelsData(e),this.currentData=e,this.toggleWelcomeDisplay()},getData:function(){return this.model.get("data")},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));l(this.dataField).val()!==e&&(l(this.dataField).val(e),l(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.row({model:e});l.builder=this,l.render(),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".so-rows-container")):l.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),l.resizeRow(),this.trigger("row_added")},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){var e=new s.model.row,t=new s.collection.cells([{weight:.5},{weight:.5}]);t.each((function(t){t.row=e})),e.set("cells",t),e.builder=this.model,this.dialogs.row.setRowModel(e),this.dialogs.row.openDialog()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},pasteRowHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.addHistoryEntry("row_pasted"),e.builder=this.model,this.model.get("rows").add(e,{at:this.model.get("rows").indexOf(this.model)+1}),this.model.refreshPanelsData())},getActiveCell:function(e){if(e=_.extend({createCell:!0},e),!this.model.get("rows").length){if(!e.createCell)return null;this.model.addRow({},[{weight:1}],{noAnimate:!0})}var t=this.activeCell;return _.isEmpty(t)||-1===this.model.get("rows").indexOf(t.model.row)?this.model.get("rows").last().get("cells").first():t.model},addLiveEditor:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.liveEditor=new s.view.liveEditor({builder:this,previewUrl:this.config.liveEditorPreview}),this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this.trigger("builder_live_editor_added"),this)},displayLiveEditor:function(){_.isUndefined(this.liveEditor)||this.liveEditor.open()},addHistoryBrowser:function(){if(_.isEmpty(this.config.liveEditorPreview))return this;this.dialogs.history=new s.dialog.history,this.dialogs.history.builder=this,this.dialogs.history.entries.builder=this.model,this.dialogs.history.setRevertEntry(this.model),this.$(".so-builder-toolbar .so-history").show()},addHistoryEntry:function(e,t){_.isUndefined(t)&&(t=null),_.isUndefined(this.dialogs.history)||this.dialogs.history.entries.addEntry(e,t)},supports:function(e){return"rowAction"===e?this.supports("addRow")||this.supports("editRow")||this.supports("deleteRow"):"widgetAction"===e?this.supports("addWidget")||this.supports("editWidget")||this.supports("deleteWidget"):!_.isUndefined(this.config.builderSupports[e])&&this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&(s.helpers.editor.isBlockEditor()||s.helpers.editor.isClassicEditor(this))){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||l.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content_json",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){this.contentPreview&&""!==e.post_content&&this.updateEditorContent(e.post_content),""!==e.preview&&(this.contentPreview=e.preview)}.bind(this))}},updateEditorContent:function(e){if("tinyMCE"!==this.config.editorType||"undefined"==typeof tinyMCE||_.isNull(tinyMCE.get("content"))){l(this.config.editorId).val(e).trigger("change").trigger("keyup")}else{var t=tinyMCE.get("content");t.setContent(e),t.fire("change"),t.fire("keyup")}this.triggerSeoChange()},triggerSeoChange:function(){"undefined"==typeof YoastSEO||_.isNull(YoastSEO)||_.isNull(YoastSEO.app.refresh)||YoastSEO.app.refresh(),"undefined"==typeof rankMathEditor||_.isNull(rankMathEditor)||_.isNull(rankMathEditor.refresh)||rankMathEditor.refresh("content")},handleDisplayBuilder:function(){var e="undefined"!=typeof tinyMCE&&tinyMCE.get("content"),t=e&&_.isFunction(e.getContent)?e.getContent():l("textarea#content").val();if((_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){var i=panelsOptions.text_widget;if(_.isEmpty(i))return;this.model.loadPanelsData(this.model.getPanelsDataFromHtml(t,i)),this.model.trigger("change"),this.model.trigger("change:data")}l("#post-status-info").addClass("for-siteorigin-panels")},handleHideBuilder:function(){l("#post-status-info").show().removeClass("for-siteorigin-panels")},wrapEditorExpandAdjust:function(){try{for(var e,t=(l.hasData(window)&&l._data(window)).events.scroll,i=0;i<t.length;i++)if("editor-expand"===t[i].namespace){e=t[i],l(window).off("scroll",e.handler),l(window).bind("scroll",function(t){this.attachedVisible||e.handler(t)}.bind(this));break}}catch(e){return}},handleBuilderSizing:function(){var e=this.$el.width();return e?(e<575?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow"),this):this},setDialogParents:function(e,t){_.each(this.dialogs,(function(i,s,l){l[s].setParent(e,t)})),this.on("add_dialog",(function(i){i.setParent(e,t)}),this)},toggleWelcomeDisplay:function(){this.model.get("rows").isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){if(l.contains(this.$el.get(0),e.target)){var i=l([]).add(this.$(".so-panels-welcome-message:visible")).add(this.$(".so-rows-container > .so-row-container")).add(this.$(".so-cells > .cell")).add(this.$(".cell-wrapper > .so-widget")).filter((function(i){return t.isOverEl(l(this),e)})),s=i.last().data("view");void 0!==s&&void 0!==s.buildContextualMenu?s.buildContextualMenu(e,t):i.last().hasClass("so-panels-welcome-message")&&this.buildContextualMenu(e,t)}},buildContextualMenu:function(e,t){var i={};this.supports("addRow")&&(i.add_row={title:panelsOptions.loc.contextual.add_row}),s.helpers.clipboard.canCopyPaste()&&s.helpers.clipboard.isModel("row-model")&&this.supports("addRow")&&(i.paste_row={title:panelsOptions.loc.contextual.row_paste}),_.isEmpty(i)||t.addSection("builder-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},i,function(e){switch(e){case"add_row":this.displayAddRowDialog();break;case"paste_row":this.pasteRowHandler()}}.bind(this))}})},{}],25:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-cell").html())),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.listenTo(this.model.get("widgets"),"add",this.onAddWidget)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.get("cells").totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.get("widgets").each((function(e){var i=new s.view.widget({model:e});i.cell=t,i.render(),i.$el.appendTo(t.$(".widgets-container"))})),this.initSortable(),this.initResizable(),this},initSortable:function(){if(!this.row.builder.supports("moveWidget"))return this;var e=this,t=e.row.builder,i=t.$el.attr("id"),s=t.model;return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+i+" .so-cells .cell .widgets-container,.block-editor .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},remove:function(t,i){e.model.get("widgets").remove(l(i.item).data("view").model,{silent:!0}),s.refreshPanelsData()},receive:function(t,i){var o=l(i.item).data("view");o.cell=e;var n=o.model;n.cell=e.model,e.model.get("widgets").add(n,{silent:!0,at:l(i.item).index()}),s.refreshPanelsData()},stop:function(t,i){var o=l(i.item),n=o.data("view"),a=o.closest(".cell").data("view");e.model.get("widgets").get(n.model)&&(e.row.builder.addHistoryEntry("widget_moved"),n.model.moveToCell(a.model,{},o.index()),n.cell=a,s.refreshPanelsData())},helper:function(e,t){var i=t.clone().css({width:t.outerWidth()+"px","z-index":1e4,position:"fixed"}).addClass("widget-being-dragged").appendTo("body");return t.outerWidth()>720&&i.animate({"margin-left":e.pageX-t.offset().left-240,width:480},"fast"),i}}),this},refreshSortable:function(){_.isNull(this.widgetSortable)||this.widgetSortable.sortable("refresh")},initResizable:function(){if(!this.row.builder.supports("editRow"))return this;var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;return t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var o=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});o.find(".resize-handle").remove();var n=e.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:e.$el.outerWidth()+"px",right:5,height:e.$el.outerHeight()+"px"});n.find(".resize-handle").remove(),l(this).data({newCellClone:o,prevCellClone:n})}},drag:function(i,o){var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;l(this).data("newCellClone").css("width",n*a+"px").find(".preview-cell-weight").html(Math.round(1e3*a)/10),l(this).data("prevCellClone").css("width",n*r+"px").find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,o){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resizeRow()),o.helper.css("left",-t.outerWidth()/2+"px"),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.widget({model:e});l.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),l.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".widgets-container")):l.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),!1===i.noAnimate&&l.visualCreate(),this.refreshSortable(),this.row.resizeRow(),this.row.builder.trigger("widget_added",l)},handleCellClick:function(e){this.row.builder.$el.find(".so-cells .cell").removeClass("cell-selected"),this.row.builder.activeCell!==this||this.model.get("widgets").length?(this.$el.addClass("cell-selected"),this.row.builder.activeCell=this):this.row.builder.activeCell=null},pasteHandler:function(){var e=s.helpers.clipboard.getModel("widget-model");!_.isEmpty(e)&&e instanceof s.model.widget&&(this.row.builder.addHistoryEntry("widget_pasted"),e.cell=this.model,this.model.get("widgets").add(e),this.row.builder.model.refreshPanelsData())},buildContextualMenu:function(e,t){var i=this;t.hasSection("add-widget-below")||t.addSection("add-widget-cell",{sectionTitle:panelsOptions.loc.contextual.add_widget_cell,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,(function(e){i.row.builder.trigger("before_user_adds_widget"),i.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=i.model,t.cell.get("widgets").add(t),i.row.builder.model.refreshPanelsData(),i.row.builder.trigger("after_user_adds_widget",t)}));var l={};this.row.builder.supports("addWidget")&&s.helpers.clipboard.isModel("widget-model")&&(l.paste={title:panelsOptions.loc.contextual.cell_paste_widget}),_.isEmpty(l)||t.addSection("cell-actions",{sectionTitle:panelsOptions.loc.contextual.cell_actions,search:!1},l,function(e){switch(e){case"paste":this.pasteHandler()}this.row.builder.model.refreshPanelsData()}.bind(this)),this.row.buildContextualMenu(e,t)}})},{}],26:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({dialogTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog").html())),dialogTabTemplate:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-dialog-tab").html())),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",dialogIcon:"",parentDialog:!1,dialogOpen:!1,editableLabel:!1,events:{"click .so-close":"closeDialog","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext"},initialize:function(){this.once("open_dialog",this.render),this.once("open_dialog",this.attach),this.once("open_dialog",this.setDialogClass),this.trigger("initialize_dialog",this),_.isUndefined(this.initializeDialog)||this.initializeDialog(),_.bindAll(this,"initSidebars","hasSidebar","onResize","toggleLeftSideBar","toggleRightSideBar")},getNextDialog:function(){return null},getPrevDialog:function(){return null},setDialogClass:function(){""!==this.dialogClass&&this.$(".so-panels-dialog").addClass(this.dialogClass)},setBuilder:function(e){return this.builder=e,e.trigger("add_dialog",this,this.builder),this},attach:function(){return this.$el.appendTo("body"),this},parseDialogContent:function(e,t){t=_.extend({cid:this.cid},t);var i=l(_.template(s.helpers.utils.processTemplate(e))(t)),o={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(o.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(o.right_sidebar=i.find(".right-sidebar").html()),o},renderDialog:function(e){if(e=_.extend({editableLabel:this.editableLabel,dialogIcon:this.dialogIcon},e),this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),!1!==this.parentDialog){var t=l('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');t.on("click",function(e){e.preventDefault(),this.closeDialog(),this.parentDialog.dialog.openDialog()}.bind(this)),this.$(".so-title-bar .so-title").before(t)}return this.$(".so-title-bar .so-title-editable").length&&this.initEditableLabel(),setTimeout(this.initSidebars,1),this},initSidebars:function(){var e=this.$(".so-show-left-sidebar").hide(),t=this.$(".so-show-right-sidebar").hide(),i=this.hasSidebar("left"),s=this.hasSidebar("right");(i||s)&&(l(window).on("resize",this.onResize),i&&(e.show(),e.on("click",this.toggleLeftSideBar)),s&&(t.show(),t.on("click",this.toggleRightSideBar))),this.onResize()},initTabs:function(){var e=this.$(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.on("click",(function(e){e.preventDefault();var i=l(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var s=i.attr("href");if(!_.isUndefined(s)&&"#"===s.charAt(0)){var o=s.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).show()}t.trigger("tab_click",i)})),this.$(".so-sidebar-tabs li a").first().trigger("click"),this},initToolbar:function(){this.$(".so-toolbar .so-buttons .so-toolbar-button").on("click",function(e){e.preventDefault(),this.trigger("button_click",l(e.currentTarget))}.bind(this)),this.$(".so-toolbar .so-buttons .so-dropdown-button").on("click",function(e){e.preventDefault();var t=l(e.currentTarget).siblings(".so-dropdown-links-wrapper");t.is(".hidden")?t.removeClass("hidden"):t.addClass("hidden")}.bind(this)),l("html").on("click",function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each((function(t,i){var s=l(i),o=l(e.target);0!==o.length&&(o.is(".so-needs-confirm")&&!o.is(".so-confirmed")||o.is(".so-dropdown-button"))||s.addClass("hidden")}))}.bind(this))},initEditableLabel:function(){var e=this.$(".so-title-bar .so-title-editable");e.on("keypress",(function(t){var i="keypress"===t.type&&13===t.keyCode;if(i){var s=l(":tabbable"),o=s.index(e);s.eq(o+1).trigger("focus"),window.getSelection().removeAllRanges()}return!i})).on("blur",function(){var t=e.text().replace(/^\s+|\s+$/gm,"");t!==e.data("original-value").replace(/^\s+|\s+$/gm,"")&&(e.text(t),this.trigger("edit_label",t))}.bind(this)).on("focus",(function(){e.data("original-value",e.text()),s.helpers.utils.selectElementContents(this)}))},setupDialog:function(){this.openDialog(),this.closeDialog()},refreshDialogNav:function(){this.$(".so-title-bar .so-nav").show().removeClass("so-disabled");var e=this.getNextDialog(),t=this.$(".so-title-bar .so-next"),i=this.getPrevDialog(),s=this.$(".so-title-bar .so-previous");null===e?t.hide():!1===e&&t.addClass("so-disabled"),null===i?s.hide():!1===i&&s.addClass("so-disabled")},openDialog:function(e){(e=_.extend({silent:!1},e)).silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),s.helpers.pageScroll.lock(),this.onResize(),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this),l(document).trigger("open_dialog",this))},closeDialog:function(e){(e=_.extend({silent:!1},e)).silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),s.helpers.pageScroll.unlock(),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&!1!==e&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&!1!==e&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),s={};return i.find("[name]").each((function(){var e=l(this);try{var i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(_.isEmpty(i))return!0;_.isUndefined(i[2])?t=e.attr("name"):(t=i[2].split("][")).unshift(i[1]),t=t.map((function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e}));var o=s,n=null,a=!!_.isString(e.attr("type"))&&e.attr("type").toLowerCase();if("checkbox"===a)n=e.is(":checked")?""===e.val()||e.val():null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("SELECT"===e.prop("tagName")){var r=e.find("option:selected");1===r.length?n=e.find("option:selected").val():r.length>1&&(n=_.map(e.find("option:selected"),(function(e,t){return l(e).val()})))}else n=e.val();if(!_.isUndefined(e.data("panels-filter")))switch(e.data("panels-filter")){case"json_parse":try{n=JSON.parse(n)}catch(e){n=""}}if(null!==n)for(var d=0;d<t.length;d++)d===t.length-1?""===t[d]?o.push(n):o[t[d]]=n:(_.isUndefined(o[t[d]])&&(""===t[d+1]?o[t[d]]=[]:o[t[d]]={}),o=o[t[d]])}catch(t){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+t.message)}})),s},setStatusMessage:function(e,t,i){var s=i?'<span class="dashicons dashicons-warning"></span>'+e:e;this.$(".so-toolbar .so-status").html(s),!_.isUndefined(t)&&t?this.$(".so-toolbar .so-status").addClass("so-panels-loading"):this.$(".so-toolbar .so-status").removeClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}},onResize:function(){var e=window.matchMedia("(max-width: 980px)");["left","right"].forEach(function(t){var i=this.$(".so-"+t+"-sidebar"),s=this.$(".so-show-"+t+"-sidebar");this.hasSidebar(t)?(s.hide(),e.matches?(s.show(),s.closest(".so-title-bar").addClass("so-has-"+t+"-button"),i.hide(),i.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-"+t+"-sidebar")):(s.hide(),s.closest(".so-title-bar").removeClass("so-has-"+t+"-button"),i.show(),i.closest(".so-panels-dialog").addClass("so-panels-dialog-has-"+t+"-sidebar"))):(i.hide(),s.hide())}.bind(this))},hasSidebar:function(e){return this.$(".so-"+e+"-sidebar").children().length>0},toggleLeftSideBar:function(){this.toggleSidebar("left")},toggleRightSideBar:function(){this.toggleSidebar("right")},toggleSidebar:function(e){var t=this.$(".so-"+e+"-sidebar");t.is(":visible")?t.hide():t.show()}})},{}],27:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-live-editor").html())),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-save":"closeAndSave","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){e=_.extend({builder:!1,previewUrl:!1},e),_.isEmpty(e.previewUrl)&&(e.previewUrl=panelsOptions.ajaxurl+"&action=so_panels_live_editor_preview"),this.builder=e.builder,this.previewUrl=e.previewUrl,this.listenTo(this.builder.model,"refresh_panels_data",this.handleRefreshData),this.listenTo(this.builder.model,"load_panels_data",this.handleLoadData)},render:function(){if(this.setElement(this.template()),this.$el.hide(),l("#submitdiv #save-post").length>0){var e=this.$el.find(".live-editor-save");e.text(e.data("save"))}var t=!1;l(document).on("mousedown",(function(){t=!0})).on("mouseup",(function(){t=!1}));var i=this;return this.$el.on("mouseenter",".so-widget-wrapper",(function(){var e=l(this).data("live-editor-preview-widget");t||void 0===e||!e.length||i.$(".so-preview-overlay").is(":visible")||(i.highlightElement(e),i.scrollToElement(e))})),this.$el.on("mouseleave",".so-widget-wrapper",function(){this.resetHighlights()}.bind(this)),this.listenTo(this.builder,"open_dialog",(function(){this.resetHighlights()})),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),s.helpers.pageScroll.lock(),this.$el.is(":visible"))return this;if(this.$el.show(),this.refreshPreview(this.builder.model.getPanelsData()),this.originalContainer=this.builder.$el.parent(),this.builder.$el.appendTo(this.$(".so-live-editor-builder")),this.builder.$(".so-tool-button.so-live-editor").hide(),this.builder.trigger("builder_resize"),"auto-draft"===l("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===l('#title[name="post_title"]').val()&&l('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),l(document).one("heartbeat-tick.autosave",(function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())})),wp.autosave.server.triggerSave())}},close:function(){if(!this.$el.is(":visible"))return this;this.$el.hide(),s.helpers.pageScroll.unlock(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),this.builder.trigger("builder_resize")},closeAndSave:function(){this.close(),l('#submitdiv input[type="submit"][name="save"]').trigger("click")},collapse:function(){this.$el.toggleClass("so-collapsed")},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout),this.previewIframe.contents().find("body").find(".panel-grid .panel-grid-cell .so-panel").filter((function(){return 0===l(this).parents(".so-panel").length})).not(e).addClass("so-panels-faded"),e.removeClass("so-panels-faded").addClass("so-panels-highlighted")},resetHighlights:function(){var e=this.previewIframe.contents().find("body");this.resetHighlightTimeout=setTimeout((function(){e.find(".panel-grid .panel-grid-cell .so-panel").removeClass("so-panels-faded so-panels-highlighted")}),100)},scrollToElement:function(e){this.$(".so-preview iframe")[0].contentWindow.liveEditorScrollTo(e)},handleRefreshData:function(e){if(!this.$el.is(":visible"))return this;this.refreshPreview(e)},handleLoadData:function(){if(!this.$el.is(":visible"))return this;this.refreshPreview(this.builder.model.getPanelsData())},refreshPreview:function(e){var t=this.loadTimes.length?_.reduce(this.loadTimes,(function(e,t){return e+t}),0)/this.loadTimes.length:1e3;_.isNull(this.previewIframe)||this.$(".so-preview-overlay").is(":visible")||(this.previewScrollTop=this.previewIframe.contents().scrollTop()),this.$(".so-preview-overlay").show(),this.$(".so-preview-overlay .so-loading-bar").clearQueue().css("width","0%").animate({width:"100%"},parseInt(t)+100),this.postToIframe({live_editor_panels_data:JSON.stringify(e),live_editor_post_ID:this.builder.config.postId},this.previewUrl,this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var s="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=l('<iframe src="'+t+'"></iframe>').attr({id:s,name:s}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var o=l('<form id="soPostToPreviewFrame" method="post"></form>').attr({id:s,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return l.each(e,(function(e,t){l('<input type="hidden" />').attr({name:e,value:t}).appendTo(o)})),o.trigger("submit").remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",(function(){var e=l(this),i=e.contents();if(!e.data("iframeready")){e.data("iframeready",!0),void 0!==e.data("load-start")&&(t.loadTimes.unshift((new Date).getTime()-e.data("load-start")),_.isEmpty(t.loadTimes)||(t.loadTimes=t.loadTimes.slice(0,4))),l(".live-editor-mode.so-active").length&&(l(".so-panels-live-editor .so-preview iframe").css("transition","none"),t.mobileToggle()),setTimeout((function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide(),l(".so-panels-live-editor .so-preview iframe").css("transition","all .2s ease")}),100);var s=i.find("#pl-"+t.builder.config.postId);s.find(".panel-grid .panel-grid-cell .so-panel").filter((function(){return l(this).closest(".panel-layout").is(s)})).each((function(e,i){var s=l(i),o=t.$(".so-live-editor-builder .so-widget-wrapper").eq(s.data("index"));o.data("live-editor-preview-widget",s),s.css({cursor:"pointer"}).on("mouseenter",(function(){o.parent().addClass("so-hovered"),t.highlightElement(s)})).on("mouseleave",(function(){o.parent().removeClass("so-hovered"),t.resetHighlights()})).on("click",(function(e){e.preventDefault(),o.find(".title h4").trigger("click")}))})),i.find("a").css({"pointer-events":"none"}).on("click",(function(e){e.preventDefault()}))}})).on("load",(function(){var e=l(this);e.data("iframeready")||e.trigger("iframeready")}))},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=l(void 0!==e?e.currentTarget:".live-editor-mode.so-active");this.$(".live-editor-mode").not(t).removeClass("so-active"),t.addClass("so-active"),this.$el.removeClass("live-editor-desktop-mode live-editor-tablet-mode live-editor-mobile-mode").addClass("live-editor-"+t.data("mode")+"-mode").find("iframe").css("width",t.data("width"))}})},{}],28:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-row").html())),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler","click .so-row-color":"rowColorChangeHandler"},builder:null,dialog:null,initialize:function(){var e=this.model.get("cells");this.listenTo(e,"add",this.handleCellAdd),this.listenTo(e,"remove",this.handleCellRemove),this.listenTo(this.model,"reweight_cells",this.resizeRow),this.listenTo(this.model,"destroy",this.onModelDestroy);var t=this;e.each((function(e){t.listenTo(e.get("widgets"),"add",t.resize)})),e.on("add",(function(e){t.listenTo(e.get("widgets"),"add",t.resize)}),this),this.listenTo(this.model,"change:label",this.onLabelChange)},render:function(){var e=this.model.has("color_label")?this.model.get("color_label"):1,t=this.model.has("label")?this.model.get("label"):"";this.setElement(this.template({rowColorLabel:e,rowLabel:t})),this.$el.data("view",this);var i=this;return this.model.get("cells").each((function(e){var t=new s.view.cell({model:e});t.row=i,t.render(),t.$el.appendTo(i.$(".so-cells"))})),this.builder.supports("rowAction")?(this.builder.supports("editRow")||(this.$(".so-row-toolbar .so-dropdown-links-wrapper .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addRow")||(this.$(".so-row-toolbar .so-dropdown-links-wrapper .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteRow")||(this.$(".so-row-toolbar .so-dropdown-links-wrapper .so-row-delete").parent().remove(),this.$el.addClass("so-row-no-delete"))):(this.$(".so-row-toolbar .so-dropdown-wrapper").remove(),this.$el.addClass("so-row-no-actions")),this.builder.supports("moveRow")||(this.$(".so-row-toolbar .so-row-move").remove(),this.$el.addClass("so-row-no-move")),this.$(".so-row-toolbar").html().trim().length||this.$(".so-row-toolbar").remove(),this.listenTo(this.builder,"widget_sortable_move",this.resizeRow),this.listenTo(this.builder,"builder_resize",this.resizeRow),this.resizeRow(),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},resizeRow:function(e){if(this.$el.is(":visible")){this.$(".so-cells .cell-wrapper").css("min-height",0),this.$(".so-cells .resize-handle").css("height",0);var t=0;this.$(".so-cells .cell").each((function(){t=Math.max(t,l(this).height()),l(this).css("width",100*l(this).data("view").model.get("weight")+"%")})),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,63)+"px"),this.$(".so-cells .resize-handle").css("height",this.$(".so-cells .cell-wrapper").outerHeight()+"px")}},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.builder.addHistoryEntry("row_deleted");var e=this;this.$el.fadeOut("normal",(function(){e.model.destroy(),e.builder.model.refreshPanelsData()}))},onLabelChange:function(e,t){0==this.$(".so-row-label").length?this.$(".so-row-toolbar").prepend('<h3 class="so-row-label">'+t+"</h3>"):this.$(".so-row-label").text(t)},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},pasteHandler:function(){var e=s.helpers.clipboard.getModel("row-model");!_.isEmpty(e)&&e instanceof s.model.row&&(this.builder.addHistoryEntry("row_pasted"),e.builder=this.builder.model,this.builder.model.get("rows").add(e,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData())},confirmedDeleteHandler:function(e){var t=l(e.target);if(t.hasClass("dashicons")&&(t=t.parent()),t.hasClass("so-confirmed"))this.visualDestroyModel();else{var i=t.html();t.addClass("so-confirmed").html('<span class="dashicons dashicons-yes"></span>'+panelsOptions.loc.dropdown_confirm),setTimeout((function(){t.removeClass("so-confirmed").html(i)}),2500)}},editSettingsHandler:function(){if(this.builder.supports("editRow"))return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model),this.dialog.rowView=this),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},rowColorChangeHandler:function(e){this.$(".so-row-color").removeClass("so-row-color-selected");var t=l(e.target),i=t.data("color-label"),s=this.model.has("color_label")?this.model.get("color_label"):1;t.addClass("so-row-color-selected"),this.$el.removeClass("so-row-color-"+s),this.$el.addClass("so-row-color-"+i),this.model.set("color_label",i)},handleCellAdd:function(e){var t=new s.view.cell({model:e});t.row=this,t.render(),t.$el.appendTo(this.$(".so-cells"))},handleCellRemove:function(e){this.$(".so-cells > .cell").each((function(){var t=l(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()}))},buildContextualMenu:function(e,t){for(var i=[],l=1;l<5;l++)i.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection("add-row",{sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},i,function(e){this.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,i=[],l=0;l<t;l++)i.push({weight:100/t});var o=new s.model.row({collection:this.collection}),n=new s.collection.cells(i);n.each((function(e){e.row=o})),o.setCells(n),o.builder=this.builder.model,this.builder.model.get("rows").add(o,{at:this.builder.model.get("rows").indexOf(this.model)+1}),this.builder.model.refreshPanelsData()}.bind(this));var o={};this.builder.supports("editRow")&&(o.edit={title:panelsOptions.loc.contextual.row_edit}),s.helpers.clipboard.canCopyPaste()&&(o.copy={title:panelsOptions.loc.contextual.row_copy},this.builder.supports("addRow")&&s.helpers.clipboard.isModel("row-model")&&(o.paste={title:panelsOptions.loc.contextual.row_paste})),this.builder.supports("addRow")&&(o.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(o.delete={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(o)||t.addSection("row-actions",{sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},o,function(e){switch(e){case"edit":this.editSettingsHandler();break;case"copy":this.copyHandler();break;case"paste":this.pasteHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this))}})},{}],29:[function(e,t,i){window.panels;var s=jQuery;t.exports=Backbone.View.extend({stylesLoaded:!1,initialize:function(){},render:function(e,t,i){if(!_.isUndefined(e)){i=_.extend({builderType:"",dialog:null},i),this.$el.addClass("so-visual-styles so-"+e+"-styles so-panels-loading");var l={builderType:i.builderType};return"cell"===e&&(l.index=i.index),s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify(l),postId:t},null,"html").done(function(e){this.$el.html(e),this.setupFields(),this.stylesLoaded=!0,this.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}.bind(this)).fail(function(e){var t;t=e&&e.responseText?e.responseText:panelsOptions.forms.loadingFailed,this.$el.html(t)}.bind(this)).always(function(){this.$el.removeClass("so-panels-loading")}.bind(this)),this}},attach:function(e){e.append(this.$el)},detach:function(){this.$el.detach()},setupFields:function(){this.$(".style-section-wrapper").each((function(){var e=s(this);e.find(".style-section-head").on("click",(function(t){t.preventDefault(),e.find(".style-section-fields").slideToggle("fast")}))})),_.isUndefined(s.fn.wpColorPicker)||(_.isObject(panelsOptions.wpColorPickerOptions.palettes)&&!s.isArray(panelsOptions.wpColorPickerOptions.palettes)&&(panelsOptions.wpColorPickerOptions.palettes=s.map(panelsOptions.wpColorPickerOptions.palettes,(function(e){return e}))),this.$(".so-wp-color-field").wpColorPicker(panelsOptions.wpColorPickerOptions)),this.$(".style-field-image").each((function(){var e=null,t=s(this);t.find(".so-image-selector").on("click",(function(i){i.preventDefault(),null===e&&(e=wp.media({title:"choose",library:{type:"image"},button:{text:"Done",close:!0}})).on("select",(function(){var i=e.state().get("selection").first().attributes,s=i.url;if(!_.isUndefined(i.sizes))try{s=i.sizes.thumbnail.url}catch(e){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find(".so-image-selector > input").val(i.id),t.find(".remove-image").removeClass("hidden")})),e.open()})),t.find(".remove-image").on("click",(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find(".so-image-selector > input").val(""),t.find(".remove-image").addClass("hidden")}))})),this.$(".style-field-measurement").each((function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),l=e.find('input[type="hidden"]');t.on("focus",(function(){s(this).trigger("select")}));!function(e){if(""!==e){var o=/(?:([0-9\.,\-]+)(.*))+/,n=l.val().split(" "),a=[];for(var r in n){var d=o.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}1===t.length?t.val(a.join(" ")):(1===a.length?a=[a[0],a[0],a[0],a[0]]:2===a.length?a=[a[0],a[1],a[0],a[1]]:3===a.length&&(a=[a[0],a[1],a[2],a[1]]),t.each((function(e,t){s(t).val(a[e])})))}}(l.val());var o=function(e){if(1===t.length){var o=t.val().split(" ").filter((function(e){return""!==e})).map((function(e){return e+i.val()})).join(" ");l.val(o)}else{var n=s(e.target),a=[],r=[],d=[];t.each((function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;a.push(i),null===i?r.push(e):d.push(e)})),3===r.length&&d[0]===t.index(n)&&(t.val(n.val()),a=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(a)===JSON.stringify([null,null,null,null])?l.val(""):l.val(a.map((function(e){return(null===e?0:e)+i.val()})).join(" "))}};t.on("change",o),i.on("change",o)}))}})},{}],30:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(s.helpers.utils.processTemplate(l("#siteorigin-panels-builder-widget").html())),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","touchend .widget-edit":"editHandler","click .title h4":"editHandler","touchend .title h4":"editHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.listenTo(this.model,"destroy",this.onModelDestroy),this.listenTo(this.model,"change:values",this.onModelChange),this.listenTo(this.model,"change:label",this.onLabelChange)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle(),widget_class:this.model.attributes.class})),this.$el.data("view",this),this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")||(this.$(".actions .widget-edit").remove(),this.$el.addClass("so-widget-no-edit")),this.cell.row.builder.supports("addWidget")||(this.$(".actions .widget-duplicate").remove(),this.$el.addClass("so-widget-no-duplicate")),this.cell.row.builder.supports("deleteWidget")||(this.$(".actions .widget-delete").remove(),this.$el.addClass("so-widget-no-delete")),this.cell.row.builder.supports("moveWidget")||this.$el.addClass("so-widget-no-move"),this.$(".actions").html().trim().length||this.$(".actions").remove(),this.model.get("read_only")&&this.$el.addClass("so-widget-read-only"),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}return this.listenTo(this.cell.row.builder,"after_user_adds_widget",this.afterUserAddsWidgetHandler),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},getEditDialog:function(){return null===this.dialog&&(this.dialog=new s.dialog.widget({model:this.model}),this.dialog.setBuilder(this.cell.row.builder),this.dialog.widgetView=this),this.dialog},editHandler:function(){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.getEditDialog().openDialog(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.get("widgets").add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},copyHandler:function(){s.helpers.clipboard.setModel(this.model)},deleteHandler:function(){return this.visualDestroyModel(),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onLabelChange:function(e){this.$(".title > h4").text(e.getWidgetField("title"))},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){return this.cell.row.builder.addHistoryEntry("widget_deleted"),this.$el.fadeOut("fast",function(){this.cell.row.resizeRow(),this.model.destroy(),this.cell.row.builder.model.refreshPanelsData(),this.remove()}.bind(this)),this},buildContextualMenu:function(e,t){this.cell.row.builder.supports("addWidget")&&t.addSection("add-widget-below",{sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){this.cell.row.builder.trigger("before_user_adds_widget"),this.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({class:e});t.cell=this.cell.model,this.cell.model.get("widgets").add(t,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this.cell.row.builder.trigger("after_user_adds_widget",t)}.bind(this));var i={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(i.edit={title:panelsOptions.loc.contextual.widget_edit}),s.helpers.clipboard.canCopyPaste()&&(i.copy={title:panelsOptions.loc.contextual.widget_copy}),this.cell.row.builder.supports("addWidget")&&(i.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(i.delete={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(i)||t.addSection("widget-actions",{sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},i,function(e){switch(e){case"edit":this.editHandler();break;case"copy":this.copyHandler();break;case"duplicate":this.duplicateHandler();break;case"delete":this.visualDestroyModel()}}.bind(this)),this.cell.buildContextualMenu(e,t)},afterUserAddsWidgetHandler:function(e){this.model===e&&panelsOptions.instant_open&&setTimeout(this.editHandler.bind(this),350)}})},{}],31:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.customHtmlWidgets,o=s("<div></div>"),n=t.find(".widget-content:first");n.before(o);var a=new l.CustomHtmlWidgetControl({el:o,syncContainer:n});return a.initializeEditor(),a.editor.codemirror.refresh(),a}};t.exports=l},{}],32:[function(e,t,i){var s=e("./custom-html-widget"),l=e("./media-widget"),o=e("./text-widget"),n={CUSTOM_HTML:"custom_html",MEDIA_AUDIO:"media_audio",MEDIA_GALLERY:"media_gallery",MEDIA_IMAGE:"media_image",MEDIA_VIDEO:"media_video",TEXT:"text",addWidget:function(e,t){var i,n=e.find("> .id_base").val();switch(n){case this.CUSTOM_HTML:i=s;break;case this.MEDIA_AUDIO:case this.MEDIA_GALLERY:case this.MEDIA_IMAGE:case this.MEDIA_VIDEO:i=l;break;case this.TEXT:i=o}i.addWidget(n,e,t)}};t.exports=n},{"./custom-html-widget":31,"./media-widget":33,"./text-widget":34}],33:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.mediaWidgets,o=l.controlConstructors[e];if(o){var n=l.modelConstructors[e]||l.MediaWidgetModel,a=t.find("> .widget-content"),r=s('<div class="media-widget-control"></div>');a.before(r);var d={};a.find(".media-widget-instance-property").each((function(){var e=s(this);d[e.data("property")]=e.val()})),d.widget_id=i;var h=new o({el:r,syncContainer:a,model:new n(d)});return h.render(),h}}};t.exports=l},{}],34:[function(e,t,i){var s=jQuery,l={addWidget:function(e,t,i){var l=wp.textWidgets,o={},n=t.find(".visual");if(n.length>0){if(!n.val())return null;var a=s("<div></div>"),r=t.find(".widget-content:first");r.before(a),o={el:a,syncContainer:r}}else o={el:t};var d=new l.TextWidgetControl(o),h=wp.oldEditor?wp.oldEditor:wp.editor;return h&&h.hasOwnProperty("autop")&&(wp.editor.autop=h.autop,wp.editor.removep=h.removep,wp.editor.initialize=h.initialize),d.initializeEditor(),d}};t.exports=l},{}]},{},[17]);
|
js/styling.js
CHANGED
@@ -28,10 +28,10 @@ jQuery( function ( $ ) {
|
|
28 |
rightSpace = fullContainer.outerWidth() - leftSpace - $$.parent().outerWidth();
|
29 |
|
30 |
$$.css( {
|
31 |
-
'margin-left': - leftSpace,
|
32 |
-
'margin-right': - rightSpace,
|
33 |
-
'padding-left': stretchType === 'full' ? leftSpace : defaultSidePadding,
|
34 |
-
'padding-right': stretchType === 'full' ? rightSpace : defaultSidePadding
|
35 |
} );
|
36 |
|
37 |
var cells = $$.find( '> .panel-grid-cell' );
|
28 |
rightSpace = fullContainer.outerWidth() - leftSpace - $$.parent().outerWidth();
|
29 |
|
30 |
$$.css( {
|
31 |
+
'margin-left': - leftSpace + 'px',
|
32 |
+
'margin-right': - rightSpace + 'px',
|
33 |
+
'padding-left': stretchType === 'full' ? leftSpace + 'px' : defaultSidePadding,
|
34 |
+
'padding-right': stretchType === 'full' ? rightSpace + 'px': defaultSidePadding
|
35 |
} );
|
36 |
|
37 |
var cells = $$.find( '> .panel-grid-cell' );
|
js/styling.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery((function(e){var t=function(){var t=e(panelsStyles.fullContainer);0===t.length&&(t=e("body"));var r=e(".siteorigin-panels-stretch.panel-row-style");r.each((function(){var r=e(this),i=r.data("stretch-type"),n="full-stretched-padded"===i?"":0;r.css({"margin-left":0,"margin-right":0,"padding-left":n,"padding-right":n});var l=r.offset().left-t.offset().left,a=t.outerWidth()-l-r.parent().outerWidth();r.css({"margin-left":-l,"margin-right":-a,"padding-left":"full"===i?l:n,"padding-right":"full"===i?a:n});var d=r.find("> .panel-grid-cell");"full-stretched"===i&&1===d.length&&d.css({"padding-left":0,"padding-right":0}),r.css({"border-left":n,"border-right":n})})),r.length&&e(window).trigger("panelsStretchRows")};e(window).on("resize load",t),t(),e("body").removeClass("siteorigin-panels-before-js")}));
|
1 |
+
jQuery((function(e){var t=function(){var t=e(panelsStyles.fullContainer);0===t.length&&(t=e("body"));var r=e(".siteorigin-panels-stretch.panel-row-style");r.each((function(){var r=e(this),i=r.data("stretch-type"),n="full-stretched-padded"===i?"":0;r.css({"margin-left":0,"margin-right":0,"padding-left":n,"padding-right":n});var l=r.offset().left-t.offset().left,a=t.outerWidth()-l-r.parent().outerWidth();r.css({"margin-left":-l+"px","margin-right":-a+"px","padding-left":"full"===i?l+"px":n,"padding-right":"full"===i?a+"px":n});var d=r.find("> .panel-grid-cell");"full-stretched"===i&&1===d.length&&d.css({"padding-left":0,"padding-right":0}),r.css({"border-left":n,"border-right":n})})),r.length&&e(window).trigger("panelsStretchRows")};e(window).on("resize load",t),t(),e("body").removeClass("siteorigin-panels-before-js")}));
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Page Builder by SiteOrigin ===
|
2 |
Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
|
3 |
Requires at least: 4.7
|
4 |
-
Tested up to: 5.
|
5 |
Requires PHP: 5.6.20
|
6 |
-
Stable tag: 2.11.
|
7 |
-
Build time: 2020-12-
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
Donate link: https://siteorigin.com/downloads/premium/
|
@@ -97,6 +97,9 @@ We've tried to ensure that Page Builder is compatible with most plugin widgets.
|
|
97 |
|
98 |
== Changelog ==
|
99 |
|
|
|
|
|
|
|
100 |
= 2.11.7 - 07 December 2020 =
|
101 |
* SEO: Generated `preview_url` before `preview_content`. Resolves Live Editor preview issue when a post loop is present in the page.
|
102 |
|
1 |
=== Page Builder by SiteOrigin ===
|
2 |
Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
|
3 |
Requires at least: 4.7
|
4 |
+
Tested up to: 5.7
|
5 |
Requires PHP: 5.6.20
|
6 |
+
Stable tag: 2.11.8
|
7 |
+
Build time: 2020-12-09T15:04:44+02:00
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
Donate link: https://siteorigin.com/downloads/premium/
|
97 |
|
98 |
== Changelog ==
|
99 |
|
100 |
+
= 2.11.8 - 09 December 2020 =
|
101 |
+
* Developer: jQuery updates for WordPress 5.6.
|
102 |
+
|
103 |
= 2.11.7 - 07 December 2020 =
|
104 |
* SEO: Generated `preview_url` before `preview_content`. Resolves Live Editor preview issue when a post loop is present in the page.
|
105 |
|
settings/admin-settings.js
CHANGED
@@ -12,15 +12,20 @@ jQuery( function($){
|
|
12 |
|
13 |
setTimeout( function(){
|
14 |
$$.show()
|
15 |
-
.css(
|
|
|
|
|
|
|
|
|
|
|
16 |
.animate({'margin-top' : 0, 'opacity': opacity}, 280 + 40*(4 - v) );
|
17 |
}, 150 + 225 * (4 - v) );
|
18 |
});
|
19 |
-
});
|
20 |
|
21 |
// Settings page tabbing
|
22 |
|
23 |
-
$('.settings-nav li a').click
|
24 |
e.preventDefault();
|
25 |
var $$ = $(this);
|
26 |
$('.settings-nav li a').not($$).closest('li').removeClass('active');
|
@@ -40,7 +45,7 @@ jQuery( function($){
|
|
40 |
});
|
41 |
|
42 |
if( window.location.hash ) {
|
43 |
-
$('.settings-nav li a[href="' + window.location.hash + '"]').click
|
44 |
}
|
45 |
|
46 |
$('#panels-settings-section-welcome').fitVids();
|
@@ -48,8 +53,11 @@ jQuery( function($){
|
|
48 |
// Save the tab the user last clicked
|
49 |
|
50 |
var tabClicked = getUserSetting('siteorigin_panels_setting_tab');
|
51 |
-
if(tabClicked === '') {
|
52 |
-
|
|
|
|
|
|
|
53 |
|
54 |
// Search settings
|
55 |
|
@@ -69,7 +77,7 @@ jQuery( function($){
|
|
69 |
$s.removeClass('highlighted');
|
70 |
});
|
71 |
|
72 |
-
$s.find('input,textarea').focus
|
73 |
};
|
74 |
|
75 |
var doSettingsSearch = function(){
|
@@ -127,7 +135,7 @@ jQuery( function($){
|
|
127 |
.click(function(){
|
128 |
highlightSetting( el );
|
129 |
$r.fadeOut('fast');
|
130 |
-
$('#panels-settings-search input').blur
|
131 |
})
|
132 |
);
|
133 |
});
|
@@ -138,9 +146,8 @@ jQuery( function($){
|
|
138 |
};
|
139 |
|
140 |
$('#panels-settings-search input')
|
141 |
-
.keyup
|
142 |
-
.
|
143 |
-
.blur( function(){
|
144 |
$('#panels-settings-search .results').fadeOut('fast');
|
145 |
} );
|
146 |
|
12 |
|
13 |
setTimeout( function(){
|
14 |
$$.show()
|
15 |
+
.css(
|
16 |
+
{
|
17 |
+
'margin-top': '-5px',
|
18 |
+
'opacity': 0,
|
19 |
+
}
|
20 |
+
)
|
21 |
.animate({'margin-top' : 0, 'opacity': opacity}, 280 + 40*(4 - v) );
|
22 |
}, 150 + 225 * (4 - v) );
|
23 |
});
|
24 |
+
}).each(function() { if(this.complete) { $(this).trigger( 'load' ); } });
|
25 |
|
26 |
// Settings page tabbing
|
27 |
|
28 |
+
$( '.settings-nav li a' ).on( 'click', function( e ) {
|
29 |
e.preventDefault();
|
30 |
var $$ = $(this);
|
31 |
$('.settings-nav li a').not($$).closest('li').removeClass('active');
|
45 |
});
|
46 |
|
47 |
if( window.location.hash ) {
|
48 |
+
$( '.settings-nav li a[href="' + window.location.hash + '"]' ).trigger( 'click' );
|
49 |
}
|
50 |
|
51 |
$('#panels-settings-section-welcome').fitVids();
|
53 |
// Save the tab the user last clicked
|
54 |
|
55 |
var tabClicked = getUserSetting('siteorigin_panels_setting_tab');
|
56 |
+
if ( tabClicked === '' ) {
|
57 |
+
$( '.settings-nav li a' ).first().trigger( 'click' );
|
58 |
+
} else {
|
59 |
+
$( '.settings-nav li a[href="#' + tabClicked + '"]' ).first().trigger( 'click' );
|
60 |
+
}
|
61 |
|
62 |
// Search settings
|
63 |
|
77 |
$s.removeClass('highlighted');
|
78 |
});
|
79 |
|
80 |
+
$s.find( 'input, textarea' ).trigger( 'focus' );
|
81 |
};
|
82 |
|
83 |
var doSettingsSearch = function(){
|
135 |
.click(function(){
|
136 |
highlightSetting( el );
|
137 |
$r.fadeOut('fast');
|
138 |
+
$('#panels-settings-search input').trigger( 'blur' );
|
139 |
})
|
140 |
);
|
141 |
});
|
146 |
};
|
147 |
|
148 |
$('#panels-settings-search input')
|
149 |
+
.on( 'keyup click', doSettingsSearch )
|
150 |
+
.on( 'blur', function(){
|
|
|
151 |
$('#panels-settings-search .results').fadeOut('fast');
|
152 |
} );
|
153 |
|
settings/admin-settings.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery((function(t){t(".settings-banner img").hide().eq(0).one("load",(function(){t.each([1,2,3],(function(e,i){var s=t(".settings-banner img.layer-"+i),n=s.css("opacity");setTimeout((function(){s.show().css({"margin-top"
|
1 |
+
jQuery((function(t){t(".settings-banner img").hide().eq(0).one("load",(function(){t.each([1,2,3],(function(e,i){var s=t(".settings-banner img.layer-"+i),n=s.css("opacity");setTimeout((function(){s.show().css({"margin-top":"-5px",opacity:0}).animate({"margin-top":0,opacity:n},280+40*(4-i))}),150+225*(4-i))}))})).each((function(){this.complete&&t(this).trigger("load")})),t(".settings-nav li a").on("click",(function(e){e.preventDefault();var i=t(this);t(".settings-nav li a").not(i).closest("li").removeClass("active"),i.closest("li").addClass("active");var s=i.attr("href").split("#")[1],n=t("#panels-settings-section-"+s);t("#panels-settings-sections .panels-settings-section").not(n).hide(),n.show(),t('#panels-settings-page input[type="submit"]').css({visibility:"welcome"===s?"hidden":"visible"}),setUserSetting("siteorigin_panels_setting_tab",s)})),window.location.hash&&t('.settings-nav li a[href="'+window.location.hash+'"]').trigger("click"),t("#panels-settings-section-welcome").fitVids();var e=getUserSetting("siteorigin_panels_setting_tab");""===e?t(".settings-nav li a").first().trigger("click"):t('.settings-nav li a[href="#'+e+'"]').first().trigger("click");t("#panels-settings-search input").on("keyup click",(function(){var e=t(this),i=t("#panels-settings-search .results"),s=e.val();if(""===s)return i.empty().hide(),!1;var n=[];t("#panels-settings-sections .panels-setting").each((function(){var e=t(this),i=0,a=e.find("label").html().toLowerCase().indexOf(s),r=e.find(".description").data("keywords").toLowerCase().indexOf(s),o=e.find(".description").html().toLowerCase().indexOf(s);0===a?i+=10:-1!==a&&(i+=7),0===r?i+=4:-1!==r&&(i+=3),0===o?i+=2:-1!==o&&(i+=1),i>0&&(n.push(e),e.data("isMatch",i))})),i.empty(),n.length>0?(i.show(),n.sort((function(t,e){return e.data("isMatch")-t.data("isMatch")})),n=n.slice(0,8),t.each(n,(function(e,s){t("#panels-settings-search .results").append(t("<li></li>").html(s.find("label").html()).click((function(){var e;t('.settings-nav li a[href="#'+(e=s).closest(".panels-settings-section").data("section")+'"]').first().click(),e.addClass("highlighted"),e.find("label").css("border-left-width",0).animate({"border-left-width":5},"normal").delay(4e3).animate({"border-left-width":0},"normal",(function(){e.removeClass("highlighted")})),e.find("input, textarea").trigger("focus"),i.fadeOut("fast"),t("#panels-settings-search input").trigger("blur")})))}))):i.hide()})).on("blur",(function(){t("#panels-settings-search .results").fadeOut("fast")}))})),function(t){"use strict";t.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("div");n.innerHTML='<p>x</p><style id="fit-vids-style">.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>',s.appendChild(n.childNodes[1])}return e&&t.extend(i,e),this.each((function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var s=".fitvidsignore";i.ignore&&(s=s+", "+i.ignore);var n=t(this).find(e.join(","));(n=(n=n.not("object object")).not(s)).each((function(){var e=t(this);if(!(e.parents(s).length>0||"embed"===this.tagName.toLowerCase()&&e.parent("object").length||e.parent(".fluid-width-video-wrapper").length)){e.css("height")||e.css("width")||!isNaN(e.attr("height"))&&!isNaN(e.attr("width"))||(e.attr("height",9),e.attr("width",16));var i=("object"===this.tagName.toLowerCase()||e.attr("height")&&!isNaN(parseInt(e.attr("height"),10))?parseInt(e.attr("height"),10):e.height())/(isNaN(parseInt(e.attr("width"),10))?e.width():parseInt(e.attr("width"),10));if(!e.attr("name")){var n="fitvid"+t.fn.fitVids._count;e.attr("name",n),t.fn.fitVids._count++}e.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*i+"%"),e.removeAttr("height").removeAttr("width")}}))}))},t.fn.fitVids._count=0}(window.jQuery||window.Zepto);
|
siteorigin-panels.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Page Builder by SiteOrigin
|
4 |
Plugin URI: https://siteorigin.com/page-builder/
|
5 |
Description: A drag and drop, responsive page builder that simplifies building your website.
|
6 |
-
Version: 2.11.
|
7 |
Author: SiteOrigin
|
8 |
Author URI: https://siteorigin.com
|
9 |
License: GPL3
|
@@ -11,7 +11,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
11 |
Donate link: http://siteorigin.com/page-builder/#donate
|
12 |
*/
|
13 |
|
14 |
-
define( 'SITEORIGIN_PANELS_VERSION', '2.11.
|
15 |
if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
|
16 |
define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
|
17 |
}
|
3 |
Plugin Name: Page Builder by SiteOrigin
|
4 |
Plugin URI: https://siteorigin.com/page-builder/
|
5 |
Description: A drag and drop, responsive page builder that simplifies building your website.
|
6 |
+
Version: 2.11.8
|
7 |
Author: SiteOrigin
|
8 |
Author URI: https://siteorigin.com
|
9 |
License: GPL3
|
11 |
Donate link: http://siteorigin.com/page-builder/#donate
|
12 |
*/
|
13 |
|
14 |
+
define( 'SITEORIGIN_PANELS_VERSION', '2.11.8' );
|
15 |
if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
|
16 |
define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
|
17 |
}
|
tpl/js-templates.php
CHANGED
@@ -156,7 +156,7 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
|
|
156 |
<div class="so-title-bar {{% if ( dialogIcon ) print( 'so-has-icon' ) %}}">
|
157 |
<a class="so-show-left-sidebar"><span class="so-dialog-icon"></span></a>
|
158 |
{{% if ( ! _.isEmpty( dialogIcon ) ) { %}}
|
159 |
-
<div class="so-panels-icon so-panels-icon-{{%- dialogIcon %}}"
|
160 |
{{% } %}}
|
161 |
<h3 class="so-title{{% if ( editableLabel ) print(' so-title-editable')%}}"
|
162 |
{{% if ( editableLabel ) print('contenteditable="true" spellcheck="false" tabIndex="1"')%}}
|
@@ -609,7 +609,7 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
|
|
609 |
<script type="text/template" id="siteorigin-panels-add-layout-block-button">
|
610 |
<div class="siteorigin-panels-add-layout-block wp-block">
|
611 |
<button class="components-button is-button is-primary">
|
612 |
-
<span class="siteorigin-panels-block-icon white"
|
613 |
<?php _e( 'Add SiteOrigin Layout Block', 'siteorigin-panels' ) ?>
|
614 |
</button>
|
615 |
</div>
|
156 |
<div class="so-title-bar {{% if ( dialogIcon ) print( 'so-has-icon' ) %}}">
|
157 |
<a class="so-show-left-sidebar"><span class="so-dialog-icon"></span></a>
|
158 |
{{% if ( ! _.isEmpty( dialogIcon ) ) { %}}
|
159 |
+
<div class="so-panels-icon so-panels-icon-{{%- dialogIcon %}}"></div>
|
160 |
{{% } %}}
|
161 |
<h3 class="so-title{{% if ( editableLabel ) print(' so-title-editable')%}}"
|
162 |
{{% if ( editableLabel ) print('contenteditable="true" spellcheck="false" tabIndex="1"')%}}
|
609 |
<script type="text/template" id="siteorigin-panels-add-layout-block-button">
|
610 |
<div class="siteorigin-panels-add-layout-block wp-block">
|
611 |
<button class="components-button is-button is-primary">
|
612 |
+
<span class="siteorigin-panels-block-icon white"></span>
|
613 |
<?php _e( 'Add SiteOrigin Layout Block', 'siteorigin-panels' ) ?>
|
614 |
</button>
|
615 |
</div>
|