Page Builder by SiteOrigin - Version 2.4.21

Version Description

  • 19 December 2016 =
  • Removed course toolbar links.
  • Added filter for post loop query.
  • Replace TinyMCE _.isUndefined() check with a typeof to prevent JS errors.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 Page Builder by SiteOrigin
Version 2.4.21
Comparing to
See all releases

Code changes from version 2.4.20 to 2.4.21

css/admin.css CHANGED
@@ -65,11 +65,11 @@
65
  .siteorigin-panels-builder .so-tool-button:hover span {
66
  color: #444444;
67
  }
68
- .siteorigin-panels-builder .so-tool-button.so-course-modal {
69
  margin-left: 10px;
70
  background: #FFFFFF;
71
  }
72
- .siteorigin-panels-builder .so-tool-button.so-course-modal:hover span {
73
  color: #333;
74
  }
75
  .siteorigin-panels-builder .so-builder-toolbar {
65
  .siteorigin-panels-builder .so-tool-button:hover span {
66
  color: #444444;
67
  }
68
+ .siteorigin-panels-builder .so-tool-button.so-siteorigin-premium {
69
  margin-left: 10px;
70
  background: #FFFFFF;
71
  }
72
+ .siteorigin-panels-builder .so-tool-button.so-siteorigin-premium:hover span {
73
  color: #333;
74
  }
75
  .siteorigin-panels-builder .so-builder-toolbar {
inc/learn.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- class SiteOrigin_Panels_Courses {
4
-
5
- function __construct() {
6
- add_action( 'siteorigin_panels_courses', array( $this, 'courses' ) );
7
- }
8
-
9
- static function single(){
10
- static $single;
11
- return empty( $single ) ? ( $single = new self() ) : $single;
12
- }
13
-
14
- function courses( $courses ){
15
- $courses[ 'seo' ] = array(
16
- 'button' => __( 'SEO', 'siteorigin-panels' ),
17
- 'title' => __( 'Page Builder SEO', 'siteorigin-panels' ),
18
- 'text' => __( 'Learn Page Builder SEO.', 'siteorigin-panels' ),
19
- 'id' => '71ccd71c07'
20
- );
21
-
22
- $courses[ 'tips' ] = array(
23
- 'button' => __( 'Tips', 'siteorigin-panels' ),
24
- 'title' => __( 'Page Builder Tips', 'siteorigin-panels' ),
25
- 'text' => __( '12 tips every Page Builder user should know.', 'siteorigin-panels' ),
26
- 'id' => '300cd058f8'
27
- );
28
-
29
- return $courses;
30
- }
31
-
32
- function get_course(){
33
- static $course;
34
- if( ! empty( $course ) ) return $course;
35
-
36
- static $courses;
37
- if( empty( $courses ) ){
38
- $courses = apply_filters( 'siteorigin_panels_courses', array( ) );
39
- }
40
-
41
- if( empty( $courses ) ) return false;
42
-
43
- $ids = array_keys( $courses );
44
- $i = floor( time() / (20*60) ) % count( $ids );
45
- $course = $courses[ $ids[ $i ] ];
46
-
47
- $user = wp_get_current_user();
48
- $signup_url = add_query_arg( array(
49
- 'email' => $user->user_email,
50
- 'name' => $user->first_name,
51
- ), 'https://siteorigin.com/wp-admin/admin-ajax.php?action=course_signup_form&course=' . urlencode( $course[ 'id' ] ) );
52
-
53
- $course['url'] = $signup_url;
54
-
55
- return $course;
56
- }
57
- }
58
-
59
- SiteOrigin_Panels_Courses::single();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/siteorigin-panels-24.js CHANGED
@@ -3307,7 +3307,7 @@ module.exports = Backbone.View.extend( {
3307
 
3308
  this.trigger( 'builder_rendered' );
3309
 
3310
- this.$( 'a.so-course-modal' ).click( function( e ){
3311
  e.preventDefault();
3312
  var $$ = $(this).blur();
3313
  var newwindow = window.open(
@@ -3883,7 +3883,7 @@ module.exports = Backbone.View.extend( {
3883
  */
3884
  updateEditorContent: function ( content ) {
3885
  // Switch back to the standard editor
3886
- if ( this.config.editorType !== 'tinymce' || _.isUndefined( tinyMCE ) || _.isNull( tinyMCE.get( "content" ) ) ) {
3887
  var $editor = $( this.config.editorId );
3888
  $editor.val( content ).trigger( 'change' ).trigger( 'keyup' );
3889
  } else {
@@ -3930,7 +3930,7 @@ module.exports = Backbone.View.extend( {
3930
  var editorContent = '';
3931
  var editor;
3932
 
3933
- if ( ! _.isUndefined( tinyMCE ) ) {
3934
  editor = tinyMCE.get( 'content' );
3935
  }
3936
  if ( editor && _.isFunction( editor.getContent ) ) {
@@ -4839,7 +4839,7 @@ module.exports = Backbone.View.extend( {
4839
  else if ( $$.prop( 'tagName' ) === 'TEXTAREA' && $$.hasClass( 'wp-editor-area' ) ) {
4840
  // This is a TinyMCE editor, so we'll use the tinyMCE object to get the content
4841
  var editor = null;
4842
- if ( ! _.isUndefined( tinyMCE ) ) {
4843
  editor = tinyMCE.get( $$.attr( 'id' ) );
4844
  }
4845
 
3307
 
3308
  this.trigger( 'builder_rendered' );
3309
 
3310
+ this.$( '.so-tip-wrapper a' ).click( function( e ){
3311
  e.preventDefault();
3312
  var $$ = $(this).blur();
3313
  var newwindow = window.open(
3883
  */
3884
  updateEditorContent: function ( content ) {
3885
  // Switch back to the standard editor
3886
+ if ( this.config.editorType !== 'tinyMCE' || typeof tinyMCE === 'undefined' || _.isNull( tinyMCE.get( "content" ) ) ) {
3887
  var $editor = $( this.config.editorId );
3888
  $editor.val( content ).trigger( 'change' ).trigger( 'keyup' );
3889
  } else {
3930
  var editorContent = '';
3931
  var editor;
3932
 
3933
+ if ( typeof tinyMCE !== 'undefined' ) {
3934
  editor = tinyMCE.get( 'content' );
3935
  }
3936
  if ( editor && _.isFunction( editor.getContent ) ) {
4839
  else if ( $$.prop( 'tagName' ) === 'TEXTAREA' && $$.hasClass( 'wp-editor-area' ) ) {
4840
  // This is a TinyMCE editor, so we'll use the tinyMCE object to get the content
4841
  var editor = null;
4842
+ if ( typeof tinyMCE !== 'undefined' ) {
4843
  editor = tinyMCE.get( $$.attr( 'id' ) );
4844
  }
4845
 
js/siteorigin-panels-24.min.js CHANGED
@@ -1,3 +1,3 @@
1
  !function e(t,i,s){function o(n,r){if(!i[n]){if(!t[n]){var a="function"==typeof require&&require;if(!r&&a)return a(n,!0);if(l)return l(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return o(i?i:e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var l="function"==typeof require&&require,n=0;n<s.length;n++)o(s[n]);return o}({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},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=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(),!e)break;e.destroy()}},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],5:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(o("#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,o=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(o("#siteorigin-panels-dialog-history-entry").html().panelsProcessTemplate()),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-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(o("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=o(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)||o(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")});o(s).data("historyEntry",i).prependTo(t)}),o(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").submit()},restoreSelectedEntry:function(){return this.$(".so-buttons .so-restore").hasClass("disabled")?!1: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&&(t=Math.floor(i/3600),1===t?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(t=Math.floor(i/60),1===t?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,o=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(o("#siteorigin-panels-directory-items").html().panelsProcessTemplate()),builder:null,dialogClass:"so-panels-dialog-prebuilt-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(o("#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=o(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;this.$(".so-content").empty(),s.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),s.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(o("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui").hide(),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.show().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,o){var l=JSON.parse(o.response);_.isUndefined(l.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=l,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(),i.find(".drag-upload-area").on("dragover",function(){o(this).addClass("file-dragover")}).on("dragleave",function(){o(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){var i=o(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,l=this.$(".so-content").empty().addClass("so-panels-loading");return void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory"),"directory"!==i||panelsOptions.directory_enabled?void o.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){l.removeClass("so-panels-loading").html(s.directoryTemplate(n));var r=l.find(".so-previous"),a=l.find(".so-next");1>=t?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?a.addClass("button-disabled"):a.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)}),l.find(".so-screenshot").each(function(){var e=o(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=o("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else o("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),l.find(".so-directory-browse").html(n.title)}},"json"):(l.removeClass("so-panels-loading").html(o("#siteorigin-panels-directory-enable").html()),void l.find(".so-panels-enable-directory").click(function(i){i.preventDefault(),o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,l.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t)}))},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"}),t=new o.Deferred;return o.get(panelsOptions.ajaxurl,e,function(e){void 0!==e.error?(alert(e.error),t.reject(e)):(this.setStatusMessage("",!1),t.resolve(e))}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(o(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,o=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(o("#siteorigin-panels-dialog-row-cell-preview").html().panelsProcessTemplate()),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"},dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:[],style:{}},initializeDialog:function(){this.on("open_dialog",function(){_.isUndefined(this.model)||_.isEmpty(this.model.cells)?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview()},this),this.row={cells:[.5,.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}})})},setRowDialogType:function(e){this.dialogType=e},render:function(e){if(this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-row").html(),{dialogType:this.dialogType})),"edit"===this.dialogType){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}),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove();var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",function(e){e?t.removeClass("so-panels-loading"):(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())},this),t.addClass("so-panels-loading")}_.isUndefined(this.model)||this.$("input.so-row-field").val(this.model.cells.length);return this.$("input.so-row-field").keyup(function(){o(this).trigger("change")}),this},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.cells.map(function(e){return e.get("weight")}),style:{}},this.$("input.so-row-field").val(this.model.cells.length),this)},regenerateRowPreview:function(){var e=this,t=this.$(".row-preview");t.empty();var i;_.each(this.row.cells,function(s,l){var n=o(this.cellPreviewTemplate({weight:s}));t.append(n);var r,a=n.prev();a.length&&(r=o('<div class="resize-handle"></div>'),r.appendTo(n).dblclick(function(){var t=e.row.cells[l]+e.row.cells[l-1];e.row.cells[l]=e.row.cells[l-1]=t/2,e.scaleRowWidths()}),r.draggable({axis:"x",containment:t,start:function(e,t){var i=n.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:n.outerWidth(),left:6,height:n.outerHeight()});i.find(".resize-handle").remove();var s=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),right:6,height:a.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),a.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),r=e.row.cells[l-1]+(s.position.left+6)/t.width();s.helper.offset().left-t.offset().left-6;o(this).data("newCellClone").css("width",t.width()*n).find(".preview-cell-weight").html(Math.round(1e3*n)/10),o(this).data("prevCellClone").css("width",t.width()*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),a.find(".preview-cell-in").css("visibility","visible");var r=s.position.left+6,d=r/t.width();e.row.cells[l]-d>.02&&e.row.cells[l-1]+d>.02&&(e.row.cells[l]-=d,e.row.cells[l-1]+=d),e.scaleRowWidths(),s.helper.css("left",-6)}})),n.find(".preview-cell-weight").click(function(s){e.$(".resize-handle").css("pointer-event","none").draggable("disable"),t.find(".preview-cell-weight").each(function(){var s=jQuery(this).hide();o('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(s.html())).insertAfter(s).focus(function(){clearTimeout(i)}).keyup(function(e){9!==e.keyCode&&o(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),o(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(o(this));s===i.length-1?i.eq(0).focus().select():i.eq(s+1).focus().select()}}).blur(function(){t.find(".preview-cell-weight-input").each(function(t,i){isNaN(parseFloat(o(i).val()))&&o(i).val(Math.floor(1e3*e.row.cells[t])/10)}),i=setTimeout(function(){if(0===t.find(".preview-cell-weight-input").legnth)return!1;var i=[],s=[],l=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,r){var a=parseFloat(o(r).val());a=isNaN(a)?1/e.row.cells.length:Math.round(10*a)/1e3;var d=!o(r).hasClass("no-user-interacted");i.push(a),s.push(d),d?l+=a:n+=a}),l>0&&n>0&&1-l>0)for(var r=0;r<i.length;r++)s[r]||(i[r]=i[r]/n*(1-l));var a=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/a}),Math.min.apply(Math,i)>.01&&(e.row.cells=i),t.find(".preview-cell").each(function(t,i){o(i).animate({width:Math.round(1e3*e.row.cells[t])/10+"%"},250),o(i).find(".preview-cell-weight-input").val(Math.round(1e3*e.row.cells[t])/10)}),t.find(".preview-cell").css("overflow","visible"),setTimeout(function(){e.regenerateRowPreview()},260)},100)}).click(function(){o(this).select()})}),o(this).siblings(".preview-cell-weight-input").select()})},this),this.trigger("form_loaded",this)},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each(function(t,i){o(i).css("width",100*e.row.cells[t]+"%").find(".preview-cell-weight").html(Math.round(1e3*e.row.cells[t])/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>10&&(e.cells=10,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form input[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,s=1,l=0;l<e.cells;l++)t.push(s),s*=e.ratio;var n=_.reduce(t,function(e,t){return e+t});if(t=_.map(t,function(e){return e/n}),t=_.filter(t,function(e){return e>.01}),"left"===e.direction&&(t=t.reverse()),this.row.cells=t,i)this.regenerateRowPreview();else{var r=this;this.$(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*r.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*r.row.cells[e])/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){r.regenerateRowPreview()},260)}}catch(a){console.log("Error setting cells - "+a.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),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(i){console.log("Error retrieving styles - "+i.message)}this.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.model=new s.model.row,this.updateModel();var e=this.builder.getActiveCell({createCell:!1,defaultPosition:"last"}),t={};return null!==e&&(t.at=this.builder.model.rows.indexOf(e.row)+1),this.model.collection=this.builder.model.rows,this.builder.model.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.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1}})},{}],9:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(o("#siteorigin-panels-dialog-widget-sidebar-widget").html().panelsProcessTemplate()),dialogClass:"so-panels-dialog-edit-widget",widgetView:!1,savingWidget:!1,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.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm(),_.isUndefined(panelsOptions.widgets[this.model.get("class")])?this.$(".so-title .widget-name").html(panelsOptions.loc.missing_widget.title):this.$(".so-title .widget-name").html(panelsOptions.widgets[this.model.get("class")].title),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 e=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(e),this.styles.on("styles_loaded",function(t){t?e.removeClass("so-panels-loading"):(e.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),e.remove())},this),e.addClass("so-panels-loading")},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(0===t)return!1;do if(widgetView=e.eq(--t).data("view"),!_.isUndefined(widgetView)&&!widgetView.model.get("read_only"))return widgetView.getEditDialog();while(!_.isUndefined(widgetView)&&t>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){var e=this;this.$(".so-content").addClass("so-panels-loading");var t={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")};o.post(panelsOptions.ajaxurl,t,function(t){var i=t.replace(/{\$id}/g,e.model.cid);e.$(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.updateModel,e)},"html")}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();_.isUndefined(t.widgets)?t={}:(t=t.widgets,t=t[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(s){}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.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{}],10:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(o("#siteorigin-panels-dialog-widgets-widget").html().panelsProcessTemplate()),filter:{},dialogClass:"so-panels-dialog-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(o("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=o(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),o('<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){o(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;o(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){this.filter.search=o(e.target).val(),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=o(this),s=i.data("class"),l=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=_.isEmpty(e.groups)?!0:null===l||_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups))?!1:!0,t&&(_.isUndefined(e.search)||""===e.search||-1===l.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=o(e.currentTarget),i=new s.model.widget({"class":t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.widgets.add(i),this.closeDialog(),this.builder.model.refreshPanelsData()},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&&o(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var l=o(s);null!==i&&i.position().top!==l.position().top&&(t[t.length]=[]),i=l,t[t.length-1].push(l)}),_.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){var s=window.panels,o=jQuery;t.exports=function(e){return this.each(function(){var t=jQuery(this),i=t.closest("form").find(".widget-id").val(),l=o.extend(!0,{},e);if(_.isUndefined(i)||!(i.indexOf("__i__")>-1)){var n=new s.model.builder,r=new s.view.builder({model:n,config:l}),a=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(a)||(a.on("close_dialog",function(){n.refreshPanelsData()}),a.on("open_dialog_complete",function(){r.trigger("builder_resize")}),a.model.on("destroy",function(){n.emptyRows().destroy()}),r.setDialogParents(panelsOptions.loc.layout_widget,a));var d=Boolean(t.closest(".widget-content").length);r.render().attach({container:t,dialog:d||"dialog"===t.data("mode"),type:t.data("type")}).setDataField(t.find("input.panels-data")),d||"dialog"===t.data("mode")?(r.setDialogParents(panelsOptions.loc.layout_widget,r.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),r.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",r)}})}},{}],12:[function(e,t,i){String.prototype.panelsProcessTemplate=function(){var e=this;return e=e.replace(/{{%/g,"<%"),e=e.replace(/%}}/g,"%>"),e=e.trim()};var s={};window.panels=s,window.siteoriginPanels=s,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,o;if(e("#siteorigin-panels-metabox").length&&e("form#post").length)t=e("#siteorigin-panels-metabox"),i=e("#siteorigin-panels-metabox .siteorigin-panels-data-field"),s=e("form#post"),o={editorType:"tinymce",postId:e("#post_ID").val(),editorId:"#content",builderType:e("#siteorigin-panels-metabox").data("builder-type"),builderSupports:e("#siteorigin-panels-metabox").data("builder-supports"),loadLiveEditor:1==e("#siteorigin-panels-metabox").data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var l=e(".siteorigin-panels-builder-form");t=l.find(".siteorigin-panels-builder-container"),i=l.find('input[name="panels_data"]'),s=l,o={editorType:"standalone",postId:l.data("post-id"),editorId:"#post_content",
2
- builderType:l.data("type"),builderSupports:l.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:l.data("preview-url")}}if(!_.isUndefined(t)){var n=window.siteoriginPanels,r=new n.model.builder,a=new n.view.builder({model:r,config:o});a.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",a,window.panels)}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()})})},{"./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,"./jquery/setup-builder-widget":11,"./model/builder":13,"./model/cell":14,"./model/history-entry":15,"./model/row":16,"./model/widget":17,"./utils/menu":18,"./view/builder":19,"./view/cell":20,"./view/dialog":21,"./view/live-editor":22,"./view/row":23,"./view/styles":24,"./view/widget":25}],13:[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.rows=new panels.collection.rows},addRow:function(e,t){t=_.extend({noAnimate:!1},t);var i=new panels.model.row({collection:this.rows});return i.setCells(e),i.builder=this,this.rows.add(i,t),i},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=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var s,o=0;o<e.grid_cells.length;o++)s=parseInt(e.grid_cells[o].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(parseFloat(e.grid_cells[o].weight));var l=this;if(_.each(i,function(t,i){var s=l.addRow(t,{noAnimate:!0});_.isUndefined(e.grids[i].style)||s.set("style",e.grids[i].style)}),_.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=l.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),o=new panels.model.widget({"class":t["class"],values:e});_.isUndefined(t.style)||o.set("style",t.style),_.isUndefined(t.read_only)||o.set("read_only",t.read_only),_.isUndefined(t.widget_id)?o.set("widget_id",l.generateUUID()):o.set("widget_id",t.widget_id),o.cell=s,s.widgets.add(o,{noAnimate:!0})}),this.trigger("load_panels_data")}catch(n){console.log("Error loading data: "+n.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=e.grids.length,s=_.isUndefined(e.widgets)?0:e.widgets.length,o={grids:[],grid_cells:[],widgets:[]};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());var l;for(l=0;l<t.grid_cells.length;l++){var n=t.grid_cells[l];n.grid=parseInt(n.grid)+i,o.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(l=0;l<t.widgets.length;l++){var r=t.widgets[l];r.panels_info.grid=parseInt(r.panels_info.grid)+i,r.panels_info.id=parseInt(r.panels_info.id)+s,o.widgets.push(r)}return o},getPanelsData:function(){var e=this,t={widgets:[],grids:[],grid_cells:[]},i=0;return this.rows.each(function(s,o){s.cells.each(function(s,l){s.widgets.each(function(s,n){var r={"class":s.get("class"),raw:s.get("raw"),grid:o,cell:l,id:i++,widget_id:s.get("widget_id"),style:s.get("style")};_.isEmpty(r.widget_id)&&(r.widget_id=e.generateUUID());var a=_.extend(_.clone(s.get("values")),{panels_info:r});t.widgets.push(a)}),t.grid_cells.push({grid:o,weight:s.get("weight")})}),t.grids.push({cells:s.cells.length,style:s.get("style")})}),t},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.rows.toArray(),"destroy"),this.rows.reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},generateUUID:function(){var e=(new Date).getTime();window.performance&&"function"==typeof window.performance.now&&(e+=performance.now());var t="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)});return t}})},{}],14:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0},indexes:null,initialize:function(){this.widgets=new panels.collection.widgets,this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.widgets.toArray(),"destroy"),this.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.cells,{silent:!0}),i.row=e,t.cloneWidgets&&this.widgets.each(function(e){i.widgets.add(e.clone(i,t),{silent:!0})}),i}})},{}],15:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],16:[function(e,t,i){t.exports=Backbone.Model.extend({cells:{},builder:null,defaults:{style:{}},indexes:null,initialize:function(){this.cells=new panels.collection.cells,this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this;if(_.isEmpty(this.cells))_.each(e,function(e){var i=new panels.model.cell({weight:e,collection:t.cells});i.row=t,t.cells.add(i)});else{if(e.length>this.cells.length)for(var i=this.cells.length;i<e.length;i++){var s=new panels.model.cell({weight:e[e.length+i],collection:t.cells});s.row=this,t.cells.add(s)}else if(e.length<this.cells.length){var o=this.cells.at(e.length-1);_.each(this.cells.slice(e.length,this.cells.length),function(e){for(var t=e.widgets.models.slice(0),i=0;i<t.length;i++)t[i].moveToCell(o,{silent:!1});e.destroy()})}this.cells.each(function(t,i){t.set("weight",e[i])})}this.reweightCells()},reweightCells:function(){var e=0;this.cells.each(function(t){e+=t.get("weight")}),this.cells.each(function(t){t.set("weight",t.get("weight")/e)}),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.cells.toArray(),"destroy"),this.cells.reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.builder),t=_.extend({cloneCells:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.rows,{silent:!0}),i.builder=e,t.cloneCells&&this.cells.each(function(e){i.cells.add(e.clone(i,t),{silent:!0})}),i}})},{}],17:[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]:"":panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t){return t=_.extend({silent:!0},t),this.cell.cid===e.cid?!1:(this.cell=e,this.collection.remove(this,t),e.widgets.add(this,t),!0)},triggerEdit:function(){this.trigger("user_edit",this)},triggerDuplicate:function(){this.trigger("user_duplicate",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"))),o=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&o(e[i])}),e};return s=o(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("values",s,{silent:!0}),i.set("collection",e.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)&&e.panels_title===!1)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)t.hasOwnProperty(s)&&i.push(s);i=_.uniq(i);for(var o in i)if(!_.isUndefined(t[i[o]])&&_.isString(t[i[o]])&&""!==t[i[o]]&&"on"!==t[i[o]]&&"_"!==i[o][0]&&!jQuery.isNumeric(t[i[o]])){var l=t[i[o]];l=l.replace(/<\/?[^>]+(>|$)/g,"");var n=l.split(" ");return n=n.slice(0,20),n.join(" ")}return this.getWidgetField("description")}})},{}],18:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({wrapperTemplate:_.template(s("#siteorigin-panels-context-menu").html().panelsProcessTemplate()),sectionTemplate:_.template(s("#siteorigin-panels-context-menu-section").html().panelsProcessTemplate()),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;s(window).on("contextmenu",function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):e.active?!0:(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"),s(window).on("keyup",{menu:this},this.keyboardListen),s(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",s(window).height()-20),e.left+this.$el.outerWidth()+10>=s(window).width()&&(e.left=s(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-s(window).scrollTop()+10>=s(window).height()&&(e.top=s(window).height()+s(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"),s(window).off("keyup",this.keyboardListen),s(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){var o=this;e=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},e);var l=s(this.sectionTemplate({settings:e,items:t}));this.$el.append(l),l.find(".so-item:not(.so-confirm)").click(function(){var e=s(this);i(e.data("key")),o.closeMenu()}),l.find(".so-item.so-confirm").click(function(){var e=s(this);return e.hasClass("so-confirming")?(i(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),void setTimeout(function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))},2500))}),l.data("settings",e).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},searchKeyUp:function(e){var t=s(e.currentTarget),i=t.closest(".so-section"),o=i.data("settings");if(38===e.which||40===e.which){var l=i.find("ul li:visible"),n=l.filter(".so-active").eq(0);if(n.length){l.removeClass("so-active");var r=l.index(n);38===e.which?n=0>r-1?l.last():l.eq(r-1):40===e.which&&(n=r+1>=l.length?l.first():l.eq(r+1))}else 38===e.which?n=l.last():40===e.which&&(n=l.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(o.defaultDisplay){i.find(".so-item").hide();for(var a=0;a<o.defaultDisplay.length;a++)i.find('.so-item[data-key="'+o.defaultDisplay[a]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each(function(){var e=s(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()});i.find(".so-item:visible:gt("+(o.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]}})},{}],19:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(o("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:void 0,menu:!1,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},_.each(this.dialogs,function(e,i,s){s[i].setBuilder(t)}),this.dialogs.row.setRowDialogType("create"),this.model.rows.on("add",this.onAddRow,this),o(window).resize(function(e){e.target===window&&t.trigger("builder_resize")}),this.model.on("change:data load_panels_data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.model.on("change:data load_panels_data",this.toggleWelcomeDisplay,this),this.menu=new s.utils.menu({}),this.menu.on("activate_context",this.activateContextMenu,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.$("a.so-course-modal").click(function(e){e.preventDefault();var t=o(this).blur(),i=window.open(t.attr("href"),"signup-window","height=450,width=650,toolbar=false");window.focus&&i.focus()}),this},attach:function(e){e=_.extend({container:!1,dialog:!1},e),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");return this.supports("addWidget")||t.find(".so-widget-add").hide(),this.supports("addRow")||t.find(".so-row-add").hide(),this.supports("prebuilt")||t.find(".so-prebuilt-add").hide(),this},attachToEditor:function(){if("tinymce"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;o("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),o("#wp-content-editor-container, #post-status-info").show(),o("#wp-content-wrap").removeClass("panels-active"),o("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(o('<a id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find(".hndle span").html()+"</a>").click(function(i){i.preventDefault();jQuery(this);o("#wp-content-wrap, #post-status-info").hide(),e.show().find("> .inside").show(),o(window).resize(),o(document).scroll(),t.trigger("display_builder")})),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),o("#wp-content-wrap, #post-status-info").show(),e.hide(),o(window).resize())}).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)||o("#content-panels.switch-panels").click();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=o(window).scrollTop()-t.$el.offset().top;"fixed"===o("#wpadminbar").css("position")&&(i+=o("#wpadminbar").outerHeight());var s={top:0,bottom:t.$el.outerHeight()-e.outerHeight()+20};i>s.top&&i<s.bottom?"fixed"!==e.css("position")&&e.css({top:o("#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),o(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this;return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",axis:"y",tolerance:"pointer",scroll:!1,stop:function(t){e.addHistoryEntry("row_moved"),e.sortCollections()}}),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(s){i={}}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay(),this.sortCollections()}return this},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));o(this.dataField).val()!==e&&(o(this.dataField).val(e),o(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.row({model:e});o.builder=this,o.render(),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".so-rows-container")):o.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),o.resize()},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){this.dialogs.row.openDialog(),this.dialogs.row.setRowModel()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},getActiveCell:function(e){if(e=_.extend({createCell:!0,defaultPosition:"first"},e),0===this.$(".so-cells .cell").length){if(!e.createCell)return null;this.model.addRow([1],{noAnimate:!0})}var t=this.$(".so-cells .cell.cell-selected");return 0===t.length&&(t="last"===e.defaultPosition?this.$(".so-cells .cell").first():this.$(".so-cells .cell").last()),t.data("view").model},sortCollections:function(){this.$(".so-widget").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,cell:t.index()}}),this.$(".so-cells .cell").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,row:t.index()}}),this.$(".so-row-container").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e}}),this.model.rows.visualSort(),this.model.rows.each(function(e){e.cells.each(function(e){e.widgets.visualSort()})}),this.model.refreshPanelsData()},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(){return _.isEmpty(this.config.liveEditorPreview)?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),void 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])?!1:this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||o.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){var t=o("<div />").html(e);t.find("div").each(function(){var e=o(this).contents();o(this).replaceWith(e)}),e=t.html().replace(/[\r\n]+/g,"\n").replace(/\n\s+/g,"\n").trim(),""!==e&&this.updateEditorContent(e)}.bind(this))}},updateEditorContent:function(e){if("tinymce"!==this.config.editorType||_.isUndefined(tinyMCE)||_.isNull(tinyMCE.get("content"))){var t=o(this.config.editorId);t.val(e).trigger("change").trigger("keyup")}else{var i=tinyMCE.get("content");i.setContent(e),i.fire("change"),i.fire("keyup")}this.triggerYoastSeoChange()},triggerYoastSeoChange:function(){if(o("#yoast_wpseo_focuskw_text_input").length){var e,t=document.getElementById("yoast_wpseo_focuskw_text_input");document.createEvent?(e=document.createEvent("HTMLEvents"),e.initEvent("keyup",!0,!0)):(e=document.createEventObject(),e.eventType="keyup"),e.eventName="keyup",document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}},handleDisplayBuilder:function(){var e,t="";if(_.isUndefined(tinyMCE)||(e=tinyMCE.get("content")),t=e&&_.isFunction(e.getContent)?e.getContent():o("textarea#content").val(),(_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){if(!confirm(panelsOptions.loc.confirm_use_builder))return;var i="";if(_.isUndefined(panelsOptions.widgets.SiteOrigin_Widget_Editor_Widget)?_.isUndefined(panelsOptions.widgets.WP_Widget_Text)||(i="WP_Widget_Text"):i="SiteOrigin_Widget_Editor_Widget",""===i)return;this.model.loadPanelsData({grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:t,title:"",type:"visual",panels_info:{"class":i,raw:!1,grid:0,cell:0}}]}),this.model.trigger("change"),this.model.trigger("change:data")}},handleBuilderSizing:function(){var e=this.$el.width();return e?void(480>e?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow")):this},setDialogParents:function(e,t){_.each(this.dialogs,function(i,s,o){o[s].setParent(e,t)}),this.on("add_dialog",function(i){i.setParent(e,t)},this)},toggleWelcomeDisplay:function(){this.model.rows.isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){var i=this,s=o(".siteorigin-panels-builder:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),l=o(".so-panels-dialog-wrapper:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===l.length||l.is(n))){var r=o([]).add(i.$(".so-rows-container > .so-row-container")).add(i.$(".so-cells > .cell")).add(i.$(".cell-wrapper > .so-widget")).filter(function(i){return t.isOverEl(o(this),e)}),a=r.last().data("view");void 0!==a&&void 0!==a.buildContextualMenu&&a.buildContextualMenu(e,t)}},lockPageScroll:function(){if("hidden"!==o("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];o("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlockPageScroll:function(){if("hidden"===o("body").css("overflow")&&!o(".so-panels-dialog-wrapper").is(":visible")&&!o(".so-panels-live-editor").is(":visible")){o("body").css("overflow","visible");var e=o("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}})},{}],20:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-cell").html().panelsProcessTemplate()),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.model.widgets.on("add",this.onAddWidget,this)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.cells.totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.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.$el.attr("id");return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+t+" .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},stop:function(t,i){e.row.builder.addHistoryEntry("widget_moved");var s=o(i.item).data("view"),l=o(i.item).closest(".cell").data("view");s.model.moveToCell(l.model),s.cell=l,e.row.builder.sortCollections()},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 l=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});l.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(),o(this).data({newCellClone:l,prevCellClone:n})}},drag:function(i,l){var n=s.row.$el.width()+10,r=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,a=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10),o(this).data("prevCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,r=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,a=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;r>.02&&a>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",r),e.model.set("weight",a),s.row.resize()),l.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.widget({model:e});o.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),o.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".widgets-container")):o.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.$el.closest(".so-rows-container").find(".so-cells .cell").removeClass("cell-selected");o(e.target).parent().addClass("cell-selected")},buildContextualMenu:function(e,t){var i=this;t.addSection({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.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.model,t.cell.widgets.add(t),i.row.builder.model.refreshPanelsData()}),this.row.buildContextualMenu(e,t)}})},{}],21:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({dialogTemplate:_.template(s("#siteorigin-panels-dialog").html().panelsProcessTemplate()),dialogTabTemplate:_.template(s("#siteorigin-panels-dialog-tab").html().panelsProcessTemplate()),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",parentDialog:!1,dialogOpen:!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()},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=s(_.template(e.panelsProcessTemplate())(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(this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),this.parentDialog!==!1){var t=this,i=s('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');i.click(function(e){e.preventDefault(),t.closeDialog(),t.parentDialog.openDialog()}),this.$(".so-title-bar").prepend(i)}return this},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=s(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var o=i.attr("href");if(!_.isUndefined(o)&&"#"===o.charAt(0)){var l=o.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+l).show()}t.trigger("tab_click",i)}),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){var e=this.$(".so-toolbar .so-buttons .so-toolbar-button");e.click(function(e){e.preventDefault(),this.trigger("button_click",s(e.currentTarget));
3
- }.bind(this));var t=this.$(".so-toolbar .so-buttons .so-dropdown-button");t.click(function(e){e.preventDefault();var t=s(e.currentTarget),i=t.siblings(".so-dropdown-links-wrapper");i.is(".hidden")?i.removeClass("hidden"):i.addClass("hidden")}.bind(this)),s("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var o=s(i),l=s(e.target);0!==l.length&&(l.is(".so-needs-confirm")&&!l.is(".so-confirmed")||l.is(".so-dropdown-button"))||o.addClass("hidden")})}.bind(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():e===!1&&t.addClass("so-disabled"),null===i?s.hide():i===!1&&s.addClass("so-disabled")},openDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),this.builder.lockPageScroll(),s(window).on("keyup",this.keyboardListen),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this))},closeDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),this.builder.unlockPageScroll(),s(window).off("keyup",this.keyboardListen),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},keyboardListen:function(e){27===e.which&&s(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&e!==!1&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&e!==!1&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),o={};return i.find("[name]").each(function(){var e=s(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("]["),t.unshift(i[1])),t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var l=o,n=null,r=_.isString(e.attr("type"))?e.attr("type").toLowerCase():!1;if("checkbox"===r)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===r){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var a=null;_.isUndefined(tinyMCE)||(a=tinyMCE.get(e.attr("id"))),n=null!==a&&_.isFunction(a.getContent)&&!a.isHidden()?a.getContent():e.val()}else if("SELECT"===e.prop("tagName")){var d=e.find("option:selected");1===d.length?n=e.find("option:selected").val():d.length>1&&(n=_.map(e.find("option:selected"),function(e,t){return s(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(c){n=""}}if(null!==n)for(var h=0;h<t.length;h++)h===t.length-1?""===t[h]?l.push(n):l[t[h]]=n:(_.isUndefined(l[t[h]])&&(""===t[h+1]?l[t[h]]=[]:l[t[h]]={}),l=l[t[h]])}catch(u){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+u.message)}}),o},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),!_.isUndefined(t)&&t&&this.$(".so-toolbar .so-status").addClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}}})},{}],22:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({template:_.template(s("#siteorigin-panels-live-editor").html().panelsProcessTemplate()),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","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.builder.model.on("refresh_panels_data",this.handleRefreshData,this),this.builder.model.on("load_panels_data",this.handleLoadData,this)},render:function(){this.setElement(this.template()),this.$el.hide();var e=this,t=!1;return s(document).mousedown(function(){t=!0}).mouseup(function(){t=!1}),e.$el.on("mouseenter",".so-widget-wrapper",function(){var i=(s(this),s(this).data("live-editor-preview-widget"));t||void 0===i||!i.length||e.$(".so-preview-overlay").is(":visible")||(e.highlightElement(i),e.scrollToElement(i))}),e.$el.on("mouseleave",".so-widget-wrapper",function(){e.resetHighlights()}),e.builder.on("open_dialog",function(){e.resetHighlights()}),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),this.builder.lockPageScroll(),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"===s("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===s('#title[name="post_title"]').val()&&s('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),s(document).one("heartbeat-tick.autosave",function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())}),wp.autosave.server.triggerSave())}},close:function(){return this.$el.is(":visible")?(this.$el.hide(),this.builder.unlockPageScroll(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),void this.builder.trigger("builder_resize")):this},collapse:function(){this.$el.toggleClass("so-collapsed");var e=this.$(".live-editor-collapse span");e.html(e.data(this.$el.hasClass("so-collapsed")?"expand":"collapse"))},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout);var t=this.previewIframe.contents().find("body");t.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(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){var t=this.$(".so-preview iframe")[0].contentWindow;t.liveEditorScrollTo(e)},handleRefreshData:function(e,t){return this.$el.is(":visible")?void this.refreshPreview(e):this},handleLoadData:function(){return this.$el.is(":visible")?void this.refreshPreview(this.builder.model.getPanelsData()):this},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)},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 o="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=s('<iframe src="javascript:false;" />').attr({id:o,name:o}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var l=s('<form id="soPostToPreviewFrame" method="post" />').attr({id:o,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return s.each(e,function(e,t){s('<input type="hidden" />').attr({name:e,value:t}).appendTo(l)}),l.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",function(){var e=s(this),i=e.contents();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))),setTimeout(function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide()},100),i.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".so-panel").length}).each(function(e,i){var o=s(i),l=t.$(".so-live-editor-builder .so-widget-wrapper").eq(o.data("index"));l.data("live-editor-preview-widget",o),o.css({cursor:"pointer"}).mouseenter(function(){l.parent().addClass("so-hovered"),t.highlightElement(o)}).mouseleave(function(){l.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),l.find(".title h4").click()})}),i.find("a").css({"pointer-events":"none"}).click(function(e){e.preventDefault()}))}).on("load",function(){var e=s(this);e.data("iframeready")||e.trigger("iframeready")})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=s(e.currentTarget);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")}})},{}],23:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-row").html().panelsProcessTemplate()),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler"},builder:null,dialog:null,initialize:function(){this.model.cells.on("add",this.handleCellAdd,this),this.model.cells.on("remove",this.handleCellRemove,this),this.model.on("reweight_cells",this.resize,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this);var e=this;this.model.cells.each(function(t){e.listenTo(t.widgets,"add",e.resize)}),this.model.cells.on("add",function(t){e.listenTo(t.widgets,"add",e.resize)},this)},render:function(){this.setElement(this.template()),this.$el.data("view",this);var e=this;return this.model.cells.each(function(t){var i=new s.view.cell({model:t});i.row=e,i.render(),i.$el.appendTo(e.$(".so-cells"))}),this.builder.supports("rowAction")?(this.builder.supports("editWidget")||(this.$(".so-row-toolbar .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addWidget")||(this.$(".so-row-toolbar .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteWidget")||(this.$(".so-row-toolbar .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")),o.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.builder.on("widget_sortable_move",this.resize,this),this.builder.on("builder_resize",this.resize,this),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);var t=0;this.$(".so-cells .cell").each(function(){t=Math.max(t,o(this).height()),o(this).css("width",100*o(this).data("view").model.get("weight")+"%")}),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,64))}},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()})},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},confirmedDeleteHandler:function(e){var t=o(e.target);if(t.hasClass("dashicons")&&(t=o.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(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},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=o(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=this,o=[],l=1;5>l;l++)o.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},o,function(e){i.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,o=[],l=0;t>l;l++)o.push(100/t);var n=new s.model.row({collection:i.collection});n.setCells(o),n.builder=i.builder,i.builder.model.rows.add(n,{at:i.builder.model.rows.indexOf(i.model)+1}),i.builder.model.refreshPanelsData()}),actions={},this.builder.supports("editRow")&&(actions.edit={title:panelsOptions.loc.contextual.row_edit}),this.builder.supports("addRow")&&(actions.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(actions["delete"]={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(actions)||t.addSection({sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},actions,function(e){switch(e){case"edit":i.editSettingsHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}})}})},{}],24:[function(e,t,i){var s=(window.panels,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");var o=this;return s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify({builderType:i.builderType}),postId:t},function(e){o.$el.html(e),o.setupFields(),o.stylesLoaded=!0,o.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}),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}}),e.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(o){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find("input").val(i.id)})),e.open()}),t.find(".remove-image").click(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find("input").val("")})}),this.$(".style-field-measurement").each(function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),o=e.find('input[type="hidden"]');t.focus(function(){s(this).select()});var l=function(e){if(""!==e){var l=/(?:([0-9\.,]+)(.*))+/,n=o.val().split(" "),r=[];for(var a in n){var d=l.exec(n[a]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(r.push(d[1]),i.val(d[2]))}1===t.length?t.val(r.join(" ")):(1===r.length?r=[r[0],r[0],r[0],r[0]]:2===r.length?r=[r[0],r[1],r[0],r[1]]:3===r.length&&(r=[r[0],r[1],r[2],r[1]]),t.each(function(e,t){s(t).val(r[e])}))}};l(o.val());var n=function(e){if(1===t.length){var l=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");o.val(l)}else{var n=s(e.target),r=[],a=[],d=[];t.each(function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;r.push(i),null===i?a.push(e):d.push(e)}),3===a.length&&d[0]===t.index(n)&&(t.val(n.val()),r=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(r)===JSON.stringify([null,null,null,null])?o.val(""):o.val(r.map(function(e){return(null===e?0:e)+i.val()}).join(" "))}};t.change(n),i.change(n)})}})},{}],25:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-widget").html().panelsProcessTemplate()),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"titleClickHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.model.on("user_edit",this.editHandler,this),this.model.on("user_duplicate",this.duplicateHandler,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this),this.model.on("change:values",this.onModelChange,this)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle()})),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"),o.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},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.getEditDialog().openDialog(),this},titleClickHandler:function(){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.editHandler(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.widgets.add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},deleteHandler:function(){return this.model.trigger("visual_destroy"),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;return this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()}),this},buildContextualMenu:function(e,t){var i=this;this.cell.row.builder.supports("addWidget")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.cell.model,i.cell.model.widgets.add(t,{at:i.model.collection.indexOf(i.model)+1}),i.cell.row.builder.model.refreshPanelsData()});var o={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(o.edit={title:panelsOptions.loc.contextual.widget_edit}),this.cell.row.builder.supports("addWidget")&&(o.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(o["delete"]={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(o)||t.addSection({sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},o,function(e){switch(e){case"edit":i.editHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}i.cell.row.builder.model.refreshPanelsData()}),this.cell.row.buildContextualMenu(e,t)}})},{}]},{},[12]);
1
  !function e(t,i,s){function o(n,r){if(!i[n]){if(!t[n]){var a="function"==typeof require&&require;if(!r&&a)return a(n,!0);if(l)return l(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return o(i?i:e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var l="function"==typeof require&&require,n=0;n<s.length;n++)o(s[n]);return o}({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},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=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(),!e)break;e.destroy()}},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],5:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(o("#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,o=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(o("#siteorigin-panels-dialog-history-entry").html().panelsProcessTemplate()),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-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(o("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=o(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)||o(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")});o(s).data("historyEntry",i).prependTo(t)}),o(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").submit()},restoreSelectedEntry:function(){return this.$(".so-buttons .so-restore").hasClass("disabled")?!1: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&&(t=Math.floor(i/3600),1===t?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(t=Math.floor(i/60),1===t?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,o=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(o("#siteorigin-panels-directory-items").html().panelsProcessTemplate()),builder:null,dialogClass:"so-panels-dialog-prebuilt-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(o("#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=o(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;this.$(".so-content").empty(),s.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),s.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(o("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui").hide(),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.show().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,o){var l=JSON.parse(o.response);_.isUndefined(l.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=l,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(),i.find(".drag-upload-area").on("dragover",function(){o(this).addClass("file-dragover")}).on("dragleave",function(){o(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){var i=o(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,l=this.$(".so-content").empty().addClass("so-panels-loading");return void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory"),"directory"!==i||panelsOptions.directory_enabled?void o.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){l.removeClass("so-panels-loading").html(s.directoryTemplate(n));var r=l.find(".so-previous"),a=l.find(".so-next");1>=t?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?a.addClass("button-disabled"):a.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)}),l.find(".so-screenshot").each(function(){var e=o(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=o("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else o("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),l.find(".so-directory-browse").html(n.title)}},"json"):(l.removeClass("so-panels-loading").html(o("#siteorigin-panels-directory-enable").html()),void l.find(".so-panels-enable-directory").click(function(i){i.preventDefault(),o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,l.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t)}))},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"}),t=new o.Deferred;return o.get(panelsOptions.ajaxurl,e,function(e){void 0!==e.error?(alert(e.error),t.reject(e)):(this.setStatusMessage("",!1),t.resolve(e))}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(o(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,o=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(o("#siteorigin-panels-dialog-row-cell-preview").html().panelsProcessTemplate()),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"},dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:[],style:{}},initializeDialog:function(){this.on("open_dialog",function(){_.isUndefined(this.model)||_.isEmpty(this.model.cells)?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview()},this),this.row={cells:[.5,.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}})})},setRowDialogType:function(e){this.dialogType=e},render:function(e){if(this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-row").html(),{dialogType:this.dialogType})),"edit"===this.dialogType){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}),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove();var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",function(e){e?t.removeClass("so-panels-loading"):(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())},this),t.addClass("so-panels-loading")}_.isUndefined(this.model)||this.$("input.so-row-field").val(this.model.cells.length);return this.$("input.so-row-field").keyup(function(){o(this).trigger("change")}),this},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.cells.map(function(e){return e.get("weight")}),style:{}},this.$("input.so-row-field").val(this.model.cells.length),this)},regenerateRowPreview:function(){var e=this,t=this.$(".row-preview");t.empty();var i;_.each(this.row.cells,function(s,l){var n=o(this.cellPreviewTemplate({weight:s}));t.append(n);var r,a=n.prev();a.length&&(r=o('<div class="resize-handle"></div>'),r.appendTo(n).dblclick(function(){var t=e.row.cells[l]+e.row.cells[l-1];e.row.cells[l]=e.row.cells[l-1]=t/2,e.scaleRowWidths()}),r.draggable({axis:"x",containment:t,start:function(e,t){var i=n.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:n.outerWidth(),left:6,height:n.outerHeight()});i.find(".resize-handle").remove();var s=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),right:6,height:a.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),a.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),r=e.row.cells[l-1]+(s.position.left+6)/t.width();s.helper.offset().left-t.offset().left-6;o(this).data("newCellClone").css("width",t.width()*n).find(".preview-cell-weight").html(Math.round(1e3*n)/10),o(this).data("prevCellClone").css("width",t.width()*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),a.find(".preview-cell-in").css("visibility","visible");var r=s.position.left+6,d=r/t.width();e.row.cells[l]-d>.02&&e.row.cells[l-1]+d>.02&&(e.row.cells[l]-=d,e.row.cells[l-1]+=d),e.scaleRowWidths(),s.helper.css("left",-6)}})),n.find(".preview-cell-weight").click(function(s){e.$(".resize-handle").css("pointer-event","none").draggable("disable"),t.find(".preview-cell-weight").each(function(){var s=jQuery(this).hide();o('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(s.html())).insertAfter(s).focus(function(){clearTimeout(i)}).keyup(function(e){9!==e.keyCode&&o(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),o(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(o(this));s===i.length-1?i.eq(0).focus().select():i.eq(s+1).focus().select()}}).blur(function(){t.find(".preview-cell-weight-input").each(function(t,i){isNaN(parseFloat(o(i).val()))&&o(i).val(Math.floor(1e3*e.row.cells[t])/10)}),i=setTimeout(function(){if(0===t.find(".preview-cell-weight-input").legnth)return!1;var i=[],s=[],l=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,r){var a=parseFloat(o(r).val());a=isNaN(a)?1/e.row.cells.length:Math.round(10*a)/1e3;var d=!o(r).hasClass("no-user-interacted");i.push(a),s.push(d),d?l+=a:n+=a}),l>0&&n>0&&1-l>0)for(var r=0;r<i.length;r++)s[r]||(i[r]=i[r]/n*(1-l));var a=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/a}),Math.min.apply(Math,i)>.01&&(e.row.cells=i),t.find(".preview-cell").each(function(t,i){o(i).animate({width:Math.round(1e3*e.row.cells[t])/10+"%"},250),o(i).find(".preview-cell-weight-input").val(Math.round(1e3*e.row.cells[t])/10)}),t.find(".preview-cell").css("overflow","visible"),setTimeout(function(){e.regenerateRowPreview()},260)},100)}).click(function(){o(this).select()})}),o(this).siblings(".preview-cell-weight-input").select()})},this),this.trigger("form_loaded",this)},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each(function(t,i){o(i).css("width",100*e.row.cells[t]+"%").find(".preview-cell-weight").html(Math.round(1e3*e.row.cells[t])/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>10&&(e.cells=10,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form input[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,s=1,l=0;l<e.cells;l++)t.push(s),s*=e.ratio;var n=_.reduce(t,function(e,t){return e+t});if(t=_.map(t,function(e){return e/n}),t=_.filter(t,function(e){return e>.01}),"left"===e.direction&&(t=t.reverse()),this.row.cells=t,i)this.regenerateRowPreview();else{var r=this;this.$(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*r.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*r.row.cells[e])/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){r.regenerateRowPreview()},260)}}catch(a){console.log("Error setting cells - "+a.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),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(i){console.log("Error retrieving styles - "+i.message)}this.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.model=new s.model.row,this.updateModel();var e=this.builder.getActiveCell({createCell:!1,defaultPosition:"last"}),t={};return null!==e&&(t.at=this.builder.model.rows.indexOf(e.row)+1),this.model.collection=this.builder.model.rows,this.builder.model.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.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1}})},{}],9:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(o("#siteorigin-panels-dialog-widget-sidebar-widget").html().panelsProcessTemplate()),dialogClass:"so-panels-dialog-edit-widget",widgetView:!1,savingWidget:!1,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.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm(),_.isUndefined(panelsOptions.widgets[this.model.get("class")])?this.$(".so-title .widget-name").html(panelsOptions.loc.missing_widget.title):this.$(".so-title .widget-name").html(panelsOptions.widgets[this.model.get("class")].title),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 e=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(e),this.styles.on("styles_loaded",function(t){t?e.removeClass("so-panels-loading"):(e.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),e.remove())},this),e.addClass("so-panels-loading")},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(0===t)return!1;do if(widgetView=e.eq(--t).data("view"),!_.isUndefined(widgetView)&&!widgetView.model.get("read_only"))return widgetView.getEditDialog();while(!_.isUndefined(widgetView)&&t>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){var e=this;this.$(".so-content").addClass("so-panels-loading");var t={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")};o.post(panelsOptions.ajaxurl,t,function(t){var i=t.replace(/{\$id}/g,e.model.cid);e.$(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.updateModel,e)},"html")}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();_.isUndefined(t.widgets)?t={}:(t=t.widgets,t=t[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(s){}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.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{}],10:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(o("#siteorigin-panels-dialog-widgets-widget").html().panelsProcessTemplate()),filter:{},dialogClass:"so-panels-dialog-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(o("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=o(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),o('<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){o(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;o(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){this.filter.search=o(e.target).val(),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=o(this),s=i.data("class"),l=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=_.isEmpty(e.groups)?!0:null===l||_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups))?!1:!0,t&&(_.isUndefined(e.search)||""===e.search||-1===l.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=o(e.currentTarget),i=new s.model.widget({"class":t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.widgets.add(i),this.closeDialog(),this.builder.model.refreshPanelsData()},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&&o(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var l=o(s);null!==i&&i.position().top!==l.position().top&&(t[t.length]=[]),i=l,t[t.length-1].push(l)}),_.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){var s=window.panels,o=jQuery;t.exports=function(e){return this.each(function(){var t=jQuery(this),i=t.closest("form").find(".widget-id").val(),l=o.extend(!0,{},e);if(_.isUndefined(i)||!(i.indexOf("__i__")>-1)){var n=new s.model.builder,r=new s.view.builder({model:n,config:l}),a=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(a)||(a.on("close_dialog",function(){n.refreshPanelsData()}),a.on("open_dialog_complete",function(){r.trigger("builder_resize")}),a.model.on("destroy",function(){n.emptyRows().destroy()}),r.setDialogParents(panelsOptions.loc.layout_widget,a));var d=Boolean(t.closest(".widget-content").length);r.render().attach({container:t,dialog:d||"dialog"===t.data("mode"),type:t.data("type")}).setDataField(t.find("input.panels-data")),d||"dialog"===t.data("mode")?(r.setDialogParents(panelsOptions.loc.layout_widget,r.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),r.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",r)}})}},{}],12:[function(e,t,i){String.prototype.panelsProcessTemplate=function(){var e=this;return e=e.replace(/{{%/g,"<%"),e=e.replace(/%}}/g,"%>"),e=e.trim()};var s={};window.panels=s,window.siteoriginPanels=s,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,o;if(e("#siteorigin-panels-metabox").length&&e("form#post").length)t=e("#siteorigin-panels-metabox"),i=e("#siteorigin-panels-metabox .siteorigin-panels-data-field"),s=e("form#post"),o={editorType:"tinymce",postId:e("#post_ID").val(),editorId:"#content",builderType:e("#siteorigin-panels-metabox").data("builder-type"),builderSupports:e("#siteorigin-panels-metabox").data("builder-supports"),loadLiveEditor:1==e("#siteorigin-panels-metabox").data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var l=e(".siteorigin-panels-builder-form");t=l.find(".siteorigin-panels-builder-container"),i=l.find('input[name="panels_data"]'),s=l,o={editorType:"standalone",postId:l.data("post-id"),editorId:"#post_content",
2
+ builderType:l.data("type"),builderSupports:l.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:l.data("preview-url")}}if(!_.isUndefined(t)){var n=window.siteoriginPanels,r=new n.model.builder,a=new n.view.builder({model:r,config:o});a.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",a,window.panels)}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()})})},{"./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,"./jquery/setup-builder-widget":11,"./model/builder":13,"./model/cell":14,"./model/history-entry":15,"./model/row":16,"./model/widget":17,"./utils/menu":18,"./view/builder":19,"./view/cell":20,"./view/dialog":21,"./view/live-editor":22,"./view/row":23,"./view/styles":24,"./view/widget":25}],13:[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.rows=new panels.collection.rows},addRow:function(e,t){t=_.extend({noAnimate:!1},t);var i=new panels.model.row({collection:this.rows});return i.setCells(e),i.builder=this,this.rows.add(i,t),i},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=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var s,o=0;o<e.grid_cells.length;o++)s=parseInt(e.grid_cells[o].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(parseFloat(e.grid_cells[o].weight));var l=this;if(_.each(i,function(t,i){var s=l.addRow(t,{noAnimate:!0});_.isUndefined(e.grids[i].style)||s.set("style",e.grids[i].style)}),_.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=l.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),o=new panels.model.widget({"class":t["class"],values:e});_.isUndefined(t.style)||o.set("style",t.style),_.isUndefined(t.read_only)||o.set("read_only",t.read_only),_.isUndefined(t.widget_id)?o.set("widget_id",l.generateUUID()):o.set("widget_id",t.widget_id),o.cell=s,s.widgets.add(o,{noAnimate:!0})}),this.trigger("load_panels_data")}catch(n){console.log("Error loading data: "+n.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=e.grids.length,s=_.isUndefined(e.widgets)?0:e.widgets.length,o={grids:[],grid_cells:[],widgets:[]};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());var l;for(l=0;l<t.grid_cells.length;l++){var n=t.grid_cells[l];n.grid=parseInt(n.grid)+i,o.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(l=0;l<t.widgets.length;l++){var r=t.widgets[l];r.panels_info.grid=parseInt(r.panels_info.grid)+i,r.panels_info.id=parseInt(r.panels_info.id)+s,o.widgets.push(r)}return o},getPanelsData:function(){var e=this,t={widgets:[],grids:[],grid_cells:[]},i=0;return this.rows.each(function(s,o){s.cells.each(function(s,l){s.widgets.each(function(s,n){var r={"class":s.get("class"),raw:s.get("raw"),grid:o,cell:l,id:i++,widget_id:s.get("widget_id"),style:s.get("style")};_.isEmpty(r.widget_id)&&(r.widget_id=e.generateUUID());var a=_.extend(_.clone(s.get("values")),{panels_info:r});t.widgets.push(a)}),t.grid_cells.push({grid:o,weight:s.get("weight")})}),t.grids.push({cells:s.cells.length,style:s.get("style")})}),t},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.rows.toArray(),"destroy"),this.rows.reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},generateUUID:function(){var e=(new Date).getTime();window.performance&&"function"==typeof window.performance.now&&(e+=performance.now());var t="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)});return t}})},{}],14:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0},indexes:null,initialize:function(){this.widgets=new panels.collection.widgets,this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.widgets.toArray(),"destroy"),this.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.cells,{silent:!0}),i.row=e,t.cloneWidgets&&this.widgets.each(function(e){i.widgets.add(e.clone(i,t),{silent:!0})}),i}})},{}],15:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],16:[function(e,t,i){t.exports=Backbone.Model.extend({cells:{},builder:null,defaults:{style:{}},indexes:null,initialize:function(){this.cells=new panels.collection.cells,this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this;if(_.isEmpty(this.cells))_.each(e,function(e){var i=new panels.model.cell({weight:e,collection:t.cells});i.row=t,t.cells.add(i)});else{if(e.length>this.cells.length)for(var i=this.cells.length;i<e.length;i++){var s=new panels.model.cell({weight:e[e.length+i],collection:t.cells});s.row=this,t.cells.add(s)}else if(e.length<this.cells.length){var o=this.cells.at(e.length-1);_.each(this.cells.slice(e.length,this.cells.length),function(e){for(var t=e.widgets.models.slice(0),i=0;i<t.length;i++)t[i].moveToCell(o,{silent:!1});e.destroy()})}this.cells.each(function(t,i){t.set("weight",e[i])})}this.reweightCells()},reweightCells:function(){var e=0;this.cells.each(function(t){e+=t.get("weight")}),this.cells.each(function(t){t.set("weight",t.get("weight")/e)}),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.cells.toArray(),"destroy"),this.cells.reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.builder),t=_.extend({cloneCells:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.rows,{silent:!0}),i.builder=e,t.cloneCells&&this.cells.each(function(e){i.cells.add(e.clone(i,t),{silent:!0})}),i}})},{}],17:[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]:"":panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t){return t=_.extend({silent:!0},t),this.cell.cid===e.cid?!1:(this.cell=e,this.collection.remove(this,t),e.widgets.add(this,t),!0)},triggerEdit:function(){this.trigger("user_edit",this)},triggerDuplicate:function(){this.trigger("user_duplicate",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"))),o=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&o(e[i])}),e};return s=o(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("values",s,{silent:!0}),i.set("collection",e.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)&&e.panels_title===!1)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)t.hasOwnProperty(s)&&i.push(s);i=_.uniq(i);for(var o in i)if(!_.isUndefined(t[i[o]])&&_.isString(t[i[o]])&&""!==t[i[o]]&&"on"!==t[i[o]]&&"_"!==i[o][0]&&!jQuery.isNumeric(t[i[o]])){var l=t[i[o]];l=l.replace(/<\/?[^>]+(>|$)/g,"");var n=l.split(" ");return n=n.slice(0,20),n.join(" ")}return this.getWidgetField("description")}})},{}],18:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({wrapperTemplate:_.template(s("#siteorigin-panels-context-menu").html().panelsProcessTemplate()),sectionTemplate:_.template(s("#siteorigin-panels-context-menu-section").html().panelsProcessTemplate()),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;s(window).on("contextmenu",function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):e.active?!0:(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"),s(window).on("keyup",{menu:this},this.keyboardListen),s(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",s(window).height()-20),e.left+this.$el.outerWidth()+10>=s(window).width()&&(e.left=s(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-s(window).scrollTop()+10>=s(window).height()&&(e.top=s(window).height()+s(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"),s(window).off("keyup",this.keyboardListen),s(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){var o=this;e=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},e);var l=s(this.sectionTemplate({settings:e,items:t}));this.$el.append(l),l.find(".so-item:not(.so-confirm)").click(function(){var e=s(this);i(e.data("key")),o.closeMenu()}),l.find(".so-item.so-confirm").click(function(){var e=s(this);return e.hasClass("so-confirming")?(i(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),void setTimeout(function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))},2500))}),l.data("settings",e).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},searchKeyUp:function(e){var t=s(e.currentTarget),i=t.closest(".so-section"),o=i.data("settings");if(38===e.which||40===e.which){var l=i.find("ul li:visible"),n=l.filter(".so-active").eq(0);if(n.length){l.removeClass("so-active");var r=l.index(n);38===e.which?n=0>r-1?l.last():l.eq(r-1):40===e.which&&(n=r+1>=l.length?l.first():l.eq(r+1))}else 38===e.which?n=l.last():40===e.which&&(n=l.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(o.defaultDisplay){i.find(".so-item").hide();for(var a=0;a<o.defaultDisplay.length;a++)i.find('.so-item[data-key="'+o.defaultDisplay[a]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each(function(){var e=s(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()});i.find(".so-item:visible:gt("+(o.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]}})},{}],19:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(o("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:void 0,menu:!1,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},_.each(this.dialogs,function(e,i,s){s[i].setBuilder(t)}),this.dialogs.row.setRowDialogType("create"),this.model.rows.on("add",this.onAddRow,this),o(window).resize(function(e){e.target===window&&t.trigger("builder_resize")}),this.model.on("change:data load_panels_data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.model.on("change:data load_panels_data",this.toggleWelcomeDisplay,this),this.menu=new s.utils.menu({}),this.menu.on("activate_context",this.activateContextMenu,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.$(".so-tip-wrapper a").click(function(e){e.preventDefault();var t=o(this).blur(),i=window.open(t.attr("href"),"signup-window","height=450,width=650,toolbar=false");window.focus&&i.focus()}),this},attach:function(e){e=_.extend({container:!1,dialog:!1},e),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");return this.supports("addWidget")||t.find(".so-widget-add").hide(),this.supports("addRow")||t.find(".so-row-add").hide(),this.supports("prebuilt")||t.find(".so-prebuilt-add").hide(),this},attachToEditor:function(){if("tinymce"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;o("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),o("#wp-content-editor-container, #post-status-info").show(),o("#wp-content-wrap").removeClass("panels-active"),o("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(o('<a id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find(".hndle span").html()+"</a>").click(function(i){i.preventDefault();jQuery(this);o("#wp-content-wrap, #post-status-info").hide(),e.show().find("> .inside").show(),o(window).resize(),o(document).scroll(),t.trigger("display_builder")})),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),o("#wp-content-wrap, #post-status-info").show(),e.hide(),o(window).resize())}).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)||o("#content-panels.switch-panels").click();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=o(window).scrollTop()-t.$el.offset().top;"fixed"===o("#wpadminbar").css("position")&&(i+=o("#wpadminbar").outerHeight());var s={top:0,bottom:t.$el.outerHeight()-e.outerHeight()+20};i>s.top&&i<s.bottom?"fixed"!==e.css("position")&&e.css({top:o("#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),o(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this;return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",axis:"y",tolerance:"pointer",scroll:!1,stop:function(t){e.addHistoryEntry("row_moved"),e.sortCollections()}}),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(s){i={}}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay(),this.sortCollections()}return this},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));o(this.dataField).val()!==e&&(o(this.dataField).val(e),o(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.row({model:e});o.builder=this,o.render(),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".so-rows-container")):o.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),o.resize()},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){this.dialogs.row.openDialog(),this.dialogs.row.setRowModel()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},getActiveCell:function(e){if(e=_.extend({createCell:!0,defaultPosition:"first"},e),0===this.$(".so-cells .cell").length){if(!e.createCell)return null;this.model.addRow([1],{noAnimate:!0})}var t=this.$(".so-cells .cell.cell-selected");return 0===t.length&&(t="last"===e.defaultPosition?this.$(".so-cells .cell").first():this.$(".so-cells .cell").last()),t.data("view").model},sortCollections:function(){this.$(".so-widget").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,cell:t.index()}}),this.$(".so-cells .cell").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,row:t.index()}}),this.$(".so-row-container").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e}}),this.model.rows.visualSort(),this.model.rows.each(function(e){e.cells.each(function(e){e.widgets.visualSort()})}),this.model.refreshPanelsData()},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(){return _.isEmpty(this.config.liveEditorPreview)?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),void 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])?!1:this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||o.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){var t=o("<div />").html(e);t.find("div").each(function(){var e=o(this).contents();o(this).replaceWith(e)}),e=t.html().replace(/[\r\n]+/g,"\n").replace(/\n\s+/g,"\n").trim(),""!==e&&this.updateEditorContent(e)}.bind(this))}},updateEditorContent:function(e){if("tinyMCE"!==this.config.editorType||"undefined"==typeof tinyMCE||_.isNull(tinyMCE.get("content"))){var t=o(this.config.editorId);t.val(e).trigger("change").trigger("keyup")}else{var i=tinyMCE.get("content");i.setContent(e),i.fire("change"),i.fire("keyup")}this.triggerYoastSeoChange()},triggerYoastSeoChange:function(){if(o("#yoast_wpseo_focuskw_text_input").length){var e,t=document.getElementById("yoast_wpseo_focuskw_text_input");document.createEvent?(e=document.createEvent("HTMLEvents"),e.initEvent("keyup",!0,!0)):(e=document.createEventObject(),e.eventType="keyup"),e.eventName="keyup",document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}},handleDisplayBuilder:function(){var e,t="";if("undefined"!=typeof tinyMCE&&(e=tinyMCE.get("content")),t=e&&_.isFunction(e.getContent)?e.getContent():o("textarea#content").val(),(_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){if(!confirm(panelsOptions.loc.confirm_use_builder))return;var i="";if(_.isUndefined(panelsOptions.widgets.SiteOrigin_Widget_Editor_Widget)?_.isUndefined(panelsOptions.widgets.WP_Widget_Text)||(i="WP_Widget_Text"):i="SiteOrigin_Widget_Editor_Widget",""===i)return;this.model.loadPanelsData({grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:t,title:"",type:"visual",panels_info:{"class":i,raw:!1,grid:0,cell:0}}]}),this.model.trigger("change"),this.model.trigger("change:data")}},handleBuilderSizing:function(){var e=this.$el.width();return e?void(480>e?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow")):this},setDialogParents:function(e,t){_.each(this.dialogs,function(i,s,o){o[s].setParent(e,t)}),this.on("add_dialog",function(i){i.setParent(e,t)},this)},toggleWelcomeDisplay:function(){this.model.rows.isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){var i=this,s=o(".siteorigin-panels-builder:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),l=o(".so-panels-dialog-wrapper:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===l.length||l.is(n))){var r=o([]).add(i.$(".so-rows-container > .so-row-container")).add(i.$(".so-cells > .cell")).add(i.$(".cell-wrapper > .so-widget")).filter(function(i){return t.isOverEl(o(this),e)}),a=r.last().data("view");void 0!==a&&void 0!==a.buildContextualMenu&&a.buildContextualMenu(e,t)}},lockPageScroll:function(){if("hidden"!==o("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];o("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlockPageScroll:function(){if("hidden"===o("body").css("overflow")&&!o(".so-panels-dialog-wrapper").is(":visible")&&!o(".so-panels-live-editor").is(":visible")){o("body").css("overflow","visible");var e=o("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}})},{}],20:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-cell").html().panelsProcessTemplate()),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.model.widgets.on("add",this.onAddWidget,this)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.cells.totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.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.$el.attr("id");return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+t+" .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},stop:function(t,i){e.row.builder.addHistoryEntry("widget_moved");var s=o(i.item).data("view"),l=o(i.item).closest(".cell").data("view");s.model.moveToCell(l.model),s.cell=l,e.row.builder.sortCollections()},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 l=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});l.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(),o(this).data({newCellClone:l,prevCellClone:n})}},drag:function(i,l){var n=s.row.$el.width()+10,r=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,a=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10),o(this).data("prevCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,r=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,a=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;r>.02&&a>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",r),e.model.set("weight",a),s.row.resize()),l.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.widget({model:e});o.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),o.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".widgets-container")):o.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.$el.closest(".so-rows-container").find(".so-cells .cell").removeClass("cell-selected");o(e.target).parent().addClass("cell-selected")},buildContextualMenu:function(e,t){var i=this;t.addSection({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.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.model,t.cell.widgets.add(t),i.row.builder.model.refreshPanelsData()}),this.row.buildContextualMenu(e,t)}})},{}],21:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({dialogTemplate:_.template(s("#siteorigin-panels-dialog").html().panelsProcessTemplate()),dialogTabTemplate:_.template(s("#siteorigin-panels-dialog-tab").html().panelsProcessTemplate()),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",parentDialog:!1,dialogOpen:!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()},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=s(_.template(e.panelsProcessTemplate())(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(this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),this.parentDialog!==!1){var t=this,i=s('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');i.click(function(e){e.preventDefault(),t.closeDialog(),t.parentDialog.openDialog()}),this.$(".so-title-bar").prepend(i)}return this},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=s(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var o=i.attr("href");if(!_.isUndefined(o)&&"#"===o.charAt(0)){var l=o.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+l).show()}t.trigger("tab_click",i)}),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){var e=this.$(".so-toolbar .so-buttons .so-toolbar-button");e.click(function(e){e.preventDefault(),this.trigger("button_click",s(e.currentTarget));
3
+ }.bind(this));var t=this.$(".so-toolbar .so-buttons .so-dropdown-button");t.click(function(e){e.preventDefault();var t=s(e.currentTarget),i=t.siblings(".so-dropdown-links-wrapper");i.is(".hidden")?i.removeClass("hidden"):i.addClass("hidden")}.bind(this)),s("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var o=s(i),l=s(e.target);0!==l.length&&(l.is(".so-needs-confirm")&&!l.is(".so-confirmed")||l.is(".so-dropdown-button"))||o.addClass("hidden")})}.bind(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():e===!1&&t.addClass("so-disabled"),null===i?s.hide():i===!1&&s.addClass("so-disabled")},openDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),this.builder.lockPageScroll(),s(window).on("keyup",this.keyboardListen),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this))},closeDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),this.builder.unlockPageScroll(),s(window).off("keyup",this.keyboardListen),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},keyboardListen:function(e){27===e.which&&s(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&e!==!1&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&e!==!1&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),o={};return i.find("[name]").each(function(){var e=s(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("]["),t.unshift(i[1])),t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var l=o,n=null,r=_.isString(e.attr("type"))?e.attr("type").toLowerCase():!1;if("checkbox"===r)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===r){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var a=null;"undefined"!=typeof tinyMCE&&(a=tinyMCE.get(e.attr("id"))),n=null!==a&&_.isFunction(a.getContent)&&!a.isHidden()?a.getContent():e.val()}else if("SELECT"===e.prop("tagName")){var d=e.find("option:selected");1===d.length?n=e.find("option:selected").val():d.length>1&&(n=_.map(e.find("option:selected"),function(e,t){return s(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(c){n=""}}if(null!==n)for(var h=0;h<t.length;h++)h===t.length-1?""===t[h]?l.push(n):l[t[h]]=n:(_.isUndefined(l[t[h]])&&(""===t[h+1]?l[t[h]]=[]:l[t[h]]={}),l=l[t[h]])}catch(u){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+u.message)}}),o},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),!_.isUndefined(t)&&t&&this.$(".so-toolbar .so-status").addClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}}})},{}],22:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({template:_.template(s("#siteorigin-panels-live-editor").html().panelsProcessTemplate()),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","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.builder.model.on("refresh_panels_data",this.handleRefreshData,this),this.builder.model.on("load_panels_data",this.handleLoadData,this)},render:function(){this.setElement(this.template()),this.$el.hide();var e=this,t=!1;return s(document).mousedown(function(){t=!0}).mouseup(function(){t=!1}),e.$el.on("mouseenter",".so-widget-wrapper",function(){var i=(s(this),s(this).data("live-editor-preview-widget"));t||void 0===i||!i.length||e.$(".so-preview-overlay").is(":visible")||(e.highlightElement(i),e.scrollToElement(i))}),e.$el.on("mouseleave",".so-widget-wrapper",function(){e.resetHighlights()}),e.builder.on("open_dialog",function(){e.resetHighlights()}),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),this.builder.lockPageScroll(),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"===s("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===s('#title[name="post_title"]').val()&&s('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),s(document).one("heartbeat-tick.autosave",function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())}),wp.autosave.server.triggerSave())}},close:function(){return this.$el.is(":visible")?(this.$el.hide(),this.builder.unlockPageScroll(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),void this.builder.trigger("builder_resize")):this},collapse:function(){this.$el.toggleClass("so-collapsed");var e=this.$(".live-editor-collapse span");e.html(e.data(this.$el.hasClass("so-collapsed")?"expand":"collapse"))},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout);var t=this.previewIframe.contents().find("body");t.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(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){var t=this.$(".so-preview iframe")[0].contentWindow;t.liveEditorScrollTo(e)},handleRefreshData:function(e,t){return this.$el.is(":visible")?void this.refreshPreview(e):this},handleLoadData:function(){return this.$el.is(":visible")?void this.refreshPreview(this.builder.model.getPanelsData()):this},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)},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 o="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=s('<iframe src="javascript:false;" />').attr({id:o,name:o}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var l=s('<form id="soPostToPreviewFrame" method="post" />').attr({id:o,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return s.each(e,function(e,t){s('<input type="hidden" />').attr({name:e,value:t}).appendTo(l)}),l.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",function(){var e=s(this),i=e.contents();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))),setTimeout(function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide()},100),i.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".so-panel").length}).each(function(e,i){var o=s(i),l=t.$(".so-live-editor-builder .so-widget-wrapper").eq(o.data("index"));l.data("live-editor-preview-widget",o),o.css({cursor:"pointer"}).mouseenter(function(){l.parent().addClass("so-hovered"),t.highlightElement(o)}).mouseleave(function(){l.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),l.find(".title h4").click()})}),i.find("a").css({"pointer-events":"none"}).click(function(e){e.preventDefault()}))}).on("load",function(){var e=s(this);e.data("iframeready")||e.trigger("iframeready")})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=s(e.currentTarget);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")}})},{}],23:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-row").html().panelsProcessTemplate()),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler"},builder:null,dialog:null,initialize:function(){this.model.cells.on("add",this.handleCellAdd,this),this.model.cells.on("remove",this.handleCellRemove,this),this.model.on("reweight_cells",this.resize,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this);var e=this;this.model.cells.each(function(t){e.listenTo(t.widgets,"add",e.resize)}),this.model.cells.on("add",function(t){e.listenTo(t.widgets,"add",e.resize)},this)},render:function(){this.setElement(this.template()),this.$el.data("view",this);var e=this;return this.model.cells.each(function(t){var i=new s.view.cell({model:t});i.row=e,i.render(),i.$el.appendTo(e.$(".so-cells"))}),this.builder.supports("rowAction")?(this.builder.supports("editWidget")||(this.$(".so-row-toolbar .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addWidget")||(this.$(".so-row-toolbar .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteWidget")||(this.$(".so-row-toolbar .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")),o.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.builder.on("widget_sortable_move",this.resize,this),this.builder.on("builder_resize",this.resize,this),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);var t=0;this.$(".so-cells .cell").each(function(){t=Math.max(t,o(this).height()),o(this).css("width",100*o(this).data("view").model.get("weight")+"%")}),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,64))}},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()})},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},confirmedDeleteHandler:function(e){var t=o(e.target);if(t.hasClass("dashicons")&&(t=o.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(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},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=o(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=this,o=[],l=1;5>l;l++)o.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},o,function(e){i.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,o=[],l=0;t>l;l++)o.push(100/t);var n=new s.model.row({collection:i.collection});n.setCells(o),n.builder=i.builder,i.builder.model.rows.add(n,{at:i.builder.model.rows.indexOf(i.model)+1}),i.builder.model.refreshPanelsData()}),actions={},this.builder.supports("editRow")&&(actions.edit={title:panelsOptions.loc.contextual.row_edit}),this.builder.supports("addRow")&&(actions.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(actions["delete"]={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(actions)||t.addSection({sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},actions,function(e){switch(e){case"edit":i.editSettingsHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}})}})},{}],24:[function(e,t,i){var s=(window.panels,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");var o=this;return s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify({builderType:i.builderType}),postId:t},function(e){o.$el.html(e),o.setupFields(),o.stylesLoaded=!0,o.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}),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}}),e.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(o){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find("input").val(i.id)})),e.open()}),t.find(".remove-image").click(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find("input").val("")})}),this.$(".style-field-measurement").each(function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),o=e.find('input[type="hidden"]');t.focus(function(){s(this).select()});var l=function(e){if(""!==e){var l=/(?:([0-9\.,]+)(.*))+/,n=o.val().split(" "),r=[];for(var a in n){var d=l.exec(n[a]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(r.push(d[1]),i.val(d[2]))}1===t.length?t.val(r.join(" ")):(1===r.length?r=[r[0],r[0],r[0],r[0]]:2===r.length?r=[r[0],r[1],r[0],r[1]]:3===r.length&&(r=[r[0],r[1],r[2],r[1]]),t.each(function(e,t){s(t).val(r[e])}))}};l(o.val());var n=function(e){if(1===t.length){var l=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");o.val(l)}else{var n=s(e.target),r=[],a=[],d=[];t.each(function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;r.push(i),null===i?a.push(e):d.push(e)}),3===a.length&&d[0]===t.index(n)&&(t.val(n.val()),r=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(r)===JSON.stringify([null,null,null,null])?o.val(""):o.val(r.map(function(e){return(null===e?0:e)+i.val()}).join(" "))}};t.change(n),i.change(n)})}})},{}],25:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-widget").html().panelsProcessTemplate()),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"titleClickHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.model.on("user_edit",this.editHandler,this),this.model.on("user_duplicate",this.duplicateHandler,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this),this.model.on("change:values",this.onModelChange,this)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle()})),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"),o.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},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.getEditDialog().openDialog(),this},titleClickHandler:function(){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.editHandler(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.widgets.add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},deleteHandler:function(){return this.model.trigger("visual_destroy"),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;return this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()}),this},buildContextualMenu:function(e,t){var i=this;this.cell.row.builder.supports("addWidget")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.cell.model,i.cell.model.widgets.add(t,{at:i.model.collection.indexOf(i.model)+1}),i.cell.row.builder.model.refreshPanelsData()});var o={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(o.edit={title:panelsOptions.loc.contextual.widget_edit}),this.cell.row.builder.supports("addWidget")&&(o.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(o["delete"]={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(o)||t.addSection({sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},o,function(e){switch(e){case"edit":i.editHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}i.cell.row.builder.model.refreshPanelsData()}),this.cell.row.buildContextualMenu(e,t)}})},{}]},{},[12]);
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.0
4
  Tested up to: 4.7
5
- Stable tag: 2.4.20
6
- Build time: 2016-12-07T20:36:30+02:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: https://siteorigin.com/downloads/contribution/
@@ -96,6 +96,11 @@ We've tried to ensure that Page Builder is compatible with most plugin widgets.
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
99
  = 2.4.20 - 7 December 2016 =
100
  * Removed Premium and contribution links.
101
  * Added course links.
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.0
4
  Tested up to: 4.7
5
+ Stable tag: 2.4.21
6
+ Build time: 2016-12-19T12:05:47+02:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: https://siteorigin.com/downloads/contribution/
96
 
97
  == Changelog ==
98
 
99
+ = 2.4.21 - 19 December 2016 =
100
+ * Removed course toolbar links.
101
+ * Added filter for post loop query.
102
+ * Replace TinyMCE _.isUndefined() check with a typeof to prevent JS errors.
103
+
104
  = 2.4.20 - 7 December 2016 =
105
  * Removed Premium and contribution links.
106
  * Added course links.
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.4.20
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.4.20');
15
  if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
17
  }
