Page Builder by SiteOrigin - Version 2.3.2

Version Description

  • March 11 2016 =
  • Fixed compatibility with WordPress 4.5
Download this release

Release Info

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

Code changes from version 2.3.1 to 2.3.2

js/siteorigin-panels-23.js CHANGED
@@ -2,7 +2,7 @@
2
  var panels = window.panels;
3
 
4
  module.exports = Backbone.Collection.extend( {
5
- model: panels.cell,
6
 
7
  initialize: function(){
8
  },
@@ -20,6 +20,7 @@ module.exports = Backbone.Collection.extend( {
20
  return totalWeight;
21
  }
22
  } );
 
23
  },{}],2:[function(require,module,exports){
24
  var panels = window.panels;
25
 
@@ -1722,8 +1723,6 @@ module.exports = panels.view.dialog.extend( {
1722
 
1723
  var $w = $(e.currentTarget);
1724
 
1725
- console.log( panels );
1726
-
1727
  var widget = new panels.model.widget( {
1728
  class: $w.data('class')
1729
  } );
@@ -1780,6 +1779,7 @@ module.exports = panels.view.dialog.extend( {
1780
  } );
1781
  }
1782
  } );
 
1783
  },{}],11:[function(require,module,exports){
1784
  var panels = window.panels, $ = jQuery;
1785
 
@@ -2481,8 +2481,9 @@ module.exports = Backbone.Model.extend( {
2481
  this.set( 'values', values, {silent: true} );
2482
 
2483
  if( hasChanged ) {
2484
- // We'll trigger our own change events
2485
- this.trigger('change');
 
2486
  this.trigger('change:values');
2487
  }
2488
  },
@@ -2582,6 +2583,7 @@ module.exports = Backbone.Model.extend( {
2582
  }
2583
 
2584
  } );
 
2585
  },{}],18:[function(require,module,exports){
2586
  var panels = window.panels, $ = jQuery;
2587
 
2
  var panels = window.panels;
3
 
4
  module.exports = Backbone.Collection.extend( {
5
+ model: panels.model.cell,
6
 
7
  initialize: function(){
8
  },
20
  return totalWeight;
21
  }
22
  } );
23
+
24
  },{}],2:[function(require,module,exports){
25
  var panels = window.panels;
26
 
1723
 
1724
  var $w = $(e.currentTarget);
1725
 
 
 
1726
  var widget = new panels.model.widget( {
1727
  class: $w.data('class')
1728
  } );
1779
  } );
1780
  }
1781
  } );
1782
+
1783
  },{}],11:[function(require,module,exports){
1784
  var panels = window.panels, $ = jQuery;
1785
 
2481
  this.set( 'values', values, {silent: true} );
2482
 
2483
  if( hasChanged ) {
2484
+ // We'll trigger our own change events.
2485
+ // NB: Must include the model being changed (i.e. `this`) as a workaround for a bug in Backbone 1.2.3
2486
+ this.trigger('change', this);
2487
  this.trigger('change:values');
2488
  }
2489
  },
2583
  }
2584
 
2585
  } );