@@ -30,7 +30,6 @@ require_once plugin_dir_path(__FILE__) . 'inc/revisions.php';
30
  require_once plugin_dir_path(__FILE__) . 'inc/styles.php';
31
  require_once plugin_dir_path(__FILE__) . 'inc/default-styles.php';
32
  require_once plugin_dir_path(__FILE__) . 'inc/widgets.php';
33
- require_once plugin_dir_path(__FILE__) . 'inc/learn.php';
34
  require_once plugin_dir_path(__FILE__) . 'inc/plugin-activation.php';
35
  require_once plugin_dir_path(__FILE__) . 'inc/admin-actions.php';
36
 
@@ -1474,8 +1473,13 @@ function siteorigin_panels_render_form($widget, $instance = array(), $raw = fals
1474
  */
1475
  function siteorigin_panels_plugin_action_links($links) {
1476
  unset( $links['edit'] );
1477
- $links[] = '<a href="http://siteorigin.com/threads/plugin-page-builder/">' . __('Support Forum', 'siteorigin-panels') . '</a>';
1478
  $links[] = '<a href="http://siteorigin.com/page-builder/#newsletter">' . __('Newsletter', 'siteorigin-panels') . '</a>';
 
 
 
 
 
1479
  return $links;
1480
  }
1481
  add_action('plugin_action_links_' . plugin_basename(__FILE__), 'siteorigin_panels_plugin_action_links');
@@ -1611,6 +1615,17 @@ function siteorigin_panels_process_panels_data( $panels_data ){
1611
  }
1612
  add_filter( 'siteorigin_panels_data', 'siteorigin_panels_process_panels_data', 5 );
1613
 
 
 
 
 
 
 
 
 
 
 
 
1614
  function siteorigin_panels_premium_url() {
1615
  $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
1616
  $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
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.4.21
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.4.21');
15
  if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
17
  }
30
  require_once plugin_dir_path(__FILE__) . 'inc/styles.php';
31
  require_once plugin_dir_path(__FILE__) . 'inc/default-styles.php';
32
  require_once plugin_dir_path(__FILE__) . 'inc/widgets.php';
 
33
  require_once plugin_dir_path(__FILE__) . 'inc/plugin-activation.php';
34
  require_once plugin_dir_path(__FILE__) . 'inc/admin-actions.php';
35
 
1473
  */
1474
  function siteorigin_panels_plugin_action_links($links) {
1475
  unset( $links['edit'] );
1476
+ $links[] = '<a href="http://siteorigin.com/threads/plugin-page-builder/">' . __('Support', 'siteorigin-panels') . '</a>';
1477
  $links[] = '<a href="http://siteorigin.com/page-builder/#newsletter">' . __('Newsletter', 'siteorigin-panels') . '</a>';
1478
+
1479
+ if( siteorigin_panels_display_premium_teaser() ) {
1480
+ $links[] = '<a href="' . esc_url( siteorigin_panels_premium_url() ) . '" style="color: #3db634" target="_blank">' . __('Addons', 'siteorigin-panels') . '</a>';
1481
+ }
1482
+
1483
  return $links;
1484
  }
1485
  add_action('plugin_action_links_' . plugin_basename(__FILE__), 'siteorigin_panels_plugin_action_links');
1615
  }