2586
+
2587
  },{}],18:[function(require,module,exports){
2588
  var panels = window.panels, $ = jQuery;
2589
 
js/siteorigin-panels-23.min.js CHANGED
@@ -1,3 +1,3 @@
1
- !function e(t,i,s){function o(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(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.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each(function(t){e+=t.get("weight")}),e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){("undefined"==typeof t||null===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()}}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){}})},{}],5:[function(e,t,i){var s=window.panels,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,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(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){o(this).show()})},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")||this.entries.models.length>0)&&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){this.$("iframe.siteorigin-panels-history-iframe").hide(),this.$('form.history-form input[name="siteorigin_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.entries.addEntry("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))),0===s.length?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({entryTemplate:_.template(o("#siteorigin-panels-dialog-prebuilt-entry").html().panelsProcessTemplate()),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-content .so-directory-item .so-button-use":"directoryClickHandler"},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")})},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-prebuilt").html(),{}))},tabClickHandler:function(e){this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=jQuery(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;return this.$(".so-content").empty(),s.currentTab=i,"directory"===i?this.displayLayoutDirectory():"import"===i?this.displayImportExport():"undefined"==typeof this.layoutCache[i]?(this.$(".so-content").addClass("so-panels-loading"),o.get(panelsOptions.ajaxurl,{action:"so_panels_prebuilt_layouts",type:i},function(e){s.layoutCache[i]=e,s.currentTab===i&&(s.$(".so-content").removeClass("so-panels-loading"),s.displayLayouts(i,e))})):s.displayLayouts(i,this.layoutCache[i]),s.$(".so-sidebar-search").val(""),!1},displayLayouts:function(e,t){var i=this.$(".so-content").empty(),s=this.$(".so-sidebar-search").val().toLowerCase();if("undefined"!=typeof t.error_message)return void this.$(".so-content").append(o('<div class="so-error-message">').html(t.error_message));if(_.size(t))for(var l in t)if(t.hasOwnProperty(l)){if("prebuilt"!==e&&l===o("#post_ID").val())continue;if(""!==s&&-1===t[l].name.toLowerCase().indexOf(s))continue;var n=o(this.entryTemplate({name:t[l].name,description:t[l].description}));n.appendTo(i).data({type:e,lid:l})}},layoutClickHandler:function(e){var t=o(e.target).closest(".layout");return this.loadLayout(t.data("type"),t.data("lid")),!1},loadLayout:function(e,t){var i=this;return confirm(panelsOptions.loc.prebuilt_confirm)?(this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0),void o.post(panelsOptions.ajaxurl,{action:"so_panels_get_prebuilt_layout",type:e,lid:t},function(e){i.setStatusMessage("",!1),i.builder.addHistoryEntry("prebuilt_loaded"),i.builder.model.loadPanelsData(e),i.closeDialog()})):!1},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"),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,i,s){var o=JSON.parse(s.response);"undefined"!=typeof o.widgets?(t.builder.addHistoryEntry("prebuilt_loaded"),t.builder.model.loadPanelsData(o),t.closeDialog()):alert(panelsOptions.plupload.error_message)},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=jQuery(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t){var i=this,s=this.$(".so-content").empty().addClass("so-panels-loading");return void 0===e&&(e=""),void 0===t&&(t=1),panelsOptions.directory_enabled?void o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_query",search:e,page:t},function(l){if("directory"===i.currentTab){s.removeClass("so-panels-loading").html(i.directoryTemplate(l));var n=s.find(".so-previous"),a=s.find(".so-next");1>=t?n.addClass("button-disabled"):n.click(function(s){s.preventDefault(),i.displayLayoutDirectory(e,t-1)}),t===l.max_num_pages||0==l.max_num_pages?a.addClass("button-disabled"):a.click(function(s){s.preventDefault(),i.displayLayoutDirectory(e,t+1)}),""!==e&&s.find(".so-directory-browse").html(panelsOptions.loc.search_results_header+'"<em>'+_.escape(e)+'</em>"'),s.find(".so-screenshot").each(function(){var e=jQuery(this),t=e.find("a");t.css("height",t.width()/4*3+"px").addClass("so-loading");var i=o("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")})})}},"json"):(s.removeClass("so-panels-loading").html(o("#siteorigin-panels-directory-enable").html()),void s.find(".so-panels-enable-directory").click(function(l){l.preventDefault(),o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,s.addClass("so-panels-loading"),i.displayLayoutDirectory(e,t)}))},directoryClickHandler:function(e){e.preventDefault();var t=jQuery(e.currentTarget),i=this;return confirm(panelsOptions.loc.prebuilt_confirm)?(this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0),void o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_item",layout_slug:t.data("layout-slug")},function(e){void 0!==e.error?alert(e.error):(i.setStatusMessage("",!1),i.builder.addHistoryEntry("prebuilt_loaded"),i.builder.model.loadPanelsData(e),i.closeDialog())})):!1},searchHandler:function(e){if("directory"!==this.currentTab){if(this.currentTab===!1||"undefined"==typeof this.layoutCache[this.currentTab])return!1;this.displayLayouts(this.currentTab,this.layoutCache[this.currentTab])}else 13===e.keyCode&&this.displayLayoutDirectory(o(e.currentTarget).val(),1)}})},{}],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(){"undefined"!=typeof this.model&&0!==this.model.cells.length?this.setRowModel(this.model):this.setRowModel(null),this.regenerateRowPreview()},this),this.row={cells:[.5,.5],style:{}}},setRowDialogType:function(e){this.dialogType=e},render:function(e){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",o("#post_ID").val(),{builderType:this.builder.builderType}),this.styles.attach(this.$(".so-sidebar.so-right-sidebar")),this.styles.on("styles_loaded",function(){this.$(".so-sidebar.so-right-sidebar").removeClass("so-panels-loading")},this),this.$(".so-sidebar.so-right-sidebar").addClass("so-panels-loading")),"undefined"!=typeof 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 a,r=n.prev();0!==r.length&&(a=o('<div class="resize-handle"></div>'),a.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()}),a.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=r.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:r.outerWidth(),right:6,height:r.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),r.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),a=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()*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),r.find(".preview-cell-in").css("visibility","visible");var a=s.position.left+6,d=a/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").length)return!1;var i=[],s=[],l=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(o(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!o(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?l+=r:n+=r}),l>0&&n>0&&1-l>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-l));var r=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/r}),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)},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(){var e={cells:parseInt(this.$el.find('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$el.find('.row-set-form select[name="ratio"]').val()),direction:this.$el.find('.row-set-form select[name="ratio_direction"]').val()},t=[];if(isNaN(e.cells)||isNaN(e.ratio))return!1;var i=this.row.cells.length!==e.cells;e.cells<1?(this.$el.find('.row-set-form input[name="cells"]').val(1),e.cells=1):e.cells>20&&(this.$el.find('.row-set-form input[name="cells"]').val(20),e.cells=20);for(var 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 a=this;this.$el.find(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*a.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*a.row.cells[e])/10)}),this.$el.find(".preview-cell").css("overflow","visible"),setTimeout(function(){a.regenerateRowPreview()},260)}this.$el.find(".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(){if(this.model.setCells(this.row.cells),"undefined"!=typeof this.styles&&this.styles.stylesLoaded){var e={};try{e=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(t){}this.model.set("style",e)}},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(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog(),!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(),!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":"saveHistory","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(){this.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this)},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm(),"undefined"!=typeof panelsOptions.widgets[this.model.get("class")]?this.$(".so-title .widget-name").html(panelsOptions.widgets[this.model.get("class")].title):this.$(".so-title .widget-name").html(panelsOptions.loc.missing_widget.title),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",o("#post_ID").val(),{builderType:this.builder.builderType}),this.styles.attach(this.$(".so-sidebar.so-right-sidebar")),this.styles.on("styles_loaded",function(){this.$(".so-sidebar.so-right-sidebar").removeClass("so-panels-loading")},this),this.$(".so-sidebar.so-right-sidebar").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;var i=e.eq(t-1).data("view");return"undefined"==typeof i?!1:i.getEditDialog()},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(t===e.length-1)return!1;var i=e.eq(t+1).data("view");return"undefined"==typeof i?!1:i.getEditDialog()},loadForm:function(){if(this.$el.find("> *").length){var e=this;this.$el.find(".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.$el.find(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$el.find(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.saveWidget,e)},"html")}},saveWidget:function(){if(this.savingWidget=!0,!this.model.get("missing")){var e=this.getFormValues();"undefined"==typeof e.widgets?e={}:(e=e.widgets,e=e[Object.keys(e)[0]]),this.model.setValues(e),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(i){}this.model.set("style",t)}this.savingWidget=!1},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHistory:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.builder.liveEditor.displayed?(this.model.destroy(),this.builder.liveEditor.refreshWidgets()):this.model.trigger("visual_destroy"),this.closeDialog(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.builder.liveEditor.displayed&&this.builder.liveEditor.refreshWidgets(),this.closeDialog(),!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}));"undefined"==typeof e.icon&&(e.icon="dashicons dashicons-admin-generic"),"undefined"!=typeof e.icon&&o('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e["class"]).appendTo(this.$el.find(".widget-type-list"))},this);var e=this.$el.find(".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.$el.find(".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){"undefined"==typeof e&&(e={}),"undefined"==typeof e.groups&&(e.groups=""),this.$el.find(".widget-type-list .widget-type").each(function(){var t,i=jQuery(this),s=i.data("class"),o="undefined"!=typeof panelsOptions.widgets[s]?panelsOptions.widgets[s]:null;t=0===e.groups.length?!0:null!==o&&_.intersection(e.groups,panelsOptions.widgets[s].groups).length?!0:!1,t&&"undefined"!=typeof e.search&&""!==e.search&&-1===o.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=o(e.currentTarget);console.log(s);var i=new s.model.widget({"class":t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.widgets.add(i),this.closeDialog()},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(){return this.each(function(){var e=jQuery(this),t=e.closest("form").find(".widget-id").val();if(!("undefined"!=typeof t&&t.indexOf("__i__")>-1)){var i=new s.model.builder,l=new s.view.builder({model:i}),n=e.closest(".so-panels-dialog-wrapper").data("view");"undefined"!=typeof n&&(n.on("close_dialog",function(){i.refreshPanelsData()}),n.on("open_dialog_complete",function(){l.trigger("builder_resize")}),n.model.on("destroy",function(){i.emptyRows().destroy()}),l.setDialogParents(panelsOptions.loc.layout_widget,n));var a=Boolean(e.closest(".widget-content").length);l.render().attach({container:e,dialog:a,type:e.data("type")}).setDataField(e.find("input.panels-data")),a?(l.setDialogParents(panelsOptions.loc.layout_widget,l.dialog),e.find(".siteorigin-panels-display-builder").click(function(){l.dialog.openDialog()})):e.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",l)}})}},{}],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=!1,i=!1,s=!1,o=!1,l="";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=e("#post_ID").val(),l="editor_attached";else if(e(".siteorigin-panels-builder-form").length){var n=jQuery(".siteorigin-panels-builder-form");t=n.find(".siteorigin-panels-builder"),i=n.find('input[name="panels_data"]'),s=n,o=e("#panels-home-page").data("post-id"),l=n.data("type")}if(t!==!1){var a=window.siteoriginPanels,r=new a.model.builder,d=new a.view.builder({model:r});d.render().attach({container:t,type:l}).setDataField(i).attachToEditor().addLiveEditor(o).addHistoryBrowser(),d.liveEditor.refreshPreview(),s.submit(function(e){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",d,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({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){this.emptyRows(),this.set("data",e,{silent:!0});var t=[];if("undefined"==typeof e.grid_cells)return void this.trigger("load_panels_data");for(var i,s=0;s<e.grid_cells.length;s++)i=parseInt(e.grid_cells[s].grid),"undefined"==typeof t[i]&&(t[i]=[]),t[i].push(parseFloat(e.grid_cells[s].weight));var o=this;_.each(t,function(t,i){var s=o.addRow(t,{noAnimate:!0});"undefined"!=typeof e.grids[i].style&&s.set("style",e.grids[i].style)}),"undefined"!=typeof e.widgets&&(_.each(e.widgets,function(e){try{var t=null;"undefined"!=typeof e.panels_info?(t=e.panels_info,delete e.panels_info):(t=e.info,delete e.info);var i=o.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),l=new panels.model.widget({"class":t["class"],values:e});"undefined"!=typeof t.style&&l.set("style",t.style),l.cell=s,s.widgets.add(l,{noAnimate:!0})}catch(n){}}),this.trigger("load_panels_data"))},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.rows.each(function(i,s){
2
- i.cells.each(function(i,o){i.widgets.each(function(i,l){var n=_.extend(_.clone(i.get("values")),{panels_info:{"class":i.get("class"),raw:i.get("raw"),grid:s,cell:o,id:t++,style:i.get("style")}});e.widgets.push(n)}),e.grid_cells.push({grid:s,weight:i.get("weight")})}),e.grids.push({cells:i.cells.length,style:i.get("style")})}),e},refreshPanelsData:function(){var e=JSON.stringify(this.get("data")),t=this.getPanelsData();this.set("data",t,{silent:!0}),JSON.stringify(t)!==e&&(this.trigger("change"),this.trigger("change:data"))},emptyRows:function(){return _.invoke(this.rows.toArray(),"destroy"),this.rows.reset(),this}})},{}],14:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0},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){"undefined"==typeof 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:{}},initialize:function(){this.cells=new panels.collection.cells,this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this;if(0===this.cells.length)_.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){"undefined"==typeof 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,styles:{}},initialize:function(){var e=this.get("class");"undefined"!=typeof panelsOptions.widgets[e]&&panelsOptions.widgets[e].installed||this.set("missing",!0)},getWidgetField:function(e){return"undefined"==typeof 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.trigger("change:values"))},clone:function(e,t){"undefined"==typeof 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){"string"==typeof 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("undefined"==typeof e)return this.get("class").replace(/_/g," ");if("undefined"!=typeof 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("undefined"!=typeof t[i[o]]&&"string"==typeof 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(jQuery("#siteorigin-panels-context-menu").html().panelsProcessTemplate()),sectionTemplate:_.template(jQuery("#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),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").click(function(){var e=jQuery(this);i(e.data("key")),o.closeMenu()}),l.data("settings",e).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},searchKeyUp:function(e){var t=jQuery(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(0!==n.length){l.removeClass("so-active");var a=l.index(n);38===e.which?n=0>a-1?l.last():l.eq(a-1):40===e.which&&(n=a+1>=l.length?l.first():l.eq(a+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 r=0;r<o.defaultDisplay.length;r++)i.find('.so-item[data-key="'+o.defaultDisplay[r]+'"]').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({template:_.template(o("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:!1,menu:!1,builderType:"",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(){var e=this;return this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},_.each(this.dialogs,function(t,i,s){s[i].setBuilder(e)}),this.dialogs.row.setRowDialogType("create"),this.model.rows.on("add",this.onAddRow,this),o(window).resize(function(t){t.target===window&&e.trigger("builder_resize")}),this.model.on("change:data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,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.$el.html(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){return e=_.extend({type:"",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.builderType=e.type,this},attachToEditor:function(){if("undefined"==typeof this.metabox)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")})),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");("undefined"!=typeof i.widgets&&0!==_.size(i.widgets)||"undefined"!=typeof i.grids&&0!==_.size(i.grids))&&o("#content-panels.switch-panels").click();var s=function(){var e=t.$(".so-builder-toolbar"),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 o(window).resize(s),o(document).scroll(s),s(),this},initSortable:function(){var e=(this.$el,this);this.rowsSortable=this.$el.find(".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()}})},refreshSortable:function(){null!==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;try{i=JSON.parse(this.dataField.val())}catch(s){i=""}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay()}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(),"undefined"==typeof 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(){return this.dialogs.widgets.openDialog(),!1},displayAddRowDialog:function(){return this.dialogs.row.openDialog(),this.dialogs.row.setRowModel(),!1},displayAddPrebuiltDialog:function(){return this.dialogs.prebuilt.openDialog(),!1},displayHistoryDialog:function(){return this.dialogs.history.openDialog(),!1},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 t.length||(t="last"===e.defaultPosition?this.$(".so-cells .cell").first():this.$(".so-cells .cell").last()),t.data("view").model},sortCollections:function(){var e={};this.$(".so-rows-container .so-row-container").each(function(t,i){var s=o(i);e[s.data("view").model.cid]=t,s.find(".so-cells .cell").each(function(t,i){var s=o(i);s.find(".so-widget").each(function(t,i){var s=o(i);e[s.data("view").model.cid]=t})})}),this.model.rows.models=this.model.rows.sortBy(function(t){return e[t.cid]}),this.model.rows.each(function(t){t.cells.each(function(t){t.widgets.models=t.widgets.sortBy(function(t){return e[t.cid]})})}),this.model.refreshPanelsData()},addLiveEditor:function(e){return"undefined"==typeof s.view.liveEditor?this:(this.liveEditor=new s.view.liveEditor,this.liveEditor.setPostId(e),this.liveEditor.builder=this,this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this)},displayLiveEditor:function(){return"undefined"==typeof this.liveEditor?!1:(this.liveEditor.open(),!1)},addHistoryBrowser:function(){return"undefined"==typeof s.dialog.history?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){"undefined"==typeof t&&(t=null),"undefined"!=typeof this.dialogs.history&&this.dialogs.history.entries.addEntry(e,t)},handleContentChange:function(){panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")&&this.model.rows.length>0&&o.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(this.model.getPanelsData()),post_id:o("#post_ID").val()},function(e){if(""!==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(),this.updateEditorContent(e)}}.bind(this)),this.liveEditor!==!1&&this.liveEditor.refreshPreview()},updateEditorContent:function(e){if("undefined"==typeof tinyMCE||null===tinyMCE.get("content")){var t=o("#content");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&&"function"==typeof e.getContent?e.getContent():o("textarea#content").val(),_.isEmpty(this.model.get("data"))&&""!==t){if(!confirm(panelsOptions.loc.confirm_use_builder))return;var i="";if("undefined"!=typeof panelsOptions.widgets.SiteOrigin_Widget_Editor_Widget?i="SiteOrigin_Widget_Editor_Widget":"undefined"!=typeof panelsOptions.widgets.WP_Widget_Text&&(i="WP_Widget_Text"),""===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")}},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.length?this.$(".so-panels-welcome-message").hide():this.$(".so-panels-welcome-message").show()},activateContextMenu:function(e,t){var i=this;if("undefined"==typeof window.panelsDialogOpen||!window.panelsDialogOpen){var s=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)}),l=s.last().data("view");void 0!==l&&void 0!==l.buildContextualMenu&&l.buildContextualMenu(e,t)}}})},{}],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;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()},initSortable:function(){var e=this,t=e.row.builder.$el.attr("id");this.widgetSortable=this.$el.find(".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}})},refreshSortable:function(){this.widgetSortable.sortable("refresh")},initResizable:function(){var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),"undefined"==typeof e)return!1;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,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),o(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),l.helper.css("left",-t.outerWidth()/2)}})},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.widget({model:e});o.cell=this,"undefined"==typeof e.isDuplicate&&(e.isDuplicate=!1),o.render({loadForm:e.isDuplicate}),"undefined"==typeof 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");return o(e.target).parent().addClass("cell-selected"),!1},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)}),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),"undefined"!=typeof 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.$el.find(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click(function(e){e.preventDefault();var i=jQuery(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var s=i.attr("href");if("undefined"!=typeof s&&"#"===s.charAt(0)){var o=s.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).show()}t.trigger("tab_click",i)}),this.$el.find(".so-sidebar-tabs li a").first().click(),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(){this.trigger("open_dialog"),this.dialogOpen=!0,window.panelsDialogOpen=!0,this.refreshDialogNav(),this.bodyScrollTop=s("body").scrollTop(),s("body").css({overflow:"hidden"}),s(window).on("keyup",this.keyboardListen),this.$el.show(),this.trigger("open_dialog_complete")},closeDialog:function(e){return this.trigger("close_dialog"),this.dialogOpen=!1,window.panelsDialogOpen=!1,"undefined"!=typeof this.builder&&this.builder.model.refreshPanelsData(),this.$el.hide(),s(".so-panels-dialog-wrapper").is(":visible")||(s("body").css({overflow:"auto"}),s("body").scrollTop(this.bodyScrollTop)),s(window).off("keyup",this.keyboardListen),this.trigger("close_dialog_complete"),!1},keyboardListen:function(e){27===e.which&&s(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog(null);var e=this.getPrevDialog();null!==e&&e!==!1&&e.openDialog()},navToNext:function(){this.closeDialog(null);var e=this.getNextDialog();null!==e&&e!==!1&&e.openDialog()},getFormValues:function(e){"undefined"==typeof e&&(e=".so-content");var t,i=this.$(e),o={};return i.find("[name]").each(function(){var e=jQuery(this),i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(void 0===i)return!0;"undefined"==typeof 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,a="string"==typeof e.attr("type")?e.attr("type").toLowerCase():!1;if("checkbox"===a)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var r=null;"undefined"!=typeof tinyMCE&&(r=tinyMCE.get(e.attr("id"))),n=null===r||"function"!=typeof r.getContent||r.isHidden()?e.val():r.getContent()}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("undefined"!=typeof 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:("undefined"==typeof l[t[h]]&&(""===t[h+1]?l[t[h]]=[]:l[t[h]]={}),l=l[t[h]])}),o},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),"undefined"!=typeof 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()),sectionTemplate:_.template(s("#siteorigin-panels-live-editor-sidebar-section").html().panelsProcessTemplate()),postId:!1,bodyScrollTop:null,displayed:!1,events:{"click .live-editor-close":"close"},frameScrollTop:0,initialize:function(){},render:function(){this.setElement(this.template()),this.$el.html(this.template());var e=this;this.$("iframe#siteorigin-panels-live-editor-iframe").load(function(){s(this).show();var t=s(this).contents();t.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0==s(this).parents(".widget_siteorigin-panels-builder").length}).each(function(t,i){var o,l=jQuery(i),n=e.$(".page-widgets .so-widget").eq(t);l.css({cursor:"pointer"}).mouseenter(function(){n.addClass("so-hovered"),o=e.createPreviewOverlay(s(this))}).mouseleave(function(){n.removeClass("so-hovered"),o.fadeOut("fast",function(){s(this).remove()})}).click(function(e){e.preventDefault(),n.click()})}),t.find("a").css({"pointer-events":"none"}).click(function(e){return!1})})},attach:function(){this.$el.appendTo("body")},setPostId:function(e){this.postId=e},open:function(){""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),this.refreshWidgets(),this.$el.show(),this.refreshPreview(),this.bodyScrollTop=s("body").scrollTop(),s("body").css({overflow:"hidden"}),this.displayed=!0},close:function(){return this.$el.hide(),s("body").css({overflow:"auto"}),s("body").scrollTop(this.bodyScrollTop),this.displayed=!1,!1},refreshPreview:function(){return this.$el.is(":visible")?(this.$("iframe#siteorigin-panels-live-editor-iframe").hide(),this.frameScrollTop=this.$("iframe#siteorigin-panels-live-editor-iframe").contents().find("body").scrollTop(),this.$('form.live-editor-form input[name="siteorigin_panels_data"]').val(JSON.stringify(this.builder.model.getPanelsData())),void this.$("form.live-editor-form").submit()):!1},createPreviewOverlay:function(e){var t=this.$("iframe#siteorigin-panels-live-editor-iframe"),i=t.contents().find("body").css("position","relative");t.contents().find(".panels-live-editor-overlay").remove();var o=s("<div />").addClass("panels-live-editor-overlay").css({"pointer-events":"none"}),l=s("<div />").css({position:"absolute",background:"#000000","z-index":1e4,opacity:.25}),n=15;return o.append(l.clone().css({top:-i.offset().top,left:0,right:0,height:e.offset().top-n})).append(l.clone().css({bottom:0,left:0,right:0,height:Math.round(i.height()-e.offset().top-e.outerHeight()-n+i.offset().top-.01)})).append(l.clone().css({top:e.offset().top-n-i.offset().top,left:0,width:e.offset().left-n,height:Math.ceil(e.outerHeight()+2*n)})).append(l.clone().css({top:e.offset().top-n-i.offset().top,right:0,left:e.offset().left+e.outerWidth()+n,height:Math.ceil(e.outerHeight()+2*n)})),t.contents().find("body").append(o),o},refreshWidgets:function(){this.$(".so-sidebar .page-widgets").empty();var e=this.$("iframe#siteorigin-panels-live-editor-iframe"),t=this,i=0;this.builder.$(".so-row-container").each(function(o,l){var n=s(l),a=n.find(".so-cells .cell .so-widget"),r=s(t.sectionTemplate({title:"Row "+(o+1)})).appendTo(t.$(".so-sidebar .page-widgets"));r.find(".section-header").click(function(){n.data("view").editSettingsHandler()});var d=r.find(".section-widgets");a.each(function(o,l){var n=s(this),a=n.clone().show().css({opacity:1});a.find(".actions").remove(),a.find(".widget-icon").remove();var r=i++,c=function(){return e.contents().find("#pl-"+t.postId+" .panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".widget_siteorigin-panels-builder").length}).not("panel-hover-widget").eq(r)},h=null,u=null;a.click(function(e){return e.preventDefault(),n.data("view").editHandler(),!1}).mouseenter(function(){var i=c();i&&i.offset()&&(e.contents().find("html,body").clearQueue().animate({scrollTop:i.offset().top-Math.max(30,(Math.min(e.contents().height(),e.height())-i.outerHeight())/2)},750),h=t.createPreviewOverlay(i))}).mouseleave(function(){e.contents().find("html,body").clearQueue(),null!==h&&(h.fadeOut("fast",function(){s(this).remove()}),h=null),null!==u&&(u.remove(),u=null)}).appendTo(d)})})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")}})},{}],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),
3
- 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.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"))return!1;this.$el.find(".so-cells .cell-wrapper").css("min-height",0);var t=0;this.$el.find(".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.$el.find(".so-cells .cell-wrapper").css("min-height",Math.max(t,70))},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(),e.builder.liveEditor.displayed&&e.builder.liveEditor.refreshWidgets()})},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}),!1},confirmedDeleteHandler:function(e){var t=jQuery(e.target);if(t.hasClass("dashicons")&&(t=jQuery$.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)}return!1},editSettingsHandler:function(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),!1},deleteHandler:function(){return this.model.destroy(),!1},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.$el.find(".so-cells > .cell").each(function(){var t=o(this).data("view");return"undefined"==typeof t?!1:void(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});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})})}})},{}],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("undefined"==typeof e)return!1;i=_.extend({builderType:""},i),this.$el.addClass("so-visual-styles");var o=this;s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify(i),postId:t},function(e){o.$el.html(e),o.setupFields(),o.stylesLoaded=!0,o.trigger("styles_loaded")})},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")})}),"undefined"!=typeof s.fn.wpColorPicker&&("object"!=typeof 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=jQuery(this),t=e.find('input[type="text"]'),i=e.find("select"),s=e.find('input[type="hidden"]');if(""!==s.val()){var o=/(?:([0-9\.,]+)(.*))+/,l=s.val().split(" "),n=[];for(var a in l){var r=o.exec(l[a]);null!=r&&"undefined"!=typeof r[1]&&"undefined"!=typeof r[2]&&(n.push(r[1]),i.val(r[2]))}t.val(n.join(" "))}var d=function(){var e=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");s.val(e)};t.keyup(d).change(d),i.change(d)})}})},{}],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":"editHandler","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),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}},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(),!1},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}),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),!1},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.remove()})},buildContextualMenu:function(e,t){var i=this;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})}),this.cell.row.buildContextualMenu(e,t)}})},{}]},{},[12]);
1
+ !function e(t,i,s){function o(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(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}})},{}],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){("undefined"==typeof t||null===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()}}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){}})},{}],5:[function(e,t,i){var s=window.panels,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,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(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){o(this).show()})},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")||this.entries.models.length>0)&&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){this.$("iframe.siteorigin-panels-history-iframe").hide(),this.$('form.history-form input[name="siteorigin_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.entries.addEntry("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))),0===s.length?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({entryTemplate:_.template(o("#siteorigin-panels-dialog-prebuilt-entry").html().panelsProcessTemplate()),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-content .so-directory-item .so-button-use":"directoryClickHandler"},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")})},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-prebuilt").html(),{}))},tabClickHandler:function(e){this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=jQuery(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;return this.$(".so-content").empty(),s.currentTab=i,"directory"===i?this.displayLayoutDirectory():"import"===i?this.displayImportExport():"undefined"==typeof this.layoutCache[i]?(this.$(".so-content").addClass("so-panels-loading"),o.get(panelsOptions.ajaxurl,{action:"so_panels_prebuilt_layouts",type:i},function(e){s.layoutCache[i]=e,s.currentTab===i&&(s.$(".so-content").removeClass("so-panels-loading"),s.displayLayouts(i,e))})):s.displayLayouts(i,this.layoutCache[i]),s.$(".so-sidebar-search").val(""),!1},displayLayouts:function(e,t){var i=this.$(".so-content").empty(),s=this.$(".so-sidebar-search").val().toLowerCase();if("undefined"!=typeof t.error_message)return void this.$(".so-content").append(o('<div class="so-error-message">').html(t.error_message));if(_.size(t))for(var l in t)if(t.hasOwnProperty(l)){if("prebuilt"!==e&&l===o("#post_ID").val())continue;if(""!==s&&-1===t[l].name.toLowerCase().indexOf(s))continue;var n=o(this.entryTemplate({name:t[l].name,description:t[l].description}));n.appendTo(i).data({type:e,lid:l})}},layoutClickHandler:function(e){var t=o(e.target).closest(".layout");return this.loadLayout(t.data("type"),t.data("lid")),!1},loadLayout:function(e,t){var i=this;return confirm(panelsOptions.loc.prebuilt_confirm)?(this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0),void o.post(panelsOptions.ajaxurl,{action:"so_panels_get_prebuilt_layout",type:e,lid:t},function(e){i.setStatusMessage("",!1),i.builder.addHistoryEntry("prebuilt_loaded"),i.builder.model.loadPanelsData(e),i.closeDialog()})):!1},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"),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,i,s){var o=JSON.parse(s.response);"undefined"!=typeof o.widgets?(t.builder.addHistoryEntry("prebuilt_loaded"),t.builder.model.loadPanelsData(o),t.closeDialog()):alert(panelsOptions.plupload.error_message)},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=jQuery(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t){var i=this,s=this.$(".so-content").empty().addClass("so-panels-loading");return void 0===e&&(e=""),void 0===t&&(t=1),panelsOptions.directory_enabled?void o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_query",search:e,page:t},function(l){if("directory"===i.currentTab){s.removeClass("so-panels-loading").html(i.directoryTemplate(l));var n=s.find(".so-previous"),a=s.find(".so-next");1>=t?n.addClass("button-disabled"):n.click(function(s){s.preventDefault(),i.displayLayoutDirectory(e,t-1)}),t===l.max_num_pages||0==l.max_num_pages?a.addClass("button-disabled"):a.click(function(s){s.preventDefault(),i.displayLayoutDirectory(e,t+1)}),""!==e&&s.find(".so-directory-browse").html(panelsOptions.loc.search_results_header+'"<em>'+_.escape(e)+'</em>"'),s.find(".so-screenshot").each(function(){var e=jQuery(this),t=e.find("a");t.css("height",t.width()/4*3+"px").addClass("so-loading");var i=o("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")})})}},"json"):(s.removeClass("so-panels-loading").html(o("#siteorigin-panels-directory-enable").html()),void s.find(".so-panels-enable-directory").click(function(l){l.preventDefault(),o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,s.addClass("so-panels-loading"),i.displayLayoutDirectory(e,t)}))},directoryClickHandler:function(e){e.preventDefault();var t=jQuery(e.currentTarget),i=this;return confirm(panelsOptions.loc.prebuilt_confirm)?(this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0),void o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_item",layout_slug:t.data("layout-slug")},function(e){void 0!==e.error?alert(e.error):(i.setStatusMessage("",!1),i.builder.addHistoryEntry("prebuilt_loaded"),i.builder.model.loadPanelsData(e),i.closeDialog())})):!1},searchHandler:function(e){if("directory"!==this.currentTab){if(this.currentTab===!1||"undefined"==typeof this.layoutCache[this.currentTab])return!1;this.displayLayouts(this.currentTab,this.layoutCache[this.currentTab])}else 13===e.keyCode&&this.displayLayoutDirectory(o(e.currentTarget).val(),1)}})},{}],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(){"undefined"!=typeof this.model&&0!==this.model.cells.length?this.setRowModel(this.model):this.setRowModel(null),this.regenerateRowPreview()},this),this.row={cells:[.5,.5],style:{}}},setRowDialogType:function(e){this.dialogType=e},render:function(e){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",o("#post_ID").val(),{builderType:this.builder.builderType}),this.styles.attach(this.$(".so-sidebar.so-right-sidebar")),this.styles.on("styles_loaded",function(){this.$(".so-sidebar.so-right-sidebar").removeClass("so-panels-loading")},this),this.$(".so-sidebar.so-right-sidebar").addClass("so-panels-loading")),"undefined"!=typeof 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 a,r=n.prev();0!==r.length&&(a=o('<div class="resize-handle"></div>'),a.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()}),a.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=r.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:r.outerWidth(),right:6,height:r.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),r.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),a=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()*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),r.find(".preview-cell-in").css("visibility","visible");var a=s.position.left+6,d=a/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").length)return!1;var i=[],s=[],l=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(o(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!o(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?l+=r:n+=r}),l>0&&n>0&&1-l>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-l));var r=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/r}),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)},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(){var e={cells:parseInt(this.$el.find('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$el.find('.row-set-form select[name="ratio"]').val()),direction:this.$el.find('.row-set-form select[name="ratio_direction"]').val()},t=[];if(isNaN(e.cells)||isNaN(e.ratio))return!1;var i=this.row.cells.length!==e.cells;e.cells<1?(this.$el.find('.row-set-form input[name="cells"]').val(1),e.cells=1):e.cells>20&&(this.$el.find('.row-set-form input[name="cells"]').val(20),e.cells=20);for(var 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 a=this;this.$el.find(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*a.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*a.row.cells[e])/10)}),this.$el.find(".preview-cell").css("overflow","visible"),setTimeout(function(){a.regenerateRowPreview()},260)}this.$el.find(".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(){if(this.model.setCells(this.row.cells),"undefined"!=typeof this.styles&&this.styles.stylesLoaded){var e={};try{e=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(t){}this.model.set("style",e)}},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(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog(),!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(),!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":"saveHistory","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(){this.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this)},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm(),"undefined"!=typeof panelsOptions.widgets[this.model.get("class")]?this.$(".so-title .widget-name").html(panelsOptions.widgets[this.model.get("class")].title):this.$(".so-title .widget-name").html(panelsOptions.loc.missing_widget.title),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",o("#post_ID").val(),{builderType:this.builder.builderType}),this.styles.attach(this.$(".so-sidebar.so-right-sidebar")),this.styles.on("styles_loaded",function(){this.$(".so-sidebar.so-right-sidebar").removeClass("so-panels-loading")},this),this.$(".so-sidebar.so-right-sidebar").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;var i=e.eq(t-1).data("view");return"undefined"==typeof i?!1:i.getEditDialog()},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(t===e.length-1)return!1;var i=e.eq(t+1).data("view");return"undefined"==typeof i?!1:i.getEditDialog()},loadForm:function(){if(this.$el.find("> *").length){var e=this;this.$el.find(".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.$el.find(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$el.find(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.saveWidget,e)},"html")}},saveWidget:function(){if(this.savingWidget=!0,!this.model.get("missing")){var e=this.getFormValues();"undefined"==typeof e.widgets?e={}:(e=e.widgets,e=e[Object.keys(e)[0]]),this.model.setValues(e),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(i){}this.model.set("style",t)}this.savingWidget=!1},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHistory:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.builder.liveEditor.displayed?(this.model.destroy(),this.builder.liveEditor.refreshWidgets()):this.model.trigger("visual_destroy"),this.closeDialog(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.builder.liveEditor.displayed&&this.builder.liveEditor.refreshWidgets(),this.closeDialog(),!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}));"undefined"==typeof e.icon&&(e.icon="dashicons dashicons-admin-generic"),"undefined"!=typeof e.icon&&o('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e["class"]).appendTo(this.$el.find(".widget-type-list"))},this);var e=this.$el.find(".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.$el.find(".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){"undefined"==typeof e&&(e={}),"undefined"==typeof e.groups&&(e.groups=""),this.$el.find(".widget-type-list .widget-type").each(function(){var t,i=jQuery(this),s=i.data("class"),o="undefined"!=typeof panelsOptions.widgets[s]?panelsOptions.widgets[s]:null;t=0===e.groups.length?!0:null!==o&&_.intersection(e.groups,panelsOptions.widgets[s].groups).length?!0:!1,t&&"undefined"!=typeof e.search&&""!==e.search&&-1===o.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.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()},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(){return this.each(function(){var e=jQuery(this),t=e.closest("form").find(".widget-id").val();if(!("undefined"!=typeof t&&t.indexOf("__i__")>-1)){var i=new s.model.builder,l=new s.view.builder({model:i}),n=e.closest(".so-panels-dialog-wrapper").data("view");"undefined"!=typeof n&&(n.on("close_dialog",function(){i.refreshPanelsData()}),n.on("open_dialog_complete",function(){l.trigger("builder_resize")}),n.model.on("destroy",function(){i.emptyRows().destroy()}),l.setDialogParents(panelsOptions.loc.layout_widget,n));var a=Boolean(e.closest(".widget-content").length);l.render().attach({container:e,dialog:a,type:e.data("type")}).setDataField(e.find("input.panels-data")),a?(l.setDialogParents(panelsOptions.loc.layout_widget,l.dialog),e.find(".siteorigin-panels-display-builder").click(function(){l.dialog.openDialog()})):e.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",l)}})}},{}],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=!1,i=!1,s=!1,o=!1,l="";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=e("#post_ID").val(),l="editor_attached";else if(e(".siteorigin-panels-builder-form").length){var n=jQuery(".siteorigin-panels-builder-form");t=n.find(".siteorigin-panels-builder"),i=n.find('input[name="panels_data"]'),s=n,o=e("#panels-home-page").data("post-id"),l=n.data("type")}if(t!==!1){var a=window.siteoriginPanels,r=new a.model.builder,d=new a.view.builder({model:r});d.render().attach({container:t,type:l}).setDataField(i).attachToEditor().addLiveEditor(o).addHistoryBrowser(),d.liveEditor.refreshPreview(),s.submit(function(e){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",d,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({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){this.emptyRows(),this.set("data",e,{silent:!0});var t=[];if("undefined"==typeof e.grid_cells)return void this.trigger("load_panels_data");for(var i,s=0;s<e.grid_cells.length;s++)i=parseInt(e.grid_cells[s].grid),"undefined"==typeof t[i]&&(t[i]=[]),t[i].push(parseFloat(e.grid_cells[s].weight));var o=this;_.each(t,function(t,i){var s=o.addRow(t,{noAnimate:!0});"undefined"!=typeof e.grids[i].style&&s.set("style",e.grids[i].style)}),"undefined"!=typeof e.widgets&&(_.each(e.widgets,function(e){try{var t=null;"undefined"!=typeof e.panels_info?(t=e.panels_info,delete e.panels_info):(t=e.info,delete e.info);var i=o.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),l=new panels.model.widget({"class":t["class"],values:e});"undefined"!=typeof t.style&&l.set("style",t.style),l.cell=s,s.widgets.add(l,{noAnimate:!0})}catch(n){}}),this.trigger("load_panels_data"))},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.rows.each(function(i,s){i.cells.each(function(i,o){
2
+ i.widgets.each(function(i,l){var n=_.extend(_.clone(i.get("values")),{panels_info:{"class":i.get("class"),raw:i.get("raw"),grid:s,cell:o,id:t++,style:i.get("style")}});e.widgets.push(n)}),e.grid_cells.push({grid:s,weight:i.get("weight")})}),e.grids.push({cells:i.cells.length,style:i.get("style")})}),e},refreshPanelsData:function(){var e=JSON.stringify(this.get("data")),t=this.getPanelsData();this.set("data",t,{silent:!0}),JSON.stringify(t)!==e&&(this.trigger("change"),this.trigger("change:data"))},emptyRows:function(){return _.invoke(this.rows.toArray(),"destroy"),this.rows.reset(),this}})},{}],14:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0},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){"undefined"==typeof 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:{}},initialize:function(){this.cells=new panels.collection.cells,this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this;if(0===this.cells.length)_.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){"undefined"==typeof 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,styles:{}},initialize:function(){var e=this.get("class");"undefined"!=typeof panelsOptions.widgets[e]&&panelsOptions.widgets[e].installed||this.set("missing",!0)},getWidgetField:function(e){return"undefined"==typeof 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){"undefined"==typeof 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){"string"==typeof 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("undefined"==typeof e)return this.get("class").replace(/_/g," ");if("undefined"!=typeof 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("undefined"!=typeof t[i[o]]&&"string"==typeof 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(jQuery("#siteorigin-panels-context-menu").html().panelsProcessTemplate()),sectionTemplate:_.template(jQuery("#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),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").click(function(){var e=jQuery(this);i(e.data("key")),o.closeMenu()}),l.data("settings",e).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},searchKeyUp:function(e){var t=jQuery(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(0!==n.length){l.removeClass("so-active");var a=l.index(n);38===e.which?n=0>a-1?l.last():l.eq(a-1):40===e.which&&(n=a+1>=l.length?l.first():l.eq(a+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 r=0;r<o.defaultDisplay.length;r++)i.find('.so-item[data-key="'+o.defaultDisplay[r]+'"]').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({template:_.template(o("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:!1,menu:!1,builderType:"",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(){var e=this;return this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},_.each(this.dialogs,function(t,i,s){s[i].setBuilder(e)}),this.dialogs.row.setRowDialogType("create"),this.model.rows.on("add",this.onAddRow,this),o(window).resize(function(t){t.target===window&&e.trigger("builder_resize")}),this.model.on("change:data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,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.$el.html(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){return e=_.extend({type:"",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.builderType=e.type,this},attachToEditor:function(){if("undefined"==typeof this.metabox)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")})),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");("undefined"!=typeof i.widgets&&0!==_.size(i.widgets)||"undefined"!=typeof i.grids&&0!==_.size(i.grids))&&o("#content-panels.switch-panels").click();var s=function(){var e=t.$(".so-builder-toolbar"),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 o(window).resize(s),o(document).scroll(s),s(),this},initSortable:function(){var e=(this.$el,this);this.rowsSortable=this.$el.find(".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()}})},refreshSortable:function(){null!==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;try{i=JSON.parse(this.dataField.val())}catch(s){i=""}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay()}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(),"undefined"==typeof 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(){return this.dialogs.widgets.openDialog(),!1},displayAddRowDialog:function(){return this.dialogs.row.openDialog(),this.dialogs.row.setRowModel(),!1},displayAddPrebuiltDialog:function(){return this.dialogs.prebuilt.openDialog(),!1},displayHistoryDialog:function(){return this.dialogs.history.openDialog(),!1},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 t.length||(t="last"===e.defaultPosition?this.$(".so-cells .cell").first():this.$(".so-cells .cell").last()),t.data("view").model},sortCollections:function(){var e={};this.$(".so-rows-container .so-row-container").each(function(t,i){var s=o(i);e[s.data("view").model.cid]=t,s.find(".so-cells .cell").each(function(t,i){var s=o(i);s.find(".so-widget").each(function(t,i){var s=o(i);e[s.data("view").model.cid]=t})})}),this.model.rows.models=this.model.rows.sortBy(function(t){return e[t.cid]}),this.model.rows.each(function(t){t.cells.each(function(t){t.widgets.models=t.widgets.sortBy(function(t){return e[t.cid]})})}),this.model.refreshPanelsData()},addLiveEditor:function(e){return"undefined"==typeof s.view.liveEditor?this:(this.liveEditor=new s.view.liveEditor,this.liveEditor.setPostId(e),this.liveEditor.builder=this,this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this)},displayLiveEditor:function(){return"undefined"==typeof this.liveEditor?!1:(this.liveEditor.open(),!1)},addHistoryBrowser:function(){return"undefined"==typeof s.dialog.history?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){"undefined"==typeof t&&(t=null),"undefined"!=typeof this.dialogs.history&&this.dialogs.history.entries.addEntry(e,t)},handleContentChange:function(){panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")&&this.model.rows.length>0&&o.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(this.model.getPanelsData()),post_id:o("#post_ID").val()},function(e){if(""!==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(),this.updateEditorContent(e)}}.bind(this)),this.liveEditor!==!1&&this.liveEditor.refreshPreview()},updateEditorContent:function(e){if("undefined"==typeof tinyMCE||null===tinyMCE.get("content")){var t=o("#content");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&&"function"==typeof e.getContent?e.getContent():o("textarea#content").val(),_.isEmpty(this.model.get("data"))&&""!==t){if(!confirm(panelsOptions.loc.confirm_use_builder))return;var i="";if("undefined"!=typeof panelsOptions.widgets.SiteOrigin_Widget_Editor_Widget?i="SiteOrigin_Widget_Editor_Widget":"undefined"!=typeof panelsOptions.widgets.WP_Widget_Text&&(i="WP_Widget_Text"),""===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")}},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.length?this.$(".so-panels-welcome-message").hide():this.$(".so-panels-welcome-message").show()},activateContextMenu:function(e,t){var i=this;if("undefined"==typeof window.panelsDialogOpen||!window.panelsDialogOpen){var s=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)}),l=s.last().data("view");void 0!==l&&void 0!==l.buildContextualMenu&&l.buildContextualMenu(e,t)}}})},{}],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;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()},initSortable:function(){var e=this,t=e.row.builder.$el.attr("id");this.widgetSortable=this.$el.find(".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}})},refreshSortable:function(){this.widgetSortable.sortable("refresh")},initResizable:function(){var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),"undefined"==typeof e)return!1;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,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),o(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),l.helper.css("left",-t.outerWidth()/2)}})},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.widget({model:e});o.cell=this,"undefined"==typeof e.isDuplicate&&(e.isDuplicate=!1),o.render({loadForm:e.isDuplicate}),"undefined"==typeof 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");return o(e.target).parent().addClass("cell-selected"),!1},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)}),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),"undefined"!=typeof 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.$el.find(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click(function(e){e.preventDefault();var i=jQuery(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var s=i.attr("href");if("undefined"!=typeof s&&"#"===s.charAt(0)){var o=s.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).show()}t.trigger("tab_click",i)}),this.$el.find(".so-sidebar-tabs li a").first().click(),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(){this.trigger("open_dialog"),this.dialogOpen=!0,window.panelsDialogOpen=!0,this.refreshDialogNav(),this.bodyScrollTop=s("body").scrollTop(),s("body").css({overflow:"hidden"}),s(window).on("keyup",this.keyboardListen),this.$el.show(),this.trigger("open_dialog_complete")},closeDialog:function(e){return this.trigger("close_dialog"),this.dialogOpen=!1,window.panelsDialogOpen=!1,"undefined"!=typeof this.builder&&this.builder.model.refreshPanelsData(),this.$el.hide(),s(".so-panels-dialog-wrapper").is(":visible")||(s("body").css({overflow:"auto"}),s("body").scrollTop(this.bodyScrollTop)),s(window).off("keyup",this.keyboardListen),this.trigger("close_dialog_complete"),!1},keyboardListen:function(e){27===e.which&&s(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog(null);var e=this.getPrevDialog();null!==e&&e!==!1&&e.openDialog()},navToNext:function(){this.closeDialog(null);var e=this.getNextDialog();null!==e&&e!==!1&&e.openDialog()},getFormValues:function(e){"undefined"==typeof e&&(e=".so-content");var t,i=this.$(e),o={};return i.find("[name]").each(function(){var e=jQuery(this),i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(void 0===i)return!0;"undefined"==typeof 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,a="string"==typeof e.attr("type")?e.attr("type").toLowerCase():!1;if("checkbox"===a)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var r=null;"undefined"!=typeof tinyMCE&&(r=tinyMCE.get(e.attr("id"))),n=null===r||"function"!=typeof r.getContent||r.isHidden()?e.val():r.getContent()}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("undefined"!=typeof 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:("undefined"==typeof l[t[h]]&&(""===t[h+1]?l[t[h]]=[]:l[t[h]]={}),l=l[t[h]])}),o},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),"undefined"!=typeof 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()),sectionTemplate:_.template(s("#siteorigin-panels-live-editor-sidebar-section").html().panelsProcessTemplate()),postId:!1,bodyScrollTop:null,displayed:!1,events:{"click .live-editor-close":"close"},frameScrollTop:0,initialize:function(){},render:function(){this.setElement(this.template()),this.$el.html(this.template());var e=this;this.$("iframe#siteorigin-panels-live-editor-iframe").load(function(){s(this).show();var t=s(this).contents();t.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0==s(this).parents(".widget_siteorigin-panels-builder").length}).each(function(t,i){var o,l=jQuery(i),n=e.$(".page-widgets .so-widget").eq(t);l.css({cursor:"pointer"}).mouseenter(function(){n.addClass("so-hovered"),o=e.createPreviewOverlay(s(this))}).mouseleave(function(){n.removeClass("so-hovered"),o.fadeOut("fast",function(){s(this).remove()})}).click(function(e){e.preventDefault(),n.click()})}),t.find("a").css({"pointer-events":"none"}).click(function(e){return!1})})},attach:function(){this.$el.appendTo("body")},setPostId:function(e){this.postId=e},open:function(){""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),this.refreshWidgets(),this.$el.show(),this.refreshPreview(),this.bodyScrollTop=s("body").scrollTop(),s("body").css({overflow:"hidden"}),this.displayed=!0},close:function(){return this.$el.hide(),s("body").css({overflow:"auto"}),s("body").scrollTop(this.bodyScrollTop),this.displayed=!1,!1},refreshPreview:function(){return this.$el.is(":visible")?(this.$("iframe#siteorigin-panels-live-editor-iframe").hide(),this.frameScrollTop=this.$("iframe#siteorigin-panels-live-editor-iframe").contents().find("body").scrollTop(),this.$('form.live-editor-form input[name="siteorigin_panels_data"]').val(JSON.stringify(this.builder.model.getPanelsData())),void this.$("form.live-editor-form").submit()):!1},createPreviewOverlay:function(e){var t=this.$("iframe#siteorigin-panels-live-editor-iframe"),i=t.contents().find("body").css("position","relative");t.contents().find(".panels-live-editor-overlay").remove();var o=s("<div />").addClass("panels-live-editor-overlay").css({"pointer-events":"none"}),l=s("<div />").css({position:"absolute",background:"#000000","z-index":1e4,opacity:.25}),n=15;return o.append(l.clone().css({top:-i.offset().top,left:0,right:0,height:e.offset().top-n})).append(l.clone().css({bottom:0,left:0,right:0,height:Math.round(i.height()-e.offset().top-e.outerHeight()-n+i.offset().top-.01)})).append(l.clone().css({top:e.offset().top-n-i.offset().top,left:0,width:e.offset().left-n,height:Math.ceil(e.outerHeight()+2*n)})).append(l.clone().css({top:e.offset().top-n-i.offset().top,right:0,left:e.offset().left+e.outerWidth()+n,height:Math.ceil(e.outerHeight()+2*n)})),t.contents().find("body").append(o),o},refreshWidgets:function(){this.$(".so-sidebar .page-widgets").empty();var e=this.$("iframe#siteorigin-panels-live-editor-iframe"),t=this,i=0;this.builder.$(".so-row-container").each(function(o,l){var n=s(l),a=n.find(".so-cells .cell .so-widget"),r=s(t.sectionTemplate({title:"Row "+(o+1)})).appendTo(t.$(".so-sidebar .page-widgets"));r.find(".section-header").click(function(){n.data("view").editSettingsHandler()});var d=r.find(".section-widgets");a.each(function(o,l){var n=s(this),a=n.clone().show().css({opacity:1});a.find(".actions").remove(),a.find(".widget-icon").remove();var r=i++,c=function(){return e.contents().find("#pl-"+t.postId+" .panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".widget_siteorigin-panels-builder").length}).not("panel-hover-widget").eq(r)},h=null,u=null;a.click(function(e){return e.preventDefault(),n.data("view").editHandler(),!1}).mouseenter(function(){var i=c();i&&i.offset()&&(e.contents().find("html,body").clearQueue().animate({scrollTop:i.offset().top-Math.max(30,(Math.min(e.contents().height(),e.height())-i.outerHeight())/2)},750),h=t.createPreviewOverlay(i))}).mouseleave(function(){e.contents().find("html,body").clearQueue(),null!==h&&(h.fadeOut("fast",function(){s(this).remove()}),h=null),null!==u&&(u.remove(),u=null)}).appendTo(d)})})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")}})},{}],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),
3
+ 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.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"))return!1;this.$el.find(".so-cells .cell-wrapper").css("min-height",0);var t=0;this.$el.find(".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.$el.find(".so-cells .cell-wrapper").css("min-height",Math.max(t,70))},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(),e.builder.liveEditor.displayed&&e.builder.liveEditor.refreshWidgets()})},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}),!1},confirmedDeleteHandler:function(e){var t=jQuery(e.target);if(t.hasClass("dashicons")&&(t=jQuery$.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)}return!1},editSettingsHandler:function(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),!1},deleteHandler:function(){return this.model.destroy(),!1},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.$el.find(".so-cells > .cell").each(function(){var t=o(this).data("view");return"undefined"==typeof t?!1:void(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});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})})}})},{}],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("undefined"==typeof e)return!1;i=_.extend({builderType:""},i),this.$el.addClass("so-visual-styles");var o=this;s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify(i),postId:t},function(e){o.$el.html(e),o.setupFields(),o.stylesLoaded=!0,o.trigger("styles_loaded")})},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")})}),"undefined"!=typeof s.fn.wpColorPicker&&("object"!=typeof 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=jQuery(this),t=e.find('input[type="text"]'),i=e.find("select"),s=e.find('input[type="hidden"]');if(""!==s.val()){var o=/(?:([0-9\.,]+)(.*))+/,l=s.val().split(" "),n=[];for(var a in l){var r=o.exec(l[a]);null!=r&&"undefined"!=typeof r[1]&&"undefined"!=typeof r[2]&&(n.push(r[1]),i.val(r[2]))}t.val(n.join(" "))}var d=function(){var e=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");s.val(e)};t.keyup(d).change(d),i.change(d)})}})},{}],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":"editHandler","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),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}},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(),!1},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}),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),!1},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.remove()})},buildContextualMenu:function(e,t){var i=this;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})}),this.cell.row.buildContextualMenu(e,t)}})},{}]},{},[12]);
readme.txt CHANGED
@@ -1,228 +1,231 @@
1
- === Page Builder by SiteOrigin ===
2
- Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
- Requires at least: 4.0
4
- Tested up to: 4.4.2
5
- Stable tag: 2.3.1
6
- License: GPLv3
7
- License URI: http://www.gnu.org/licenses/gpl.html
8
- Donate link: http://siteorigin.com/page-builder/#donate
9
- Contributors: gpriday, braam-genis
10
-
11
- Build responsive page layouts using the widgets you know and love using this simple drag and drop page builder.
12
-
13
- == Description ==
14
-
15
- [vimeo https://vimeo.com/114529361]
16
-
17
- Page Builder by SiteOrigin is the most popular page creation plugin for WordPress. It makes it easy to create responsive column based content, using the widgets you know and love. Your content will accurately adapt to all mobile devices, ensuring your site is mobile-ready. Read more on [SiteOrigin](https://siteorigin.com/page-builder/).
18
-
19
- We've created an intuitive interface that looks just like WordPress itself. It's easy to learn, so you'll be building beautiful, responsive content in no time.
20
-
21
- Page Builder works with standard WordPress widgets, so you'll always find the widget you need. We've created the SiteOrigin Widgets Bundle to give you all the most common widgets, and with a world of plugins out there, you'll always find the widget you need.
22
-
23
- = It works with your theme. =
24
-
25
- Page Builder gives you complete freedom to choose any WordPress theme you like. It's not a commitment to a single theme or theme developer. The advantage is that you're free to change themes as often as you like. Your content will always come along with you.
26
-
27
- We've also made some fantastic [free themes](https://siteorigin.com/theme/) that work well with Page Builder.
28
-
29
- = No coding required. =
30
-
31
- Page Builder's simple drag and drop interface means you'll never need to write a single line of code. Page Builder generates all the highly efficient code for you.
32
-
33
- We don't limit you with a set of pre-defined row layouts. Page Builder gives you complete flexibility. You can choose the exact number of columns for each row and the precise weight of each column - down to the decimal point. This flexibility is all possible using our convenient row builder. And, if you're not sure what you like, the Row Builder will guide you towards beautifully proportioned content using advanced ratios.
34
-
35
- = Live Editing. =
36
-
37
- Page Builder supports live editing. This tool lets you see your content and edit widgets in real-time. It's the fastest way to adjust your content quickly and easily.
38
-
39
- = History Browser. =
40
-
41
- This tool lets you roll forward and back through your changes. It gives you the freedom to experiment with different layouts and content without the fear of breaking your content.
42
-
43
- = Row and widget styles. =
44
-
45
- Row and widget styles give you all the control you need to make your content uniquely your own. Change attributes like paddings, background colours and column spacing. You can also enter custom CSS and CSS classes if you need even finer grained control.
46
-
47
- = It's free, and always will be. =
48
-
49
- Page Builder is our commitment to the democratization of content creation. Like WordPress, Page Builder is, and always will be free. We'll continue supporting and developing it for many years to come. It'll only get better from here.
50
-
51
- We offer free support on the [SiteOrigin support forums](https://siteorigin.com/thread/).
52
-
53
- = Actively Developed =
54
-
55
- Page Builder is actively developed with new features and exciting enhancements all the time. Keep track on the [Page Builder GitHub repository](https://github.com/siteorigin/siteorigin-panels).
56
-
57
- Read the [Page Builder developer docs](https://siteorigin.com/docs/page-builder/) if you'd like to develop for Page Builder.
58
-
59
- = Available in 17 Languages =
60
-
61
- Through the efforts of both professional translators and our community, Page Builder is available in the following languages: Afrikaans, Bulgarian, Chinese (simplified), Danish, Dutch, English, Finnish, French, German, Hindi, Italian, Japanese, Polish, Portuguese (BR), Russian, Spanish and Swedish.
62
-
63
- == Installation ==
64
-
65
- 1. Upload and install Page Builder in the same way you'd install any other plugin.
66
- 2. Read the [usage documentation](http://siteorigin.com/page-builder/documentation/) on SiteOrigin.
67
-
68
- == Screenshots ==
69
-
70
- 1. The page builder interface.
71
- 2. Powerful widget insert dialog with groups and search.
72
- 3. Live Editor that lets you change your content in real time.
73
- 4. Undo changes with the History Browser.
74
- 5. Row Builder that gives unlimited flexibility.
75
-
76
- == Documentation ==
77
-
78
- [Documentation](http://siteorigin.com/page-builder/documentation/) is available on SiteOrigin.
79
-
80
- == Frequently Asked Questions ==
81
-
82
- = How do I move a site created with Page Builder from one server to another? =
83
-
84
- We recommend the [duplicator plugin](https://wordpress.org/plugins/duplicator/). We've tested it in several instances and it always works well with Page Builder data.
85
-
86
- = Can I bundle Page Builder with my theme? =
87
-
88
- Yes, provided your theme is licensed under GPL or a compatible license. If you're publishing your theme on ThemeForest, you must select the GPL license instead of their regular license.
89
-
90
- Page Builder is actively developed and updated, so generally I'd recommend that you have your users install the original plugin so they can receive updates. You can try [TGM Plugin Activation](http://tgmpluginactivation.com/).
91
-
92
- = Will plugin X work with Page Builder? =
93
-
94
- We've tried to ensure that Page Builder is compatible with most plugin widgets. It's best to just download Page Builder and test for yourself.
95
-
96
- == Changelog ==
97
-
98
- = 2.3.1 - February 10 2015 =
99
- * Fixed fatal error on RTL sites.
100
- * Made setting to enable tablet layout. Disabled by default.
101
-
102
- = 2.3 - February 10 2015 =
103
- * Delete preview panels data if there are no widgets.
104
- * Added a collapse order field.
105
- * Added custom row ID field.
106
- * Fixed copy content setting.
107
- * Added tablet responsive level.
108
- * Fixed admin templates.
109
- * Fix to ensure live editor works with HTTPs admin requests.
110
- * Fix for Yoast SEO compatibility.
111
- * Removed use of filter_input for HHVM issues.
112
- * Added panelsStretchRows event after frontend row stretch event.
113
- * Minor performance enhancements.
114
- * Merged all separate JS files into a single Browserify compiled file.
115
- * Added version numbers to some JS files to ensure cache busting.
116
-
117
- = 2.2.2 - December 09 2015 =
118
- * Fix tab name for WordPress 4.4. Was displaying undefined.
119
- * Fix to ensure siteorigin-panels class is added to Page Builder pages.
120
-
121
- = 2.2.1 - October 22 2015 =
122
- * Various fixes to widget class names.
123
- * Added option to remove default `widget` class from Page Builder widgets.
124
- * Added action to saving home page.
125
- * Added support for defaults in widget and row styles.
126
- * Improve check for the homepage in sidebars simulator.
127
- * Changed parallax library to improve theme compatibility.
128
- * List privately published posts and pages under the prebuilt layout dialog Clone options.
129
-
130
- = 2.2 - September 7 2015 =
131
- * Added prebuilt layout directory.
132
- * Added contextual menu for quick actions.
133
- * Added parallax background images.
134
- * Properly handle missing widgets when saving forms.
135
- * Don't revert to default page template when using custom home page interface.
136
- * Various minor bug fixes and improvements.
137
-
138
- = 2.1.5 - August 19 2015 =
139
- * Fixed handling of checkboxes and array fields.
140
- * Properly position Page Builder tab in WordPress 4.3.
141
-
142
- = 2.1.4 =
143
- * Fixed handling of raw forms.
144
-
145
- = 2.1.3 =
146
- * Removed use of filter_input for compatibility with HHVM
147
- * Fixed checkbox handling in forms.
148
- * Removed unnecessary sprintf calls to lower chance of translations causing issues.
149
- * More generic handling of builder instances to allow them to be used in different places.
150
- * Use implicit check for whether editor is undefined or null.
151
- * Added optional $widget_id parameter to siteorigin_panels_render_form.
152
- * Improved checking for home page in sidebars emulator.
153
- * Added a builder "type" to allow more targetted instances.
154
-
155
- = 2.1.2 =
156
- * Removed rendered content cache introduced in 2.1.1
157
-
158
- = 2.1.1 =
159
- * Added translations for 16 additional languages
160
- * Modified strings to improve translatability.
161
- * Row and Widget style measurement fields now allow multiple values.
162
- * New rows now added below row of currently selected cell.
163
- * Orphaned widgets in edited rows are now moved into remaining cell.
164
- * Made panels javascript object globally accessible.
165
- * panels_info array now passed into widget rendering function.
166
- * Removed unnecessary action triggers from customizer that was breaking some themes.
167
- * Disabling Page Builder on a page now properly creates history entry.
168
- * Small fixes to sidebars emulator.
169
- * Fixed import/export on custom home page interface.
170
- * Removed call to filter_input from global space.
171
- * Fixed bundled widgets conflict with Yoast SEO.
172
- * Prevented double rendering issue with Yoast SEO.
173
-
174
- = 2.1 =
175
- * Improved Page Builder settings page.
176
- * Added sidebar emulation, which makes a Page Builder page appear to be a sidebar. Improves compatibility with other widgets.
177
- * Removed jPlayer. Self hosted widget (legacy) now uses MediaElement.
178
- * Small usability improvements.
179
- * Added legacy widget migration for gallery widget.
180
- * Layout file based import/export feature.
181
- * Added widget title setting to change widget title HTML.
182
- * Added setting to control full width container.
183
- * Fixed: Handling of namespaced widgets.
184
- * Fixed: Layout Builder widget now works in the Customizer.
185
- * Fixed: Custom home page interface now properly uses page_on_front.
186
- * Fixed: Page URL for home page in custom home page.
187
- * Fixed: Custom home page encoding.
188
-
189
- = 2.0.7 =
190
- * Fixed issue that prevented prebuilt layouts from showing up.
191
-
192
- = 2.0.6 =
193
- * Added nonce to all admin requests.
194
- * Fixed live editor for missing widgets.
195
- * Fixed handling of multi-line row/widget custom CSS.
196
- * Fixed issue with encoding of panels_data.
197
-
198
- = 2.0.5 =
199
- * Added proper escaping in widget form.
200
-
201
- = 2.0.4 =
202
- * Changed how data is json encoded to prevent malformed Page Builder data.
203
- * Fixed import/export.
204
- * Added layout widget notification (doesn't work in customizer).
205
- * Fixed translation domains.
206
- * Additional hooks and filters.
207
-
208
- = 2.0.3 =
209
- * Fixed issue with double calling sidebar_admin_setup that was breaking some widgets.
210
- * Fixed fetching content from TinyMCE in text mode.
211
-
212
- = 2.0.2 =
213
- * Fixed fatal error in validation for PHP < 5.5
214
-
215
- = 2.0.1 =
216
- * Fixed issue with preview causing content loss in standard editor.
217
- * Fixed issue with Black Studio TinyMCE
218
- * Changed templating tags in js-templates.php to prevent fatal errors with some server configurations.
219
-
220
- = 2.0 =
221
- * Complete rewrite of Page Builder Javascript using Backbone.
222
- * Complete UI redesign.
223
- * Grid Engine rewrite for more efficient CSS.
224
- * Various performance enhancements and bug fixes.
225
-
226
- == Upgrade Notice ==
227
-
228
- Page Builder 2.0 is a major update. Please ensure that you backup your database before updating from a 1.x version. Updating from 1.x to 2.0 is a smooth transition, but it's always better to have a backup.
 
 
 
1
+ === Page Builder by SiteOrigin ===
2
+ Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
+ Requires at least: 4.0
4
+ Tested up to: 4.5
5
+ Stable tag: 2.3.1
6
+ License: GPLv3
7
+ License URI: http://www.gnu.org/licenses/gpl.html
8
+ Donate link: http://siteorigin.com/page-builder/#donate
9
+ Contributors: gpriday, braam-genis
10
+
11
+ Build responsive page layouts using the widgets you know and love using this simple drag and drop page builder.
12
+
13
+ == Description ==
14
+
15
+ [vimeo https://vimeo.com/114529361]
16
+
17
+ Page Builder by SiteOrigin is the most popular page creation plugin for WordPress. It makes it easy to create responsive column based content, using the widgets you know and love. Your content will accurately adapt to all mobile devices, ensuring your site is mobile-ready. Read more on [SiteOrigin](https://siteorigin.com/page-builder/).
18
+
19
+ We've created an intuitive interface that looks just like WordPress itself. It's easy to learn, so you'll be building beautiful, responsive content in no time.
20
+
21
+ Page Builder works with standard WordPress widgets, so you'll always find the widget you need. We've created the SiteOrigin Widgets Bundle to give you all the most common widgets, and with a world of plugins out there, you'll always find the widget you need.
22
+
23
+ = It works with your theme. =
24
+
25
+ Page Builder gives you complete freedom to choose any WordPress theme you like. It's not a commitment to a single theme or theme developer. The advantage is that you're free to change themes as often as you like. Your content will always come along with you.
26
+
27
+ We've also made some fantastic [free themes](https://siteorigin.com/theme/) that work well with Page Builder.
28
+
29
+ = No coding required. =
30
+
31
+ Page Builder's simple drag and drop interface means you'll never need to write a single line of code. Page Builder generates all the highly efficient code for you.
32
+
33
+ We don't limit you with a set of pre-defined row layouts. Page Builder gives you complete flexibility. You can choose the exact number of columns for each row and the precise weight of each column - down to the decimal point. This flexibility is all possible using our convenient row builder. And, if you're not sure what you like, the Row Builder will guide you towards beautifully proportioned content using advanced ratios.
34
+
35
+ = Live Editing. =
36
+
37
+ Page Builder supports live editing. This tool lets you see your content and edit widgets in real-time. It's the fastest way to adjust your content quickly and easily.
38
+
39
+ = History Browser. =
40
+
41
+ This tool lets you roll forward and back through your changes. It gives you the freedom to experiment with different layouts and content without the fear of breaking your content.
42
+
43
+ = Row and widget styles. =
44
+
45
+ Row and widget styles give you all the control you need to make your content uniquely your own. Change attributes like paddings, background colours and column spacing. You can also enter custom CSS and CSS classes if you need even finer grained control.
46
+
47
+ = It's free, and always will be. =
48
+
49
+ Page Builder is our commitment to the democratization of content creation. Like WordPress, Page Builder is, and always will be free. We'll continue supporting and developing it for many years to come. It'll only get better from here.
50
+
51
+ We offer free support on the [SiteOrigin support forums](https://siteorigin.com/thread/).
52
+
53
+ = Actively Developed =
54
+
55
+ Page Builder is actively developed with new features and exciting enhancements all the time. Keep track on the [Page Builder GitHub repository](https://github.com/siteorigin/siteorigin-panels).
56
+
57
+ Read the [Page Builder developer docs](https://siteorigin.com/docs/page-builder/) if you'd like to develop for Page Builder.
58
+
59
+ = Available in 17 Languages =
60
+
61
+ Through the efforts of both professional translators and our community, Page Builder is available in the following languages: Afrikaans, Bulgarian, Chinese (simplified), Danish, Dutch, English, Finnish, French, German, Hindi, Italian, Japanese, Polish, Portuguese (BR), Russian, Spanish and Swedish.
62
+
63
+ == Installation ==
64
+
65
+ 1. Upload and install Page Builder in the same way you'd install any other plugin.
66
+ 2. Read the [usage documentation](http://siteorigin.com/page-builder/documentation/) on SiteOrigin.
67
+
68
+ == Screenshots ==
69
+
70
+ 1. The page builder interface.
71
+ 2. Powerful widget insert dialog with groups and search.
72
+ 3. Live Editor that lets you change your content in real time.
73
+ 4. Undo changes with the History Browser.
74
+ 5. Row Builder that gives unlimited flexibility.
75
+
76
+ == Documentation ==
77
+
78
+ [Documentation](http://siteorigin.com/page-builder/documentation/) is available on SiteOrigin.
79
+
80
+ == Frequently Asked Questions ==
81
+
82
+ = How do I move a site created with Page Builder from one server to another? =
83
+
84
+ We recommend the [duplicator plugin](https://wordpress.org/plugins/duplicator/). We've tested it in several instances and it always works well with Page Builder data.
85
+
86
+ = Can I bundle Page Builder with my theme? =
87
+
88
+ Yes, provided your theme is licensed under GPL or a compatible license. If you're publishing your theme on ThemeForest, you must select the GPL license instead of their regular license.
89
+
90
+ Page Builder is actively developed and updated, so generally I'd recommend that you have your users install the original plugin so they can receive updates. You can try [TGM Plugin Activation](http://tgmpluginactivation.com/).
91
+
92
+ = Will plugin X work with Page Builder? =
93
+
94
+ We've tried to ensure that Page Builder is compatible with most plugin widgets. It's best to just download Page Builder and test for yourself.
95
+
96
+ == Changelog ==
97
+
98
+ = 2.3.2 - March 11 2016 =
99
+ * Fixed compatibility with WordPress 4.5
100
+
101
+ = 2.3.1 - February 10 2016 =
102
+ * Fixed fatal error on RTL sites.
103
+ * Made setting to enable tablet layout. Disabled by default.
104
+
105
+ = 2.3 - February 10 2016 =
106
+ * Delete preview panels data if there are no widgets.
107
+ * Added a collapse order field.
108
+ * Added custom row ID field.
109
+ * Fixed copy content setting.
110
+ * Added tablet responsive level.
111
+ * Fixed admin templates.
112
+ * Fix to ensure live editor works with HTTPs admin requests.
113
+ * Fix for Yoast SEO compatibility.
114
+ * Removed use of filter_input for HHVM issues.
115
+ * Added panelsStretchRows event after frontend row stretch event.
116
+ * Minor performance enhancements.
117
+ * Merged all separate JS files into a single Browserify compiled file.
118
+ * Added version numbers to some JS files to ensure cache busting.
119
+
120
+ = 2.2.2 - December 09 2015 =
121
+ * Fix tab name for WordPress 4.4. Was displaying undefined.
122
+ * Fix to ensure siteorigin-panels class is added to Page Builder pages.
123
+
124
+ = 2.2.1 - October 22 2015 =
125
+ * Various fixes to widget class names.
126
+ * Added option to remove default `widget` class from Page Builder widgets.
127
+ * Added action to saving home page.
128
+ * Added support for defaults in widget and row styles.
129
+ * Improve check for the homepage in sidebars simulator.
130
+ * Changed parallax library to improve theme compatibility.
131
+ * List privately published posts and pages under the prebuilt layout dialog Clone options.
132
+
133
+ = 2.2 - September 7 2015 =
134
+ * Added prebuilt layout directory.
135
+ * Added contextual menu for quick actions.
136
+ * Added parallax background images.
137
+ * Properly handle missing widgets when saving forms.
138
+ * Don't revert to default page template when using custom home page interface.
139
+ * Various minor bug fixes and improvements.
140
+
141
+ = 2.1.5 - August 19 2015 =
142
+ * Fixed handling of checkboxes and array fields.
143
+ * Properly position Page Builder tab in WordPress 4.3.
144
+
145
+ = 2.1.4 =
146
+ * Fixed handling of raw forms.
147
+
148
+ = 2.1.3 =
149
+ * Removed use of filter_input for compatibility with HHVM
150
+ * Fixed checkbox handling in forms.
151
+ * Removed unnecessary sprintf calls to lower chance of translations causing issues.
152
+ * More generic handling of builder instances to allow them to be used in different places.
153
+ * Use implicit check for whether editor is undefined or null.
154
+ * Added optional $widget_id parameter to siteorigin_panels_render_form.
155
+ * Improved checking for home page in sidebars emulator.
156
+ * Added a builder "type" to allow more targetted instances.
157
+
158
+ = 2.1.2 =
159
+ * Removed rendered content cache introduced in 2.1.1
160
+
161
+ = 2.1.1 =
162
+ * Added translations for 16 additional languages
163
+ * Modified strings to improve translatability.
164
+ * Row and Widget style measurement fields now allow multiple values.
165
+ * New rows now added below row of currently selected cell.
166
+ * Orphaned widgets in edited rows are now moved into remaining cell.
167
+ * Made panels javascript object globally accessible.
168
+ * panels_info array now passed into widget rendering function.
169
+ * Removed unnecessary action triggers from customizer that was breaking some themes.
170
+ * Disabling Page Builder on a page now properly creates history entry.
171
+ * Small fixes to sidebars emulator.
172
+ * Fixed import/export on custom home page interface.
173
+ * Removed call to filter_input from global space.
174
+ * Fixed bundled widgets conflict with Yoast SEO.
175
+ * Prevented double rendering issue with Yoast SEO.
176
+
177
+ = 2.1 =
178
+ * Improved Page Builder settings page.
179
+ * Added sidebar emulation, which makes a Page Builder page appear to be a sidebar. Improves compatibility with other widgets.
180
+ * Removed jPlayer. Self hosted widget (legacy) now uses MediaElement.
181
+ * Small usability improvements.
182
+ * Added legacy widget migration for gallery widget.
183
+ * Layout file based import/export feature.
184
+ * Added widget title setting to change widget title HTML.
185
+ * Added setting to control full width container.
186
+ * Fixed: Handling of namespaced widgets.
187
+ * Fixed: Layout Builder widget now works in the Customizer.
188
+ * Fixed: Custom home page interface now properly uses page_on_front.
189
+ * Fixed: Page URL for home page in custom home page.
190
+ * Fixed: Custom home page encoding.
191
+
192
+ = 2.0.7 =
193
+ * Fixed issue that prevented prebuilt layouts from showing up.
194
+
195
+ = 2.0.6 =
196
+ * Added nonce to all admin requests.
197
+ * Fixed live editor for missing widgets.
198
+ * Fixed handling of multi-line row/widget custom CSS.
199
+ * Fixed issue with encoding of panels_data.
200
+
201
+ = 2.0.5 =
202
+ * Added proper escaping in widget form.
203
+
204
+ = 2.0.4 =
205
+ * Changed how data is json encoded to prevent malformed Page Builder data.
206
+ * Fixed import/export.
207
+ * Added layout widget notification (doesn't work in customizer).
208
+ * Fixed translation domains.
209
+ * Additional hooks and filters.
210
+
211
+ = 2.0.3 =
212
+ * Fixed issue with double calling sidebar_admin_setup that was breaking some widgets.
213
+ * Fixed fetching content from TinyMCE in text mode.
214
+
215
+ = 2.0.2 =
216
+ * Fixed fatal error in validation for PHP < 5.5
217
+
218
+ = 2.0.1 =
219
+ * Fixed issue with preview causing content loss in standard editor.
220
+ * Fixed issue with Black Studio TinyMCE
221
+ * Changed templating tags in js-templates.php to prevent fatal errors with some server configurations.
222
+
223
+ = 2.0 =
224
+ * Complete rewrite of Page Builder Javascript using Backbone.
225
+ * Complete UI redesign.
226
+ * Grid Engine rewrite for more efficient CSS.
227
+ * Various performance enhancements and bug fixes.
228
+
229
+ == Upgrade Notice ==
230
+
231
+ Page Builder 2.0 is a major update. Please ensure that you backup your database before updating from a 1.x version. Updating from 1.x to 2.0 is a smooth transition, but it's always better to have a backup.
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.3.1
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.3.1');
15
  if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
17
  }
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
+ Version: 2.3.2
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.3.2');
15
  if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
17
  }