1616
  add_filter( 'siteorigin_panels_data', 'siteorigin_panels_process_panels_data', 5 );
1617
 
1618
+ /**
1619
+ * Should we display premium addon messages
1620
+ *
1621
+ * @return bool
1622
+ */
1623
+ function siteorigin_panels_display_premium_teaser(){
1624
+ return siteorigin_panels_setting( 'display-teaser' ) &&
1625
+ apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
1626
+ ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
1627
+ }
1628
+
1629
  function siteorigin_panels_premium_url() {
1630
  $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
1631
  $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
tpl/js-templates.php CHANGED
@@ -38,17 +38,12 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
38
 
39
  <?php endif; ?>
40
 
41
- <?php
42
- $course = SiteOrigin_Panels_Courses::single()->get_course();
43
- if( ! empty( $course ) ) {
44
- ?>
45
- <a class="so-tool-button so-course-modal" title="<?php echo esc_attr( $course[ 'title' ] ) ?>" href="<?php echo esc_url( $course[ 'url' ] ) ?>" target="_blank">
46
  <span class="so-panels-icon so-panels-icon-plus"></span>
47
- <span class="so-button-text"><?php echo esc_html( $course[ 'button' ] ) ?></span>
48
  </a>
49
- <?php
50
- }
51
- ?>
52
 
53
  <a class="so-switch-to-standard"><?php _e('Revert to Editor', 'siteorigin-panels') ?></a>
54
 
@@ -79,15 +74,20 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
79
  );
80
  ?>
81
  </div>
82
-
83
- <?php if( ! empty( $course ) ) : ?>
84
- <div class="so-tip-wrapper">
85
- <strong><?php _e( 'Learn Page Builder: ', 'siteorigin-panels' ) ?></strong>
86
- <a class="so-course-modal" title="<?php echo esc_attr( $course[ 'title' ] ) ?>" href="<?php echo esc_url( $course[ 'url' ] ) ?>">
87
- <?php echo esc_html( $course[ 'text' ] ) ?>
88
- </a>
89
- </div>
90
- <?php endif; ?>
 
 
 
 
 
91
  </div>
92
 
93
  </div>
38
 
39
  <?php endif; ?>
40
 
41
+ <?php if( siteorigin_panels_display_premium_teaser() ) : ?>
42
+ <a class="so-tool-button so-siteorigin-premium" title="<?php echo esc_attr_e( 'SiteOrigin Premium Addons' ) ?>" href="<?php echo esc_url( siteorigin_panels_premium_url() ) ?>" target="_blank">
 
 
 
43
  <span class="so-panels-icon so-panels-icon-plus"></span>
44
+ <span class="so-button-text"><?php echo esc_html_e( 'Get Addons', 'siteorigin-panels' ) ?></span>
45
  </a>
46
+ <?php endif ?>
 
 
47
 
48
  <a class="so-switch-to-standard"><?php _e('Revert to Editor', 'siteorigin-panels') ?></a>
49
 
74
  );
75
  ?>
76
  </div>
77
+ <div class="so-tip-wrapper">
78
+ <strong><?php _e( 'Pro Tip', 'siteorigin-panels' ) ?>: </strong>
79
+ <?php
80
+ $user = wp_get_current_user();
81
+ $user->user_email;
82
+ $signup_email = add_query_arg( array(
83
+ 'email' => $user->user_email,
84
+ 'name' => $user->first_name,
85
+ ), 'https://siteorigin.com/wp-admin/admin-ajax.php?action=course_signup_form&course=300cd058f8' );
86
+ ?>
87
+ <a href="<?php echo esc_url( $signup_email ) ?>">
88
+ <?php _e( '12 tips every Page Builder user should know.', 'siteorigin-panels' ) ?>
89
+ </a>
90
+ </div>
91
  </div>
92
 
93
  </div>
widgets/basic.php CHANGED
@@ -271,7 +271,7 @@ class SiteOrigin_Panels_Widgets_PostLoop extends WP_Widget{
271
  }
272
 
273
  // Create the query
274
- query_posts($query_args);
275
  echo $args['before_widget'];
276
 
277
  // Filter the title
271
  }
272
 
273
  // Create the query
274
+ query_posts( apply_filters( 'siteorigin_panels_postloop_query_args', $query_args ) );
275
  echo $args['before_widget'];
276
 
277
  // Filter the title