Version Description
Download this release
Release Info
Developer | justinbusa |
Plugin | WordPress Page Builder – Beaver Builder |
Version | 1.9.2 |
Comparing to | |
See all releases |
Code changes from version 1.9.1 to 1.9.2
- changelog.txt +7 -0
- classes/class-fl-builder-loader.php +1 -1
- fl-builder.php +1 -1
- includes/updater-config.php +1 -1
- js/fl-builder-preview.js +2 -2
- js/fl-builder.js +23 -4
- js/fl-builder.min.js +5 -5
changelog.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<h4>1.9.1 - 12/12/2016</h4>
|
2 |
<p><strong>Enhancements</strong></p>
|
3 |
<ul>
|
1 |
+
<h4>1.9.2 - 12/13/2016</h4>
|
2 |
+
<p><strong>Bug Fixes</strong></p>
|
3 |
+
<ul>
|
4 |
+
<li>Fixed a bug introduced in 1.9.1 that broke live preview when editing settings.</li>
|
5 |
+
<li>Fixed gallery fields not working when images are saved as part of a template and don't exist on the site.</li>
|
6 |
+
</ul>
|
7 |
+
|
8 |
<h4>1.9.1 - 12/12/2016</h4>
|
9 |
<p><strong>Enhancements</strong></p>
|
10 |
<ul>
|
classes/class-fl-builder-loader.php
CHANGED
@@ -45,7 +45,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
|
|
45 |
*/
|
46 |
static private function define_constants()
|
47 |
{
|
48 |
-
define('FL_BUILDER_VERSION', '1.9.
|
49 |
define('FL_BUILDER_FILE', trailingslashit(dirname(dirname(__FILE__))) . 'fl-builder.php');
|
50 |
define('FL_BUILDER_DIR', plugin_dir_path(FL_BUILDER_FILE));
|
51 |
define('FL_BUILDER_URL', plugins_url('/', FL_BUILDER_FILE));
|
45 |
*/
|
46 |
static private function define_constants()
|
47 |
{
|
48 |
+
define('FL_BUILDER_VERSION', '1.9.2');
|
49 |
define('FL_BUILDER_FILE', trailingslashit(dirname(dirname(__FILE__))) . 'fl-builder.php');
|
50 |
define('FL_BUILDER_DIR', plugin_dir_path(FL_BUILDER_FILE));
|
51 |
define('FL_BUILDER_URL', plugins_url('/', FL_BUILDER_FILE));
|
fl-builder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Beaver Builder Plugin (Lite Version)
|
4 |
* Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
|
5 |
* Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
|
6 |
-
* Version: 1.9.
|
7 |
* Author: The Beaver Builder Team
|
8 |
* Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
|
9 |
* Copyright: (c) 2014 Beaver Builder
|
3 |
* Plugin Name: Beaver Builder Plugin (Lite Version)
|
4 |
* Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
|
5 |
* Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
|
6 |
+
* Version: 1.9.2
|
7 |
* Author: The Beaver Builder Team
|
8 |
* Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
|
9 |
* Copyright: (c) 2014 Beaver Builder
|
includes/updater-config.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if(class_exists('FLUpdater')) {
|
4 |
FLUpdater::add_product(array(
|
5 |
'name' => 'Beaver Builder Plugin (Lite Version)',
|
6 |
-
'version' => '1.9.
|
7 |
'slug' => 'bb-plugin',
|
8 |
'type' => 'plugin'
|
9 |
));
|
3 |
if(class_exists('FLUpdater')) {
|
4 |
FLUpdater::add_product(array(
|
5 |
'name' => 'Beaver Builder Plugin (Lite Version)',
|
6 |
+
'version' => '1.9.2',
|
7 |
'slug' => 'bb-plugin',
|
8 |
'type' => 'plugin'
|
9 |
));
|
js/fl-builder-preview.js
CHANGED
@@ -241,10 +241,10 @@
|
|
241 |
|
242 |
// Content Class
|
243 |
if(this.type == 'row') {
|
244 |
-
contentClass = '
|
245 |
}
|
246 |
else {
|
247 |
-
contentClass = '
|
248 |
}
|
249 |
|
250 |
// Class Names
|
241 |
|
242 |
// Content Class
|
243 |
if(this.type == 'row') {
|
244 |
+
contentClass = '.fl-row-content-wrap';
|
245 |
}
|
246 |
else {
|
247 |
+
contentClass = '.fl-' + this.type + '-content';
|
248 |
}
|
249 |
|
250 |
// Class Names
|
js/fl-builder.js
CHANGED
@@ -6267,16 +6267,30 @@
|
|
6267 |
var wrap = $(this).closest('.fl-multiple-photos-field'),
|
6268 |
photosField = wrap.find('input[type=hidden]'),
|
6269 |
photosFieldVal = photosField.val(),
|
6270 |
-
|
6271 |
-
shortcode = wp.shortcode.next('gallery', content).shortcode,
|
6272 |
defaultPostId = wp.media.gallery.defaults.id,
|
|
|
|
|
6273 |
attachments = null,
|
6274 |
-
selection = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6275 |
|
6276 |
if(_.isUndefined(shortcode.get('id')) && !_.isUndefined(defaultPostId)) {
|
6277 |
shortcode.set('id', defaultPostId);
|
6278 |
}
|
6279 |
-
|
|
|
6280 |
attachments = wp.media.gallery.attachments(shortcode);
|
6281 |
|
6282 |
selection = new wp.media.model.Selection(attachments.models, {
|
@@ -6289,6 +6303,11 @@
|
|
6289 |
// Fetch the query's attachments, and then break ties from the
|
6290 |
// query to allow for sorting.
|
6291 |
selection.more().done(function() {
|
|
|
|
|
|
|
|
|
|
|
6292 |
// Break ties with the query.
|
6293 |
selection.props.set({ query: false });
|
6294 |
selection.unmirror();
|
6267 |
var wrap = $(this).closest('.fl-multiple-photos-field'),
|
6268 |
photosField = wrap.find('input[type=hidden]'),
|
6269 |
photosFieldVal = photosField.val(),
|
6270 |
+
parsedVal = photosFieldVal === '' ? '' : JSON.parse(photosFieldVal),
|
|
|
6271 |
defaultPostId = wp.media.gallery.defaults.id,
|
6272 |
+
content = '[gallery ids="-1"]',
|
6273 |
+
shortcode = null,
|
6274 |
attachments = null,
|
6275 |
+
selection = null,
|
6276 |
+
i = null,
|
6277 |
+
ids = [];
|
6278 |
+
|
6279 |
+
// Builder the gallery shortcode.
|
6280 |
+
if ( 'object' == typeof parsedVal ) {
|
6281 |
+
for ( i in parsedVal ) {
|
6282 |
+
ids.push( parsedVal[ i ] );
|
6283 |
+
}
|
6284 |
+
content = '[gallery ids="'+ ids.join() +'"]';
|
6285 |
+
}
|
6286 |
+
|
6287 |
+
shortcode = wp.shortcode.next('gallery', content).shortcode;
|
6288 |
|
6289 |
if(_.isUndefined(shortcode.get('id')) && !_.isUndefined(defaultPostId)) {
|
6290 |
shortcode.set('id', defaultPostId);
|
6291 |
}
|
6292 |
+
|
6293 |
+
// Get the selection object.
|
6294 |
attachments = wp.media.gallery.attachments(shortcode);
|
6295 |
|
6296 |
selection = new wp.media.model.Selection(attachments.models, {
|
6303 |
// Fetch the query's attachments, and then break ties from the
|
6304 |
// query to allow for sorting.
|
6305 |
selection.more().done(function() {
|
6306 |
+
|
6307 |
+
if ( ! selection.length ) {
|
6308 |
+
FLBuilder._multiplePhotoSelector.setState( 'gallery-library' );
|
6309 |
+
}
|
6310 |
+
|
6311 |
// Break ties with the query.
|
6312 |
selection.props.set({ query: false });
|
6313 |
selection.unmirror();
|
js/fl-builder.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){FLBuilderAJAXLayout=function(t,l){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=l,this._post=e("#fl-post-id").val(),this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback()},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),l="fl-row",i=this._data.scriptsStyles,o="";this._data.partial&&(l="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(l)||(o=e(this).remove(),i+=o[0].outerHTML)}),""!==i&&(i=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+i+"<div>":'<div class="fl-builder-node-scripts-styles">'+i+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=i}},_addNewHTML:function(){var e;this._data.partial?this._data.nodeParent?(e=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),0===e.length||e.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):e.eq(this._data.nodePosition).before(this._data.html)):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html)},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var l=e("<div>"+t+"</div>"),i="",o=null,s="",r=null,n=window.location,a=n.protocol+"//"+n.hostname+(n.port?":"+n.port:"");return l.find("script").each(function(){i=e(this).attr("src"),"undefined"!=typeof i&&(i=i.replace(a,""),o=e('script[src*="'+i+'"]'),o.length>0&&e(this).remove())}),l.find("link").each(function(){s=e(this).attr("href"),"undefined"!=typeof s&&(s=s.replace(a,""),r=e('link[href*="'+s+'"]'),r.length>0&&e(this).remove())}),l.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),!function(e){"use strict";if(e.matchMedia&&e.matchMedia("all").addListener)return!1;var t=e.matchMedia,l=t("only all").matches,i=!1,o=0,s=[],r=function(l){e.clearTimeout(o),o=e.setTimeout(function(){for(var l=0,i=s.length;l<i;l++){var o=s[l].mql,r=s[l].listeners||[],n=t(o.media).matches;if(n!==o.matches){o.matches=n;for(var a=0,d=r.length;a<d;a++)r[a].call(e,o)}}},30)};e.matchMedia=function(o){var n=t(o),a=[],d=0;return n.addListener=function(t){l&&(i||(i=!0,e.addEventListener("resize",r,!0)),0===d&&(d=s.push({mql:n,listeners:a})),a.push(t))},n.removeListener=function(e){for(var t=0,l=a.length;t<l;t++)a[t]===e&&a.splice(t,1)},n}}(this),!function(e){"use strict";e.matchMedia=e.matchMedia||function(e,t){var l,i=e.documentElement,o=i.firstElementChild||i.firstChild,s=e.createElement("body"),r=e.createElement("div");return r.id="mq-test-1",r.style.cssText="position:absolute;top:-100em",s.style.background="none",s.appendChild(r),function(e){return r.innerHTML='­<style media="'+e+'"> #mq-test-1 { width: 42px; }</style>',i.insertBefore(s,o),l=42===r.offsetWidth,i.removeChild(s),{matches:l,media:e}}}(e.document)}(this),function(e){FLBuilderForcedMediaQueries={_requestQueue:[],_xmlHttp:function(){var e=!1;try{e=new window.XMLHttpRequest}catch(t){e=new window.ActiveXObject("Microsoft.XMLHTTP")}return function(){return e}}(),_regex:{media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},_mediaStyles:[],_rules:[],_appendedEls:[],_parsedSheets:{},_emInPx:null,_width:null,_callback:null,update:function(e,t){var l=FLBuilderForcedMediaQueries,i=window.document,o=i.documentElement,s=i.getElementsByTagName("head")[0]||o,r=i.getElementsByTagName("base")[0],n=s.getElementsByTagName("link");l._mediaStyles=[],l._rules=[],"undefined"!=typeof e&&(l._width=e),"undefined"!=typeof t&&(l._callback=t);for(var a in l._parsedSheets)a.indexOf("-layout-draft.css?")>-1?l._parsedSheets[a].parsed=!1:a.indexOf("-layout-preview.css?")>-1&&(l._parsedSheets[a].parsed=!1);for(var d=0;d<n.length;d++){var a=n[d],u=a.href,c=a.media,f=a.rel&&"stylesheet"===a.rel.toLowerCase();if(u&&f){if(u.indexOf(FLBuilderConfig.pluginUrl)>-1)continue;"undefined"!=typeof l._parsedSheets[u]&&l._parsedSheets[u].parsed?l._translate(l._parsedSheets[u].styles,u,l._parsedSheets[u].media):a.styleSheet&&a.styleSheet.rawCssText?(l._translate(a.styleSheet.rawCssText,u,c),l._parsedSheets[u]=!0):(/^([a-zA-Z:]*\/\/)/.test(u)||r)&&u.replace(RegExp.$1,"").split("/")[0]!==window.location.host||("//"===u.substring(0,2)&&(u=window.location.protocol+u),l._requestQueue.push({href:u,media:c}))}}l._makeRequests()},applyMedia:function(e){var t=FLBuilderForcedMediaQueries,l="clientWidth",i=window.document,o=i.documentElement,s=(o[l],i.getElementsByTagName("head")[0]||o),r=s.getElementsByTagName("link"),n=r[r.length-1],a=((new Date).getTime(),{}),d=t._mediaStyles,u=t._appendedEls,c=t._emInPx;t._width=e;for(var f in d)if(d.hasOwnProperty(f)){var h=d[f],p=h.minw,g=h.maxw,_=null===p,m=null===g,b="em";p&&(p=parseFloat(p)*(p.indexOf(b)>-1?c||t.getEmPixelValue():1)),g&&(g=parseFloat(g)*(g.indexOf(b)>-1?c||t.getEmPixelValue():1)),h.hasQuery&&(_&&m||!(_||e>=p)||!(m||e<=g))||(a[h.media]||(a[h.media]=[]),a[h.media].push(t._rules[h.rules]))}for(var v in u)u.hasOwnProperty(v)&&u[v]&&u[v].parentNode===s&&s.removeChild(u[v]);t._appendedEls.length=0;for(var L in a)if(a.hasOwnProperty(L)){var F=i.createElement("style"),y=a[L].join("\n");F.type="text/css",F.media=L,s.insertBefore(F,n.nextSibling),F.styleSheet?F.styleSheet.cssText=y:F.appendChild(i.createTextNode(y)),t._appendedEls.push(F)}},isUnsupportedMediaQuery:function(e){var t=FLBuilderForcedMediaQueries._regex;return e.replace(t.minmaxwh,"").match(t.other)},getEmPixelValue:function(){var e=null,t=window.document,l=t.documentElement,i=t.body,o=t.createElement("div"),s=l.style.fontSize,r=i&&i.style.fontSize,n=!1;return o.style.cssText="position:absolute;font-size:1em;width:1em",i||(i=n=t.createElement("body"),i.style.background="none"),l.style.fontSize="100%",i.style.fontSize="100%",i.appendChild(o),n&&l.insertBefore(i,l.firstChild),e=o.offsetWidth,n?l.removeChild(i):i.removeChild(o),l.style.fontSize=s,r&&(i.style.fontSize=r),e=FLBuilderForcedMediaQueries._emInPx=parseFloat(e)},_translate:function(e,t,l){var i=FLBuilderForcedMediaQueries,o=i._regex,s=e.replace(o.comments,"").replace(o.keyframes,"").match(o.media),r=s&&s.length||0;t=t.substring(0,t.lastIndexOf("/"));var n=function(e){return e.replace(o.urls,"$1"+t+"$2$3")},a=!r&&l;t.length&&(t+="/"),a&&(r=1);for(var d=0;d<r;d++){var u,c,f,h;a?(u=l,i._rules.push(n(e))):(u=s[d].match(o.findStyles)&&RegExp.$1,i._rules.push(RegExp.$2&&n(RegExp.$2))),f=u.split(","),h=f.length;for(var p=0;p<h;p++)c=f[p],i.isUnsupportedMediaQuery(c)||i._mediaStyles.push({media:c.split("(")[0].match(o.only)&&RegExp.$2||"all",rules:i._rules.length-1,hasQuery:c.indexOf("(")>-1,minw:c.match(o.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:c.match(o.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}},_makeRequests:function(){var e=FLBuilderForcedMediaQueries;if(e._requestQueue.length){var t=e._requestQueue.shift();e._ajax(t.href,function(l){e._translate(l,t.href,t.media),e._parsedSheets[t.href]={parsed:!0,styles:l,media:t.media},window.setTimeout(function(){e._makeRequests()},0)})}else e._width&&(e.applyMedia(e._width),e._callback&&(e._callback(),e._callback=null))},_ajax:function(e,t){var l=FLBuilderForcedMediaQueries._xmlHttp();l&&(l.open("GET",e,!0),l.onreadystatechange=function(){4!==l.readyState||200!==l.status&&304!==l.status||t(l.responseText)},4!==l.readyState&&l.send(null))}}}(jQuery),function(e){FLBuilderPreview=function(t){this.type=t.type,"undefined"!=t.state&&t.state?this.state=t.state:this._saveState(),"undefined"!=t.layout&&t.layout?FLBuilder._renderLayout(t.layout,e.proxy(this._init,this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(l)},_initElementsAndClasses:function(){var t;t="row"==this.type?"> .fl-row-content-wrap":"> .fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,l){this._styleSheet.updateRule(e,t,l)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),l=t>>16&255,i=t>>8&255,o=255&t;return[l,i,o]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,l){var i=FLBuilderResponsiveEditing._mode,o="default"==i?"":i.charAt(0).toUpperCase()+i.slice(1);this["_styleSheet"+o].updateRule(e,t,l)},_saveState:function(){var t=e("#fl-post-id").val(),l=e('link[href*="/cache/'+t+'"]').attr("href"),i=e('script[src*="/cache/'+t+'"]').attr("src"),o=e(FLBuilder._contentClass).html();this.state={css:l,js:i,html:o}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.attr("data-node"),i=FLBuilder._getSettings(t);this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:l,node_preview:i},e.proxy(this._renderPreview,this))},delayPreview:function(t){var l="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),i=e(".fl-builder-widget-settings .fl-builder-settings-title"),o=e(".fl-builder-settings .fl-lightbox-header"),s=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.gif",r=e('<img class="fl-builder-preview-loader" src="'+s+'" />');e(".fl-builder-preview-loader").remove(),l.length>0?l.append(r):i.length>0?i.append(r):o.length>0&&o.append(r),this.delay(1e3,e.proxy(this.preview,this))},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._initElementsAndClasses(),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){this.clear(),this._settingsHaveChanged()&&FLBuilder._renderLayout(this.state)},clear:function(){this._cancelDelay(),this._cancelPreview(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var l=this.elements.textColor.val(),i=this.elements.linkColor.val(),o=this.elements.hoverColor.val(),s=this.elements.headingColor.val();i=""===i?l:i,o=""===o?l:o,s=""===s?l:s,this.delay(100,e.proxy(function(){""===l?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+l),""===i?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+i),""===o?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+o),""===s?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+s),this.updateCSSRule(this.classes.node+" h2","color","#"+s),this.updateCSSRule(this.classes.node+" h3","color","#"+s),this.updateCSSRule(this.classes.node+" h4","color","#"+s),this.updateCSSRule(this.classes.node+" h5","color","#"+s),this.updateCSSRule(this.classes.node+" h6","color","#"+s),this.updateCSSRule(this.classes.node+" h1 a","color","#"+s),this.updateCSSRule(this.classes.node+" h2 a","color","#"+s),this.updateCSSRule(this.classes.node+" h3 a","color","#"+s),this.updateCSSRule(this.classes.node+" h4 a","color","#"+s),this.updateCSSRule(this.classes.node+" h5 a","color","#"+s),this.updateCSSRule(this.classes.node+" h6 a","color","#"+s))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),""!=this.elements.bgVideo.val()&&this.preview()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var l,i,o;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(l=this.hexToRgb(this.elements.bgColor.val()),i=this.parseFloat(this.elements.bgOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",o)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgSlideshowChange:function(t){var l=this.elements,i=l.bgSlideshowSource.val(),o=l.bgSlideshowPhotos.val(),s=l.bgSlideshowFeedUrl.val(),r=l.bgSlideshowSpeed.val(),n=l.bgSlideshowTransSpeed.val();"wordpress"==i&&""===o||"smugmug"==i&&""===s||isNaN(parseInt(r))||isNaN(parseInt(n))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var l,i,o;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(l=this.hexToRgb(this.elements.bgOverlayColor.val()),i=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",o)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var l,i,o;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(l=this.hexToRgb(this.elements.borderColor.val()),i=parseInt(this.elements.borderOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",o)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var l={},i=["Top","Bottom","Left","Right"],o=["","Medium","Responsive"],s=this.classes.settings,r="",n="",a=null,d=null;for(a=0;a<i.length;a++)for(d=0;d<o.length;d++)r=t+i[a]+o[d],n=t+"_"+i[a].toLowerCase(),""!=o[d]&&(n+="_"+o[d].toLowerCase()),l[r]=e(s+" input[name="+n+"]"),l[r].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,l)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,l=["Top","Bottom","Left","Right"],i="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),o={},s=0;s<l.length;s++)o[l[s].toLowerCase()]=this.elements[e+l[s]+i].val();return this._normalizeDimensionValues(o,e)},_responsiveDimensionChange:function(t){var l=this._getDimensions(t),i={},o="border"==t;e.each(l,function(e,l){i[t+"-"+e+(o?"-width":"")]=l}),this.updateResponsiveCSSRule(this.classes.content,i),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,l){var i=this,o=FLBuilderResponsiveEditing._mode,s="default"==o?"":o.charAt(0).toUpperCase()+o.slice(1),l=l.split("-");return"undefined"==typeof l[1]?l[1]="":l[1]=l[1].charAt(0).toUpperCase()+l[1].slice(1),e.map(t,function(e,o){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var r=l[0]+o.charAt(0).toUpperCase()+o.slice(1)+l[1]+s,n=i.elements[r].attr("placeholder");n&&(e=n)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[o]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),l=this.elements.node.find(".fl-bg-video"),i=null,o=null,s={top:0,bottom:0,left:0,right:0};(t.length>0||l.length>0)&&(i=this._getDimensions("margin"),o=this._getDimensions("border"),e.map(s,function(e,t){i[t]&&o[t]?s[t]="calc("+i[t]+"+"+o[t]+")":i[t]?s[t]=i[t]:o[t]&&(s[t]=o[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",s),FLBuilder._resizeLayout()),l.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",s))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node;"full"==this.elements.width.val()?(t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content");"full"==this.elements.contentWidth.val()?(t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"))},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,l=100-t,i=parseFloat(this.elements.size.val()),o=this.elements.node.prev(".fl-col"),s=this.elements.node.next(".fl-col"),r=0===s.length?o:s,n=this.elements.node.siblings(".fl-col"),a=0;0===n.length||isNaN(i)||(n.each(function(){e(this).data("node")!=r.data("node")&&(l-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),i<t&&(i=t),i>l&&(i=l),r.css("width",100-a-i+"%"),this.elements.node.css("width",i+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin");
|
2 |
-
},_initDefaultFieldPreviews:function(){for(var e=this.elements.settings.find(".fl-field"),t=null,l=null,i=0;i<e.length;i++)t=e.eq(i),l=t.data("preview"),"refresh"==l.type&&this._initFieldRefreshPreview(t),"text"==l.type&&this._initFieldTextPreview(t),"css"==l.type&&this._initFieldCSSPreview(t),"widget"==l.type&&this._initFieldWidgetPreview(t),"font"==l.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var l=t.data("type"),i=t.data("preview"),o=e.proxy(this.delayPreview,this);switch(l){case"text":t.find("input[type=text]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"select":t.find("select").on("change",o);break;case"color":t.find(".fl-color-picker-value").on("change",o);break;case"photo":t.find("select").on("change",o);break;case"multiple-photos":t.find("input").on("change",o);break;case"photo-sizes":t.find("select").on("change",o);break;case"video":t.find("input").on("change",o);break;case"multiple-audios":t.find("input").on("change",o);break;case"icon":t.find("input").on("change",o);break;case"form":t.delegate("input","change",o);break;case"editor":this._addTextEditorCallback(t,i);break;case"code":t.find("textarea").on("change",o);break;case"post-type":t.find("select").on("change",o);break;case"suggest":t.find(".as-values").on("change",o);break;case"unit":t.find("input[type=number]").on("keyup",o)}},_initFieldTextPreview:function(t){var l=t.data("type"),i=t.data("preview"),o=e.proxy(this._previewText,this,i);switch(l){case"text":t.find("input[type=text]").on("keyup",o);break;case"unit":t.find("input[type=number]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"code":t.find("textarea").on("change",o);break;case"editor":this._addTextEditorCallback(t,i)}},_previewText:function(t,l){var i=this.elements.node.find(t.selector),o=e("<div>"+e(l.target).val()+"</div>");i.length>0&&(o.find("script").remove(),i.html(o.html()))},_previewTextEditor:function(t,l,i){var o=this.elements.node.find(t.selector),s="undefined"!=typeof tinyMCE?tinyMCE.get(l):null,r=e("#"+l),n="";o.length>0&&(n=e(s&&"none"==r.css("display")?"<div>"+s.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+r.val()+"</div>":"<div>"+switchEditors.wpautop(r.val())+"</div>"),n.find("script").remove(),o.html(n.html()))},_addTextEditorCallback:function(t,l){var i=t.find("textarea.wp-editor-area").attr("id"),o=null;if("refresh"==l.type)o=e.proxy(this.delayPreview,this);else{if("text"!=l.type)return;o=e.proxy(this._previewTextEditor,this,l,i)}e("#"+i).on("keyup",o),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(i),editor.on("change",o),editor.on("keyup",o))},_initFieldFontPreview:function(t){var l=t.data("type"),i=t.data("preview");i.id=t.attr("id");var o=e.proxy(this._previewFont,this,i);"font"==l&&t.find(".fl-font-field").on("change","select",o)},_previewFont:function(t,l){var i=e(l.delegateTarget),o=i.find(".fl-font-field-font"),s=e(o).find(":selected"),r=s.parent().attr("label"),n=i.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==r&&this._buildFontStylesheet(a,o.val(),n.val()),"Default"==o.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",o.val()),this.updateCSSRule(d,"font-weight",n.val()))},_buildFontStylesheet:function(t,l,i){var o=FLBuilderConfig.googleFontsUrl,s="",r={},n={};r[l]=[i],FLBuilderPreview._fontsList[t]=r,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var l=t[e];n[e]=n[e]||[],l=l.filter(function(t){return n[e].indexOf(t)<0}),n[e]=n[e].concat(l)})}),e.each(n,function(e,t){s+=e+":"+t.join()+"|"}),s=o+s.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",s).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",s)},_initFieldCSSPreview:function(e){var t=e.data("preview"),l=null;if("undefined"!=typeof t.rules)for(l in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[l]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,l){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,l));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,l));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,l));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,l))}},_previewCSS:function(t,l){var i=this._getPreviewSelector(this.classes.node,t.selector),o=t.property,s="undefined"==typeof t.unit?"":t.unit,r=e(l.target),n=r.val();"%"==s?n=parseInt(n)/100:n+=s,r.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(i,o,n):this.updateCSSRule(i,o,n)},_previewColor:function(t,l){var i=this._getPreviewSelector(this.classes.node,t.selector),o=e(l.target),s=o.val(),r=""===s?"inherit":"#"+s;o.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(i,t.property,r):this.updateCSSRule(i,t.property,r)},_initFieldWidgetPreview:function(t){var l=e.proxy(this.delayPreview,this);t.find("input").on("keyup",l),t.find("input[type=checkbox]").on("click",l),t.find("textarea").on("keyup",l),t.find("select").on("change",l)},_getPreviewSelector:function(e,t){for(var l="",i=t.split(","),o=0;o<i.length;o++)l+=e+" "+i[o],o!=i.length-1&&(l+=", ");return l}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",_fields:{},refreshPreview:function(){e(".fl-responsive-preview").length&&FLBuilderForcedMediaQueries.update()},_init:function(){this._bind()},_bind:function(){FLBuilder.addHook("responsive-editing-switched",this._previewSpacingFields),FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_switchTo:function(t,l){var i=e("body"),o=e(FLBuilder._contentClass),s=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),n=e(".fl-content-placeholder"),a=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===n.length)return;n.after(o),n.remove(),s.remove(),r.remove()}else 0===s.length?(o.after('<div class="fl-content-placeholder"></div>'),i.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(o)):(s.removeClass("fl-preview-responsive fl-preview-medium"),s.addClass("fl-preview-"+t));"responsive"==t?(a=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,o.width(a),FLBuilderForcedMediaQueries.update(a,l)):"medium"==t?(a=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,o.width(a),FLBuilderForcedMediaQueries.update(a,l)):(o.width(""),FLBuilderForcedMediaQueries.update(1e4,l)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),l=e(".fl-responsive-preview"),i=e(".fl-content-placeholder"),o=i.parents(),s="#fff",r=0;if(0===l.length)t.css("background-color","");else{for(;r<o.length&&(s=o.eq(r).css("background-color"),"rgba(0, 0, 0, 0)"==s);r++);t.css("background-color",s)}},_switchToAndScroll:function(t){var l=e(".fl-builder-settings").data("node"),i=void 0===l?void 0:e(".fl-node-"+l);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==i&&i&&setTimeout(function(){var t=e(window),l=e(".fl-responsive-preview-content");!l.length||t.height()<l.height()?e("html, body").animate({scrollTop:i.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),l=t.data("mode");l="default"==l?"medium":"medium"==l?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(l),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var l="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(l),e(".fl-field-responsive-setting").hide(),l="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(l).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(FLBuilderResponsiveEditing._fields={},e._initFields("unit","input","keyup",e._spacingFieldKeyup,["margin_top","margin_bottom","margin_left","margin_right","padding_top","padding_bottom","padding_left","padding_right"]),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,l,i,o,s){var r=e(".fl-builder-settings"),n=r.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0,c=0;for("object"!=typeof this._fields[t]&&(this._fields[t]={});u<n.length;u++)if(a=n.eq(u),d=a.attr("id").replace("fl-field-",""),!("object"==typeof s&&e.inArray(d,s)<0)&&t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")){this._fields[t][d]={"default":a.find(".fl-field-responsive-setting-default "+l),medium:a.find(".fl-field-responsive-setting-medium "+l),responsive:a.find(".fl-field-responsive-setting-responsive "+l)};for(c in this._fields[t][d])this._fields[t][d][c].on(i,o);this._fields[t][d]["default"].trigger(i),a.attr("data-responsive-init",1)}},_getFields:function(t){var l=e(t).closest(".fl-field");return type=l.attr("data-type"),name=l.attr("id").replace("fl-field-",""),this._fields[type][name]},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this),t=e["default"].attr("placeholder"),l=e["default"].val(),i=e.medium.val();""==l?e.medium.attr("placeholder",void 0===t?"":t):e.medium.attr("placeholder",l),""==i?e.responsive.attr("placeholder",e.medium.attr("placeholder")):e.responsive.attr("placeholder",i)},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),l="row",i=e(this).closest(".fl-field").attr("id").replace("fl-field-","").split("_"),o=i[0],s=i[1],r=FLBuilderResponsiveEditing._fields.unit[o+"_"+s],n=FLBuilderConfig.global,a=null,d=r["default"].val(),u=null,c=r.medium.val(),f=null,h=(r.responsive.val(),null),p=null,g=null;t.hasClass("fl-builder-row-settings")?l="row":t.hasClass("fl-builder-col-settings")?l="col":t.hasClass("fl-builder-module-settings")&&(l="module"),e.extend(n,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),a=l+"_"+o+("margin"==o?"s":""),u=n[a],f=n[a+"_medium"],h=n[a+"_responsive"],""==f&&(""!=d?r.medium.attr("placeholder",d):""!=u&&r.medium.attr("placeholder",u)),""==h&&("module"==l&&Number(n.auto_spacing)?(p=""==f?Number(u):f,g=""==c?Number(d):c,""!=g&&(g>p||g<0)?r.responsive.attr("placeholder",p):""!=g?r.responsive.attr("placeholder",g):r.responsive.attr("placeholder",p)):(!Number(n.auto_spacing)||"padding"==o&&"top|bottom".indexOf(s)>-1)&&(""!=c?r.responsive.attr("placeholder",c):""!=f?r.responsive.attr("placeholder",f):""!=d?r.responsive.attr("placeholder",d):""!=u&&r.responsive.attr("placeholder",u)))},_previewSpacingFields:function(){var t=FLBuilderResponsiveEditing._mode,l=e(".fl-builder-settings"),i=null,o=null;if(0!==l.length&&void 0!==l.attr("data-node")){i=FLBuilderResponsiveEditing._fields.unit;for(o in i)i[o][t].trigger("keyup")}}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var l=e(".fl-builder-settings"),i=t.closest(".fl-builder-service-settings"),o=e(".fl-builder-service-error");l.append('<div class="fl-builder-loading"></div>'),i.addClass("fl-builder-service-settings-loading"),o.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),l=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),l.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this),o=i.closest("tr"),s=i.val();o.siblings("tr.fl-builder-service-account-row").remove(),o.siblings("tr.fl-builder-service-connect-row").remove(),o.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==s&&(t._startSettingsLoading(i),FLBuilder.ajax({action:"render_service_settings",node_id:l,service:s},t._serviceChangeComplete))},_serviceChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row");s.after(i.html),t._addAccountDelete(o),t._finishSettingsLoading()},_connectClicked:function(){for(var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-connect-row"),r=i.find(".fl-builder-service-connect-input"),n=null,a=null,d=0,u={action:"connect_service",node_id:l,service:o.val(),fields:{}};d<r.length;d++)n=r.eq(d),a=n.attr("name"),u.fields[a]=n.val();s.hide(),t._startSettingsLoading(o),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row"),r=o.find(".fl-builder-service-select"),n=o.find(".fl-builder-service-account-row"),a=o.find(".fl-builder-service-account-select"),d=o.find(".fl-builder-service-connect-row");i.error?(d.show(),0===a.length?r.after('<div class="fl-builder-service-error">'+i.error+"</div>"):a.after('<div class="fl-builder-service-error">'+i.error+"</div>")):(d.remove(),n.remove(),s.after(i.html)),t._addAccountDelete(o),t._finishSettingsLoading()},_accountChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=i.find(".fl-builder-service-connect-row"),n=i.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=s.val(),u=null;r.remove(),n.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:l,service:o.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:l,service:o.val(),account:d}),u&&(t._startSettingsLoading(o),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(i)},_accountChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-account-row");s.after(i.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var l=e(this).closest(".fl-builder-service-settings"),i=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:i.val(),account:o.val()},t._accountDeleteComplete),t._startSettingsLoading(o))},_accountDeleteComplete:function(){var l=e(".fl-builder-service-settings-loading"),i=l.find(".fl-builder-service-select");t._finishSettingsLoading(),i.trigger("change")},_campaignMonitorClientChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=e(this),n=i.find(".fl-builder-service-list-select"),a=r.val();0!==n.length&&n.closest("tr").remove(),""!==a&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:l,service:o.val(),account:s.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-campaign-monitor-client-select");s.closest("tr").after(i.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=i.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==r.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:l,service:o.val(),account:s.val(),list_id:r.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-list-select");s.closest("tr").after(i.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=i.find(".fl-builder-service-list-select");list_type=i.find('select[name="list_type"]'),0!==r.length&&r.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:l,service:o.val(),account:s.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-field-row");s.after(i.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fa fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder-bar",placement:"bottom",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShown:function(){0===e(".fl-template-selector").length?(e(".popover[class*=tour-]").css("visibility","hidden"),FLBuilder._showTemplateSelector()):FLBuilderTour._templateSelectorLoaded()}},{animation:!1,element:"#fl-builder-blocks-rows .fl-builder-blocks-section-title",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilderTour._dimSection("body"),FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._showPanel(),e(".fl-template-selector .fl-builder-settings-cancel").trigger("click"),e("#fl-builder-blocks-rows .fl-builder-blocks-section-title").trigger("click")}},{animation:!1,element:"#fl-builder-blocks-basic .fl-builder-blocks-section-title",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilderTour._dimSection("body"),FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._showPanel(),e("#fl-builder-blocks-basic .fl-builder-blocks-section-title").trigger("click"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-add-content-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fa fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.append('<div class="fl-builder-tour-mask"></div>'),t.on("fl-builder.template-selector-loaded",FLBuilderTour._templateSelectorLoaded),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')},_templateSelectorLoaded:function(){var t=e(".fl-builder-settings-lightbox .fl-lightbox-header"),l=t.height(),i=t.offset().top+75;e(".popover[class*=tour-]").css({top:i+l+"px",visibility:"visible"})}}}(jQuery),function(e){FLBuilder={preview:null,_actionsLightbox:null,_addModuleAfterNodeRender:null,_colResizeData:null,_colResizing:!1,_contentClass:!1,_dragEnabled:!1,_dragging:!1,_dragInitialScrollTop:0,_exitUrl:null,_layout:null,_layoutSettingsCSSCache:null,_layoutSettingsCSSTimeout:null,_lightbox:null,_lightboxScrollbarTimeout:null,_loadedModuleAssets:[],_moduleHelpers:{},_multiplePhotoSelector:null,_newColGroupParent:null,_newColGroupPosition:0,_newModuleParent:null,_newModulePosition:0,_newRowPosition:0,_selectedTemplateId:null,_selectedTemplateType:null,_singlePhotoSelector:null,_singleVideoSelector:null,_multipleAudiosSelector:null,_silentUpdate:!1,_silentUpdateCallbackData:null,_init:function(){FLBuilder._initJQueryReadyFix(),FLBuilder._initGlobalErrorHandling(),FLBuilder._initPostLock(),FLBuilder._initClassNames(),FLBuilder._initMediaUploader(),FLBuilder._initOverflowFix(),FLBuilder._initScrollbars(),FLBuilder._initLightboxes(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._initStrings(),FLBuilder._initTipTips(),FLBuilder._bindEvents(),FLBuilder._bindOverlayEvents(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showTourOrTemplates()},_initJQueryReadyFix:function(){FLBuilderConfig.debug||(jQuery.fn.oldReady=jQuery.fn.ready,jQuery.fn.ready=function(e){return jQuery.fn.oldReady(function(){try{"function"==typeof e&&e()}catch(t){FLBuilder.logError(t)}})})},_initGlobalErrorHandling:function(){FLBuilderConfig.debug||(window.onerror=function(e,t,l,i,o){return FLBuilder.logGlobalError(e,t,l,i,o),!0})},_initPostLock:function(){"undefined"!=typeof wp.heartbeat&&(wp.heartbeat.interval(30),wp.heartbeat.enqueue("fl_builder_post_lock",{post_id:e("#fl-post-id").val()}))},_initClassNames:function(){e("html").addClass("fl-builder-edit"),e("body").addClass("fl-builder"),FLBuilderConfig.simpleUi&&e("body").addClass("fl-builder-simple"),FLBuilder._contentClass=".fl-builder-content-"+FLBuilderConfig.postId},_initMediaUploader:function(){wp.media.model.settings.post.id=e("#fl-post-id").val()},_initOverflowFix:function(){e(FLBuilder._contentClass).parents().css("overflow","visible")},_initScrollbars:function(){e(".fl-nanoscroller").nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox"}),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_initSortables:function(){var t={appendTo:"body",cursor:"move",cursorAt:{left:60,top:20},distance:1,helper:FLBuilder._blockDragHelper,start:FLBuilder._blockDragStart,sort:FLBuilder._blockDragSort,change:FLBuilder._blockDragChange,stop:FLBuilder._blockDragStop,placeholder:"fl-builder-drop-zone",tolerance:"intersect"},l="",i="";i="row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col-content":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-row:not(.fl-node-global) .fl-col-content",l=FLBuilderConfig.nestedColumns?i:"row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",e(".fl-builder-rows").sortable(e.extend({},t,{connectWith:l,items:".fl-builder-block-row",stop:FLBuilder._rowDragStop})),e(".fl-builder-row-templates").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-row-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-rows").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-saved-row",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-modules, .fl-builder-widgets").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-module",stop:FLBuilder._moduleDragStop})),e(".fl-builder-module-templates").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-module-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-modules").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:i,items:".fl-builder-block-saved-module",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-row-sortable-proxy").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",helper:FLBuilder._rowDragHelper,start:FLBuilder._rowDragStart,stop:FLBuilder._rowDragStop})),e(".fl-col-sortable-proxy").sortable(e.extend({},t,{connectWith:i,helper:FLBuilder._colDragHelper,start:FLBuilder._colDragStart,stop:FLBuilder._colDragStop})),e(FLBuilder._contentClass+" .fl-col-content").sortable(e.extend({},t,{connectWith:i,handle:".fl-module-overlay .fl-block-overlay-actions .fl-block-move",helper:FLBuilder._moduleDragHelper,items:".fl-module, .fl-col-group",start:FLBuilder._moduleDragStart,stop:FLBuilder._moduleDragStop})),e(FLBuilder._contentClass+" .fl-row-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-group-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-drop-target").sortable(t)},_initStrings:function(){e.validator.messages.required=FLBuilderStrings.validateRequiredMessage},_bindEvents:function(){e("a").on("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").on("click",FLBuilder._headerLinkClicked),e(document).on("heartbeat-tick",FLBuilder._initPostLock),e(window).on("beforeunload",FLBuilder._warnBeforeUnload),e("body").delegate(".fl-builder-has-submenu","click",FLBuilder._submenuParentClicked),e("body").delegate(".fl-builder-has-submenu a","click",FLBuilder._submenuChildClicked),e("body").delegate(".fl-builder-submenu","mouseenter",FLBuilder._submenuMouseenter),e("body").delegate(".fl-builder-submenu","mouseleave",FLBuilder._submenuMouseleave),e("body").delegate(".fl-builder-submenu .fl-builder-has-submenu","mouseenter",FLBuilder._submenuNestedParentMouseenter),e(".fl-builder-tools-button").on("click",FLBuilder._toolsClicked),e(".fl-builder-done-button").on("click",FLBuilder._doneClicked),e(".fl-builder-add-content-button").on("click",FLBuilder._showPanel),
|
3 |
-
e(".fl-builder-templates-button").on("click",FLBuilder._changeTemplateClicked),e(".fl-builder-buy-button").on("click",FLBuilder._upgradeClicked),e(".fl-builder-upgrade-button").on("click",FLBuilder._upgradeClicked),e(".fl-builder-help-button").on("click",FLBuilder._helpButtonClicked),e(".fl-builder-panel-actions .fl-builder-panel-close").on("click",FLBuilder._closePanel),e(".fl-builder-blocks-section-title").on("click",FLBuilder._blockSectionTitleClicked),e("body").delegate(".fl-builder-node-template-actions","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-delete","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","click",FLBuilder._editNodeTemplateClicked),e("body").delegate(".fl-builder-node-template-delete","click",FLBuilder._deleteNodeTemplateClicked),e("body").delegate(".fl-builder-block","mousedown",FLBuilder._blockDragInit),e("body").on("mouseup",FLBuilder._blockDragCancel),e("body").delegate(".fl-builder-actions .fl-builder-cancel-button","click",FLBuilder._cancelButtonClicked),e("body").delegate(".fl-lightbox-controls .fa","click",FLBuilder._resizeLightbox),e("body").delegate(".fl-builder-save-actions .fl-builder-publish-button","click",FLBuilder._publishButtonClicked),e("body").delegate(".fl-builder-save-actions .fl-builder-draft-button","click",FLBuilder._draftButtonClicked),e("body").delegate(".fl-builder-save-actions .fl-builder-discard-button","click",FLBuilder._discardButtonClicked),e("body").delegate(".fl-builder-save-user-template-button","click",FLBuilder._saveUserTemplateClicked),e("body").delegate(".fl-builder-duplicate-layout-button","click",FLBuilder._duplicateLayoutClicked),e("body").delegate(".fl-builder-layout-settings-button","click",FLBuilder._layoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-save","click",FLBuilder._saveLayoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-builder-global-settings-button","click",FLBuilder._globalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-save","click",FLBuilder._saveGlobalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-template-category-select","change",FLBuilder._templateCategoryChanged),e("body").delegate(".fl-template-preview","click",FLBuilder._templateClicked),e("body").delegate(".fl-user-template","click",FLBuilder._userTemplateClicked),e("body").delegate(".fl-user-template-edit","click",FLBuilder._editUserTemplateClicked),e("body").delegate(".fl-user-template-delete","click",FLBuilder._deleteUserTemplateClicked),e("body").delegate(".fl-builder-template-replace-button","click",FLBuilder._templateReplaceClicked),e("body").delegate(".fl-builder-template-append-button","click",FLBuilder._templateAppendClicked),e("body").delegate(".fl-builder-template-actions .fl-builder-cancel-button","click",FLBuilder._templateCancelClicked),e("body").delegate(".fl-builder-user-template-settings .fl-builder-settings-save","click",FLBuilder._saveUserTemplateSettings),e("body").delegate(".fl-builder-help-tour-button","click",FLBuilder._startHelpTour),e("body").delegate(".fl-builder-help-video-button","click",FLBuilder._watchVideoClicked),e("body").delegate(".fl-builder-knowledge-base-button","click",FLBuilder._viewKnowledgeBaseClicked),e("body").delegate(".fl-builder-forums-button","click",FLBuilder._visitForumsClicked),e("body").delegate(".fl-builder-no-tour-button","click",FLBuilder._noTourButtonClicked),e("body").delegate(".fl-builder-yes-tour-button","click",FLBuilder._yesTourButtonClicked),e("body").delegate(".fl-builder-alert-close","click",FLBuilder._alertClose),e("body").delegate(".fl-row-overlay .fl-block-remove","click",FLBuilder._deleteRowClicked),e("body").delegate(".fl-row-overlay .fl-block-copy","click",FLBuilder._rowCopyClicked),e("body").delegate(".fl-row-overlay .fl-block-move","mousedown",FLBuilder._rowDragInit),e("body").delegate(".fl-row-overlay .fl-block-settings","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-row-overlay","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-builder-row-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-col-overlay .fl-block-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-col-overlay .fl-block-remove","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-col-overlay","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-col-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-col-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-delete","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-reset","click",FLBuilder._resetColumnWidthsClicked),e("body").delegate(".fl-block-col-submenu li","mouseenter",FLBuilder._showColHighlightGuide),e("body").delegate(".fl-block-col-submenu li","mouseleave",FLBuilder._removeColHighlightGuides),e("body").delegate(".fl-block-col-submenu .fl-block-col-move-parent","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit-parent","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-module-overlay .fl-block-remove","click",FLBuilder._deleteModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-copy","click",FLBuilder._moduleCopyClicked),e("body").delegate(".fl-module-overlay .fl-block-move","mousedown",FLBuilder._blockDragInit),e("body").delegate(".fl-module-overlay .fl-block-settings","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-module-overlay","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-builder-module-settings .fl-builder-settings-save","click",FLBuilder._saveModuleClicked),e("body").delegate(".fl-builder-settings-save-as","click",FLBuilder._showNodeTemplateSettings),e("body").delegate(".fl-builder-node-template-settings .fl-builder-settings-save","click",FLBuilder._saveNodeTemplate),e("body").delegate(".fl-builder-settings-tabs a","click",FLBuilder._settingsTabClicked),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),e("body").delegate(".fl-help-tooltip-icon","mouseover",FLBuilder._showHelpTooltip),e("body").delegate(".fl-help-tooltip-icon","mouseout",FLBuilder._hideHelpTooltip),e("body").delegate(".fl-builder-field-add","click",FLBuilder._addFieldClicked),e("body").delegate(".fl-builder-field-copy","click",FLBuilder._copyFieldClicked),e("body").delegate(".fl-builder-field-delete","click",FLBuilder._deleteFieldClicked),e("body").delegate(".fl-builder-settings-fields select","change",FLBuilder._settingsSelectChanged),e("body").delegate(".fl-photo-field .fl-photo-select","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-edit","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-replace","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-remove","click",FLBuilder._singlePhotoRemoved),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-select","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-edit","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-add","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-video-field .fl-video-select","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-replace","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-select","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-edit","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-add","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-icon-field .fl-icon-select","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-replace","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-remove","click",FLBuilder._removeIcon),e("body").delegate(".fl-form-field .fl-form-field-edit","click",FLBuilder._formFieldClicked),e("body").delegate(".fl-form-field-settings .fl-builder-settings-save","click",FLBuilder._saveFormFieldClicked),e("body").delegate(".fl-layout-field-option","click",FLBuilder._layoutFieldClicked),e("body").delegate(".fl-link-field-select","click",FLBuilder._linkFieldSelectClicked),e("body").delegate(".fl-link-field-search-cancel","click",FLBuilder._linkFieldSelectCancelClicked),e("body").delegate(".fl-loop-builder select[name=post_type]","change",FLBuilder._loopBuilderPostTypeChange),e("body").delegate(".fl-select-add-value","change",FLBuilder._textFieldAddValueSelectChange)},_bindOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.delegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.delegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.delegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.delegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.delegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_destroyOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.undelegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.undelegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.undelegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.undelegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.undelegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_preventDefault:function(e){e.preventDefault()},_stopPropagation:function(e){e.stopPropagation()},_headerLinkClicked:function(t){var l=e(this),i=l.attr("href");t.preventDefault(),FLBuilderConfig.isUserTemplate||(FLBuilder._exitUrl=i.indexOf("?")>-1?i:i+"?fl_builder",FLBuilder._doneClicked())},_warnBeforeUnload:function(){var t=e(".fl-builder-row-settings").length>0,l=e(".fl-builder-col-settings").length>0,i=e(".fl-builder-module-settings").length>0;if(t||l||i)return FLBuilderStrings.unloadWarning},_initTipTips:function(){e(".fl-tip:not(.fl-has-tip)").each(function(){var t=e(this);t.addClass("fl-has-tip"),void 0==t.attr("data-title")&&t.attr("data-title",t.attr("title"))}).tipTip({defaultPosition:"top",delay:1500})},_hideTipTips:function(){e("#tiptip_holder").stop().remove()},_submenuParentClicked:function(t){var l=e(this),i=l.find(".fl-builder-submenu");l.hasClass("fl-builder-submenu-open")?(l.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-right")):(l.offset().left+i.width()>e(window).width()&&l.addClass("fl-builder-submenu-right"),l.addClass("fl-builder-submenu-open")),FLBuilder._hideTipTips(),t.preventDefault(),t.stopPropagation()},_submenuChildClicked:function(t){var l=e(this).parents(".fl-builder-has-submenu");l.parents(".fl-builder-has-submenu").length||l.removeClass("fl-builder-submenu-open")},_submenuMouseenter:function(t){var l=e(this),i=l.data("timeout");"undefined"!=typeof i&&clearTimeout(i)},_submenuMouseleave:function(t){var l=e(this),i=setTimeout(function(){l.closest(".fl-builder-has-submenu").removeClass("fl-builder-submenu-open")},500);l.data("timeout",i)},_submenuNestedParentMouseenter:function(t){var l=e(this),i=l.find(".fl-builder-submenu");l.width()+l.offset().left+i.width()>e(window).width()&&l.addClass("fl-builder-submenu-right")},_closeAllSubmenus:function(){e(".fl-builder-submenu-open").removeClass("fl-builder-submenu-open")},_toolsClicked:function(){var e=[],t=FLBuilderConfig.lite,l=FLBuilderConfig.enabledTemplates;t||FLBuilderConfig.isUserTemplate||"enabled"!=l&&"user"!=l||(e[10]={key:"save-user-template",label:FLBuilderStrings.saveTemplate}),FLBuilderConfig.isUserTemplate?"undefined"!=typeof window.opener&&window.opener||(e[20]={key:"duplicate-layout",label:FLBuilderStrings.duplicateLayout}):e[20]={key:"duplicate-layout",label:FLBuilderStrings.duplicateLayout},e[30]={key:"layout-settings",label:FLBuilderStrings.editLayoutSettings},e[40]={key:"global-settings",label:FLBuilderStrings.editGlobalSettings},FLBuilder._showActionsLightbox({className:"fl-builder-tools-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_doneClicked:function(){var e=[],t=FLBuilderStrings.publish;"publish"==FLBuilderConfig.postStatus||FLBuilderConfig.userCanPublish||(t=FLBuilderStrings.submitForReview),e[10]={key:"publish",label:t},e[20]={key:"draft",label:FLBuilderStrings.draft},e[30]={key:"discard",label:FLBuilderStrings.discard},FLBuilder._showActionsLightbox({className:"fl-builder-save-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_upgradeClicked:function(){window.open(FLBuilderConfig.upgradeUrl)},_helpButtonClicked:function(){var e={};FLBuilderConfig.help.tour&&(e[10]={key:"help-tour",label:FLBuilderStrings.takeHelpTour}),FLBuilderConfig.help.video&&(e[20]={key:"help-video",label:FLBuilderStrings.watchHelpVideo}),FLBuilderConfig.help.knowledge_base&&(e[30]={key:"knowledge-base",label:FLBuilderStrings.viewKnowledgeBase}),FLBuilderConfig.help.forums&&(e[40]={key:"forums",label:FLBuilderStrings.visitForums}),FLBuilder._showActionsLightbox({className:"fl-builder-help-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_closePanel:function(){e(".fl-builder-panel").stop(!0,!0).animate({right:"-350px"},500,function(){e(this).hide()}),e(".fl-builder-bar .fl-builder-add-content-button").stop(!0,!0).fadeIn()},_showPanel:function(){e(".fl-builder-bar .fl-builder-add-content-button").stop(!0,!0).fadeOut(),e(".fl-builder-panel").stop(!0,!0).show().animate({right:"0"},500)},_blockSectionTitleClicked:function(){var t=e(this),l=t.parent();l.hasClass("fl-active")?l.removeClass("fl-active"):(e(".fl-builder-blocks-section").removeClass("fl-active"),l.addClass("fl-active")),FLBuilder._initScrollbars()},_publishButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_layout"},FLBuilder._exit),FLBuilder._actionsLightbox.close()},_draftButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_draft"},FLBuilder._exit),FLBuilder._actionsLightbox.close()},_discardButtonClicked:function(){var e=confirm(FLBuilderStrings.discardMessage);e&&(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"clear_draft_layout"},FLBuilder._exit),FLBuilder._actionsLightbox.close())},_cancelButtonClicked:function(){FLBuilder._exitUrl=null,FLBuilder._actionsLightbox.close()},_exit:function(){var e=window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&window.opener.FLBuilder._updateLayout(),window.close()):(FLBuilder._exitUrl?e=FLBuilder._exitUrl:(e=e.replace("?fl_builder&","?"),e=e.replace("?fl_builder",""),e=e.replace("&fl_builder","")),window.location.href=e)},_duplicateLayoutClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"duplicate_post"},FLBuilder._duplicateLayoutComplete)},_duplicateLayoutComplete:function(t){var l=e("#fl-admin-url").val();window.location.href=l+"post.php?post="+t+"&action=edit"},_layoutSettingsClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showLightbox(),FLBuilder._closePanel(),FLBuilder.ajax({action:"render_layout_settings"},FLBuilder._layoutSettingsLoaded)},_layoutSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.html),FLBuilder._layoutSettingsInitCSS()},_layoutSettingsInitCSS:function(){var t=e(".fl-builder-settings #fl-field-css textarea:not(.ace_text-input)");t.on("change",FLBuilder._layoutSettingsCSSChanged),FLBuilder._layoutSettingsCSSCache=t.val()},_layoutSettingsCSSChanged:function(){FLBuilder._layoutSettingsCSSTimeout&&clearTimeout(FLBuilder._layoutSettingsCSSTimeout),FLBuilder._layoutSettingsCSSTimeout=setTimeout(e.proxy(FLBuilder._layoutSettingsCSSDoChange,this),600)},_layoutSettingsCSSDoChange:function(){var t=e(".fl-builder-settings"),l=e(this),i=l.parents("#fl-field-css");i.find(".ace_error").length>0||(t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(l.val()):e("#fl-builder-global-css").html(l.val()),FLBuilder._layoutSettingsCSSTimeout=null)},_saveLayoutSettingsClicked:function(){for(var t=e(this).closest(".fl-builder-settings"),l=t.serializeArray(),i={},o=0;o<l.length;o++)i[l[o].name]=l[o].value;FLBuilder.showAjaxLoader(),FLBuilder._lightbox.close(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_layout_settings",settings:i},FLBuilder._updateLayout)},_cancelLayoutSettingsClicked:function(){var t=e(".fl-builder-settings");t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(FLBuilder._layoutSettingsCSSCache):e("#fl-builder-global-css").html(FLBuilder._layoutSettingsCSSCache),FLBuilder._layoutSettingsCSSCache=null},_globalSettingsClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_global_settings"},FLBuilder._globalSettingsLoaded)},_globalSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.html),FLBuilder._layoutSettingsInitCSS(),FLBuilder._initSettingsValidation({row_width:{required:!0,number:!0},responsive_breakpoint:{required:!0,number:!0}})},_saveGlobalSettingsClicked:function(){var t=e(this).closest(".fl-builder-settings"),l=t.validate().form(),i=t.serializeArray(),o={},s=0;if(l){for(;s<i.length;s++)o[i[s].name]=i[s].value;FLBuilder.showAjaxLoader(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_global_settings",settings:o},FLBuilder._saveGlobalSettingsComplete),FLBuilder._lightbox.close()}},_saveGlobalSettingsComplete:function(e){FLBuilderConfig.global=JSON.parse(e),FLBuilder._updateLayout()},_initTemplateSelector:function(){var t=e(FLBuilder._contentClass).find(".fl-row");0===t.length&&FLBuilder._showTemplateSelector()},_changeTemplateClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showTemplateSelector()},_showTemplateSelector:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||"disabled"!=FLBuilderConfig.enabledTemplates&&0!==e(".fl-builder-templates-button").length&&(FLBuilder._showLightbox(!1),FLBuilder.ajax({action:"render_template_selector"},FLBuilder._templateSelectorLoaded))},_templateSelectorLoaded:function(t){var l=JSON.parse(t),i=null,o=null;FLBuilder._setLightboxContent(l.html),i=e(".fl-template-category-select"),tabs=e(".fl-builder-settings-tab"),userTemplatesTab=e("#fl-builder-settings-tab-yours"),o=e(".fl-user-template"),("user"==FLBuilderConfig.enabledTemplates||o.length>0||userTemplatesTab.length>0&&1==tabs.length)&&(i.val("fl-builder-settings-tab-yours"),e(".fl-builder-settings-tab").removeClass("fl-active"),e("#fl-builder-settings-tab-yours").addClass("fl-active")),0===o.length&&e(".fl-user-templates-message").show(),e("body").trigger("fl-builder.template-selector-loaded")},_templateCategoryChanged:function(){e(".fl-template-selector .fl-builder-settings-tab").hide(),e("#"+e(this).val()).show()},_templateClicked:function(){var t=e(this),l=t.closest(".fl-template-preview").attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?0==l?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate(0,!1,"core")):(FLBuilder._selectedTemplateId=l,FLBuilder._selectedTemplateType="core",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(l,!1,"core")},_showTemplateActions:function(){var e=[];e[10]={key:"template-replace",label:FLBuilderStrings.templateReplace},e[20]={key:"template-append",label:FLBuilderStrings.templateAppend},FLBuilder._showActionsLightbox({className:"fl-builder-template-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_templateReplaceClicked:function(){confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!1,FLBuilder._selectedTemplateType))},_templateAppendClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!0,FLBuilder._selectedTemplateType)},_templateCancelClicked:function(){FLBuilder._lightbox._node.show()},_applyTemplate:function(e,t,l){t="undefined"!=typeof t&&t?"1":"0",l="undefined"==typeof l?"core":l,FLBuilder._lightbox.close(),FLBuilder.showAjaxLoader(),"core"==l?FLBuilder.ajax({action:"apply_template",template_id:e,append:t},FLBuilder._updateLayout):FLBuilder.ajax({action:"apply_user_template",template_id:e,append:t},FLBuilder._updateLayout)},_saveUserTemplateClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showLightbox(!1),FLBuilder.ajax({action:"render_user_template_settings"},FLBuilder._userTemplateSettingsLoaded)},_userTemplateSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.html),FLBuilder._initSettingsValidation({name:{required:!0}})},_saveUserTemplateSettings:function(){var t=e(this).closest(".fl-builder-settings"),l=t.validate().form(),i=FLBuilder._getSettings(t);l&&(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_user_template",settings:i},FLBuilder._saveUserTemplateSettingsComplete),FLBuilder._lightbox.close())},_saveUserTemplateSettingsComplete:function(){FLBuilder.alert(FLBuilderStrings.templateSaved)},_userTemplateClicked:function(){var t=e(this).attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?"blank"==t?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate("blank",!1,"user")):(FLBuilder._selectedTemplateId=t,FLBuilder._selectedTemplateType="user",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(t,!1,"user")},_editUserTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteUserTemplateClicked:function(t){var l=e(this).closest(".fl-user-template"),i=l.attr("data-id"),o=e(".fl-user-template[data-id="+i+"]"),s=null;confirm(FLBuilderStrings.deleteTemplate)&&(FLBuilder.ajax({action:"delete_user_template",template_id:i}),o.fadeOut(function(){l=e(this),s=l.closest(".fl-user-template-category"),l.remove(),0===s.find(".fl-user-template").length&&s.remove(),1===e(".fl-user-template").length&&(e(".fl-user-templates").hide(),e(".fl-user-templates-message").show())})),t.stopPropagation()},_watchVideoClicked:function(){var e=wp.template("fl-video-lightbox");FLBuilder._actionsLightbox.close(),FLBuilder._lightbox.open(e({video:FLBuilderConfig.help.video_embed}))},_viewKnowledgeBaseClicked:function(){FLBuilder._actionsLightbox.close(),window.open(FLBuilderConfig.help.knowledge_base_url)},_visitForumsClicked:function(){FLBuilder._actionsLightbox.close(),window.open(FLBuilderConfig.help.forums_url)},_showTourOrTemplates:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||(FLBuilderConfig.help.tour&&FLBuilderConfig.newUser?FLBuilder._showTourLightbox():FLBuilder._initTemplateSelector())},_showTourLightbox:function(){var e=wp.template("fl-tour-lightbox");FLBuilder._actionsLightbox.open(e())},_noTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._initTemplateSelector()},_yesTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_startHelpTour:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_setupEmptyLayout:function(){var t=e(FLBuilder._contentClass);FLBuilderConfig.isUserTemplate&&"module"==FLBuilderConfig.userTemplateType||(t.removeClass("fl-builder-empty"),t.find(".fl-builder-empty-message").remove(),0===t.children(".fl-row").length&&(t.addClass("fl-builder-empty"),t.append('<span class="fl-builder-empty-message">'+FLBuilderStrings.emptyMessage+"</span>"),FLBuilder._initSortables()))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",l=e(FLBuilder._contentClass+" .fl-row"),i=null,o=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),s=null,r=null,n=0;for(e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),l.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),l.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');n<l.length;n++)i=l.eq(n),0===i.find(".fl-col-group").length&&i.find(".fl-row-content").append('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(n=0;n<o.length;n++)s=o.eq(n),r=s.find("> .fl-col"),s.hasClass("fl-col-group-nested")||(s.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),s.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),r.append('<div class="fl-drop-target fl-col-drop-target"></div>'),r.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var l=t.clone();return t.clone().insertAfter(t),l.addClass("fl-builder-block-drag-helper"),l},_blockDragInit:function(t){var l=e(t.currentTarget),i=null,o=e(window).scrollTop(),s=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=o,l.closest("[data-node]").length>0?(i=l.closest("[data-node]"),i.addClass("fl-node-drag-init")):l.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===i&&e(this).offset().top-o>0&&(i=e(this))}),null!==i&&(s=i.offset().top-o),FLBuilder._highlightRowsAndColsForDrag(l),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),s>0&&scrollTo(0,i.offset().top-s)},_blockDragStart:function(t,l){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init")},_blockDragSort:function(t,l){var i=l.placeholder.parent(),o=FLBuilderStrings.insert;FLBuilder._blockPreventSort(l.item,i)||(i.hasClass("fl-col-content")?o=l.item.hasClass("fl-builder-block-row")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:l.item.hasClass("fl-builder-block-module")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-builder-block-saved-module")||l.item.hasClass("fl-builder-block-module-template")?l.item.find(".fl-builder-block-title").text():l.item.attr("data-name"):i.hasClass("fl-col-drop-target")?o="":i.hasClass("fl-col-group-drop-target")?o="":i.hasClass("fl-row-drop-target")&&(o=l.item.hasClass("fl-builder-block-row")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-builder-block-saved-row")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),l.placeholder.html(o),l.item.hasClass("fl-node-global")||l.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?l.placeholder.addClass("fl-builder-drop-zone-global"):l.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.hide(),t.placeholder.fadeIn(100)},_blockPreventSort:function(t,l){var i=!1,o=t.hasClass("fl-builder-block-row"),s=t.hasClass("fl-col-sortable-proxy-item"),r=l.hasClass("fl-col-content"),n=l.hasClass("fl-col-drop-target"),a=l.parents(".fl-col-group:not(.fl-col-group-nested)"),d=l.parents(".fl-col-group-nested");return(o||s)&&r&&d.length>0&&(i=!0),r&&!l.find(".fl-module, .fl-col").length&&(o&&"1-col"==t.data("cols")?i=!0:s&&(i=!0)),o&&r&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(i=!0),s&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(r||n&&d.length>0)&&(i=!0),n&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(i=!0),n&&d.length>0&&d.find(".fl-col:visible").length>3&&(i=!0),i&&l.addClass("fl-sortable-disabled"),i},_blockDragStop:function(t,l){var i=e(window).scrollTop(),o=l.item.parent(),s=null;o.hasClass("fl-drop-target")&&o.closest("[data-node]").length?(o=o.closest("[data-node]"),s=o.offset().top-i):s=o.offset().top-i,o.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,o.offset().top-s)},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t,silent:!0})},_moveNode:function(e,t,l){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:l,silent:!0})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips()},_appendOverlay:function(e,t){var l=0,i=null,o=e.hasClass("fl-row"),s=o?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),r={top:parseInt(s.css("margin-top"),10),bottom:parseInt(s.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),i=e.find("> .fl-block-overlay"),r.top<0&&(l=parseInt(i.css("top"),10),l=isNaN(l)?0:l,i.css("top",r.top+l+"px")),r.bottom<0&&(l=parseInt(i.css("bottom"),10),l=isNaN(l)?0:l,i.css("bottom",r.bottom+l+"px")),i},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),l=t.data("original"),i=0,o=null,s=0,r=null,n=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=l&&(t.after(l),t.remove(),t=l),t.data("original",t.clone()),i=t[0].getBoundingClientRect().width,o=t.find(" > i, > span.fl-builder-has-submenu");n<o.length;n++)r=o.eq(n),s+=r.outerWidth(),s>i?(d.push(r),r.remove()):a.push(r);if(d.length>0){for(d.unshift(a.pop().remove()),n=0;n<d.length;n++)d[n].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[n].find(".fa").data("title"),
|
4 |
-
submenu:d[n].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[n].data("title"),className:d[n].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height")},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),l=t.offset().top,i=null,o=null,s=wp.template("fl-row-overlay");t.hasClass("fl-block-overlay-active")||(o=FLBuilder._appendOverlay(t,s({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;i=null===i||i>t?t:i}),null!==i&&i<l&&o.css("top",i-l-30+"px"),o.offset().top<43&&o.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}))},_rowMouseleave:function(t){var l=e(t.toElement)||e(t.relatedTarget),i=l.hasClass("fl-row-overlay"),o=l.closest(".fl-row-overlay").length>0,s=l.is("#tiptip_holder"),r=l.closest("#tiptip_holder").length>0;i||o||s||r||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var l=e(t.target),i=e(".fl-row-sortable-proxy-item"),o=l.closest(".fl-row");o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=i[0],i.trigger(t)},_rowDragStart:function(t,l){var i=e(FLBuilder._contentClass+" .fl-row"),o=e(".fl-node-dragging");1===i.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),o.hide(),FLBuilder._blockDragStart(t,l)},_rowDragStop:function(t,l){var i=l.item,o=i.parent(),s=null,r=null,n=0;if(FLBuilder._blockDragStop(t,l),o.hasClass("fl-builder-rows"))return void i.remove();if(o.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(i.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return i.remove(),void FLBuilder._showPanel();o.hasClass("fl-col-content")?FLBuilder._addColGroup(i.closest(".fl-col").attr("data-node"),i.attr("data-cols"),o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(i)):o.hasClass("fl-col-drop-target")?FLBuilder._addCols(o.closest(".fl-col"),o.hasClass("fl-col-drop-target-last")?"after":"before",i.attr("data-cols"),o.closest(".fl-col-group-nested").length>0):o.hasClass("fl-col-group-drop-target")?(r=i.closest(".fl-col-group"),n=i.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(r),FLBuilder._addColGroup(i.closest(".fl-row").attr("data-node"),i.attr("data-cols"),o.hasClass("fl-drop-target-last")?n+1:n)):(s=i.closest(".fl-row"),n=s.length?e(FLBuilder._contentClass+" .fl-row").index(s):0,FLBuilder._addRow(i.attr("data-cols"),o.hasClass("fl-drop-target-last")?n+1:n)),i.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else s=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o.parent().hasClass("fl-builder-content")||(o.hasClass("fl-drop-target-last")?o.parent().after(s):o.parent().before(s),FLBuilder._reorderNode(s.attr("data-node"),s.index())),e(".fl-row-sortable-proxy").append(l.item)},_addRow:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder._newRowPosition=t,FLBuilder.ajax({action:"render_new_row",cols:e,position:t},FLBuilder._addRowComplete)},_addRowComplete:function(t){var l=JSON.parse(t),i=e(FLBuilder._contentClass),o=e(l.html).data("node"),s=FLBuilder._addModuleAfterNodeRender;l.nodeParent=i,l.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(l,function(){null!==s&&(e(".fl-node-"+o+" .fl-col-content").append(s),FLBuilder._reorderModule(s),FLBuilder._addModuleAfterNodeRender=null)})},_deleteRowClicked:function(t){var l=e(this).closest(".fl-row"),i=null;l.find(".fl-module").length?(i=confirm(FLBuilderStrings.deleteRowMessage),i&&FLBuilder._deleteRow(l)):FLBuilder._deleteRow(l),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){FLBuilder.ajax({action:"delete_node",node_id:e.attr("data-node"),silent:!0}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays()},_rowCopyClicked:function(t){var l=e(this).closest(".fl-row"),i=l.attr("data-node");FLBuilder.showAjaxLoader(),FLBuilder._removeAllOverlays(),FLBuilder._newRowPosition=l.index(".fl-row")+1,FLBuilder.ajax({action:"copy_row",node_id:i},FLBuilder._rowCopyComplete),t.stopPropagation()},_rowCopyComplete:function(t){var l=JSON.parse(t);l.nodeParent=e(FLBuilder._contentClass),l.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(l)},_rowSettingsClicked:function(t){var l=e(this),i=l.closest(".fl-row").attr("data-node"),o=l.closest(".fl-block-overlay-global").length>0;o&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&window.open(e('.fl-row[data-node="'+i+'"]').attr("data-template-url")):l.hasClass("fl-block-settings")&&(FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_row_settings",node_id:i},FLBuilder._rowSettingsLoaded)),t.stopPropagation()},_rowSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.settings),FLBuilder.preview=new FLBuilderPreview({type:"row",state:t.state})},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",l=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),l.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),l.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_highlightRowsAndColsForDrag:function(t){var l="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+l).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",l=e(FLBuilder._contentClass),i=l.find(t+".fl-col-group:not(.fl-col-group-nested) > .fl-col > .fl-col-content"),o=l.find(t+".fl-col-group-nested .fl-col-content"),s=0;for(e(".fl-node-drag-init").hide();s<o.length;s++)FLBuilder._adjustColHeightForDrag(o.eq(s));for(s=0;s<i.length;s++)FLBuilder._adjustColHeightForDrag(i.eq(s));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),l=t.find("a"),i=t.closest(".fl-col"),o=i.parents(".fl-col"),s=e('<div class="fl-col-highlight-guide"></div>'),r=null,n=t.closest(".fl-block-overlay").offset().top;(l.hasClass("fl-block-col-move-parent")||l.hasClass("fl-block-col-edit-parent"))&&(i=o),i.hasClass("fl-col-highlight")||(i.find("> .fl-col-content").append(s),i.addClass("fl-col-has-highlight-guide"),r=s.offset().top,r>n&&s.css("top",n-r+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),l=t.closest(".fl-col-group"),i=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,s=t.closest(".fl-col-group").find("> .fl-col").length,r=l.find("> .fl-col").index(t),n=0===r,a=s===r+1,d=t.find(".fl-col").length>0,u=t.parents(".fl-col"),c=u.closest(".fl-col-group"),f=u.length>0,h=f?c.find("> .fl-col").length:0,p=c.find("> .fl-col").index(u),g=!!f&&0===p,_=!!f&&h===p+1,m=t.find("> .fl-col-content").width(),b=wp.template("fl-col-overlay"),v=null;FLBuilderConfig.simpleUi||i&&o&&"row"!=FLBuilderConfig.userTemplateType||t.find(".fl-module").length>0||t.find(".fl-col").length>0||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),v=FLBuilder._appendOverlay(t,b({global:i,numCols:s,first:n,last:a,hasChildCols:d,hasParentCol:f,parentFirst:g,parentLast:_,numParentCols:h,contentWidth:m})),FLBuilder._buildOverlayOverflowMenu(v),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var l=e(this),i=e(t.toElement)||e(t.relatedTarget),o=l.find(".fl-module").length>0,s=i.is("#tiptip_holder"),r=i.closest("#tiptip_holder").length>0;s||r||o||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted")},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var l=e(t.target),i=e(".fl-col-sortable-proxy-item"),o=l.closest(".fl-col");l.hasClass("fl-block-col-move-parent")&&(o=o.parents(".fl-col")),o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=i[0],i.trigger(t)},_colDragStart:function(t,l){var i=e(".fl-node-dragging");i.hide(),FLBuilder._resetColumnWidths(i.parent()),FLBuilder._blockDragStart(t,l)},_colDragStop:function(t,l){FLBuilder._blockDragStop(t,l);var i=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o=i.attr("data-node"),s=l.item.parent(),r=i.parent(),n=r.attr("data-node");newGroup=s.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=s.closest(".fl-row"),position=0,s.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(r):s.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(r):s.hasClass("fl-col-content")?(i.remove(),0===r.find(".fl-col").length&&r.remove(),position=s.find(".fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(l.item),FLBuilder._addColGroup(s.closest(".fl-col").attr("data-node"),o,position)):s.hasClass("fl-col-drop-target")?(s.hasClass("fl-col-drop-target-last")?s.parent().after(i):s.parent().before(i),FLBuilder._resetColumnWidths(newGroup),n==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:o,position:i.index(),silent:!0}):FLBuilder.ajax({action:"move_col",node_id:o,new_parent:newGroupId,position:i.index(),resize:[n,newGroupId],silent:!0}),FLBuilder._resizeLayout()):s.hasClass("fl-col-group-drop-target")?(i.remove(),0===r.find(".fl-col").length&&r.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),o,position)):s.hasClass("fl-row-drop-target")&&(i.remove(),position=s.closest(".fl-builder-content").find(".fl-row").index(newRow),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(o,position)),0===r.find(".fl-col").length&&r.remove(),e(".fl-col-sortable-proxy").append(l.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables()},_colSettingsClicked:function(t){var l=e(this),i=l.closest(".fl-col"),o=null;FLBuilder._colResizing||(o=l.hasClass("fl-block-col-edit-parent")?i.parents(".fl-col").data("node"):i.attr("data-node"),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_column_settings",node_id:o},FLBuilder._colSettingsLoaded),t.stopPropagation())},_colSettingsLoaded:function(t){var l=JSON.parse(t),i=null,o=null,s=null,r=null;FLBuilder._setSettingsFormContent(l.settings),i=e(".fl-builder-col-settings"),o=i.data("node"),s=e('.fl-col[data-node="'+o+'"]'),r=s.find("> .fl-col-content"),0===s.siblings(".fl-col").length?e(i).find("#fl-builder-settings-section-general").css("display","none"):r.width()<=40&&e("#fl-field-size").hide(),FLBuilder.preview=new FLBuilderPreview({type:"col",state:l.state})},_deleteColClicked:function(t){var l=e(this),i=l.closest(".fl-col"),o=i.closest(".fl-col-group"),s=i.parents(".fl-col"),r=s.length>0,n=s.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=i.siblings(".fl-col"),d=!0;i.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),r&&1===n.length&&(0===a.length?i=s:1!==a.length||a.find(".fl-module").length||(i=o)),d&&(FLBuilder._deleteCol(i),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.closest(".fl-row"),l=e.closest(".fl-col-group"),i=0;e.remove(),rowCols=t.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(t):(0===groupCols.length?l.remove():(i=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",i+"%")),FLBuilder.ajax({action:"delete_col",node_id:e.attr("data-node"),new_width:i,silent:!0}),FLBuilder._initDropTargets(),FLBuilder._initSortables())},_addCols:function(e,t,l,i){l="undefined"==typeof l?"1-col":l,i="undefined"!=typeof i&&i,FLBuilder.showAjaxLoader(),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:l,nested:i?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var l=JSON.parse(t),i=null,o=FLBuilder._addModuleAfterNodeRender;FLBuilder._renderLayout(l,function(){null!==o&&(e('[data-node="'+o.module.data("node")+'"]').remove(),i=e('[data-node="'+o.colId+'"]'),"after"==o.position?i.next().find(".fl-col-content").append(o.module):i.prev().find(".fl-col-content").append(o.module),FLBuilder._reorderModule(o.module),FLBuilder._addModuleAfterNodeRender=null)})},_addColGroup:function(t,l,i){var o=e(".fl-node-"+t);FLBuilder.showAjaxLoader(),FLBuilder._newColGroupPosition=i,o.hasClass("fl-col")?FLBuilder._newColGroupParent=o.find(" > .fl-col-content"):FLBuilder._newColGroupParent=o.find(".fl-row-content"),FLBuilder.ajax({action:"render_new_column_group",cols:l,node_id:t,position:i},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var l=JSON.parse(t),i=e(l.html).find(".fl-col").data("node"),o=FLBuilder._addModuleAfterNodeRender;l.nodeParent=FLBuilder._newColGroupParent,l.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(l,function(){l.nodeParent.hasClass("fl-col-content")&&l.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==o&&(e(".fl-node-"+i+" .fl-col-content").append(o),FLBuilder._reorderModule(o),FLBuilder._addModuleAfterNodeRender=null)})},_initColDragResizing:function(){e(".fl-block-col-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,l){var i=e(l.helper),o="",s=i.hasClass("fl-block-col-resize-parent"),r=s?i.closest(".fl-col").parents(".fl-col"):null,n=s?r.parents(".fl-col-group"):i.closest(".fl-col-group"),a=n.find("> .fl-col"),d=s?r:i.closest(".fl-col"),u=null,c=100,f=0;for(i.hasClass("fl-block-col-resize-e")?(o="e",u=d.next(".fl-col")):(o="w",u=d.prev(".fl-col"));f<a.length;f++)a.eq(f).data("node")!=d.data("node")&&a.eq(f).data("node")!=u.data("node")&&(c-=parseFloat(a.eq(f)[0].style.width));FLBuilder._colResizeData={handle:i,feedbackLeft:i.find(".fl-block-col-resize-feedback-left"),feedbackRight:i.find(".fl-block-col-resize-feedback-right"),direction:o,groupWidth:n.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:u,offset:l.position.left,availWidth:c},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var l=FLBuilder._colResizeData,i=(l.offset-t.position.left)/l.groupWidth,o="e"==l.direction?100*(l.colWidth-i):100*(l.colWidth+i),s=Math.round(100*o)/100,r=l.availWidth-o,n=Math.round(100*r)/100,a=8,d=Math.round(100*(l.availWidth-a))/100;s<a?(s=a,n=d):n<a&&(s=d,n=a),"e"==l.direction?(l.feedbackLeft.html(s.toFixed(1)+"%").show(),l.feedbackRight.html(n.toFixed(1)+"%").show()):(l.feedbackLeft.html(n.toFixed(1)+"%").show(),l.feedbackRight.html(s.toFixed(1)+"%").show()),l.col.css("width",s+"%"),l.sibling.css("width",n+"%"),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,l){var i=FLBuilder._colResizeData,o=FLBuilder._colResizeData.handle.closest(".fl-block-overlay");FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:i.col.data("node"),col_width:parseFloat(i.col[0].style.width),sibling_id:i.sibling.data("node"),sibling_width:parseFloat(i.sibling[0].style.width),silent:!0}),FLBuilder._buildOverlayOverflowMenu(o),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop")},_resetColumnWidthsClicked:function(t){var l=e(this).parents(".fl-col-group").last(),i=[l.data("node")],o=l.find(".fl-col-group"),s=0;for(FLBuilder._resetColumnWidths(l);s<o.length;s++)FLBuilder._resetColumnWidths(o.eq(s)),i.push(o.eq(s).data("node"));FLBuilder.ajax({action:"reset_col_widths",group_id:i,silent:!0}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),l=0;l=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",l+"%")},_moduleMouseenter:function(){var t=e(this),l=t.attr("data-name"),i=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,s=t.closest(".fl-col-group").find("> .fl-col").length,r=t.closest(".fl-col"),n=0===r.index(),a=s===r.index()+1,d=r.parents(".fl-col"),u=d.length>0,c=u?d.closest(".fl-col-group").find("> .fl-col").length:0,f=!!u&&0===d.index(),h=!!u&&c===d.index()+1,p=r.find("> .fl-col-content").width(),g=wp.template("fl-module-overlay"),_=null;FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),i&&o&&"row"!=FLBuilderConfig.userTemplateType||(t.hasClass("fl-block-overlay-active")||(_=FLBuilder._appendOverlay(t,g({global:i,moduleName:l,numCols:s,colFirst:n,colLast:a,hasParentCol:u,numParentCols:c,parentFirst:f,parentLast:h,contentWidth:p})),FLBuilder._buildOverlayOverflowMenu(_),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var l=(e(this),e(t.toElement)||e(t.relatedTarget)),i=l.is("#tiptip_holder"),o=l.closest("#tiptip_holder").length>0;i||o||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),e("body").removeClass("fl-block-overlay-muted")},_moduleDragHelper:function(t,l){return e('<div class="fl-builder-block-drag-helper">'+l.attr("data-name")+"</div>")},_moduleDragStart:function(t,l){e(l.item).data("original-position",l.item.index()),FLBuilder._blockDragStart(t,l)},_moduleDragStop:function(t,l){FLBuilder._blockDragStop(t,l);var i=l.item,o=i.parent(),s=null,r=0,n=0;if(o.hasClass("fl-builder-modules")||o.hasClass("fl-builder-widgets"))return void i.remove();if(i.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return i.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=i.closest(".fl-builder-content"),n=0,s=i.closest(".fl-row"),r=o.find(".fl-row").index(s)):o.hasClass("fl-col-group-drop-target")?(o=i.closest(".fl-row-content"),n=o.closest(".fl-row").attr("data-node"),s=i.closest(".fl-col-group"),r=o.find(" > .fl-col-group").index(s)):o.hasClass("fl-col-drop-target")?(o=i.closest(".fl-col-group"),n=o.attr("data-node"),s=i.closest(".fl-col"),r=o.find(" > .fl-col").index(s)):(r=o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(i),n=i.closest(".fl-col").attr("data-node")),i.closest(".fl-drop-target-last").length&&(r+=1),FLBuilder._addModule(o,n,i.attr("data-type"),r,i.attr("data-widget")),i.remove()}else{if(o.hasClass("fl-sortable-disabled"))return e(t.target).append(l.item),e(t.target).children().eq(l.item.data("original-position")).before(l.item),void FLBuilder._highlightEmptyCols();o.hasClass("fl-row-drop-target")?(s=i.closest(".fl-row"),r=i.closest(".fl-builder-content").children(".fl-row").index(s),r=i.closest(".fl-drop-target-last").length?r+1:r,FLBuilder._addModuleAfterNodeRender=i,FLBuilder._addRow("1-col",r),i.remove()):o.hasClass("fl-col-group-drop-target")?(s=i.closest(".fl-col-group"),r=i.closest(".fl-row-content ").find(" > .fl-col-group").index(s),r=i.closest(".fl-drop-target-last").length?r+1:r,FLBuilder._addModuleAfterNodeRender=i,FLBuilder._addColGroup(i.closest(".fl-row").attr("data-node"),"1-col",r),i.remove()):o.hasClass("fl-col-drop-target")?(s=i.closest(".fl-col"),r=i.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:i,colId:s.data("node"),position:r},FLBuilder._addCols(s,r,"1-col",i.closest(".fl-col-group-nested").length>0),i.remove()):FLBuilder._reorderModule(i)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),l=e.attr("data-parent"),i=e.attr("data-node"),o=e.index();t==l?FLBuilder._reorderNode(i,o):(e.attr("data-parent",t),FLBuilder._moveNode(t,i,o))},_deleteModuleClicked:function(t){var l=e(this).closest(".fl-module"),i=confirm(FLBuilderStrings.deleteModuleMessage);i&&(FLBuilder._deleteModule(l),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row");FLBuilder.ajax({action:"delete_node",node_id:e.attr("data-node"),silent:!0}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays()},_moduleCopyClicked:function(t){var l=e(this).closest(".fl-module");FLBuilder.showAjaxLoader(),FLBuilder._removeAllOverlays(),FLBuilder._newModuleParent=l.parent(),FLBuilder._newModulePosition=l.index()+1,FLBuilder.ajax({action:"copy_module",node_id:l.attr("data-node")},FLBuilder._moduleCopyComplete),t.stopPropagation()},_moduleCopyComplete:function(e){var t=JSON.parse(e);t.nodeParent=FLBuilder._newModuleParent,t.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(t)},_moduleSettingsClicked:function(t){var l=e(this),i=l.closest(".fl-module").attr("data-node"),o=l.closest(".fl-col").attr("data-node"),s=l.closest(".fl-module").attr("data-type"),r=l.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||r&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings(i,o,s)},_showModuleSettings:function(e,t,l){FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_module_settings",node_id:e,type:l,parent_id:t},FLBuilder._moduleSettingsLoaded)},_moduleSettingsLoaded:function(t){var l=JSON.parse(t),i=e("<div>"+l.settings+"</div>"),o=i.find("link.fl-builder-settings-css"),s=i.find("script.fl-builder-settings-js"),r=i.find(".fl-builder-settings"),n=r.attr("data-type"),a=null,d=null,u=null;e.inArray(n,FLBuilder._loadedModuleAssets)>-1?(o.remove(),s.remove()):(e("head").append(o),e("head").append(s),FLBuilder._loadedModuleAssets.push(n)),FLBuilder._setSettingsFormContent(i),"undefined"!=typeof l.layout&&(a=l.layout,a.nodeParent=FLBuilder._newModuleParent,a.nodePosition=FLBuilder._newModulePosition),"undefined"!=typeof l.state&&(d=l.state),FLBuilder.preview=new FLBuilderPreview({type:"module",layout:a,state:d}),u=FLBuilder._moduleHelpers[n],"undefined"!=typeof u&&(FLBuilder._initSettingsValidation(u.rules),u.init())},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),l=t.attr("data-type"),i=(t.attr("data-node"),FLBuilder._moduleHelpers[l]),o=!0;"undefined"!=typeof i&&(t.find("label.error").remove(),t.validate().hideErrors(),o=t.validate().form(),o&&(o=i.submit())),o?(FLBuilder._saveSettings(),FLBuilder._lightbox.close()):FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,l,i,o){FLBuilder.showAjaxLoader(),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=i),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:l,position:i,node_preview:1,widget:"undefined"==typeof o?"":o},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){FLBuilder._showLightbox(),FLBuilder._moduleSettingsLoaded(t),e(".fl-builder-module-settings").data("new-module","1")},registerModuleHelper:function(t,l){var i={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},i,l)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var l=e(".fl-builder-settings-lightbox .fl-builder-settings");FLBuilder._saveSettings(),FLBuilder.ajax({action:"render_node_template_settings",node_id:l.attr("data-node")},FLBuilder._nodeTemplateSettingsLoaded)},_nodeTemplateSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._showLightbox(!1),FLBuilder._setSettingsFormContent(t.html),FLBuilder._initSettingsValidation({name:{required:!0}})},_saveNodeTemplate:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.validate().form();l&&(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_node_template",node_id:t.attr("data-node"),settings:FLBuilder._getSettings(t)},FLBuilder._saveNodeTemplateComplete),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var l=JSON.parse(t),i=e(".fl-builder-saved-"+l.type+"s"),o=i.find(".fl-builder-block"),s=null,r="",n=l.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block");if("row"==l.type?FLBuilder.alert(FLBuilderStrings.rowTemplateSaved):"module"==l.type&&FLBuilder.alert(FLBuilderStrings.moduleTemplateSaved),l.layout&&FLBuilder._renderLayout(l.layout),0===o.length)i.append(d(l));else for(;a<o.length;a++){if(s=o.eq(a),r=s.text().toLowerCase().trim(),0===a&&n<r){i.prepend(d(l));break}if(n<r){s.before(d(l));break}if(o.length-1===a){i.append(d(l));break}}i.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,l){FLBuilder._blockDragStop(t,l);var i=l.item,o=i.parent(),s=null,r=0,n=null,a="",d=null;if(i.hasClass("fl-builder-block-saved-row")||i.hasClass("fl-builder-block-row-template"))n=i.closest(".fl-row"),r=n.length?e(FLBuilder._contentClass+" .fl-row").index(n):0,r=o.hasClass("fl-drop-target-last")?r+1:r,s=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=r;else if(i.hasClass("fl-builder-block-saved-module")||i.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,o.hasClass("fl-sortable-disabled"))return i.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=i.closest(".fl-builder-content"),s=0,r=o.find(".fl-row").index(i.closest(".fl-row"))):o.hasClass("fl-col-group-drop-target")?(o=i.closest(".fl-row-content"),s=o.closest(".fl-row").attr("data-node"),r=o.find(" > .fl-col-group").index(i.closest(".fl-col-group"))):o.hasClass("fl-col-drop-target")?(o=i.closest(".fl-col-group"),r=o.children(".fl-col").index(i.closest(".fl-col")),s=o.attr("data-node")):(r=o.children(".fl-module, .fl-builder-block").index(i),s=i.closest(".fl-col").attr("data-node")),i.closest(".fl-drop-target-last").length&&(r+=1),o.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=o,FLBuilder._newModulePosition=r)}FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:a,template_id:i.attr("data-id"),template_type:i.attr("data-type"),parent_id:s,position:r},d),i.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var l=e(t.target),i=l.closest(".fl-builder-blocks-section"),o=i.find(".fl-builder-blocks-section-content"),s=o.find(".fl-builder-block"),r=l.closest(".fl-builder-block"),n=r.hasClass("fl-builder-block-global"),a=n?FLBuilder._updateLayout:void 0,d=n?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate;confirm(d)&&(r.remove(),1===s.length&&(r.hasClass("fl-builder-block-saved-row")?o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),FLBuilder.ajax({action:"delete_node_template",template_id:r.attr("data-id"),silent:!r.hasClass("fl-builder-block-global")},a))},_initSettingsForms:function(){FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder.triggerHook("settings-form-init")},_setSettingsFormContent:function(e){FLBuilder._setLightboxContent(e),FLBuilder._initSettingsForms()},_settingsTabClicked:function(t){var l=e(this),i=l.closest(".fl-builder-settings"),o=l.attr("href").split("#").pop();i.find(".fl-builder-settings-tab").removeClass("fl-active"),i.find("#"+o).addClass("fl-active"),i.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),e(this).addClass("fl-active"),t.preventDefault()},_settingsCancelClicked:function(t){var l=e(".fl-builder-module-settings"),i=null,o=null,s=null,r=null;l.length>0&&"undefined"!=typeof l.data("new-module")?(i=e(FLBuilder.preview.state.html),o=e(".fl-node-"+l.data("node")),s=o.closest(".fl-col"),r=i.find(".fl-node-"+s.data("node")),r.length>0?FLBuilder._deleteModule(o):FLBuilder._deleteCol(s)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,FLLightbox.closeParent(this)},_initSettingsValidation:function(t,l){var i=e(".fl-builder-settings").last();i.validate({ignore:[],rules:t,messages:l,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),l=t.find(".fl-builder-settings-tab"),i=null,o=null,s=0;s<l.length;s++)i=l.eq(s),o=i.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+i.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),o.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"))},_getSettings:function(t){FLBuilder._updateEditorFields();var l=t.serializeArray(),i=0,o=0,s="",r="",n="",a=[],d=[],u={};for(i=0;i<l.length;i++)if(s=l[i].value.replace(/\r/gm,""),!(l[i].name.indexOf("flrich")>-1))if(l[i].name.indexOf("[")>-1){for(r=l[i].name.replace(/\[(.*)\]/,""),n=l[i].name.replace(r,""),a=[],d=n.match(/\[[^\]]*\]/g),o=0;o<d.length;o++)"[]"!=d[o]&&a.push(d[o].replace(/\[|\]/g,""));n.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[r]&&(u[r]={}),"undefined"==typeof u[r][a[0]]&&(u[r][a[0]]={}),"undefined"==typeof u[r][a[0]][a[1]]&&(u[r][a[0]][a[1]]={}),u[r][a[0]][a[1]]=s):n.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[r]&&(u[r]={}),"undefined"==typeof u[r][a[0]]&&(u[r][a[0]]=[]),u[r][a[0]].push(s)):n.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[r]&&(u[r]={}),u[r][a[0]]=s):n.match(/\[\]/)&&("undefined"==typeof u[r]&&(u[r]=[]),u[r].push(s))}else u[l[i].name]=s;for(n in u)if("undefined"!=typeof u["as_values_"+n]){u[n]=e.grep(u["as_values_"+n].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+n]}catch(c){}}return u},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.attr("data-node"),i=FLBuilder._getSettings(t);FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_settings",node_id:l,settings:i},FLBuilder._saveSettingsComplete),FLBuilder._lightbox.close()},_saveSettingsComplete:function(e){FLBuilder._renderLayout(e,function(){
|
5 |
-
FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)})},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){e(".fl-suggest-field").each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args")))},_updateAutoSuggestField:function(t,l,i){e(this).siblings(".as-values").val(i.join(",")).trigger("change")},_initMultipleFields:function(){for(var t=e(".fl-builder-field-multiples"),l=null,i=null,o=0,s=FLBuilderConfig.isRtl?{left:10}:{right:10};o<t.length;o++)l=t.eq(o),i=l.find(".fl-builder-field-multiple"),1===i.length?i.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):i.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:s,distance:5,opacity:.5,helper:FLBuilder._fieldDragHelper,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer"})},_addFieldClicked:function(){var t=e(this),l=t.attr("data-field"),i=t.closest("tr").siblings("tr[data-field="+l+"]").last(),o=i.clone(),s=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;o.find("th label span.fl-builder-field-index").html(s),o.find(".fl-form-field-preview-text").html(""),o.find("input, textarea, select").val(""),i.after(o),FLBuilder._initMultipleFields()},_copyFieldClicked:function(){var t=e(this),l=t.closest("tr"),i=l.clone(),o=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;i.find("th label span.fl-builder-field-index").html(o),l.after(i),FLBuilder._renumberFields(l.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),l=t.parent(),i=confirm(FLBuilderStrings.deleteFieldMessage);i&&(t.remove(),FLBuilder._renumberFields(l),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),l=0;l<t.length;l++)t.eq(l).find("th label span.fl-builder-field-index").html(l+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),l=t.attr("data-toggle"),i=t.attr("data-hide"),o=t.attr("data-trigger"),s=t.val(),r=0;if("undefined"!=typeof l){l=JSON.parse(l);for(r in l)FLBuilder._settingsSelectToggle(l[r].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[r].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[r].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof l[s]&&(FLBuilder._settingsSelectToggle(l[s].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(l[s].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[s].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof i&&(i=JSON.parse(i),"undefined"!=typeof i[s]&&(FLBuilder._settingsSelectToggle(i[s].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[s].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[s].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof o&&(o=JSON.parse(o),"undefined"!=typeof o[s]&&"undefined"!=typeof o[s].fields))for(r=0;r<o[s].fields.length;r++)e("#fl-field-"+o[s].fields[r]).find("select").trigger("change")},_settingsSelectToggle:function(t,l,i,o){var s=0;if(o="undefined"==typeof o?"":o,"undefined"!=typeof t)for(;s<t.length;s++)e(i+t[s]+o)[l](),"#fl-field-"==i&&"code"==e(i+t[s]).data("type")&&e(i+t[s]).data("editor").resize()},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded},mode:"hsv"}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}))},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),l=e(this).closest(".fl-photo-field"),i=l.find("input[type=hidden]"),o=i.val(),s=null;e(this).hasClass("fl-photo-replace")?(t.reset(),l.addClass("fl-photo-empty"),i.val("")):""!==o?(s=wp.media.attachment(o),s.fetch(),t.add(s?[s]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),l=e(this).closest(".fl-photo-field"),i=l.find("input[type=hidden]"),o=l.find(".fl-photo-preview img"),s=l.find("select");i.val(t.id),o.attr("src",FLBuilder._getPhotoSrc(t)),l.removeClass("fl-photo-empty"),l.find("label.error").remove(),s.show(),s.html(FLBuilder._getPhotoSizeOptions(t)),s.trigger("change")},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),l="undefined"!=typeof t?t.get("selection"):null,i=e(this).closest(".fl-photo-field"),o=i.find("input[type=hidden]"),s=i.find("select");l&&l.reset(),i.addClass("fl-photo-empty"),o.val(""),s.html('<option value="" selected></option>'),s.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e){var t="",l=null,i=null,o="",s={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes)t+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else for(l in e.sizes)o="undefined"!=typeof s[l]?s[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",i="full"==l?' selected="selected"':"",t+='<option value="'+e.sizes[l].url+'"'+i+">"+o+e.sizes[l].width+" x "+e.sizes[l].height+"</option>";return t},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),l=t.find("input[type=hidden]"),i=l.val(),o=""===i?'[gallery ids="-1"]':'[gallery ids="'+JSON.parse(i).join()+'"]',s=wp.shortcode.next("gallery",o).shortcode,r=wp.media.gallery.defaults.id,n=null,a=null;_.isUndefined(s.get("id"))&&!_.isUndefined(r)&&s.set("id",r),n=wp.media.gallery.attachments(s),a=new wp.media.model.Selection(n.models,{props:n.props.toJSON(),multiple:!0}),a.gallery=n.gallery,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:a}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var l=e(this).closest(".fl-multiple-photos-field"),i=l.find("input[type=hidden]"),o=l.find(".fl-multiple-photos-count"),s=[],r=0;r<t.models.length;r++)s.push(t.models[r].id);1==s.length?o.html("1 "+FLBuilderStrings.photoSelected):o.html(s.length+" "+FLBuilderStrings.photosSelected),l.removeClass("fl-multiple-photos-empty"),l.find("label.error").remove(),i.val(JSON.stringify(s)).trigger("change")},_selectSingleVideo:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1})),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),l=e(this).closest(".fl-video-field"),i=l.find(".fl-video-preview-img img"),o=l.find(".fl-video-preview-filename"),s=l.find("input[type=hidden]");i.attr("src",t.icon),o.html(t.filename),l.removeClass("fl-video-empty"),l.find("label.error").remove(),s.val(t.id).trigger("change")},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),l=t.find("input[type=hidden]"),i=l.val(),o=""==i?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(i).join()+'"]',s=wp.shortcode.next("playlist",o).shortcode,r=wp.media.playlist.defaults.id,n=null,a=null;_.isUndefined(s.get("id"))&&!_.isUndefined(r)&&s.set("id",r),n=wp.media.playlist.attachments(s),a=new wp.media.model.Selection(n.models,{props:n.props.toJSON(),multiple:!0}),a.playlist=n.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var l=e(this).closest(".fl-multiple-audios-field"),i=l.find(".fl-multiple-audios-count"),o=l.find("input[type=hidden]"),s=[],r=0;r<t.models.length;r++)s.push(t.models[r].id);1==s.length?i.html("1 "+FLBuilderStrings.audioSelected):i.html(s.length+" "+FLBuilderStrings.audiosSelected),o.val(JSON.stringify(s)).trigger("change"),l.removeClass("fl-multiple-audios-empty"),l.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var l=e(this).closest(".fl-icon-field"),i=l.find("input[type=hidden]"),o=l.find("i"),s=o.attr("data-icon");i.val(t).trigger("change"),o.removeClass(s),o.addClass(t),o.attr("data-icon",t),l.removeClass("fl-icon-empty"),l.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),l=t.find("input[type=hidden]"),i=t.find("i");l.val("").trigger("change"),i.removeClass(),i.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),l=t.closest(".fl-lightbox-wrap").attr("data-instance-id"),i=FLLightbox._instances[l],o=i._node.find(".fl-lightbox").css("left"),s=i._node.find(".fl-lightbox").css("top"),r=t.closest(".fl-builder-settings"),n=t.attr("data-type"),a=t.siblings("input").val(),d=FLBuilder._moduleHelpers[n],u=new FLLightbox({className:"fl-builder-lightbox fl-form-field-settings",destroyOnClose:!0});t.closest(".fl-builder-lightbox").hide(),t.attr("id","fl-"+u._id),u.open('<div class="fl-builder-lightbox-loading"></div>'),u.draggable({handle:".fl-lightbox-header"}),e("body").undelegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),u._node.find(".fl-lightbox").css({left:o,top:Number(parseInt(s)+233)+"px"}),FLBuilder.ajax({action:"render_settings_form",node_id:r.attr("data-node"),node_settings:FLBuilder._getSettings(r),type:n,settings:a.replace(/'/g,"'")},function(e){var t=JSON.parse(e);u.setContent(t.html),u._node.find("form.fl-builder-settings").attr("data-type",n),u._node.find(".fl-builder-settings-cancel").on("click",FLBuilder._closeFormFieldLightbox),FLBuilder._initSettingsForms(),"undefined"!=typeof d&&(FLBuilder._initSettingsValidation(d.rules),d.init()),u._node.find(".fl-lightbox").css({left:o,top:s})})},_closeFormFieldLightbox:function(){var t=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=FLLightbox._instances[t],i=e(".fl-builder-settings-lightbox"),o=i.find("form"),s=l._node.find(".fl-lightbox").css("left"),r=l._node.find(".fl-lightbox").css("top"),n=0,a=e(window),d=a.height();"undefined"!=typeof tinymce&&"undefined"!=typeof tinymce.EditorManager.activeEditor&&tinymce.EditorManager.activeEditor.remove(),l._node.find(".fl-lightbox-content").html('<div class="fl-builder-lightbox-loading"></div>'),n=l._node.find(".fl-lightbox").height(),d-80>n?l._node.find(".fl-lightbox").css("top",(d-n)/2-40+"px"):l._node.find(".fl-lightbox").css("top","0px"),l.on("close",function(){i.show(),i.find("label.error").remove(),o.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors(),i.find(".fl-lightbox").css({left:s,top:r})}),setTimeout(function(){l.close(),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked)},500)},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),l=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),i=t.attr("data-type"),o=FLBuilder._getSettings(t),s={},r=FLBuilder._moduleHelpers[i],n=e(".fl-builder-settings #fl-"+l),a=n.parent().attr("data-preview-text"),d=o[a],u=e('select[name="'+a+'"]'),c=document.createElement("div"),f=!0;return u.length>0&&(d=u.find('option[value="'+o[a]+'"]').text()),"undefined"!=typeof r&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=r.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof d&&(d.indexOf("fa fa-")>-1?d='<i class="'+d+'"></i>':d.length>35&&(c.innerHTML=d,d=(c.textContent||c.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),n.siblings(".fl-form-field-preview-text").html(d)),s=n.siblings("input").val().replace(/'/g,"'"),""!=s&&(o=e.extend(JSON.parse(s),o)),n.siblings("input").val(JSON.stringify(o)).trigger("change"),FLBuilder._closeFormFieldLightbox.apply(this),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),l=t.find(".fl-link-field-search-input");l.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:l.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,l){var i=e.closest(".fl-link-field"),o=i.find(".fl-link-field-search"),s=i.find(".fl-link-field-search-input"),r=i.find(".fl-link-field-input");r.val(t.value).trigger("keyup"),s.autoSuggest("remove",t.value),o.hide()},_linkFieldSelectClicked:function(){e(this).parent().find(".fl-link-field-search").show()},_linkFieldSelectCancelClicked:function(){e(this).parent().hide()},_initFontFields:function(){e(".fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),l=t.find(".fl-font-field-font");l.on("change",function(){FLBuilder._getFontWeights(l)})},_getFontWeights:function(t){var l=t.next(".fl-font-field-weight"),i=t.val(),o={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},s={};l.html(""),s="undefined"!=typeof FLBuilderFontFamilies.system[i]?FLBuilderFontFamilies.system[i].weights:"undefined"!=typeof FLBuilderFontFamilies.google[i]?FLBuilderFontFamilies.google[i]:FLBuilderFontFamilies["default"][i],e.each(s,function(e,t){l.append('<option value="'+t+'">'+o[t]+"</option>")})},initEditorField:function(e){var t=tinyMCEPreInit.mceInit.flhiddeneditor;t.elements=e,tinyMCEPreInit.mceInit[e]=t},_updateEditorFields:function(){var t=e(".fl-builder-settings textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),l=t.closest(".fl-editor-field"),i=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),o=t.attr("id"),s=l.attr("id"),r="undefined"!=typeof tinyMCE&&tinyMCE.get(o),n=t.siblings('textarea[name="'+s+'"]'),a=l.data("wpautop");0===n.length&&(n=e('<textarea name="'+s+'"></textarea>').hide(),t.after(n)),a?r&&i.hasClass("tmce-active")?n.val(r.getContent()):"undefined"!=typeof switchEditors?n.val(switchEditors.wpautop(t.val())):n.val(t.val()):(r&&i.hasClass("tmce-active")&&r.save(),n.val(t.val()))},_loopBuilderPostTypeChange:function(){var t=e(this).val();e(".fl-loop-builder-filter").hide(),e(".fl-loop-builder-"+t+"-filter").show()},_textFieldAddValueSelectChange:function(){var t=e(this),l=e('input[name="'+t.data("target")+'"]'),i=l.val(),o=t.val(),s="";-1==i.indexOf(o)&&(s=(i.trim()+" "+o.trim()).trim(),l.val(s).trigger("change").trigger("keyup")),t.val("")},ajax:function(t,l){var i;if(FLBuilder._silentUpdate)return FLBuilder.showAjaxLoader(),void(FLBuilder._silentUpdateCallbackData=[t,l]);t.silent===!0&&(FLBuilder._silentUpdate=!0);for(i in t)"undefined"==typeof t[i]&&(t[i]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=e("#fl-post-id").val(),t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(t.settings)),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(t.node_settings)),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof l&&l.call(this,e)})},_ajaxComplete:function(){var e,t;FLBuilder._silentUpdate=!1,null!==FLBuilder._silentUpdateCallbackData?(FLBuilder.showAjaxLoader(),e=FLBuilder._silentUpdateCallbackData[0],t=FLBuilder._silentUpdateCallbackData[1],FLBuilder._silentUpdateCallbackData=null,FLBuilder.ajax(e,t)):FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),l=null;if("undefined"!=typeof e)for(l in e)t+=t.indexOf("?")>-1?"&":"?",t+=l+"="+e[l];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_showLightbox:function(e){e="undefined"==typeof e||e,FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),e?FLBuilder._lightbox.draggable({handle:".fl-lightbox-header"}):FLBuilder._lightbox.draggable(!1),FLBuilder._removeAllOverlays(),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},_resizeLightbox:function(){var t=e(this),l=t.hasClass("fa-expand")?"expand":"contract";FLBuilder._lightbox.renderResize(l),e(this).toggleClass("fa-expand").toggleClass("fa-compress")},alert:function(e){var t=new FLLightbox({className:"fl-builder-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),l=wp.template("fl-alert-lightbox");t.open(l({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},triggerHook:function(t,l){e("body").trigger("fl-builder."+t,l)},addHook:function(t,l){e("body").on("fl-builder."+t,l)},removeHook:function(t,l){e("body").off("fl-builder."+t,l)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,l,i,o){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",l).replace("{file}",t)),"undefined"!=typeof o&&"undefined"!=typeof o.stack&&(FLBuilder.log(o.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery);var FLBuilderColorPicker;!function(e,t){function l(){var t,l,i="backgroundImage";f?h="filter":(t=e('<div id="iris-gradtest" />'),l="linear-gradient(top,#fff,#000)",e.each(p,function(e,o){if(t.css(i,o+l),t.css(i).match("gradient"))return h=e,!1}),h===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css(this.bgImageString).match("gradient")&&(h="webkit")),t.remove())}function i(t,l){return t="top"===t?"top":"left",l=e.isArray(l)?l:Array.prototype.slice.call(arguments,1),"webkit"===h?s(t,l):p[h]+"linear-gradient("+t+", "+l.join(", ")+")"}function o(t,l){var i,o,s,n,a,d,u,c,f;t="top"===t?"top":"left",l=e.isArray(l)?l:Array.prototype.slice.call(arguments,1),i="top"===t?0:1,o=e(this),s=l.length-1,n="filter",a=1===i?"left":"top",d=1===i?"right":"bottom",u=1===i?"height":"width",c='<div class="iris-ie-gradient-shim" style="position:absolute;'+u+":100%;"+a+":%start%;"+d+":%end%;"+n+':%filter%;" data-color:"%color%"></div>',f="","static"===o.css("position")&&o.css({position:"relative"}),l=r(l),e.each(l,function(e,t){var o,r,n;return e!==s&&(o=l[e+1],void(t.stop!==o.stop&&(r=100-parseFloat(o.stop)+"%",t.octoHex=new Color(t.color).toIEOctoHex(),o.octoHex=new Color(o.color).toIEOctoHex(),n="progid:DXImageTransform.Microsoft.Gradient(GradientType="+i+", StartColorStr='"+t.octoHex+"', EndColorStr='"+o.octoHex+"')",f+=c.replace("%start%",t.stop).replace("%end%",r).replace("%filter%",n))))}),o.find(".iris-ie-gradient-shim").remove(),e(f).prependTo(o)}function s(t,l){var i=[];return t="top"===t?"0% 0%,0% 100%,":"0% 100%,100% 100%,",l=r(l),e.each(l,function(e,t){i.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+i.join(",")+")"}function r(t){var l=[],i=[],o=[],s=t.length-1;return e.each(t,function(e,t){var o=t,s=!1,r=t.match(/1?[0-9]{1,2}%$/);r&&(o=t.replace(/\s?1?[0-9]{1,2}%$/,""),s=r.shift()),l.push(o),i.push(s)}),i[0]===!1&&(i[0]="0%"),i[s]===!1&&(i[s]="100%"),i=n(i),e.each(i,function(e){o[e]={color:l[e],stop:i[e]}}),o}function n(t){var l,i,o,s,r=0,a=t.length-1,d=0,u=!1;if(t.length<=2||e.inArray(!1,t)<0)return t;for(;d<t.length-1;)u||t[d]!==!1?u&&t[d]!==!1&&(a=d,d=t.length):(r=d-1,u=!0),d++;for(i=a-r,s=parseInt(t[r].replace("%"),10),l=(parseFloat(t[a].replace("%"))-s)/i,d=r+1,o=1;d<a;)t[d]=s+o*l+"%",o++,d++;return n(t)}var a=[],d=navigator.userAgent.toLowerCase(),u="Microsoft Internet Explorer"===navigator.appName,c=u?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,f=u&&c<10,h=!1,p=["-moz-","-webkit-","-o-","-ms-"];flBuilderParseColorValue=function(e){var t=e.replace(/\s+/g,""),l=t.indexOf("rgba")!==-1?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100,i=l<100;return{value:t,alpha:l,rgba:i}},e.fn.flBuilderColorPickerGradient=function(){var t=arguments;return this.each(function(){f?o.apply(this,t):e(this).css("backgroundImage",i.apply(this,t))})},e.fn.flBuilderColorPickerRaninbowGradient=function(t,l){var i,o,s,r;for(t=t||"top",i=e.extend({},{s:100,l:50},l),o="hsl(%h%,"+i.s+"%,"+i.l+"%)",s=0,r=[];s<=360;)r.push(o.replace("%h%",s)),s+=30;return this.each(function(){e(this).flBuilderColorPickerGradient(t,r)})},FLBuilderColorPicker=function(t){this._html='<div class="fl-color-picker-ui"><div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div></div>';var l={elements:null,color:"",mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},target:!1,width:200,presets:[],labels:{colorPresets:"Color Presets",colorPicker:"Color Picker",placeholder:"Paste color here...",removePresetConfirm:"Are you sure?",noneColorSelected:"None color selected.",alreadySaved:"%s is already a saved preset.",noPresets:"Add a color preset first.",presetAdded:"%s added to presets!"}};this.options=e.extend({},l,t),(f===!1||f===!0&&c>7)&&this._init()},FLBuilderColorPicker.prototype={_html:"",_color:"",_currentElement:"",_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_init:function(){var t=this;e(t.options.elements);this._color=new Color("#ff0000").setHSpace(t.options.mode),a=this.options.presets,h===!1&&l(),e("html").hasClass("fl-color-picker-init")?t.picker=e(".fl-color-picker-ui"):t.picker=e(this._html).appendTo("body"),u?9===c?t.picker.addClass("iris-ie-9"):c<=8&&t.picker.addClass("iris-ie-lt9"):d.indexOf("compatible")<0&&d.indexOf("khtml")<0&&d.match(/mozilla/)&&t.picker.addClass("iris-mozilla"),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},"hsv"===t.options.mode&&t._has("l",t.options.controls)?t.options.controls=t._defaultHSVControls:"hsl"===t.options.mode&&t._has("v",t.options.controls)&&(t.options.controls=t._defaultHSLControls),t.hue=t._color.h(),this._setTemplates(),this._ui=e(".fl-color-picker-ui"),this._iris=e(".iris-picker"),this._wrapper=e("body"),e("html").hasClass("fl-color-picker-init")||this._ui.prepend(this._hexHtml).append(this._presetsHtml),t.element=this._ui.find(".fl-color-picker-input"),t._initControls(),t.active="external",t._change(),t._addInputListeners(t.element),this._buildUI(),this._prepareColorFields(),this._pickerControls(),this._presetsControls(),this._buildAlphaUI(),e("html").addClass("fl-color-picker-init")},_prepareColorFields:function(){var t=this;e(".fl-color-picker-value").each(function(){var l=e(this),i=l.val(),o=l.parent().find(".fl-color-picker-color"),s=flBuilderParseColorValue(i),r="";if(i){if(o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba)r=l.val().toString();else if(!o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba){var n=i.replace("rgba","rgb");n=n.substr(0,n.lastIndexOf(","))+")",t._color._alpha=1,r=n,l.val(n)}else r="#"+l.val().toString();o.css({backgroundColor:r})}})},_setTemplates:function(){this._alphaHtml='<div class="fl-alpha-wrap"><div class="fl-alpha-slider"></div><div class="fl-alpha-slider-offset"></div><div class="fl-alpha-text"></div></div>',this._presetsHtml='<div class="fl-color-picker-presets"><div class="fl-color-picker-presets-toggle"><div class="fl-color-picker-presets-open-label fl-color-picker-active">'+this.options.labels.colorPresets+' <span class="fl-color-picker-icon-arrow-up"></span></div><div class="fl-color-picker-presets-close-label">'+this.options.labels.colorPicker+' <span class="fl-color-picker-icon-arrow-down"></span></div></div><ul class="fl-color-picker-presets-list"></ul></div>',this._hexHtml='<input type="text" class="fl-color-picker-input" maxlength="7" placeholder="'+this.options.labels.placeholder+'"><div class="fl-color-picker-preset-add"></div>',this._presetsTpl='<li class="fl-color-picker-preset"><span class="fl-color-picker-preset-color"></span> <span class="fl-color-picker-preset-label"></span> <span class="fl-color-picker-preset-remove fl-color-picker-icon-remove"></span></li>',this._noPresetsTpl='<li class="fl-color-picker-no-preset"><span class="fl-color-picker-preset-label">'+this.options.labels.noPresets+"</span></li>"},_has:function(t,l){var i=!1;return e.each(l,function(e,l){if(t===l)return i=!0,!1}),i},_buildUI:function(){var t=this;t._presetsList=this._ui.find(".fl-color-picker-presets-list"),t._presetsList.html(""),this.options.presets.length>0?e.each(this.options.presets,function(e,l){t._addPresetView(l)}):t._presetsList.append(this._noPresetsTpl)},_addPresetView:function(t){var l=this._presetsList.find(".fl-color-picker-no-preset");l.length>0&&l.remove();var i=e(this._presetsTpl),o=Color(t);i.attr("data-color",t).find(".fl-color-picker-preset-color").css({backgroundColor:o.toString()}).end().find(".fl-color-picker-preset-label").html(o.toString()),this._presetsList.append(i)},_addPresetFeedback:function(){this._ui.append('<div class="fl-color-picker-added"><div class="fl-color-picker-added-text"><div class="fl-color-picker-icon-check"></div> "'+this.options.labels.presetAdded.replace("%s",this._color.toString())+'"</div></div>'),this._ui.find(".fl-color-picker-added").hide().fadeIn(200).delay(2e3).fadeOut(200,function(){e(this).remove()})},_pickerControls:function(){var t=this;this._wrapper.on("click",".fl-color-picker-color",function(){var l=e(this);t._currentElement=l.parent().find(".fl-color-picker-value"),t._ui.position({my:"left top",at:"left bottom",of:l,collision:"flipfit",using:function(e,l){t._togglePicker(e)}})}).on("click",".fl-color-picker-clear",function(){var l=e(this);t._currentElement=l.parent().find(".fl-color-picker-value"),l.prev(".fl-color-picker-color").css({backgroundColor:"transparent"}).addClass("fl-color-picker-empty"),t._setColor(""),t.element.val(""),t._currentElement.val("").trigger("change")}),e(document).on("click",function(t){0===e(t.target).closest(".fl-color-picker-ui").length&&e(".fl-color-picker-ui.fl-color-picker-active").removeClass("fl-color-picker-active")})},_presetsControls:function(){var t=this,l=t._ui.find(".fl-color-picker-preset-add"),i=t._ui.find(".fl-color-picker-presets"),o=i.find(".fl-color-picker-presets-open-label"),s=i.find(".fl-color-picker-presets-close-label"),r=i.find(".fl-color-picker-presets-list");
|
6 |
l.off("click").on("click",function(){t._addPreset(t.element.val())}),r.css({height:t.element.innerHeight()+t._iris.innerHeight()+14+"px"}).hide(),i.off("click").on("click",".fl-color-picker-presets-toggle",function(){o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),r.slideToggle(500)}).on("click",".fl-color-picker-preset",function(l){var i=new Color(e(this).data("color").toString());t._setColor(i),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:i.toString()}).removeClass("fl-color-picker-empty"),o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),r.slideToggle(500)}).on("click",".fl-color-picker-preset-remove",function(l){l.stopPropagation(),t._removePreset(e(this).parent().data("color"))})},_removePreset:function(t){if(confirm(this.options.labels.removePresetConfirm)){var l=t.toString(),i=a.indexOf(l);i>-1&&(a.splice(i,1),this.options.presets=a,this._presetsList.find('.fl-color-picker-preset[data-color="'+l+'"]').slideUp(function(){e(this).remove()})),a.length<1&&this._presetsList.append(this._noPresetsTpl),e(this).trigger("presetRemoved",{presets:a})}},_addPreset:function(t){var l=t.toString().replace(/^#/,"");""===l?alert(this.options.labels.noneColorSelected):a.indexOf(l)>-1?alert(this.options.labels.alreadySaved.replace("%s","#"+l)):(this._addPresetView(l),this._addPresetFeedback(),a.push(l),this.options.presets=a,e(this).trigger("presetAdded",{presets:a}))},_togglePicker:function(e){var t=this;this._ui.hasClass("fl-color-picker-active")?(this._ui.removeClass("fl-color-picker-active"),e&&setTimeout(function(){t._ui.css(e),t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200)):(e&&t._ui.css(e),setTimeout(function(){t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200))},_paint:function(){var e=this;e._paintDimension("right","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var l,i=this,o=i._color,s=i.options.mode,r=i._getHSpaceColor(),n=i.controls[t],a=i.options.controls;if(t!==i.active&&("square"!==i.active||"strip"===t))switch(a[t]){case"h":if("hsv"===s){switch(r=o.clone(),t){case"horiz":r[a.vert](100);break;case"vert":r[a.horiz](100);break;case"strip":r.setHSpace("hsl")}l=r.toHsl()}else l="strip"===t?{s:r.s,l:r.l}:{s:100,l:r.l};n.flBuilderColorPickerRaninbowGradient(e,l);break;case"s":"hsv"===s?"vert"===t?l=[o.clone().a(0).s(0).toCSS("rgba"),o.clone().a(1).s(0).toCSS("rgba")]:"strip"===t?l=[o.clone().s(100).toCSS("hsl"),o.clone().s(0).toCSS("hsl")]:"horiz"===t&&(l=["#fff","hsl("+r.h+",100%,50%)"]):l="vert"===t&&"h"===i.options.controls.horiz?["hsla(0, 0%, "+r.l+"%, 0)","hsla(0, 0%, "+r.l+"%, 1)"]:["hsl("+r.h+",0%,50%)","hsl("+r.h+",100%,50%)"],n.flBuilderColorPickerGradient(e,l);break;case"l":l="strip"===t?["hsl("+r.h+",100%,100%)","hsl("+r.h+", "+r.s+"%,50%)","hsl("+r.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],n.flBuilderColorPickerGradient(e,l);break;case"v":l="strip"===t?[o.clone().v(100).toCSS(),o.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],n.flBuilderColorPickerGradient(e,l)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(e){var t,l=this,i=l.options,o=l.controls,s=o.square,r=l.picker.find(".iris-strip"),n="77.5%",a="12%",d=20,u=i.border?i.width-d:i.width;if(e&&(s.css("width",""),r.css("width",""),l.picker.css({width:"",height:""})),n=u*(parseFloat(n)/100),a=u*(parseFloat(a)/100),t=i.border?n+d:n,s.width(n).height(n),r.height(n).width(a),l.picker.css({width:i.width,height:t}),!i.palettes)return l.picker.css("paddingBottom","")},_addInputListeners:function(e){var t=this,l=100,i=function(l){var i=new Color(e.val()),o=e.val().replace(/^#/,"");if(e.removeClass("iris-error"),i.error)""!==o&&e.addClass("iris-error");else if(i.toString()!==t._color.toString())if("keyup"===l.type){if(o.match(/^[0-9a-fA-F]{3}$/))return;t._setColor(o),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:Color(o).toString()}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change")}else if("paste"===l.type)return o=l.originalEvent.clipboardData.getData("text").replace(/^#/,""),hex=Color(o).toString(),t._setColor(o),e.val(hex),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:hex}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change"),!1};e.on("change",i).on("keyup",t._debounce(i,l))},_initControls:function(){var t=this,l=t.controls,i=l.square,o=t.options.controls,s=t._scale[o.strip];l.stripSlider.slider({orientation:"horizontal",max:s,slide:function(e,l){t.active="strip","h"===o.strip&&(l.value=s-l.value),t._color[o.strip](l.value),t._change.apply(t,arguments)}}),l.squareDrag.draggable({containment:l.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(e,l){t._squareDrag(e,l)},start:function(){i.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){i.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(l){var i="ui-state-focus";l.preventDefault(),"mousedown"===l.type?(t.picker.find("."+i).removeClass(i).blur(),e(this).addClass(i).focus()):e(this).removeClass(i)}).on("keydown",function(e){var i=l.square,o=l.squareDrag,s=o.position(),r=2;switch(e.altKey&&(r*=10),e.keyCode){case 37:s.left-=r;break;case 38:s.top-=r;break;case 39:s.left+=r;break;case 40:s.top+=r;break;default:return!0}s.left=Math.max(0,Math.min(s.left,i.width())),s.top=Math.max(0,Math.min(s.top,i.height())),o.css(s),t._squareDrag(e,{position:s}),e.preventDefault()}),i.mousedown(function(l){var i,o;1===l.which&&e(l.target).is("div")&&(i=t.controls.square.offset(),o={top:l.pageY-i.top,left:l.pageX-i.left},l.preventDefault(),t._squareDrag(l,{position:o}),l.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(o).trigger(l))})},_squareDrag:function(e,t){var l=this,i=l.options.controls,o=l._squareDimensions(),s=Math.round((o.h-t.position.top)/o.h*l._scale[i.vert]),r=l._scale[i.horiz]-Math.round((o.w-t.position.left)/o.w*l._scale[i.horiz]);l._color[i.horiz](r)[i.vert](s),l.active="square",l._change.apply(l,arguments)},_setColor:function(e){var t,l,i=this,o=i.options.color;i.options.color=e,e=""+e,t=e.replace(/^#/,""),l=new Color(e).setHSpace(i.options.mode),l.error?i.options.color=o:(i._color=l,i.options.color=i._color.toString(),i.active="external",i._change())},_squareDimensions:function(e){var l,i,o=this.controls.square;return e!==t&&o.data("dimensions")?o.data("dimensions"):(i=this.controls.squareDrag,l={w:o.width(),h:o.height()},o.data("dimensions",l),l)},_isNonHueControl:function(e,t){return"square"===e&&"h"===this.options.controls.strip||"external"!==t&&("h"!==t||"strip"!==e)},_change:function(){var t=this,l=t.controls,i=t._getHSpaceColor(),o=["square","strip"],s=t.options.controls,r=s[t.active]||"external",n=t.hue;"strip"===t.active?o=[]:"external"!==t.active&&o.pop(),e.each(o,function(e,o){var r,n,a;if(o!==t.active)switch(o){case"strip":r="h"===s.strip?t._scale[s.strip]-i[s.strip]:i[s.strip],l.stripSlider.slider("value",r);break;case"square":n=t._squareDimensions(),a={left:i[s.horiz]/t._scale[s.horiz]*n.w,top:n.h-i[s.vert]/t._scale[s.vert]*n.h},t.controls.squareDrag.css(a)}}),i.h!==n&&t._isNonHueControl(t.active,r)&&t._color.h(n),t.hue=t._color.h(),t.options.color=t._color.toString(),t.element.is(":input")&&!t._color.error&&(t.element.removeClass("iris-error"),t.element.val()!==t._color.toString()&&(t.element.val(t._color.toString()),this._currentElement&&(this._currentElement.val(t._color.toString().replace(/^#/,"")).parent().find(".fl-color-picker-color").css({backgroundColor:t._color.toString()}).removeClass("fl-color-picker-empty"),t._wrapper.find(".fl-alpha-slider-offset").css("background-color",t._color.toString()),this._currentElement.trigger("change")))),t._paint(),t._inited=!0,t.active=!1},_debounce:function(e,t,l){var i,o;return function(){var s,r,n=this,a=arguments;return s=function(){i=null,l||(o=e.apply(n,a))},r=l&&!i,clearTimeout(i),i=setTimeout(s,t),r&&(o=e.apply(n,a)),o}},_buildAlphaUI:function(){var t=this;t._wrapper.on("click",".fl-color-picker-color",function(){var l=e(this);t._currentElement.val();l.hasClass("fl-color-picker-alpha-enabled")?(t._ui.find(".fl-alpha-wrap").length<=0&&e(t._alphaHtml).insertAfter(t._iris),t._pickerAlphaControls()):t._ui.find(".fl-alpha-wrap").remove()})},_pickerAlphaControls:function(){var e=this,t=e._currentElement,l=flBuilderParseColorValue(t.val()),i=parseFloat(l.alpha/100),o=e._wrapper,s=e._ui,r=s.find(".fl-alpha-wrap"),n=r.find(".fl-alpha-slider"),a=r.find(".fl-alpha-text"),d=r.find(".fl-alpha-slider-offset");alphaHandle=r.find(".ui-slider-handle"),a.text(i<1?i:""),n.slider({orientation:"vertical",slide:function(t,l){var i=parseFloat(l.value/100);e._color._alpha=i,a.text(i<1?i:""),e._change.apply(e,arguments)},create:function(){d.css({backgroundColor:l.value}),o.on("click",".fl-color-picker-clear",function(){e._color._alpha=1,a.text(""),n.slider("value",100).trigger("slide")})},value:l.alpha,step:1,min:1,max:100})}}}(jQuery),function(e,t){var l=function(e,t){return this instanceof l?this._init(e,t):new l(e,t)};l.fn=l.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var l="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),l=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":l,this[l](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var e=new l(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"],i=t.length-1;i>=0;i--)e[t[i]]=this[t[i]];return e},setHSpace:function(e){return this._hSpace="hsv"===e?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,l=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),e.match(l)&&e.match(/\)$/)){if(t=e.replace(/(\s|%)/g,"").replace(l,"").replace(/,?\);?$/,"").split(","),t.length<3)return this._error();if(4===t.length&&(this.a(parseFloat(t.pop())),this.error))return this;for(var i=t.length-1;i>=0;i--)if(t[i]=parseInt(t[i],10),isNaN(t[i]))return this._error();return e.match(/^rgb/)?this.fromRgb({r:t[0],g:t[1],b:t[2]}):e.match(/^hsv/)?this.fromHsv({h:t[0],s:t[1],v:t[2]}):this.fromHsl({h:t[0],s:t[1],l:t[2]})}return this.fromHex(e)},fromRgb:function(e,l){return"object"!=typeof e||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),l))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var l,i,o,s,r,n,a,d;return"object"!=typeof e||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",n=e.h/360,a=e.s/100,d=e.l/100,0===a?l=i=o=d:(s=d<.5?d*(1+a):d+a-d*a,r=2*d-s,l=this.hue2rgb(r,s,n+1/3),i=this.hue2rgb(r,s,n),o=this.hue2rgb(r,s,n-1/3)),this.fromRgb({r:255*l,g:255*i,b:255*o},!0))},fromHsv:function(e){var l,i,o,s,r,n,a,d,u,c,f;if("object"!=typeof e||e.h===t||e.s===t||e.v===t)return this._error();switch(this._hsv=e,this._hSpace="hsv",l=e.h/360,i=e.s/100,o=e.v/100,a=Math.floor(6*l),d=6*l-a,u=o*(1-i),c=o*(1-d*i),f=o*(1-(1-d)*i),a%6){case 0:s=o,r=f,n=u;break;case 1:s=c,r=o,n=u;break;case 2:s=u,r=o,n=f;break;case 3:s=u,r=c,n=o;break;case 4:s=f,r=u,n=o;break;case 5:s=o,r=u,n=c}return this.fromRgb({r:255*s,g:255*r,b:255*n},!0)},fromInt:function(e,l){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),l===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,l){return l<0&&(l+=1),l>1&&(l-=1),l<1/6?e+6*(t-e)*l:l<.5?t:l<2/3?e+(t-e)*(2/3-l)*6:e},toString:function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){switch(e=e||"hex",t=parseFloat(t||this._alpha),e){case"rgb":case"rgba":var l=this.toRgb();return t<1?"rgba( "+l.r+", "+l.g+", "+l.b+", "+t+" )":"rgb( "+l.r+", "+l.g+", "+l.b+" )";case"hsl":case"hsla":var i=this.toHsl();return t<1?"hsla( "+i.h+", "+i.s+"%, "+i.l+"%, "+t+" )":"hsl( "+i.h+", "+i.s+"%, "+i.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e,t,l=this.toRgb(),i=l.r/255,o=l.g/255,s=l.b/255,r=Math.max(i,o,s),n=Math.min(i,o,s),a=(r+n)/2;if(r===n)e=t=0;else{var d=r-n;switch(t=a>.5?d/(2-r-n):d/(r+n),r){case i:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-i)/d+2;break;case s:e=(i-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsl.h!==e&&(e=this._hsl.h),t=Math.round(100*t),0===t&&this._hsl.s&&(t=this._hsl.s),{h:e,s:t,l:Math.round(100*a)}},toHsv:function(){var e,t,l=this.toRgb(),i=l.r/255,o=l.g/255,s=l.b/255,r=Math.max(i,o,s),n=Math.min(i,o,s),a=r,d=r-n;if(t=0===r?0:d/r,r===n)e=t=0;else{switch(r){case i:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-i)/d+2;break;case s:e=(i-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsv.h!==e&&(e=this._hsv.h),t=Math.round(100*t),0===t&&this._hsv.s&&(t=this._hsv.s),{h:e,s:t,v:Math.round(100*a)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return 1===t.length&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(!(e instanceof l))throw"getDistanceLuminosityFrom requires a Color object";var t=this.toLuminosity(),i=e.toLuminosity();return t>i?(t+.05)/(i+.05):(i+.05)/(t+.05)},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new l(t)},getReadableContrastingColor:function(e,i){if(!(e instanceof l))return this;var o=i===t?5:i,s=e.getDistanceLuminosityFrom(this),r=e.getMaxContrastColor(),n=r.getDistanceLuminosityFrom(e);if(n<=o)return r;if(s>=o)return this;for(var a=0===r.toInt()?-1:1;s<o&&(this.l(a,!0),s=this.getDistanceLuminosityFrom(e),0!==this._color&&16777215!==this._color););return this},a:function(e){if(e===t)return this._alpha;var l=parseFloat(e);return isNaN(l)?this._error():(this._alpha=l,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+30*e;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=30*e;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=60*e;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=120*e;return this.h(t,!0)},_partial:function(e){var l=i[e];return function(i,o){var s=this._spaceFunc("to",l.space);return i===t?s[e]:(o===!0&&(i=s[e]+i),l.mod&&(i%=l.mod),l.range&&(i=i<l.range[0]?l.range[0]:i>l.range[1]?l.range[1]:i),s[e]=i,this._spaceFunc("from",l.space,s))}},_spaceFunc:function(e,t,l){var i=t||this._hSpace,o=e+i.charAt(0).toUpperCase()+i.substr(1);return this[o](l)}};var i={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var o in i)i.hasOwnProperty(o)&&(l.fn[o]=l.fn._partial(o));"object"==typeof exports?module.exports=l:e.Color=l}(this),function(e){FLIconSelector={_content:null,_lightbox:null,_rendered:!1,_filterText:"",open:function(e){FLIconSelector._rendered||FLIconSelector._render(),null===FLIconSelector._content?(FLIconSelector._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder.ajax({action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelector._lightbox.open(),FLIconSelector._lightbox.on("icon-selected",function(t,l){FLIconSelector._lightbox.off("icon-selected"),FLIconSelector._lightbox.close(),e(l)})},_render:function(){FLIconSelector._lightbox=new FLLightbox({className:"fl-icon-selector"}),FLIconSelector._rendered=!0},_getContentComplete:function(t){var l=JSON.parse(t);FLIconSelector._content=l.html,FLIconSelector._lightbox.setContent(l.html),e(".fl-icons-filter-select").on("change",FLIconSelector._filter),e(".fl-icons-filter-text").on("keyup",FLIconSelector._filter),e(".fl-icons-list i").on("click",FLIconSelector._select),e(".fl-icon-selector-cancel").on("click",e.proxy(FLIconSelector._lightbox.close,FLIconSelector._lightbox))},_filter:function(){var t=e(".fl-icons-filter-select").val(),l=e(".fl-icons-filter-text").val();"all"==t?e(".fl-icons-section").show():(e(".fl-icons-section").hide(),e(".fl-"+t).show()),FLIconSelector._filterText=l,""!==l?e(".fl-icons-list i").each(FLIconSelector._filterIcon):e(".fl-icons-list i").show()},_filterIcon:function(){var t=e(this);-1==t.attr("class").indexOf(FLIconSelector._filterText)?t.hide():t.show()},_select:function(){var t=e(this).attr("class");FLIconSelector._lightbox.trigger("icon-selected",t)}}}(jQuery),function(e){FLLightbox=function(e){this._init(e),this._render(),this._bind()},FLLightbox.closeParent=function(t){var l=e(t).closest(".fl-lightbox-wrap").attr("data-instance-id");FLLightbox._instances[l].close()},FLLightbox._instances={},FLLightbox.prototype={_id:null,_node:null,_visible:!1,_resizeTimer:null,_draggable:!1,_defaults:{className:"",destroyOnClose:!1},open:function(e){this._node.find(".fl-lightbox").attr("style",""),this._node.show(),this._visible=!0,"undefined"!=typeof e?this.setContent(e):this._resize(),this.trigger("open")},close:function(){"undefined"!=typeof tinymce&&"undefined"!=typeof tinymce.EditorManager.activeEditor&&null!=tinymce.EditorManager.activeEditor&&tinymce.EditorManager.activeEditor.hide(),this._node.hide(),this._visible=!1,this.trigger("close"),this._defaults.destroyOnClose&&this.destroy()},setContent:function(e){this._node.find(".fl-lightbox-content").html(e),this._resize()},empty:function(){this._node.find(".fl-lightbox-content").empty(),this._node.find(".fl-lightbox").removeClass("fl-lightbox-expanded")},on:function(e,t){this._node.on(e,t)},off:function(e){this._node.off(e)},trigger:function(e,t){this._node.trigger(e,t)},draggable:function(e){var t=this._node.find(".fl-lightbox-mask"),l=this._node.find(".fl-lightbox");e="undefined"!=typeof e&&e,this._draggable&&l.draggable("destroy"),e?(this._unbind(),this._draggable=!0,t.hide(),l.draggable({cursor:"move",handle:e.handle||""})):(t.show(),this._bind(),this._draggable=!1),this._resize()},destroy:function(){e(window).off("resize.fl-lightbox-"+this._id),this._node.empty(),this._node.remove(),FLLightbox._instances[this._id]="undefined";try{delete FLLightbox._instances[this._id]}catch(t){}},renderResize:function(t){if("undefined"!=typeof t){var l=this._getActiveNode();if(lightbox=l.find(".fl-lightbox"),boxFields=lightbox.find(".fl-builder-settings-fields"),win=e(window),winHeight=win.height(),winWidth=win.width(),boxHeaderHeight=lightbox.find(".fl-lightbox-header").height(),boxTabsHeight=lightbox.find(".fl-builder-settings-tabs").height(),boxFooterHeight=lightbox.find(".fl-lightbox-footer").height(),boxFieldHeight=winHeight-(boxHeaderHeight+boxTabsHeight+boxFooterHeight+103),editor="undefined"!=typeof tinymce&&tinymce.EditorManager.activeEditor?tinymce:null,editorId=editor?editor.EditorManager.activeEditor.id:"flhiddeneditor",editorIframeEl=lightbox.find("#"+editorId+"_ifr"),editorTextarea=lightbox.find("#"+editorId),codeField=lightbox.find(".fl-code-field .ace_editor"),"expand"==t||"window_resize"==t){if("window_resize"==t&&!lightbox.hasClass("fl-lightbox-expanded"))return!1;boxFields.css("height",boxFieldHeight+"px"),"expand"==t&&(lightbox.addClass("fl-lightbox-expanded"),lightbox.draggable("disable")),editorIframeEl.length>0&&editorIframeEl.css("height",boxFieldHeight-145+"px"),editorTextarea.length>0&&editorTextarea.css("height",boxFieldHeight-145+"px"),codeField.length>0&&codeField.css("height",boxFieldHeight-30+"px")}else setTimeout(e.proxy(this._resize,this),250),lightbox.removeClass("fl-lightbox-expanded"),boxFields.removeAttr("style"),null!==editorId&&(editorIframeEl.css("height","232px"),editorTextarea.css("height","232px")),codeField.length>0&&codeField.css("height","380px"),lightbox.draggable("enable")}},_init:function(t){var l=0,i=null;for(i in FLLightbox._instances)l++;this._defaults=e.extend({},this._defaults,t),this._id=(new Date).getTime()+l,FLLightbox._instances[this._id]=this},_render:function(){this._node=e('<div class="fl-lightbox-wrap" data-instance-id="'+this._id+'"><div class="fl-lightbox-mask"></div><div class="fl-lightbox"><div class="fl-lightbox-content-wrap"><div class="fl-lightbox-content"></div></div></div></div>'),this._node.addClass(this._defaults.className),e("body").append(this._node)},_bind:function(){e(window).on("resize.fl-lightbox-"+this._id,e.proxy(this._delayedResize,this))},_unbind:function(){e(window).off("resize.fl-lightbox-"+this._id)},_delayedResize:function(){clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(e.proxy(this._resize,this),250),this.renderResize("window_resize")},_resize:function(){if(this._visible){var t=this._node.find(".fl-lightbox"),l=t.height(),i=t.width(),o=e(window),s=o.height(),r=o.width(),n="0px",a=(r-i)/2-30+"px";t.css({margin:"0px",top:"auto",left:"auto"}),s-80>l&&(n=(s-l)/2-40+"px"),this._draggable?(t.css("top",n),t.css("left",FLBuilderConfig.isRtl?"-"+a:a)):(t.css("margin-top",n),t.css("margin-left","auto"),t.css("margin-right","auto"))}},_onKeypress:function(e){27==e.which&&this._visible&&this.close()},_getActiveNode:function(){var t=this._node;return e.each(FLLightbox._instances,function(l,i){e(i._node).is(":visible")&&(t=e(i._node))}),t}}}(jQuery),function(e){FLStyleSheet=function(t){"object"==typeof t&&e.extend(this,t),this._createSheet()},FLStyleSheet.prototype={id:null,_sheet:null,_sheetElement:null,updateRule:function(e,t,l){for(var i=this._sheet.cssRules?this._sheet.cssRules:this._sheet.rules,o=null,s=0;s<i.length;s++)i[s].selectorText.toLowerCase()==e.toLowerCase()&&(o=i[s]);if(o)if("object"==typeof t)for(s in t)o.style[this._toCamelCase(s)]=t[s];else o.style[this._toCamelCase(t)]=l;else this.addRule(e,t,l)},addRule:function(e,t,l){var i="",o="";if("object"==typeof t)for(o in t)i+=o+":"+t[o]+";";else i=t+":"+l+";";this._sheet.insertRule?this._sheet.insertRule(e+" { "+i+" }",this._sheet.cssRules.length):this._sheet.addRule(e,i)},destroy:function(){this._sheetElement&&(this._sheetElement.remove(),this._sheetElement=null),this._sheet&&(this._sheet=null)},disable:function(){this._sheet.disabled=!0},enable:function(){this._sheet.disabled=!1},_createSheet:function(){var t=this.id?' id="'+this.id+'"':"";this._sheet||(this._sheetElement=e('<style type="text/css"'+t+"></style>"),e("body").append(this._sheetElement),this._sheet=this._sheetElement[0].sheet)},_toCamelCase:function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}}(jQuery);
|
1 |
+
!function(e){FLBuilderAJAXLayout=function(t,l){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=l,this._post=e("#fl-post-id").val(),this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback()},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),l="fl-row",i=this._data.scriptsStyles,o="";this._data.partial&&(l="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(l)||(o=e(this).remove(),i+=o[0].outerHTML)}),""!==i&&(i=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+i+"<div>":'<div class="fl-builder-node-scripts-styles">'+i+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=i}},_addNewHTML:function(){var e;this._data.partial?this._data.nodeParent?(e=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),0===e.length||e.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):e.eq(this._data.nodePosition).before(this._data.html)):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html)},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var l=e("<div>"+t+"</div>"),i="",o=null,s="",r=null,n=window.location,a=n.protocol+"//"+n.hostname+(n.port?":"+n.port:"");return l.find("script").each(function(){i=e(this).attr("src"),"undefined"!=typeof i&&(i=i.replace(a,""),o=e('script[src*="'+i+'"]'),o.length>0&&e(this).remove())}),l.find("link").each(function(){s=e(this).attr("href"),"undefined"!=typeof s&&(s=s.replace(a,""),r=e('link[href*="'+s+'"]'),r.length>0&&e(this).remove())}),l.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),!function(e){"use strict";if(e.matchMedia&&e.matchMedia("all").addListener)return!1;var t=e.matchMedia,l=t("only all").matches,i=!1,o=0,s=[],r=function(l){e.clearTimeout(o),o=e.setTimeout(function(){for(var l=0,i=s.length;l<i;l++){var o=s[l].mql,r=s[l].listeners||[],n=t(o.media).matches;if(n!==o.matches){o.matches=n;for(var a=0,d=r.length;a<d;a++)r[a].call(e,o)}}},30)};e.matchMedia=function(o){var n=t(o),a=[],d=0;return n.addListener=function(t){l&&(i||(i=!0,e.addEventListener("resize",r,!0)),0===d&&(d=s.push({mql:n,listeners:a})),a.push(t))},n.removeListener=function(e){for(var t=0,l=a.length;t<l;t++)a[t]===e&&a.splice(t,1)},n}}(this),!function(e){"use strict";e.matchMedia=e.matchMedia||function(e,t){var l,i=e.documentElement,o=i.firstElementChild||i.firstChild,s=e.createElement("body"),r=e.createElement("div");return r.id="mq-test-1",r.style.cssText="position:absolute;top:-100em",s.style.background="none",s.appendChild(r),function(e){return r.innerHTML='­<style media="'+e+'"> #mq-test-1 { width: 42px; }</style>',i.insertBefore(s,o),l=42===r.offsetWidth,i.removeChild(s),{matches:l,media:e}}}(e.document)}(this),function(e){FLBuilderForcedMediaQueries={_requestQueue:[],_xmlHttp:function(){var e=!1;try{e=new window.XMLHttpRequest}catch(t){e=new window.ActiveXObject("Microsoft.XMLHTTP")}return function(){return e}}(),_regex:{media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},_mediaStyles:[],_rules:[],_appendedEls:[],_parsedSheets:{},_emInPx:null,_width:null,_callback:null,update:function(e,t){var l=FLBuilderForcedMediaQueries,i=window.document,o=i.documentElement,s=i.getElementsByTagName("head")[0]||o,r=i.getElementsByTagName("base")[0],n=s.getElementsByTagName("link");l._mediaStyles=[],l._rules=[],"undefined"!=typeof e&&(l._width=e),"undefined"!=typeof t&&(l._callback=t);for(var a in l._parsedSheets)a.indexOf("-layout-draft.css?")>-1?l._parsedSheets[a].parsed=!1:a.indexOf("-layout-preview.css?")>-1&&(l._parsedSheets[a].parsed=!1);for(var d=0;d<n.length;d++){var a=n[d],u=a.href,c=a.media,f=a.rel&&"stylesheet"===a.rel.toLowerCase();if(u&&f){if(u.indexOf(FLBuilderConfig.pluginUrl)>-1)continue;"undefined"!=typeof l._parsedSheets[u]&&l._parsedSheets[u].parsed?l._translate(l._parsedSheets[u].styles,u,l._parsedSheets[u].media):a.styleSheet&&a.styleSheet.rawCssText?(l._translate(a.styleSheet.rawCssText,u,c),l._parsedSheets[u]=!0):(/^([a-zA-Z:]*\/\/)/.test(u)||r)&&u.replace(RegExp.$1,"").split("/")[0]!==window.location.host||("//"===u.substring(0,2)&&(u=window.location.protocol+u),l._requestQueue.push({href:u,media:c}))}}l._makeRequests()},applyMedia:function(e){var t=FLBuilderForcedMediaQueries,l="clientWidth",i=window.document,o=i.documentElement,s=(o[l],i.getElementsByTagName("head")[0]||o),r=s.getElementsByTagName("link"),n=r[r.length-1],a=((new Date).getTime(),{}),d=t._mediaStyles,u=t._appendedEls,c=t._emInPx;t._width=e;for(var f in d)if(d.hasOwnProperty(f)){var h=d[f],p=h.minw,g=h.maxw,_=null===p,m=null===g,b="em";p&&(p=parseFloat(p)*(p.indexOf(b)>-1?c||t.getEmPixelValue():1)),g&&(g=parseFloat(g)*(g.indexOf(b)>-1?c||t.getEmPixelValue():1)),h.hasQuery&&(_&&m||!(_||e>=p)||!(m||e<=g))||(a[h.media]||(a[h.media]=[]),a[h.media].push(t._rules[h.rules]))}for(var v in u)u.hasOwnProperty(v)&&u[v]&&u[v].parentNode===s&&s.removeChild(u[v]);t._appendedEls.length=0;for(var L in a)if(a.hasOwnProperty(L)){var F=i.createElement("style"),y=a[L].join("\n");F.type="text/css",F.media=L,s.insertBefore(F,n.nextSibling),F.styleSheet?F.styleSheet.cssText=y:F.appendChild(i.createTextNode(y)),t._appendedEls.push(F)}},isUnsupportedMediaQuery:function(e){var t=FLBuilderForcedMediaQueries._regex;return e.replace(t.minmaxwh,"").match(t.other)},getEmPixelValue:function(){var e=null,t=window.document,l=t.documentElement,i=t.body,o=t.createElement("div"),s=l.style.fontSize,r=i&&i.style.fontSize,n=!1;return o.style.cssText="position:absolute;font-size:1em;width:1em",i||(i=n=t.createElement("body"),i.style.background="none"),l.style.fontSize="100%",i.style.fontSize="100%",i.appendChild(o),n&&l.insertBefore(i,l.firstChild),e=o.offsetWidth,n?l.removeChild(i):i.removeChild(o),l.style.fontSize=s,r&&(i.style.fontSize=r),e=FLBuilderForcedMediaQueries._emInPx=parseFloat(e)},_translate:function(e,t,l){var i=FLBuilderForcedMediaQueries,o=i._regex,s=e.replace(o.comments,"").replace(o.keyframes,"").match(o.media),r=s&&s.length||0;t=t.substring(0,t.lastIndexOf("/"));var n=function(e){return e.replace(o.urls,"$1"+t+"$2$3")},a=!r&&l;t.length&&(t+="/"),a&&(r=1);for(var d=0;d<r;d++){var u,c,f,h;a?(u=l,i._rules.push(n(e))):(u=s[d].match(o.findStyles)&&RegExp.$1,i._rules.push(RegExp.$2&&n(RegExp.$2))),f=u.split(","),h=f.length;for(var p=0;p<h;p++)c=f[p],i.isUnsupportedMediaQuery(c)||i._mediaStyles.push({media:c.split("(")[0].match(o.only)&&RegExp.$2||"all",rules:i._rules.length-1,hasQuery:c.indexOf("(")>-1,minw:c.match(o.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:c.match(o.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}},_makeRequests:function(){var e=FLBuilderForcedMediaQueries;if(e._requestQueue.length){var t=e._requestQueue.shift();e._ajax(t.href,function(l){e._translate(l,t.href,t.media),e._parsedSheets[t.href]={parsed:!0,styles:l,media:t.media},window.setTimeout(function(){e._makeRequests()},0)})}else e._width&&(e.applyMedia(e._width),e._callback&&(e._callback(),e._callback=null))},_ajax:function(e,t){var l=FLBuilderForcedMediaQueries._xmlHttp();l&&(l.open("GET",e,!0),l.onreadystatechange=function(){4!==l.readyState||200!==l.status&&304!==l.status||t(l.responseText)},4!==l.readyState&&l.send(null))}}}(jQuery),function(e){FLBuilderPreview=function(t){this.type=t.type,"undefined"!=t.state&&t.state?this.state=t.state:this._saveState(),"undefined"!=t.layout&&t.layout?FLBuilder._renderLayout(t.layout,e.proxy(this._init,this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(l)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,l){this._styleSheet.updateRule(e,t,l)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),l=t>>16&255,i=t>>8&255,o=255&t;return[l,i,o]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,l){var i=FLBuilderResponsiveEditing._mode,o="default"==i?"":i.charAt(0).toUpperCase()+i.slice(1);this["_styleSheet"+o].updateRule(e,t,l)},_saveState:function(){var t=e("#fl-post-id").val(),l=e('link[href*="/cache/'+t+'"]').attr("href"),i=e('script[src*="/cache/'+t+'"]').attr("src"),o=e(FLBuilder._contentClass).html();this.state={css:l,js:i,html:o}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.attr("data-node"),i=FLBuilder._getSettings(t);this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:l,node_preview:i},e.proxy(this._renderPreview,this))},delayPreview:function(t){var l="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),i=e(".fl-builder-widget-settings .fl-builder-settings-title"),o=e(".fl-builder-settings .fl-lightbox-header"),s=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.gif",r=e('<img class="fl-builder-preview-loader" src="'+s+'" />');e(".fl-builder-preview-loader").remove(),l.length>0?l.append(r):i.length>0?i.append(r):o.length>0&&o.append(r),this.delay(1e3,e.proxy(this.preview,this))},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._initElementsAndClasses(),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){this.clear(),this._settingsHaveChanged()&&FLBuilder._renderLayout(this.state)},clear:function(){this._cancelDelay(),this._cancelPreview(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var l=this.elements.textColor.val(),i=this.elements.linkColor.val(),o=this.elements.hoverColor.val(),s=this.elements.headingColor.val();i=""===i?l:i,o=""===o?l:o,s=""===s?l:s,this.delay(100,e.proxy(function(){""===l?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+l),""===i?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+i),""===o?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+o),""===s?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+s),this.updateCSSRule(this.classes.node+" h2","color","#"+s),this.updateCSSRule(this.classes.node+" h3","color","#"+s),this.updateCSSRule(this.classes.node+" h4","color","#"+s),this.updateCSSRule(this.classes.node+" h5","color","#"+s),this.updateCSSRule(this.classes.node+" h6","color","#"+s),this.updateCSSRule(this.classes.node+" h1 a","color","#"+s),this.updateCSSRule(this.classes.node+" h2 a","color","#"+s),this.updateCSSRule(this.classes.node+" h3 a","color","#"+s),this.updateCSSRule(this.classes.node+" h4 a","color","#"+s),this.updateCSSRule(this.classes.node+" h5 a","color","#"+s),this.updateCSSRule(this.classes.node+" h6 a","color","#"+s))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),""!=this.elements.bgVideo.val()&&this.preview()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var l,i,o;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(l=this.hexToRgb(this.elements.bgColor.val()),i=this.parseFloat(this.elements.bgOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",o)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgSlideshowChange:function(t){var l=this.elements,i=l.bgSlideshowSource.val(),o=l.bgSlideshowPhotos.val(),s=l.bgSlideshowFeedUrl.val(),r=l.bgSlideshowSpeed.val(),n=l.bgSlideshowTransSpeed.val();"wordpress"==i&&""===o||"smugmug"==i&&""===s||isNaN(parseInt(r))||isNaN(parseInt(n))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var l,i,o;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(l=this.hexToRgb(this.elements.bgOverlayColor.val()),i=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",o)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var l,i,o;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(l=this.hexToRgb(this.elements.borderColor.val()),i=parseInt(this.elements.borderOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",o)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var l={},i=["Top","Bottom","Left","Right"],o=["","Medium","Responsive"],s=this.classes.settings,r="",n="",a=null,d=null;for(a=0;a<i.length;a++)for(d=0;d<o.length;d++)r=t+i[a]+o[d],n=t+"_"+i[a].toLowerCase(),""!=o[d]&&(n+="_"+o[d].toLowerCase()),l[r]=e(s+" input[name="+n+"]"),l[r].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,l)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,l=["Top","Bottom","Left","Right"],i="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),o={},s=0;s<l.length;s++)o[l[s].toLowerCase()]=this.elements[e+l[s]+i].val();return this._normalizeDimensionValues(o,e)},_responsiveDimensionChange:function(t){var l=this._getDimensions(t),i={},o="border"==t;e.each(l,function(e,l){i[t+"-"+e+(o?"-width":"")]=l}),this.updateResponsiveCSSRule(this.classes.content,i),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,l){var i=this,o=FLBuilderResponsiveEditing._mode,s="default"==o?"":o.charAt(0).toUpperCase()+o.slice(1),l=l.split("-");return"undefined"==typeof l[1]?l[1]="":l[1]=l[1].charAt(0).toUpperCase()+l[1].slice(1),e.map(t,function(e,o){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var r=l[0]+o.charAt(0).toUpperCase()+o.slice(1)+l[1]+s,n=i.elements[r].attr("placeholder");n&&(e=n)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[o]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),l=this.elements.node.find(".fl-bg-video"),i=null,o=null,s={top:0,bottom:0,left:0,right:0};(t.length>0||l.length>0)&&(i=this._getDimensions("margin"),o=this._getDimensions("border"),e.map(s,function(e,t){i[t]&&o[t]?s[t]="calc("+i[t]+"+"+o[t]+")":i[t]?s[t]=i[t]:o[t]&&(s[t]=o[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",s),FLBuilder._resizeLayout()),l.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",s))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node;"full"==this.elements.width.val()?(t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content");"full"==this.elements.contentWidth.val()?(t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"))},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,l=100-t,i=parseFloat(this.elements.size.val()),o=this.elements.node.prev(".fl-col"),s=this.elements.node.next(".fl-col"),r=0===s.length?o:s,n=this.elements.node.siblings(".fl-col"),a=0;0===n.length||isNaN(i)||(n.each(function(){e(this).data("node")!=r.data("node")&&(l-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),i<t&&(i=t),i>l&&(i=l),r.css("width",100-a-i+"%"),this.elements.node.css("width",i+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(){
|
2 |
+
for(var e=this.elements.settings.find(".fl-field"),t=null,l=null,i=0;i<e.length;i++)t=e.eq(i),l=t.data("preview"),"refresh"==l.type&&this._initFieldRefreshPreview(t),"text"==l.type&&this._initFieldTextPreview(t),"css"==l.type&&this._initFieldCSSPreview(t),"widget"==l.type&&this._initFieldWidgetPreview(t),"font"==l.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var l=t.data("type"),i=t.data("preview"),o=e.proxy(this.delayPreview,this);switch(l){case"text":t.find("input[type=text]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"select":t.find("select").on("change",o);break;case"color":t.find(".fl-color-picker-value").on("change",o);break;case"photo":t.find("select").on("change",o);break;case"multiple-photos":t.find("input").on("change",o);break;case"photo-sizes":t.find("select").on("change",o);break;case"video":t.find("input").on("change",o);break;case"multiple-audios":t.find("input").on("change",o);break;case"icon":t.find("input").on("change",o);break;case"form":t.delegate("input","change",o);break;case"editor":this._addTextEditorCallback(t,i);break;case"code":t.find("textarea").on("change",o);break;case"post-type":t.find("select").on("change",o);break;case"suggest":t.find(".as-values").on("change",o);break;case"unit":t.find("input[type=number]").on("keyup",o)}},_initFieldTextPreview:function(t){var l=t.data("type"),i=t.data("preview"),o=e.proxy(this._previewText,this,i);switch(l){case"text":t.find("input[type=text]").on("keyup",o);break;case"unit":t.find("input[type=number]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"code":t.find("textarea").on("change",o);break;case"editor":this._addTextEditorCallback(t,i)}},_previewText:function(t,l){var i=this.elements.node.find(t.selector),o=e("<div>"+e(l.target).val()+"</div>");i.length>0&&(o.find("script").remove(),i.html(o.html()))},_previewTextEditor:function(t,l,i){var o=this.elements.node.find(t.selector),s="undefined"!=typeof tinyMCE?tinyMCE.get(l):null,r=e("#"+l),n="";o.length>0&&(n=e(s&&"none"==r.css("display")?"<div>"+s.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+r.val()+"</div>":"<div>"+switchEditors.wpautop(r.val())+"</div>"),n.find("script").remove(),o.html(n.html()))},_addTextEditorCallback:function(t,l){var i=t.find("textarea.wp-editor-area").attr("id"),o=null;if("refresh"==l.type)o=e.proxy(this.delayPreview,this);else{if("text"!=l.type)return;o=e.proxy(this._previewTextEditor,this,l,i)}e("#"+i).on("keyup",o),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(i),editor.on("change",o),editor.on("keyup",o))},_initFieldFontPreview:function(t){var l=t.data("type"),i=t.data("preview");i.id=t.attr("id");var o=e.proxy(this._previewFont,this,i);"font"==l&&t.find(".fl-font-field").on("change","select",o)},_previewFont:function(t,l){var i=e(l.delegateTarget),o=i.find(".fl-font-field-font"),s=e(o).find(":selected"),r=s.parent().attr("label"),n=i.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==r&&this._buildFontStylesheet(a,o.val(),n.val()),"Default"==o.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",o.val()),this.updateCSSRule(d,"font-weight",n.val()))},_buildFontStylesheet:function(t,l,i){var o=FLBuilderConfig.googleFontsUrl,s="",r={},n={};r[l]=[i],FLBuilderPreview._fontsList[t]=r,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var l=t[e];n[e]=n[e]||[],l=l.filter(function(t){return n[e].indexOf(t)<0}),n[e]=n[e].concat(l)})}),e.each(n,function(e,t){s+=e+":"+t.join()+"|"}),s=o+s.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",s).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",s)},_initFieldCSSPreview:function(e){var t=e.data("preview"),l=null;if("undefined"!=typeof t.rules)for(l in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[l]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,l){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,l));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,l));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,l));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,l))}},_previewCSS:function(t,l){var i=this._getPreviewSelector(this.classes.node,t.selector),o=t.property,s="undefined"==typeof t.unit?"":t.unit,r=e(l.target),n=r.val();"%"==s?n=parseInt(n)/100:n+=s,r.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(i,o,n):this.updateCSSRule(i,o,n)},_previewColor:function(t,l){var i=this._getPreviewSelector(this.classes.node,t.selector),o=e(l.target),s=o.val(),r=""===s?"inherit":"#"+s;o.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(i,t.property,r):this.updateCSSRule(i,t.property,r)},_initFieldWidgetPreview:function(t){var l=e.proxy(this.delayPreview,this);t.find("input").on("keyup",l),t.find("input[type=checkbox]").on("click",l),t.find("textarea").on("keyup",l),t.find("select").on("change",l)},_getPreviewSelector:function(e,t){for(var l="",i=t.split(","),o=0;o<i.length;o++)l+=e+" "+i[o],o!=i.length-1&&(l+=", ");return l}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",_fields:{},refreshPreview:function(){e(".fl-responsive-preview").length&&FLBuilderForcedMediaQueries.update()},_init:function(){this._bind()},_bind:function(){FLBuilder.addHook("responsive-editing-switched",this._previewSpacingFields),FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_switchTo:function(t,l){var i=e("body"),o=e(FLBuilder._contentClass),s=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),n=e(".fl-content-placeholder"),a=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===n.length)return;n.after(o),n.remove(),s.remove(),r.remove()}else 0===s.length?(o.after('<div class="fl-content-placeholder"></div>'),i.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(o)):(s.removeClass("fl-preview-responsive fl-preview-medium"),s.addClass("fl-preview-"+t));"responsive"==t?(a=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,o.width(a),FLBuilderForcedMediaQueries.update(a,l)):"medium"==t?(a=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,o.width(a),FLBuilderForcedMediaQueries.update(a,l)):(o.width(""),FLBuilderForcedMediaQueries.update(1e4,l)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),l=e(".fl-responsive-preview"),i=e(".fl-content-placeholder"),o=i.parents(),s="#fff",r=0;if(0===l.length)t.css("background-color","");else{for(;r<o.length&&(s=o.eq(r).css("background-color"),"rgba(0, 0, 0, 0)"==s);r++);t.css("background-color",s)}},_switchToAndScroll:function(t){var l=e(".fl-builder-settings").data("node"),i=void 0===l?void 0:e(".fl-node-"+l);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==i&&i&&setTimeout(function(){var t=e(window),l=e(".fl-responsive-preview-content");!l.length||t.height()<l.height()?e("html, body").animate({scrollTop:i.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),l=t.data("mode");l="default"==l?"medium":"medium"==l?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(l),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var l="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(l),e(".fl-field-responsive-setting").hide(),l="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(l).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(FLBuilderResponsiveEditing._fields={},e._initFields("unit","input","keyup",e._spacingFieldKeyup,["margin_top","margin_bottom","margin_left","margin_right","padding_top","padding_bottom","padding_left","padding_right"]),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,l,i,o,s){var r=e(".fl-builder-settings"),n=r.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0,c=0;for("object"!=typeof this._fields[t]&&(this._fields[t]={});u<n.length;u++)if(a=n.eq(u),d=a.attr("id").replace("fl-field-",""),!("object"==typeof s&&e.inArray(d,s)<0)&&t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")){this._fields[t][d]={"default":a.find(".fl-field-responsive-setting-default "+l),medium:a.find(".fl-field-responsive-setting-medium "+l),responsive:a.find(".fl-field-responsive-setting-responsive "+l)};for(c in this._fields[t][d])this._fields[t][d][c].on(i,o);this._fields[t][d]["default"].trigger(i),a.attr("data-responsive-init",1)}},_getFields:function(t){var l=e(t).closest(".fl-field");return type=l.attr("data-type"),name=l.attr("id").replace("fl-field-",""),this._fields[type][name]},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this),t=e["default"].attr("placeholder"),l=e["default"].val(),i=e.medium.val();""==l?e.medium.attr("placeholder",void 0===t?"":t):e.medium.attr("placeholder",l),""==i?e.responsive.attr("placeholder",e.medium.attr("placeholder")):e.responsive.attr("placeholder",i)},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),l="row",i=e(this).closest(".fl-field").attr("id").replace("fl-field-","").split("_"),o=i[0],s=i[1],r=FLBuilderResponsiveEditing._fields.unit[o+"_"+s],n=FLBuilderConfig.global,a=null,d=r["default"].val(),u=null,c=r.medium.val(),f=null,h=(r.responsive.val(),null),p=null,g=null;t.hasClass("fl-builder-row-settings")?l="row":t.hasClass("fl-builder-col-settings")?l="col":t.hasClass("fl-builder-module-settings")&&(l="module"),e.extend(n,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),a=l+"_"+o+("margin"==o?"s":""),u=n[a],f=n[a+"_medium"],h=n[a+"_responsive"],""==f&&(""!=d?r.medium.attr("placeholder",d):""!=u&&r.medium.attr("placeholder",u)),""==h&&("module"==l&&Number(n.auto_spacing)?(p=""==f?Number(u):f,g=""==c?Number(d):c,""!=g&&(g>p||g<0)?r.responsive.attr("placeholder",p):""!=g?r.responsive.attr("placeholder",g):r.responsive.attr("placeholder",p)):(!Number(n.auto_spacing)||"padding"==o&&"top|bottom".indexOf(s)>-1)&&(""!=c?r.responsive.attr("placeholder",c):""!=f?r.responsive.attr("placeholder",f):""!=d?r.responsive.attr("placeholder",d):""!=u&&r.responsive.attr("placeholder",u)))},_previewSpacingFields:function(){var t=FLBuilderResponsiveEditing._mode,l=e(".fl-builder-settings"),i=null,o=null;if(0!==l.length&&void 0!==l.attr("data-node")){i=FLBuilderResponsiveEditing._fields.unit;for(o in i)i[o][t].trigger("keyup")}}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var l=e(".fl-builder-settings"),i=t.closest(".fl-builder-service-settings"),o=e(".fl-builder-service-error");l.append('<div class="fl-builder-loading"></div>'),i.addClass("fl-builder-service-settings-loading"),o.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),l=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),l.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this),o=i.closest("tr"),s=i.val();o.siblings("tr.fl-builder-service-account-row").remove(),o.siblings("tr.fl-builder-service-connect-row").remove(),o.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==s&&(t._startSettingsLoading(i),FLBuilder.ajax({action:"render_service_settings",node_id:l,service:s},t._serviceChangeComplete))},_serviceChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row");s.after(i.html),t._addAccountDelete(o),t._finishSettingsLoading()},_connectClicked:function(){for(var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-connect-row"),r=i.find(".fl-builder-service-connect-input"),n=null,a=null,d=0,u={action:"connect_service",node_id:l,service:o.val(),fields:{}};d<r.length;d++)n=r.eq(d),a=n.attr("name"),u.fields[a]=n.val();s.hide(),t._startSettingsLoading(o),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row"),r=o.find(".fl-builder-service-select"),n=o.find(".fl-builder-service-account-row"),a=o.find(".fl-builder-service-account-select"),d=o.find(".fl-builder-service-connect-row");i.error?(d.show(),0===a.length?r.after('<div class="fl-builder-service-error">'+i.error+"</div>"):a.after('<div class="fl-builder-service-error">'+i.error+"</div>")):(d.remove(),n.remove(),s.after(i.html)),t._addAccountDelete(o),t._finishSettingsLoading()},_accountChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=i.find(".fl-builder-service-connect-row"),n=i.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=s.val(),u=null;r.remove(),n.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:l,service:o.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:l,service:o.val(),account:d}),u&&(t._startSettingsLoading(o),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(i)},_accountChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-account-row");s.after(i.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var l=e(this).closest(".fl-builder-service-settings"),i=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:i.val(),account:o.val()},t._accountDeleteComplete),t._startSettingsLoading(o))},_accountDeleteComplete:function(){var l=e(".fl-builder-service-settings-loading"),i=l.find(".fl-builder-service-select");t._finishSettingsLoading(),i.trigger("change")},_campaignMonitorClientChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=e(this),n=i.find(".fl-builder-service-list-select"),a=r.val();0!==n.length&&n.closest("tr").remove(),""!==a&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:l,service:o.val(),account:s.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-campaign-monitor-client-select");s.closest("tr").after(i.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=i.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==r.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:l,service:o.val(),account:s.val(),list_id:r.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-list-select");s.closest("tr").after(i.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var l=e(".fl-builder-settings").data("node"),i=e(this).closest(".fl-builder-service-settings"),o=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select"),r=i.find(".fl-builder-service-list-select");list_type=i.find('select[name="list_type"]'),0!==r.length&&r.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:l,service:o.val(),account:s.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(l){var i=JSON.parse(l),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-field-row");s.after(i.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fa fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder-bar",placement:"bottom",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShown:function(){0===e(".fl-template-selector").length?(e(".popover[class*=tour-]").css("visibility","hidden"),FLBuilder._showTemplateSelector()):FLBuilderTour._templateSelectorLoaded()}},{animation:!1,element:"#fl-builder-blocks-rows .fl-builder-blocks-section-title",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilderTour._dimSection("body"),FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._showPanel(),e(".fl-template-selector .fl-builder-settings-cancel").trigger("click"),e("#fl-builder-blocks-rows .fl-builder-blocks-section-title").trigger("click")}},{animation:!1,element:"#fl-builder-blocks-basic .fl-builder-blocks-section-title",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilderTour._dimSection("body"),FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._showPanel(),e("#fl-builder-blocks-basic .fl-builder-blocks-section-title").trigger("click"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-add-content-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fa fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.append('<div class="fl-builder-tour-mask"></div>'),t.on("fl-builder.template-selector-loaded",FLBuilderTour._templateSelectorLoaded),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')},_templateSelectorLoaded:function(){var t=e(".fl-builder-settings-lightbox .fl-lightbox-header"),l=t.height(),i=t.offset().top+75;e(".popover[class*=tour-]").css({top:i+l+"px",visibility:"visible"})}}}(jQuery),function(e){FLBuilder={preview:null,_actionsLightbox:null,_addModuleAfterNodeRender:null,_colResizeData:null,_colResizing:!1,_contentClass:!1,_dragEnabled:!1,_dragging:!1,_dragInitialScrollTop:0,_exitUrl:null,_layout:null,_layoutSettingsCSSCache:null,_layoutSettingsCSSTimeout:null,_lightbox:null,_lightboxScrollbarTimeout:null,_loadedModuleAssets:[],_moduleHelpers:{},_multiplePhotoSelector:null,_newColGroupParent:null,_newColGroupPosition:0,_newModuleParent:null,_newModulePosition:0,_newRowPosition:0,_selectedTemplateId:null,_selectedTemplateType:null,_singlePhotoSelector:null,_singleVideoSelector:null,_multipleAudiosSelector:null,_silentUpdate:!1,_silentUpdateCallbackData:null,_init:function(){FLBuilder._initJQueryReadyFix(),FLBuilder._initGlobalErrorHandling(),FLBuilder._initPostLock(),FLBuilder._initClassNames(),FLBuilder._initMediaUploader(),FLBuilder._initOverflowFix(),FLBuilder._initScrollbars(),FLBuilder._initLightboxes(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._initStrings(),FLBuilder._initTipTips(),FLBuilder._bindEvents(),FLBuilder._bindOverlayEvents(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showTourOrTemplates()},_initJQueryReadyFix:function(){FLBuilderConfig.debug||(jQuery.fn.oldReady=jQuery.fn.ready,jQuery.fn.ready=function(e){return jQuery.fn.oldReady(function(){try{"function"==typeof e&&e()}catch(t){FLBuilder.logError(t)}})})},_initGlobalErrorHandling:function(){FLBuilderConfig.debug||(window.onerror=function(e,t,l,i,o){return FLBuilder.logGlobalError(e,t,l,i,o),!0})},_initPostLock:function(){"undefined"!=typeof wp.heartbeat&&(wp.heartbeat.interval(30),wp.heartbeat.enqueue("fl_builder_post_lock",{post_id:e("#fl-post-id").val()}))},_initClassNames:function(){e("html").addClass("fl-builder-edit"),e("body").addClass("fl-builder"),FLBuilderConfig.simpleUi&&e("body").addClass("fl-builder-simple"),FLBuilder._contentClass=".fl-builder-content-"+FLBuilderConfig.postId},_initMediaUploader:function(){wp.media.model.settings.post.id=e("#fl-post-id").val()},_initOverflowFix:function(){e(FLBuilder._contentClass).parents().css("overflow","visible")},_initScrollbars:function(){e(".fl-nanoscroller").nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox"}),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_initSortables:function(){var t={appendTo:"body",cursor:"move",cursorAt:{left:60,top:20},distance:1,helper:FLBuilder._blockDragHelper,start:FLBuilder._blockDragStart,sort:FLBuilder._blockDragSort,change:FLBuilder._blockDragChange,stop:FLBuilder._blockDragStop,placeholder:"fl-builder-drop-zone",tolerance:"intersect"},l="",i="";i="row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col-content":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-row:not(.fl-node-global) .fl-col-content",l=FLBuilderConfig.nestedColumns?i:"row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",e(".fl-builder-rows").sortable(e.extend({},t,{connectWith:l,items:".fl-builder-block-row",stop:FLBuilder._rowDragStop})),e(".fl-builder-row-templates").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-row-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-rows").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-saved-row",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-modules, .fl-builder-widgets").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-module",stop:FLBuilder._moduleDragStop})),e(".fl-builder-module-templates").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-module-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-modules").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:i,items:".fl-builder-block-saved-module",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-row-sortable-proxy").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",helper:FLBuilder._rowDragHelper,start:FLBuilder._rowDragStart,stop:FLBuilder._rowDragStop})),e(".fl-col-sortable-proxy").sortable(e.extend({},t,{connectWith:i,helper:FLBuilder._colDragHelper,start:FLBuilder._colDragStart,stop:FLBuilder._colDragStop})),e(FLBuilder._contentClass+" .fl-col-content").sortable(e.extend({},t,{connectWith:i,handle:".fl-module-overlay .fl-block-overlay-actions .fl-block-move",helper:FLBuilder._moduleDragHelper,items:".fl-module, .fl-col-group",start:FLBuilder._moduleDragStart,stop:FLBuilder._moduleDragStop})),e(FLBuilder._contentClass+" .fl-row-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-group-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-drop-target").sortable(t)},_initStrings:function(){e.validator.messages.required=FLBuilderStrings.validateRequiredMessage},_bindEvents:function(){e("a").on("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").on("click",FLBuilder._headerLinkClicked),e(document).on("heartbeat-tick",FLBuilder._initPostLock),e(window).on("beforeunload",FLBuilder._warnBeforeUnload),e("body").delegate(".fl-builder-has-submenu","click",FLBuilder._submenuParentClicked),e("body").delegate(".fl-builder-has-submenu a","click",FLBuilder._submenuChildClicked),e("body").delegate(".fl-builder-submenu","mouseenter",FLBuilder._submenuMouseenter),e("body").delegate(".fl-builder-submenu","mouseleave",FLBuilder._submenuMouseleave),e("body").delegate(".fl-builder-submenu .fl-builder-has-submenu","mouseenter",FLBuilder._submenuNestedParentMouseenter),e(".fl-builder-tools-button").on("click",FLBuilder._toolsClicked),e(".fl-builder-done-button").on("click",FLBuilder._doneClicked),e(".fl-builder-add-content-button").on("click",FLBuilder._showPanel),e(".fl-builder-templates-button").on("click",FLBuilder._changeTemplateClicked),
|
3 |
+
e(".fl-builder-buy-button").on("click",FLBuilder._upgradeClicked),e(".fl-builder-upgrade-button").on("click",FLBuilder._upgradeClicked),e(".fl-builder-help-button").on("click",FLBuilder._helpButtonClicked),e(".fl-builder-panel-actions .fl-builder-panel-close").on("click",FLBuilder._closePanel),e(".fl-builder-blocks-section-title").on("click",FLBuilder._blockSectionTitleClicked),e("body").delegate(".fl-builder-node-template-actions","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-delete","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","click",FLBuilder._editNodeTemplateClicked),e("body").delegate(".fl-builder-node-template-delete","click",FLBuilder._deleteNodeTemplateClicked),e("body").delegate(".fl-builder-block","mousedown",FLBuilder._blockDragInit),e("body").on("mouseup",FLBuilder._blockDragCancel),e("body").delegate(".fl-builder-actions .fl-builder-cancel-button","click",FLBuilder._cancelButtonClicked),e("body").delegate(".fl-lightbox-controls .fa","click",FLBuilder._resizeLightbox),e("body").delegate(".fl-builder-save-actions .fl-builder-publish-button","click",FLBuilder._publishButtonClicked),e("body").delegate(".fl-builder-save-actions .fl-builder-draft-button","click",FLBuilder._draftButtonClicked),e("body").delegate(".fl-builder-save-actions .fl-builder-discard-button","click",FLBuilder._discardButtonClicked),e("body").delegate(".fl-builder-save-user-template-button","click",FLBuilder._saveUserTemplateClicked),e("body").delegate(".fl-builder-duplicate-layout-button","click",FLBuilder._duplicateLayoutClicked),e("body").delegate(".fl-builder-layout-settings-button","click",FLBuilder._layoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-save","click",FLBuilder._saveLayoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-builder-global-settings-button","click",FLBuilder._globalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-save","click",FLBuilder._saveGlobalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-template-category-select","change",FLBuilder._templateCategoryChanged),e("body").delegate(".fl-template-preview","click",FLBuilder._templateClicked),e("body").delegate(".fl-user-template","click",FLBuilder._userTemplateClicked),e("body").delegate(".fl-user-template-edit","click",FLBuilder._editUserTemplateClicked),e("body").delegate(".fl-user-template-delete","click",FLBuilder._deleteUserTemplateClicked),e("body").delegate(".fl-builder-template-replace-button","click",FLBuilder._templateReplaceClicked),e("body").delegate(".fl-builder-template-append-button","click",FLBuilder._templateAppendClicked),e("body").delegate(".fl-builder-template-actions .fl-builder-cancel-button","click",FLBuilder._templateCancelClicked),e("body").delegate(".fl-builder-user-template-settings .fl-builder-settings-save","click",FLBuilder._saveUserTemplateSettings),e("body").delegate(".fl-builder-help-tour-button","click",FLBuilder._startHelpTour),e("body").delegate(".fl-builder-help-video-button","click",FLBuilder._watchVideoClicked),e("body").delegate(".fl-builder-knowledge-base-button","click",FLBuilder._viewKnowledgeBaseClicked),e("body").delegate(".fl-builder-forums-button","click",FLBuilder._visitForumsClicked),e("body").delegate(".fl-builder-no-tour-button","click",FLBuilder._noTourButtonClicked),e("body").delegate(".fl-builder-yes-tour-button","click",FLBuilder._yesTourButtonClicked),e("body").delegate(".fl-builder-alert-close","click",FLBuilder._alertClose),e("body").delegate(".fl-row-overlay .fl-block-remove","click",FLBuilder._deleteRowClicked),e("body").delegate(".fl-row-overlay .fl-block-copy","click",FLBuilder._rowCopyClicked),e("body").delegate(".fl-row-overlay .fl-block-move","mousedown",FLBuilder._rowDragInit),e("body").delegate(".fl-row-overlay .fl-block-settings","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-row-overlay","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-builder-row-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-col-overlay .fl-block-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-col-overlay .fl-block-remove","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-col-overlay","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-col-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-col-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-delete","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-reset","click",FLBuilder._resetColumnWidthsClicked),e("body").delegate(".fl-block-col-submenu li","mouseenter",FLBuilder._showColHighlightGuide),e("body").delegate(".fl-block-col-submenu li","mouseleave",FLBuilder._removeColHighlightGuides),e("body").delegate(".fl-block-col-submenu .fl-block-col-move-parent","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit-parent","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-module-overlay .fl-block-remove","click",FLBuilder._deleteModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-copy","click",FLBuilder._moduleCopyClicked),e("body").delegate(".fl-module-overlay .fl-block-move","mousedown",FLBuilder._blockDragInit),e("body").delegate(".fl-module-overlay .fl-block-settings","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-module-overlay","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-builder-module-settings .fl-builder-settings-save","click",FLBuilder._saveModuleClicked),e("body").delegate(".fl-builder-settings-save-as","click",FLBuilder._showNodeTemplateSettings),e("body").delegate(".fl-builder-node-template-settings .fl-builder-settings-save","click",FLBuilder._saveNodeTemplate),e("body").delegate(".fl-builder-settings-tabs a","click",FLBuilder._settingsTabClicked),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),e("body").delegate(".fl-help-tooltip-icon","mouseover",FLBuilder._showHelpTooltip),e("body").delegate(".fl-help-tooltip-icon","mouseout",FLBuilder._hideHelpTooltip),e("body").delegate(".fl-builder-field-add","click",FLBuilder._addFieldClicked),e("body").delegate(".fl-builder-field-copy","click",FLBuilder._copyFieldClicked),e("body").delegate(".fl-builder-field-delete","click",FLBuilder._deleteFieldClicked),e("body").delegate(".fl-builder-settings-fields select","change",FLBuilder._settingsSelectChanged),e("body").delegate(".fl-photo-field .fl-photo-select","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-edit","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-replace","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-remove","click",FLBuilder._singlePhotoRemoved),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-select","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-edit","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-add","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-video-field .fl-video-select","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-replace","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-select","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-edit","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-add","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-icon-field .fl-icon-select","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-replace","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-remove","click",FLBuilder._removeIcon),e("body").delegate(".fl-form-field .fl-form-field-edit","click",FLBuilder._formFieldClicked),e("body").delegate(".fl-form-field-settings .fl-builder-settings-save","click",FLBuilder._saveFormFieldClicked),e("body").delegate(".fl-layout-field-option","click",FLBuilder._layoutFieldClicked),e("body").delegate(".fl-link-field-select","click",FLBuilder._linkFieldSelectClicked),e("body").delegate(".fl-link-field-search-cancel","click",FLBuilder._linkFieldSelectCancelClicked),e("body").delegate(".fl-loop-builder select[name=post_type]","change",FLBuilder._loopBuilderPostTypeChange),e("body").delegate(".fl-select-add-value","change",FLBuilder._textFieldAddValueSelectChange)},_bindOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.delegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.delegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.delegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.delegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.delegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_destroyOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.undelegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.undelegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.undelegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.undelegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.undelegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_preventDefault:function(e){e.preventDefault()},_stopPropagation:function(e){e.stopPropagation()},_headerLinkClicked:function(t){var l=e(this),i=l.attr("href");t.preventDefault(),FLBuilderConfig.isUserTemplate||(FLBuilder._exitUrl=i.indexOf("?")>-1?i:i+"?fl_builder",FLBuilder._doneClicked())},_warnBeforeUnload:function(){var t=e(".fl-builder-row-settings").length>0,l=e(".fl-builder-col-settings").length>0,i=e(".fl-builder-module-settings").length>0;if(t||l||i)return FLBuilderStrings.unloadWarning},_initTipTips:function(){e(".fl-tip:not(.fl-has-tip)").each(function(){var t=e(this);t.addClass("fl-has-tip"),void 0==t.attr("data-title")&&t.attr("data-title",t.attr("title"))}).tipTip({defaultPosition:"top",delay:1500})},_hideTipTips:function(){e("#tiptip_holder").stop().remove()},_submenuParentClicked:function(t){var l=e(this),i=l.find(".fl-builder-submenu");l.hasClass("fl-builder-submenu-open")?(l.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-right")):(l.offset().left+i.width()>e(window).width()&&l.addClass("fl-builder-submenu-right"),l.addClass("fl-builder-submenu-open")),FLBuilder._hideTipTips(),t.preventDefault(),t.stopPropagation()},_submenuChildClicked:function(t){var l=e(this).parents(".fl-builder-has-submenu");l.parents(".fl-builder-has-submenu").length||l.removeClass("fl-builder-submenu-open")},_submenuMouseenter:function(t){var l=e(this),i=l.data("timeout");"undefined"!=typeof i&&clearTimeout(i)},_submenuMouseleave:function(t){var l=e(this),i=setTimeout(function(){l.closest(".fl-builder-has-submenu").removeClass("fl-builder-submenu-open")},500);l.data("timeout",i)},_submenuNestedParentMouseenter:function(t){var l=e(this),i=l.find(".fl-builder-submenu");l.width()+l.offset().left+i.width()>e(window).width()&&l.addClass("fl-builder-submenu-right")},_closeAllSubmenus:function(){e(".fl-builder-submenu-open").removeClass("fl-builder-submenu-open")},_toolsClicked:function(){var e=[],t=FLBuilderConfig.lite,l=FLBuilderConfig.enabledTemplates;t||FLBuilderConfig.isUserTemplate||"enabled"!=l&&"user"!=l||(e[10]={key:"save-user-template",label:FLBuilderStrings.saveTemplate}),FLBuilderConfig.isUserTemplate?"undefined"!=typeof window.opener&&window.opener||(e[20]={key:"duplicate-layout",label:FLBuilderStrings.duplicateLayout}):e[20]={key:"duplicate-layout",label:FLBuilderStrings.duplicateLayout},e[30]={key:"layout-settings",label:FLBuilderStrings.editLayoutSettings},e[40]={key:"global-settings",label:FLBuilderStrings.editGlobalSettings},FLBuilder._showActionsLightbox({className:"fl-builder-tools-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_doneClicked:function(){var e=[],t=FLBuilderStrings.publish;"publish"==FLBuilderConfig.postStatus||FLBuilderConfig.userCanPublish||(t=FLBuilderStrings.submitForReview),e[10]={key:"publish",label:t},e[20]={key:"draft",label:FLBuilderStrings.draft},e[30]={key:"discard",label:FLBuilderStrings.discard},FLBuilder._showActionsLightbox({className:"fl-builder-save-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_upgradeClicked:function(){window.open(FLBuilderConfig.upgradeUrl)},_helpButtonClicked:function(){var e={};FLBuilderConfig.help.tour&&(e[10]={key:"help-tour",label:FLBuilderStrings.takeHelpTour}),FLBuilderConfig.help.video&&(e[20]={key:"help-video",label:FLBuilderStrings.watchHelpVideo}),FLBuilderConfig.help.knowledge_base&&(e[30]={key:"knowledge-base",label:FLBuilderStrings.viewKnowledgeBase}),FLBuilderConfig.help.forums&&(e[40]={key:"forums",label:FLBuilderStrings.visitForums}),FLBuilder._showActionsLightbox({className:"fl-builder-help-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_closePanel:function(){e(".fl-builder-panel").stop(!0,!0).animate({right:"-350px"},500,function(){e(this).hide()}),e(".fl-builder-bar .fl-builder-add-content-button").stop(!0,!0).fadeIn()},_showPanel:function(){e(".fl-builder-bar .fl-builder-add-content-button").stop(!0,!0).fadeOut(),e(".fl-builder-panel").stop(!0,!0).show().animate({right:"0"},500)},_blockSectionTitleClicked:function(){var t=e(this),l=t.parent();l.hasClass("fl-active")?l.removeClass("fl-active"):(e(".fl-builder-blocks-section").removeClass("fl-active"),l.addClass("fl-active")),FLBuilder._initScrollbars()},_publishButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_layout"},FLBuilder._exit),FLBuilder._actionsLightbox.close()},_draftButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_draft"},FLBuilder._exit),FLBuilder._actionsLightbox.close()},_discardButtonClicked:function(){var e=confirm(FLBuilderStrings.discardMessage);e&&(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"clear_draft_layout"},FLBuilder._exit),FLBuilder._actionsLightbox.close())},_cancelButtonClicked:function(){FLBuilder._exitUrl=null,FLBuilder._actionsLightbox.close()},_exit:function(){var e=window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&window.opener.FLBuilder._updateLayout(),window.close()):(FLBuilder._exitUrl?e=FLBuilder._exitUrl:(e=e.replace("?fl_builder&","?"),e=e.replace("?fl_builder",""),e=e.replace("&fl_builder","")),window.location.href=e)},_duplicateLayoutClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"duplicate_post"},FLBuilder._duplicateLayoutComplete)},_duplicateLayoutComplete:function(t){var l=e("#fl-admin-url").val();window.location.href=l+"post.php?post="+t+"&action=edit"},_layoutSettingsClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showLightbox(),FLBuilder._closePanel(),FLBuilder.ajax({action:"render_layout_settings"},FLBuilder._layoutSettingsLoaded)},_layoutSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.html),FLBuilder._layoutSettingsInitCSS()},_layoutSettingsInitCSS:function(){var t=e(".fl-builder-settings #fl-field-css textarea:not(.ace_text-input)");t.on("change",FLBuilder._layoutSettingsCSSChanged),FLBuilder._layoutSettingsCSSCache=t.val()},_layoutSettingsCSSChanged:function(){FLBuilder._layoutSettingsCSSTimeout&&clearTimeout(FLBuilder._layoutSettingsCSSTimeout),FLBuilder._layoutSettingsCSSTimeout=setTimeout(e.proxy(FLBuilder._layoutSettingsCSSDoChange,this),600)},_layoutSettingsCSSDoChange:function(){var t=e(".fl-builder-settings"),l=e(this),i=l.parents("#fl-field-css");i.find(".ace_error").length>0||(t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(l.val()):e("#fl-builder-global-css").html(l.val()),FLBuilder._layoutSettingsCSSTimeout=null)},_saveLayoutSettingsClicked:function(){for(var t=e(this).closest(".fl-builder-settings"),l=t.serializeArray(),i={},o=0;o<l.length;o++)i[l[o].name]=l[o].value;FLBuilder.showAjaxLoader(),FLBuilder._lightbox.close(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_layout_settings",settings:i},FLBuilder._updateLayout)},_cancelLayoutSettingsClicked:function(){var t=e(".fl-builder-settings");t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(FLBuilder._layoutSettingsCSSCache):e("#fl-builder-global-css").html(FLBuilder._layoutSettingsCSSCache),FLBuilder._layoutSettingsCSSCache=null},_globalSettingsClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_global_settings"},FLBuilder._globalSettingsLoaded)},_globalSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.html),FLBuilder._layoutSettingsInitCSS(),FLBuilder._initSettingsValidation({row_width:{required:!0,number:!0},responsive_breakpoint:{required:!0,number:!0}})},_saveGlobalSettingsClicked:function(){var t=e(this).closest(".fl-builder-settings"),l=t.validate().form(),i=t.serializeArray(),o={},s=0;if(l){for(;s<i.length;s++)o[i[s].name]=i[s].value;FLBuilder.showAjaxLoader(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_global_settings",settings:o},FLBuilder._saveGlobalSettingsComplete),FLBuilder._lightbox.close()}},_saveGlobalSettingsComplete:function(e){FLBuilderConfig.global=JSON.parse(e),FLBuilder._updateLayout()},_initTemplateSelector:function(){var t=e(FLBuilder._contentClass).find(".fl-row");0===t.length&&FLBuilder._showTemplateSelector()},_changeTemplateClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showTemplateSelector()},_showTemplateSelector:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||"disabled"!=FLBuilderConfig.enabledTemplates&&0!==e(".fl-builder-templates-button").length&&(FLBuilder._showLightbox(!1),FLBuilder.ajax({action:"render_template_selector"},FLBuilder._templateSelectorLoaded))},_templateSelectorLoaded:function(t){var l=JSON.parse(t),i=null,o=null;FLBuilder._setLightboxContent(l.html),i=e(".fl-template-category-select"),tabs=e(".fl-builder-settings-tab"),userTemplatesTab=e("#fl-builder-settings-tab-yours"),o=e(".fl-user-template"),("user"==FLBuilderConfig.enabledTemplates||o.length>0||userTemplatesTab.length>0&&1==tabs.length)&&(i.val("fl-builder-settings-tab-yours"),e(".fl-builder-settings-tab").removeClass("fl-active"),e("#fl-builder-settings-tab-yours").addClass("fl-active")),0===o.length&&e(".fl-user-templates-message").show(),e("body").trigger("fl-builder.template-selector-loaded")},_templateCategoryChanged:function(){e(".fl-template-selector .fl-builder-settings-tab").hide(),e("#"+e(this).val()).show()},_templateClicked:function(){var t=e(this),l=t.closest(".fl-template-preview").attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?0==l?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate(0,!1,"core")):(FLBuilder._selectedTemplateId=l,FLBuilder._selectedTemplateType="core",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(l,!1,"core")},_showTemplateActions:function(){var e=[];e[10]={key:"template-replace",label:FLBuilderStrings.templateReplace},e[20]={key:"template-append",label:FLBuilderStrings.templateAppend},FLBuilder._showActionsLightbox({className:"fl-builder-template-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_templateReplaceClicked:function(){confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!1,FLBuilder._selectedTemplateType))},_templateAppendClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!0,FLBuilder._selectedTemplateType)},_templateCancelClicked:function(){FLBuilder._lightbox._node.show()},_applyTemplate:function(e,t,l){t="undefined"!=typeof t&&t?"1":"0",l="undefined"==typeof l?"core":l,FLBuilder._lightbox.close(),FLBuilder.showAjaxLoader(),"core"==l?FLBuilder.ajax({action:"apply_template",template_id:e,append:t},FLBuilder._updateLayout):FLBuilder.ajax({action:"apply_user_template",template_id:e,append:t},FLBuilder._updateLayout)},_saveUserTemplateClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._showLightbox(!1),FLBuilder.ajax({action:"render_user_template_settings"},FLBuilder._userTemplateSettingsLoaded)},_userTemplateSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.html),FLBuilder._initSettingsValidation({name:{required:!0}})},_saveUserTemplateSettings:function(){var t=e(this).closest(".fl-builder-settings"),l=t.validate().form(),i=FLBuilder._getSettings(t);l&&(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_user_template",settings:i},FLBuilder._saveUserTemplateSettingsComplete),FLBuilder._lightbox.close())},_saveUserTemplateSettingsComplete:function(){FLBuilder.alert(FLBuilderStrings.templateSaved)},_userTemplateClicked:function(){var t=e(this).attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?"blank"==t?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate("blank",!1,"user")):(FLBuilder._selectedTemplateId=t,FLBuilder._selectedTemplateType="user",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(t,!1,"user")},_editUserTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteUserTemplateClicked:function(t){var l=e(this).closest(".fl-user-template"),i=l.attr("data-id"),o=e(".fl-user-template[data-id="+i+"]"),s=null;confirm(FLBuilderStrings.deleteTemplate)&&(FLBuilder.ajax({action:"delete_user_template",template_id:i}),o.fadeOut(function(){l=e(this),s=l.closest(".fl-user-template-category"),l.remove(),0===s.find(".fl-user-template").length&&s.remove(),1===e(".fl-user-template").length&&(e(".fl-user-templates").hide(),e(".fl-user-templates-message").show())})),t.stopPropagation()},_watchVideoClicked:function(){var e=wp.template("fl-video-lightbox");FLBuilder._actionsLightbox.close(),FLBuilder._lightbox.open(e({video:FLBuilderConfig.help.video_embed}))},_viewKnowledgeBaseClicked:function(){FLBuilder._actionsLightbox.close(),window.open(FLBuilderConfig.help.knowledge_base_url)},_visitForumsClicked:function(){FLBuilder._actionsLightbox.close(),window.open(FLBuilderConfig.help.forums_url)},_showTourOrTemplates:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||(FLBuilderConfig.help.tour&&FLBuilderConfig.newUser?FLBuilder._showTourLightbox():FLBuilder._initTemplateSelector())},_showTourLightbox:function(){var e=wp.template("fl-tour-lightbox");FLBuilder._actionsLightbox.open(e())},_noTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._initTemplateSelector()},_yesTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_startHelpTour:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_setupEmptyLayout:function(){var t=e(FLBuilder._contentClass);FLBuilderConfig.isUserTemplate&&"module"==FLBuilderConfig.userTemplateType||(t.removeClass("fl-builder-empty"),t.find(".fl-builder-empty-message").remove(),0===t.children(".fl-row").length&&(t.addClass("fl-builder-empty"),t.append('<span class="fl-builder-empty-message">'+FLBuilderStrings.emptyMessage+"</span>"),FLBuilder._initSortables()))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",l=e(FLBuilder._contentClass+" .fl-row"),i=null,o=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),s=null,r=null,n=0;for(e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),l.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),l.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');n<l.length;n++)i=l.eq(n),0===i.find(".fl-col-group").length&&i.find(".fl-row-content").append('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(n=0;n<o.length;n++)s=o.eq(n),r=s.find("> .fl-col"),s.hasClass("fl-col-group-nested")||(s.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),s.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),r.append('<div class="fl-drop-target fl-col-drop-target"></div>'),r.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var l=t.clone();return t.clone().insertAfter(t),l.addClass("fl-builder-block-drag-helper"),l},_blockDragInit:function(t){var l=e(t.currentTarget),i=null,o=e(window).scrollTop(),s=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=o,l.closest("[data-node]").length>0?(i=l.closest("[data-node]"),i.addClass("fl-node-drag-init")):l.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===i&&e(this).offset().top-o>0&&(i=e(this))}),null!==i&&(s=i.offset().top-o),FLBuilder._highlightRowsAndColsForDrag(l),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),s>0&&scrollTo(0,i.offset().top-s)},_blockDragStart:function(t,l){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init")},_blockDragSort:function(t,l){var i=l.placeholder.parent(),o=FLBuilderStrings.insert;FLBuilder._blockPreventSort(l.item,i)||(i.hasClass("fl-col-content")?o=l.item.hasClass("fl-builder-block-row")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:l.item.hasClass("fl-builder-block-module")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-builder-block-saved-module")||l.item.hasClass("fl-builder-block-module-template")?l.item.find(".fl-builder-block-title").text():l.item.attr("data-name"):i.hasClass("fl-col-drop-target")?o="":i.hasClass("fl-col-group-drop-target")?o="":i.hasClass("fl-row-drop-target")&&(o=l.item.hasClass("fl-builder-block-row")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-builder-block-saved-row")?l.item.find(".fl-builder-block-title").text():l.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),l.placeholder.html(o),l.item.hasClass("fl-node-global")||l.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?l.placeholder.addClass("fl-builder-drop-zone-global"):l.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.hide(),t.placeholder.fadeIn(100)},_blockPreventSort:function(t,l){var i=!1,o=t.hasClass("fl-builder-block-row"),s=t.hasClass("fl-col-sortable-proxy-item"),r=l.hasClass("fl-col-content"),n=l.hasClass("fl-col-drop-target"),a=l.parents(".fl-col-group:not(.fl-col-group-nested)"),d=l.parents(".fl-col-group-nested");return(o||s)&&r&&d.length>0&&(i=!0),r&&!l.find(".fl-module, .fl-col").length&&(o&&"1-col"==t.data("cols")?i=!0:s&&(i=!0)),o&&r&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(i=!0),s&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(r||n&&d.length>0)&&(i=!0),n&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(i=!0),n&&d.length>0&&d.find(".fl-col:visible").length>3&&(i=!0),i&&l.addClass("fl-sortable-disabled"),i},_blockDragStop:function(t,l){var i=e(window).scrollTop(),o=l.item.parent(),s=null;o.hasClass("fl-drop-target")&&o.closest("[data-node]").length?(o=o.closest("[data-node]"),s=o.offset().top-i):s=o.offset().top-i,o.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,o.offset().top-s)},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t,silent:!0})},_moveNode:function(e,t,l){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:l,silent:!0})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips()},_appendOverlay:function(e,t){var l=0,i=null,o=e.hasClass("fl-row"),s=o?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),r={top:parseInt(s.css("margin-top"),10),bottom:parseInt(s.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),i=e.find("> .fl-block-overlay"),r.top<0&&(l=parseInt(i.css("top"),10),l=isNaN(l)?0:l,i.css("top",r.top+l+"px")),r.bottom<0&&(l=parseInt(i.css("bottom"),10),l=isNaN(l)?0:l,i.css("bottom",r.bottom+l+"px")),i},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),l=t.data("original"),i=0,o=null,s=0,r=null,n=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=l&&(t.after(l),t.remove(),t=l),t.data("original",t.clone()),i=t[0].getBoundingClientRect().width,o=t.find(" > i, > span.fl-builder-has-submenu");n<o.length;n++)r=o.eq(n),s+=r.outerWidth(),s>i?(d.push(r),r.remove()):a.push(r);if(d.length>0){for(d.unshift(a.pop().remove()),n=0;n<d.length;n++)d[n].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[n].find(".fa").data("title"),submenu:d[n].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",
|
4 |
+
label:d[n].data("title"),className:d[n].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height")},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),l=t.offset().top,i=null,o=null,s=wp.template("fl-row-overlay");t.hasClass("fl-block-overlay-active")||(o=FLBuilder._appendOverlay(t,s({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;i=null===i||i>t?t:i}),null!==i&&i<l&&o.css("top",i-l-30+"px"),o.offset().top<43&&o.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}))},_rowMouseleave:function(t){var l=e(t.toElement)||e(t.relatedTarget),i=l.hasClass("fl-row-overlay"),o=l.closest(".fl-row-overlay").length>0,s=l.is("#tiptip_holder"),r=l.closest("#tiptip_holder").length>0;i||o||s||r||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var l=e(t.target),i=e(".fl-row-sortable-proxy-item"),o=l.closest(".fl-row");o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=i[0],i.trigger(t)},_rowDragStart:function(t,l){var i=e(FLBuilder._contentClass+" .fl-row"),o=e(".fl-node-dragging");1===i.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),o.hide(),FLBuilder._blockDragStart(t,l)},_rowDragStop:function(t,l){var i=l.item,o=i.parent(),s=null,r=null,n=0;if(FLBuilder._blockDragStop(t,l),o.hasClass("fl-builder-rows"))return void i.remove();if(o.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(i.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return i.remove(),void FLBuilder._showPanel();o.hasClass("fl-col-content")?FLBuilder._addColGroup(i.closest(".fl-col").attr("data-node"),i.attr("data-cols"),o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(i)):o.hasClass("fl-col-drop-target")?FLBuilder._addCols(o.closest(".fl-col"),o.hasClass("fl-col-drop-target-last")?"after":"before",i.attr("data-cols"),o.closest(".fl-col-group-nested").length>0):o.hasClass("fl-col-group-drop-target")?(r=i.closest(".fl-col-group"),n=i.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(r),FLBuilder._addColGroup(i.closest(".fl-row").attr("data-node"),i.attr("data-cols"),o.hasClass("fl-drop-target-last")?n+1:n)):(s=i.closest(".fl-row"),n=s.length?e(FLBuilder._contentClass+" .fl-row").index(s):0,FLBuilder._addRow(i.attr("data-cols"),o.hasClass("fl-drop-target-last")?n+1:n)),i.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else s=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o.parent().hasClass("fl-builder-content")||(o.hasClass("fl-drop-target-last")?o.parent().after(s):o.parent().before(s),FLBuilder._reorderNode(s.attr("data-node"),s.index())),e(".fl-row-sortable-proxy").append(l.item)},_addRow:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder._newRowPosition=t,FLBuilder.ajax({action:"render_new_row",cols:e,position:t},FLBuilder._addRowComplete)},_addRowComplete:function(t){var l=JSON.parse(t),i=e(FLBuilder._contentClass),o=e(l.html).data("node"),s=FLBuilder._addModuleAfterNodeRender;l.nodeParent=i,l.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(l,function(){null!==s&&(e(".fl-node-"+o+" .fl-col-content").append(s),FLBuilder._reorderModule(s),FLBuilder._addModuleAfterNodeRender=null)})},_deleteRowClicked:function(t){var l=e(this).closest(".fl-row"),i=null;l.find(".fl-module").length?(i=confirm(FLBuilderStrings.deleteRowMessage),i&&FLBuilder._deleteRow(l)):FLBuilder._deleteRow(l),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){FLBuilder.ajax({action:"delete_node",node_id:e.attr("data-node"),silent:!0}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays()},_rowCopyClicked:function(t){var l=e(this).closest(".fl-row"),i=l.attr("data-node");FLBuilder.showAjaxLoader(),FLBuilder._removeAllOverlays(),FLBuilder._newRowPosition=l.index(".fl-row")+1,FLBuilder.ajax({action:"copy_row",node_id:i},FLBuilder._rowCopyComplete),t.stopPropagation()},_rowCopyComplete:function(t){var l=JSON.parse(t);l.nodeParent=e(FLBuilder._contentClass),l.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(l)},_rowSettingsClicked:function(t){var l=e(this),i=l.closest(".fl-row").attr("data-node"),o=l.closest(".fl-block-overlay-global").length>0;o&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&window.open(e('.fl-row[data-node="'+i+'"]').attr("data-template-url")):l.hasClass("fl-block-settings")&&(FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_row_settings",node_id:i},FLBuilder._rowSettingsLoaded)),t.stopPropagation()},_rowSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._setSettingsFormContent(t.settings),FLBuilder.preview=new FLBuilderPreview({type:"row",state:t.state})},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",l=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),l.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),l.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_highlightRowsAndColsForDrag:function(t){var l="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+l).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",l=e(FLBuilder._contentClass),i=l.find(t+".fl-col-group:not(.fl-col-group-nested) > .fl-col > .fl-col-content"),o=l.find(t+".fl-col-group-nested .fl-col-content"),s=0;for(e(".fl-node-drag-init").hide();s<o.length;s++)FLBuilder._adjustColHeightForDrag(o.eq(s));for(s=0;s<i.length;s++)FLBuilder._adjustColHeightForDrag(i.eq(s));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),l=t.find("a"),i=t.closest(".fl-col"),o=i.parents(".fl-col"),s=e('<div class="fl-col-highlight-guide"></div>'),r=null,n=t.closest(".fl-block-overlay").offset().top;(l.hasClass("fl-block-col-move-parent")||l.hasClass("fl-block-col-edit-parent"))&&(i=o),i.hasClass("fl-col-highlight")||(i.find("> .fl-col-content").append(s),i.addClass("fl-col-has-highlight-guide"),r=s.offset().top,r>n&&s.css("top",n-r+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),l=t.closest(".fl-col-group"),i=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,s=t.closest(".fl-col-group").find("> .fl-col").length,r=l.find("> .fl-col").index(t),n=0===r,a=s===r+1,d=t.find(".fl-col").length>0,u=t.parents(".fl-col"),c=u.closest(".fl-col-group"),f=u.length>0,h=f?c.find("> .fl-col").length:0,p=c.find("> .fl-col").index(u),g=!!f&&0===p,_=!!f&&h===p+1,m=t.find("> .fl-col-content").width(),b=wp.template("fl-col-overlay"),v=null;FLBuilderConfig.simpleUi||i&&o&&"row"!=FLBuilderConfig.userTemplateType||t.find(".fl-module").length>0||t.find(".fl-col").length>0||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),v=FLBuilder._appendOverlay(t,b({global:i,numCols:s,first:n,last:a,hasChildCols:d,hasParentCol:f,parentFirst:g,parentLast:_,numParentCols:h,contentWidth:m})),FLBuilder._buildOverlayOverflowMenu(v),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var l=e(this),i=e(t.toElement)||e(t.relatedTarget),o=l.find(".fl-module").length>0,s=i.is("#tiptip_holder"),r=i.closest("#tiptip_holder").length>0;s||r||o||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted")},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var l=e(t.target),i=e(".fl-col-sortable-proxy-item"),o=l.closest(".fl-col");l.hasClass("fl-block-col-move-parent")&&(o=o.parents(".fl-col")),o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=i[0],i.trigger(t)},_colDragStart:function(t,l){var i=e(".fl-node-dragging");i.hide(),FLBuilder._resetColumnWidths(i.parent()),FLBuilder._blockDragStart(t,l)},_colDragStop:function(t,l){FLBuilder._blockDragStop(t,l);var i=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o=i.attr("data-node"),s=l.item.parent(),r=i.parent(),n=r.attr("data-node");newGroup=s.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=s.closest(".fl-row"),position=0,s.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(r):s.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(r):s.hasClass("fl-col-content")?(i.remove(),0===r.find(".fl-col").length&&r.remove(),position=s.find(".fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(l.item),FLBuilder._addColGroup(s.closest(".fl-col").attr("data-node"),o,position)):s.hasClass("fl-col-drop-target")?(s.hasClass("fl-col-drop-target-last")?s.parent().after(i):s.parent().before(i),FLBuilder._resetColumnWidths(newGroup),n==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:o,position:i.index(),silent:!0}):FLBuilder.ajax({action:"move_col",node_id:o,new_parent:newGroupId,position:i.index(),resize:[n,newGroupId],silent:!0}),FLBuilder._resizeLayout()):s.hasClass("fl-col-group-drop-target")?(i.remove(),0===r.find(".fl-col").length&&r.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),o,position)):s.hasClass("fl-row-drop-target")&&(i.remove(),position=s.closest(".fl-builder-content").find(".fl-row").index(newRow),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(o,position)),0===r.find(".fl-col").length&&r.remove(),e(".fl-col-sortable-proxy").append(l.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables()},_colSettingsClicked:function(t){var l=e(this),i=l.closest(".fl-col"),o=null;FLBuilder._colResizing||(o=l.hasClass("fl-block-col-edit-parent")?i.parents(".fl-col").data("node"):i.attr("data-node"),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_column_settings",node_id:o},FLBuilder._colSettingsLoaded),t.stopPropagation())},_colSettingsLoaded:function(t){var l=JSON.parse(t),i=null,o=null,s=null,r=null;FLBuilder._setSettingsFormContent(l.settings),i=e(".fl-builder-col-settings"),o=i.data("node"),s=e('.fl-col[data-node="'+o+'"]'),r=s.find("> .fl-col-content"),0===s.siblings(".fl-col").length?e(i).find("#fl-builder-settings-section-general").css("display","none"):r.width()<=40&&e("#fl-field-size").hide(),FLBuilder.preview=new FLBuilderPreview({type:"col",state:l.state})},_deleteColClicked:function(t){var l=e(this),i=l.closest(".fl-col"),o=i.closest(".fl-col-group"),s=i.parents(".fl-col"),r=s.length>0,n=s.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=i.siblings(".fl-col"),d=!0;i.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),r&&1===n.length&&(0===a.length?i=s:1!==a.length||a.find(".fl-module").length||(i=o)),d&&(FLBuilder._deleteCol(i),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.closest(".fl-row"),l=e.closest(".fl-col-group"),i=0;e.remove(),rowCols=t.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(t):(0===groupCols.length?l.remove():(i=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",i+"%")),FLBuilder.ajax({action:"delete_col",node_id:e.attr("data-node"),new_width:i,silent:!0}),FLBuilder._initDropTargets(),FLBuilder._initSortables())},_addCols:function(e,t,l,i){l="undefined"==typeof l?"1-col":l,i="undefined"!=typeof i&&i,FLBuilder.showAjaxLoader(),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:l,nested:i?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var l=JSON.parse(t),i=null,o=FLBuilder._addModuleAfterNodeRender;FLBuilder._renderLayout(l,function(){null!==o&&(e('[data-node="'+o.module.data("node")+'"]').remove(),i=e('[data-node="'+o.colId+'"]'),"after"==o.position?i.next().find(".fl-col-content").append(o.module):i.prev().find(".fl-col-content").append(o.module),FLBuilder._reorderModule(o.module),FLBuilder._addModuleAfterNodeRender=null)})},_addColGroup:function(t,l,i){var o=e(".fl-node-"+t);FLBuilder.showAjaxLoader(),FLBuilder._newColGroupPosition=i,o.hasClass("fl-col")?FLBuilder._newColGroupParent=o.find(" > .fl-col-content"):FLBuilder._newColGroupParent=o.find(".fl-row-content"),FLBuilder.ajax({action:"render_new_column_group",cols:l,node_id:t,position:i},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var l=JSON.parse(t),i=e(l.html).find(".fl-col").data("node"),o=FLBuilder._addModuleAfterNodeRender;l.nodeParent=FLBuilder._newColGroupParent,l.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(l,function(){l.nodeParent.hasClass("fl-col-content")&&l.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==o&&(e(".fl-node-"+i+" .fl-col-content").append(o),FLBuilder._reorderModule(o),FLBuilder._addModuleAfterNodeRender=null)})},_initColDragResizing:function(){e(".fl-block-col-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,l){var i=e(l.helper),o="",s=i.hasClass("fl-block-col-resize-parent"),r=s?i.closest(".fl-col").parents(".fl-col"):null,n=s?r.parents(".fl-col-group"):i.closest(".fl-col-group"),a=n.find("> .fl-col"),d=s?r:i.closest(".fl-col"),u=null,c=100,f=0;for(i.hasClass("fl-block-col-resize-e")?(o="e",u=d.next(".fl-col")):(o="w",u=d.prev(".fl-col"));f<a.length;f++)a.eq(f).data("node")!=d.data("node")&&a.eq(f).data("node")!=u.data("node")&&(c-=parseFloat(a.eq(f)[0].style.width));FLBuilder._colResizeData={handle:i,feedbackLeft:i.find(".fl-block-col-resize-feedback-left"),feedbackRight:i.find(".fl-block-col-resize-feedback-right"),direction:o,groupWidth:n.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:u,offset:l.position.left,availWidth:c},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var l=FLBuilder._colResizeData,i=(l.offset-t.position.left)/l.groupWidth,o="e"==l.direction?100*(l.colWidth-i):100*(l.colWidth+i),s=Math.round(100*o)/100,r=l.availWidth-o,n=Math.round(100*r)/100,a=8,d=Math.round(100*(l.availWidth-a))/100;s<a?(s=a,n=d):n<a&&(s=d,n=a),"e"==l.direction?(l.feedbackLeft.html(s.toFixed(1)+"%").show(),l.feedbackRight.html(n.toFixed(1)+"%").show()):(l.feedbackLeft.html(n.toFixed(1)+"%").show(),l.feedbackRight.html(s.toFixed(1)+"%").show()),l.col.css("width",s+"%"),l.sibling.css("width",n+"%"),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,l){var i=FLBuilder._colResizeData,o=FLBuilder._colResizeData.handle.closest(".fl-block-overlay");FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:i.col.data("node"),col_width:parseFloat(i.col[0].style.width),sibling_id:i.sibling.data("node"),sibling_width:parseFloat(i.sibling[0].style.width),silent:!0}),FLBuilder._buildOverlayOverflowMenu(o),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop")},_resetColumnWidthsClicked:function(t){var l=e(this).parents(".fl-col-group").last(),i=[l.data("node")],o=l.find(".fl-col-group"),s=0;for(FLBuilder._resetColumnWidths(l);s<o.length;s++)FLBuilder._resetColumnWidths(o.eq(s)),i.push(o.eq(s).data("node"));FLBuilder.ajax({action:"reset_col_widths",group_id:i,silent:!0}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),l=0;l=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",l+"%")},_moduleMouseenter:function(){var t=e(this),l=t.attr("data-name"),i=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,s=t.closest(".fl-col-group").find("> .fl-col").length,r=t.closest(".fl-col"),n=0===r.index(),a=s===r.index()+1,d=r.parents(".fl-col"),u=d.length>0,c=u?d.closest(".fl-col-group").find("> .fl-col").length:0,f=!!u&&0===d.index(),h=!!u&&c===d.index()+1,p=r.find("> .fl-col-content").width(),g=wp.template("fl-module-overlay"),_=null;FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),i&&o&&"row"!=FLBuilderConfig.userTemplateType||(t.hasClass("fl-block-overlay-active")||(_=FLBuilder._appendOverlay(t,g({global:i,moduleName:l,numCols:s,colFirst:n,colLast:a,hasParentCol:u,numParentCols:c,parentFirst:f,parentLast:h,contentWidth:p})),FLBuilder._buildOverlayOverflowMenu(_),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var l=(e(this),e(t.toElement)||e(t.relatedTarget)),i=l.is("#tiptip_holder"),o=l.closest("#tiptip_holder").length>0;i||o||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),e("body").removeClass("fl-block-overlay-muted")},_moduleDragHelper:function(t,l){return e('<div class="fl-builder-block-drag-helper">'+l.attr("data-name")+"</div>")},_moduleDragStart:function(t,l){e(l.item).data("original-position",l.item.index()),FLBuilder._blockDragStart(t,l)},_moduleDragStop:function(t,l){FLBuilder._blockDragStop(t,l);var i=l.item,o=i.parent(),s=null,r=0,n=0;if(o.hasClass("fl-builder-modules")||o.hasClass("fl-builder-widgets"))return void i.remove();if(i.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return i.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=i.closest(".fl-builder-content"),n=0,s=i.closest(".fl-row"),r=o.find(".fl-row").index(s)):o.hasClass("fl-col-group-drop-target")?(o=i.closest(".fl-row-content"),n=o.closest(".fl-row").attr("data-node"),s=i.closest(".fl-col-group"),r=o.find(" > .fl-col-group").index(s)):o.hasClass("fl-col-drop-target")?(o=i.closest(".fl-col-group"),n=o.attr("data-node"),s=i.closest(".fl-col"),r=o.find(" > .fl-col").index(s)):(r=o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(i),n=i.closest(".fl-col").attr("data-node")),i.closest(".fl-drop-target-last").length&&(r+=1),FLBuilder._addModule(o,n,i.attr("data-type"),r,i.attr("data-widget")),i.remove()}else{if(o.hasClass("fl-sortable-disabled"))return e(t.target).append(l.item),e(t.target).children().eq(l.item.data("original-position")).before(l.item),void FLBuilder._highlightEmptyCols();o.hasClass("fl-row-drop-target")?(s=i.closest(".fl-row"),r=i.closest(".fl-builder-content").children(".fl-row").index(s),r=i.closest(".fl-drop-target-last").length?r+1:r,FLBuilder._addModuleAfterNodeRender=i,FLBuilder._addRow("1-col",r),i.remove()):o.hasClass("fl-col-group-drop-target")?(s=i.closest(".fl-col-group"),r=i.closest(".fl-row-content ").find(" > .fl-col-group").index(s),r=i.closest(".fl-drop-target-last").length?r+1:r,FLBuilder._addModuleAfterNodeRender=i,FLBuilder._addColGroup(i.closest(".fl-row").attr("data-node"),"1-col",r),i.remove()):o.hasClass("fl-col-drop-target")?(s=i.closest(".fl-col"),r=i.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:i,colId:s.data("node"),position:r},FLBuilder._addCols(s,r,"1-col",i.closest(".fl-col-group-nested").length>0),i.remove()):FLBuilder._reorderModule(i)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),l=e.attr("data-parent"),i=e.attr("data-node"),o=e.index();t==l?FLBuilder._reorderNode(i,o):(e.attr("data-parent",t),FLBuilder._moveNode(t,i,o))},_deleteModuleClicked:function(t){var l=e(this).closest(".fl-module"),i=confirm(FLBuilderStrings.deleteModuleMessage);i&&(FLBuilder._deleteModule(l),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row");FLBuilder.ajax({action:"delete_node",node_id:e.attr("data-node"),silent:!0}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays()},_moduleCopyClicked:function(t){var l=e(this).closest(".fl-module");FLBuilder.showAjaxLoader(),FLBuilder._removeAllOverlays(),FLBuilder._newModuleParent=l.parent(),FLBuilder._newModulePosition=l.index()+1,FLBuilder.ajax({action:"copy_module",node_id:l.attr("data-node")},FLBuilder._moduleCopyComplete),t.stopPropagation()},_moduleCopyComplete:function(e){var t=JSON.parse(e);t.nodeParent=FLBuilder._newModuleParent,t.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(t)},_moduleSettingsClicked:function(t){var l=e(this),i=l.closest(".fl-module").attr("data-node"),o=l.closest(".fl-col").attr("data-node"),s=l.closest(".fl-module").attr("data-type"),r=l.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||r&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings(i,o,s)},_showModuleSettings:function(e,t,l){FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder.ajax({action:"render_module_settings",node_id:e,type:l,parent_id:t},FLBuilder._moduleSettingsLoaded)},_moduleSettingsLoaded:function(t){var l=JSON.parse(t),i=e("<div>"+l.settings+"</div>"),o=i.find("link.fl-builder-settings-css"),s=i.find("script.fl-builder-settings-js"),r=i.find(".fl-builder-settings"),n=r.attr("data-type"),a=null,d=null,u=null;e.inArray(n,FLBuilder._loadedModuleAssets)>-1?(o.remove(),s.remove()):(e("head").append(o),e("head").append(s),FLBuilder._loadedModuleAssets.push(n)),FLBuilder._setSettingsFormContent(i),"undefined"!=typeof l.layout&&(a=l.layout,a.nodeParent=FLBuilder._newModuleParent,a.nodePosition=FLBuilder._newModulePosition),"undefined"!=typeof l.state&&(d=l.state),FLBuilder.preview=new FLBuilderPreview({type:"module",layout:a,state:d}),u=FLBuilder._moduleHelpers[n],"undefined"!=typeof u&&(FLBuilder._initSettingsValidation(u.rules),u.init())},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),l=t.attr("data-type"),i=(t.attr("data-node"),FLBuilder._moduleHelpers[l]),o=!0;"undefined"!=typeof i&&(t.find("label.error").remove(),t.validate().hideErrors(),o=t.validate().form(),o&&(o=i.submit())),o?(FLBuilder._saveSettings(),FLBuilder._lightbox.close()):FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,l,i,o){FLBuilder.showAjaxLoader(),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=i),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:l,position:i,node_preview:1,widget:"undefined"==typeof o?"":o},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){FLBuilder._showLightbox(),FLBuilder._moduleSettingsLoaded(t),e(".fl-builder-module-settings").data("new-module","1")},registerModuleHelper:function(t,l){var i={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},i,l)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var l=e(".fl-builder-settings-lightbox .fl-builder-settings");FLBuilder._saveSettings(),FLBuilder.ajax({action:"render_node_template_settings",node_id:l.attr("data-node")},FLBuilder._nodeTemplateSettingsLoaded)},_nodeTemplateSettingsLoaded:function(e){var t=JSON.parse(e);FLBuilder._showLightbox(!1),FLBuilder._setSettingsFormContent(t.html),FLBuilder._initSettingsValidation({name:{required:!0}})},_saveNodeTemplate:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.validate().form();l&&(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_node_template",node_id:t.attr("data-node"),settings:FLBuilder._getSettings(t)},FLBuilder._saveNodeTemplateComplete),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var l=JSON.parse(t),i=e(".fl-builder-saved-"+l.type+"s"),o=i.find(".fl-builder-block"),s=null,r="",n=l.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block");if("row"==l.type?FLBuilder.alert(FLBuilderStrings.rowTemplateSaved):"module"==l.type&&FLBuilder.alert(FLBuilderStrings.moduleTemplateSaved),l.layout&&FLBuilder._renderLayout(l.layout),0===o.length)i.append(d(l));else for(;a<o.length;a++){if(s=o.eq(a),r=s.text().toLowerCase().trim(),0===a&&n<r){i.prepend(d(l));break}if(n<r){s.before(d(l));break}if(o.length-1===a){i.append(d(l));break}}i.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,l){FLBuilder._blockDragStop(t,l);var i=l.item,o=i.parent(),s=null,r=0,n=null,a="",d=null;if(i.hasClass("fl-builder-block-saved-row")||i.hasClass("fl-builder-block-row-template"))n=i.closest(".fl-row"),r=n.length?e(FLBuilder._contentClass+" .fl-row").index(n):0,r=o.hasClass("fl-drop-target-last")?r+1:r,s=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=r;else if(i.hasClass("fl-builder-block-saved-module")||i.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,o.hasClass("fl-sortable-disabled"))return i.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=i.closest(".fl-builder-content"),s=0,r=o.find(".fl-row").index(i.closest(".fl-row"))):o.hasClass("fl-col-group-drop-target")?(o=i.closest(".fl-row-content"),s=o.closest(".fl-row").attr("data-node"),r=o.find(" > .fl-col-group").index(i.closest(".fl-col-group"))):o.hasClass("fl-col-drop-target")?(o=i.closest(".fl-col-group"),r=o.children(".fl-col").index(i.closest(".fl-col")),s=o.attr("data-node")):(r=o.children(".fl-module, .fl-builder-block").index(i),s=i.closest(".fl-col").attr("data-node")),i.closest(".fl-drop-target-last").length&&(r+=1),o.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=o,FLBuilder._newModulePosition=r)}FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:a,template_id:i.attr("data-id"),template_type:i.attr("data-type"),parent_id:s,position:r},d),i.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var l=e(t.target),i=l.closest(".fl-builder-blocks-section"),o=i.find(".fl-builder-blocks-section-content"),s=o.find(".fl-builder-block"),r=l.closest(".fl-builder-block"),n=r.hasClass("fl-builder-block-global"),a=n?FLBuilder._updateLayout:void 0,d=n?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate;confirm(d)&&(r.remove(),1===s.length&&(r.hasClass("fl-builder-block-saved-row")?o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),FLBuilder.ajax({action:"delete_node_template",template_id:r.attr("data-id"),silent:!r.hasClass("fl-builder-block-global")},a))},_initSettingsForms:function(){FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder.triggerHook("settings-form-init")},_setSettingsFormContent:function(e){FLBuilder._setLightboxContent(e),FLBuilder._initSettingsForms()},_settingsTabClicked:function(t){var l=e(this),i=l.closest(".fl-builder-settings"),o=l.attr("href").split("#").pop();i.find(".fl-builder-settings-tab").removeClass("fl-active"),i.find("#"+o).addClass("fl-active"),i.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),e(this).addClass("fl-active"),t.preventDefault()},_settingsCancelClicked:function(t){var l=e(".fl-builder-module-settings"),i=null,o=null,s=null,r=null;l.length>0&&"undefined"!=typeof l.data("new-module")?(i=e(FLBuilder.preview.state.html),o=e(".fl-node-"+l.data("node")),s=o.closest(".fl-col"),r=i.find(".fl-node-"+s.data("node")),r.length>0?FLBuilder._deleteModule(o):FLBuilder._deleteCol(s)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,FLLightbox.closeParent(this)},_initSettingsValidation:function(t,l){var i=e(".fl-builder-settings").last();i.validate({ignore:[],rules:t,messages:l,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),l=t.find(".fl-builder-settings-tab"),i=null,o=null,s=0;s<l.length;s++)i=l.eq(s),o=i.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+i.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),o.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"))},_getSettings:function(t){FLBuilder._updateEditorFields();var l=t.serializeArray(),i=0,o=0,s="",r="",n="",a=[],d=[],u={};for(i=0;i<l.length;i++)if(s=l[i].value.replace(/\r/gm,""),!(l[i].name.indexOf("flrich")>-1))if(l[i].name.indexOf("[")>-1){for(r=l[i].name.replace(/\[(.*)\]/,""),n=l[i].name.replace(r,""),a=[],d=n.match(/\[[^\]]*\]/g),o=0;o<d.length;o++)"[]"!=d[o]&&a.push(d[o].replace(/\[|\]/g,""));n.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[r]&&(u[r]={}),"undefined"==typeof u[r][a[0]]&&(u[r][a[0]]={}),"undefined"==typeof u[r][a[0]][a[1]]&&(u[r][a[0]][a[1]]={}),u[r][a[0]][a[1]]=s):n.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[r]&&(u[r]={}),"undefined"==typeof u[r][a[0]]&&(u[r][a[0]]=[]),u[r][a[0]].push(s)):n.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[r]&&(u[r]={}),u[r][a[0]]=s):n.match(/\[\]/)&&("undefined"==typeof u[r]&&(u[r]=[]),u[r].push(s))}else u[l[i].name]=s;for(n in u)if("undefined"!=typeof u["as_values_"+n]){u[n]=e.grep(u["as_values_"+n].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+n]}catch(c){}}return u},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.attr("data-node"),i=FLBuilder._getSettings(t);FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_settings",node_id:l,settings:i},FLBuilder._saveSettingsComplete),FLBuilder._lightbox.close()},_saveSettingsComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder.preview&&(FLBuilder.preview.clear(),
|
5 |
+
FLBuilder.preview=null)})},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){e(".fl-suggest-field").each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args")))},_updateAutoSuggestField:function(t,l,i){e(this).siblings(".as-values").val(i.join(",")).trigger("change")},_initMultipleFields:function(){for(var t=e(".fl-builder-field-multiples"),l=null,i=null,o=0,s=FLBuilderConfig.isRtl?{left:10}:{right:10};o<t.length;o++)l=t.eq(o),i=l.find(".fl-builder-field-multiple"),1===i.length?i.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):i.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:s,distance:5,opacity:.5,helper:FLBuilder._fieldDragHelper,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer"})},_addFieldClicked:function(){var t=e(this),l=t.attr("data-field"),i=t.closest("tr").siblings("tr[data-field="+l+"]").last(),o=i.clone(),s=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;o.find("th label span.fl-builder-field-index").html(s),o.find(".fl-form-field-preview-text").html(""),o.find("input, textarea, select").val(""),i.after(o),FLBuilder._initMultipleFields()},_copyFieldClicked:function(){var t=e(this),l=t.closest("tr"),i=l.clone(),o=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;i.find("th label span.fl-builder-field-index").html(o),l.after(i),FLBuilder._renumberFields(l.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),l=t.parent(),i=confirm(FLBuilderStrings.deleteFieldMessage);i&&(t.remove(),FLBuilder._renumberFields(l),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),l=0;l<t.length;l++)t.eq(l).find("th label span.fl-builder-field-index").html(l+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),l=t.attr("data-toggle"),i=t.attr("data-hide"),o=t.attr("data-trigger"),s=t.val(),r=0;if("undefined"!=typeof l){l=JSON.parse(l);for(r in l)FLBuilder._settingsSelectToggle(l[r].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[r].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[r].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof l[s]&&(FLBuilder._settingsSelectToggle(l[s].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(l[s].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[s].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof i&&(i=JSON.parse(i),"undefined"!=typeof i[s]&&(FLBuilder._settingsSelectToggle(i[s].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[s].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[s].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof o&&(o=JSON.parse(o),"undefined"!=typeof o[s]&&"undefined"!=typeof o[s].fields))for(r=0;r<o[s].fields.length;r++)e("#fl-field-"+o[s].fields[r]).find("select").trigger("change")},_settingsSelectToggle:function(t,l,i,o){var s=0;if(o="undefined"==typeof o?"":o,"undefined"!=typeof t)for(;s<t.length;s++)e(i+t[s]+o)[l](),"#fl-field-"==i&&"code"==e(i+t[s]).data("type")&&e(i+t[s]).data("editor").resize()},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded},mode:"hsv"}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}))},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),l=e(this).closest(".fl-photo-field"),i=l.find("input[type=hidden]"),o=i.val(),s=null;e(this).hasClass("fl-photo-replace")?(t.reset(),l.addClass("fl-photo-empty"),i.val("")):""!==o?(s=wp.media.attachment(o),s.fetch(),t.add(s?[s]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),l=e(this).closest(".fl-photo-field"),i=l.find("input[type=hidden]"),o=l.find(".fl-photo-preview img"),s=l.find("select");i.val(t.id),o.attr("src",FLBuilder._getPhotoSrc(t)),l.removeClass("fl-photo-empty"),l.find("label.error").remove(),s.show(),s.html(FLBuilder._getPhotoSizeOptions(t)),s.trigger("change")},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),l="undefined"!=typeof t?t.get("selection"):null,i=e(this).closest(".fl-photo-field"),o=i.find("input[type=hidden]"),s=i.find("select");l&&l.reset(),i.addClass("fl-photo-empty"),o.val(""),s.html('<option value="" selected></option>'),s.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e){var t="",l=null,i=null,o="",s={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes)t+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else for(l in e.sizes)o="undefined"!=typeof s[l]?s[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",i="full"==l?' selected="selected"':"",t+='<option value="'+e.sizes[l].url+'"'+i+">"+o+e.sizes[l].width+" x "+e.sizes[l].height+"</option>";return t},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),l=t.find("input[type=hidden]"),i=l.val(),o=""===i?"":JSON.parse(i),s=wp.media.gallery.defaults.id,r='[gallery ids="-1"]',n=null,a=null,d=null,u=null,c=[];if("object"==typeof o){for(u in o)c.push(o[u]);r='[gallery ids="'+c.join()+'"]'}n=wp.shortcode.next("gallery",r).shortcode,_.isUndefined(n.get("id"))&&!_.isUndefined(s)&&n.set("id",s),a=wp.media.gallery.attachments(n),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),d.props.set({query:!1}),d.unmirror(),d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var l=e(this).closest(".fl-multiple-photos-field"),i=l.find("input[type=hidden]"),o=l.find(".fl-multiple-photos-count"),s=[],r=0;r<t.models.length;r++)s.push(t.models[r].id);1==s.length?o.html("1 "+FLBuilderStrings.photoSelected):o.html(s.length+" "+FLBuilderStrings.photosSelected),l.removeClass("fl-multiple-photos-empty"),l.find("label.error").remove(),i.val(JSON.stringify(s)).trigger("change")},_selectSingleVideo:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1})),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),l=e(this).closest(".fl-video-field"),i=l.find(".fl-video-preview-img img"),o=l.find(".fl-video-preview-filename"),s=l.find("input[type=hidden]");i.attr("src",t.icon),o.html(t.filename),l.removeClass("fl-video-empty"),l.find("label.error").remove(),s.val(t.id).trigger("change")},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),l=t.find("input[type=hidden]"),i=l.val(),o=""==i?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(i).join()+'"]',s=wp.shortcode.next("playlist",o).shortcode,r=wp.media.playlist.defaults.id,n=null,a=null;_.isUndefined(s.get("id"))&&!_.isUndefined(r)&&s.set("id",r),n=wp.media.playlist.attachments(s),a=new wp.media.model.Selection(n.models,{props:n.props.toJSON(),multiple:!0}),a.playlist=n.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var l=e(this).closest(".fl-multiple-audios-field"),i=l.find(".fl-multiple-audios-count"),o=l.find("input[type=hidden]"),s=[],r=0;r<t.models.length;r++)s.push(t.models[r].id);1==s.length?i.html("1 "+FLBuilderStrings.audioSelected):i.html(s.length+" "+FLBuilderStrings.audiosSelected),o.val(JSON.stringify(s)).trigger("change"),l.removeClass("fl-multiple-audios-empty"),l.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var l=e(this).closest(".fl-icon-field"),i=l.find("input[type=hidden]"),o=l.find("i"),s=o.attr("data-icon");i.val(t).trigger("change"),o.removeClass(s),o.addClass(t),o.attr("data-icon",t),l.removeClass("fl-icon-empty"),l.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),l=t.find("input[type=hidden]"),i=t.find("i");l.val("").trigger("change"),i.removeClass(),i.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),l=t.closest(".fl-lightbox-wrap").attr("data-instance-id"),i=FLLightbox._instances[l],o=i._node.find(".fl-lightbox").css("left"),s=i._node.find(".fl-lightbox").css("top"),r=t.closest(".fl-builder-settings"),n=t.attr("data-type"),a=t.siblings("input").val(),d=FLBuilder._moduleHelpers[n],u=new FLLightbox({className:"fl-builder-lightbox fl-form-field-settings",destroyOnClose:!0});t.closest(".fl-builder-lightbox").hide(),t.attr("id","fl-"+u._id),u.open('<div class="fl-builder-lightbox-loading"></div>'),u.draggable({handle:".fl-lightbox-header"}),e("body").undelegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),u._node.find(".fl-lightbox").css({left:o,top:Number(parseInt(s)+233)+"px"}),FLBuilder.ajax({action:"render_settings_form",node_id:r.attr("data-node"),node_settings:FLBuilder._getSettings(r),type:n,settings:a.replace(/'/g,"'")},function(e){var t=JSON.parse(e);u.setContent(t.html),u._node.find("form.fl-builder-settings").attr("data-type",n),u._node.find(".fl-builder-settings-cancel").on("click",FLBuilder._closeFormFieldLightbox),FLBuilder._initSettingsForms(),"undefined"!=typeof d&&(FLBuilder._initSettingsValidation(d.rules),d.init()),u._node.find(".fl-lightbox").css({left:o,top:s})})},_closeFormFieldLightbox:function(){var t=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=FLLightbox._instances[t],i=e(".fl-builder-settings-lightbox"),o=i.find("form"),s=l._node.find(".fl-lightbox").css("left"),r=l._node.find(".fl-lightbox").css("top"),n=0,a=e(window),d=a.height();"undefined"!=typeof tinymce&&"undefined"!=typeof tinymce.EditorManager.activeEditor&&tinymce.EditorManager.activeEditor.remove(),l._node.find(".fl-lightbox-content").html('<div class="fl-builder-lightbox-loading"></div>'),n=l._node.find(".fl-lightbox").height(),d-80>n?l._node.find(".fl-lightbox").css("top",(d-n)/2-40+"px"):l._node.find(".fl-lightbox").css("top","0px"),l.on("close",function(){i.show(),i.find("label.error").remove(),o.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors(),i.find(".fl-lightbox").css({left:s,top:r})}),setTimeout(function(){l.close(),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked)},500)},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),l=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),i=t.attr("data-type"),o=FLBuilder._getSettings(t),s={},r=FLBuilder._moduleHelpers[i],n=e(".fl-builder-settings #fl-"+l),a=n.parent().attr("data-preview-text"),d=o[a],u=e('select[name="'+a+'"]'),c=document.createElement("div"),f=!0;return u.length>0&&(d=u.find('option[value="'+o[a]+'"]').text()),"undefined"!=typeof r&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=r.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof d&&(d.indexOf("fa fa-")>-1?d='<i class="'+d+'"></i>':d.length>35&&(c.innerHTML=d,d=(c.textContent||c.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),n.siblings(".fl-form-field-preview-text").html(d)),s=n.siblings("input").val().replace(/'/g,"'"),""!=s&&(o=e.extend(JSON.parse(s),o)),n.siblings("input").val(JSON.stringify(o)).trigger("change"),FLBuilder._closeFormFieldLightbox.apply(this),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),l=t.find(".fl-link-field-search-input");l.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:l.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,l){var i=e.closest(".fl-link-field"),o=i.find(".fl-link-field-search"),s=i.find(".fl-link-field-search-input"),r=i.find(".fl-link-field-input");r.val(t.value).trigger("keyup"),s.autoSuggest("remove",t.value),o.hide()},_linkFieldSelectClicked:function(){e(this).parent().find(".fl-link-field-search").show()},_linkFieldSelectCancelClicked:function(){e(this).parent().hide()},_initFontFields:function(){e(".fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),l=t.find(".fl-font-field-font");l.on("change",function(){FLBuilder._getFontWeights(l)})},_getFontWeights:function(t){var l=t.next(".fl-font-field-weight"),i=t.val(),o={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},s={};l.html(""),s="undefined"!=typeof FLBuilderFontFamilies.system[i]?FLBuilderFontFamilies.system[i].weights:"undefined"!=typeof FLBuilderFontFamilies.google[i]?FLBuilderFontFamilies.google[i]:FLBuilderFontFamilies["default"][i],e.each(s,function(e,t){l.append('<option value="'+t+'">'+o[t]+"</option>")})},initEditorField:function(e){var t=tinyMCEPreInit.mceInit.flhiddeneditor;t.elements=e,tinyMCEPreInit.mceInit[e]=t},_updateEditorFields:function(){var t=e(".fl-builder-settings textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),l=t.closest(".fl-editor-field"),i=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),o=t.attr("id"),s=l.attr("id"),r="undefined"!=typeof tinyMCE&&tinyMCE.get(o),n=t.siblings('textarea[name="'+s+'"]'),a=l.data("wpautop");0===n.length&&(n=e('<textarea name="'+s+'"></textarea>').hide(),t.after(n)),a?r&&i.hasClass("tmce-active")?n.val(r.getContent()):"undefined"!=typeof switchEditors?n.val(switchEditors.wpautop(t.val())):n.val(t.val()):(r&&i.hasClass("tmce-active")&&r.save(),n.val(t.val()))},_loopBuilderPostTypeChange:function(){var t=e(this).val();e(".fl-loop-builder-filter").hide(),e(".fl-loop-builder-"+t+"-filter").show()},_textFieldAddValueSelectChange:function(){var t=e(this),l=e('input[name="'+t.data("target")+'"]'),i=l.val(),o=t.val(),s="";-1==i.indexOf(o)&&(s=(i.trim()+" "+o.trim()).trim(),l.val(s).trigger("change").trigger("keyup")),t.val("")},ajax:function(t,l){var i;if(FLBuilder._silentUpdate)return FLBuilder.showAjaxLoader(),void(FLBuilder._silentUpdateCallbackData=[t,l]);t.silent===!0&&(FLBuilder._silentUpdate=!0);for(i in t)"undefined"==typeof t[i]&&(t[i]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=e("#fl-post-id").val(),t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(t.settings)),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(t.node_settings)),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof l&&l.call(this,e)})},_ajaxComplete:function(){var e,t;FLBuilder._silentUpdate=!1,null!==FLBuilder._silentUpdateCallbackData?(FLBuilder.showAjaxLoader(),e=FLBuilder._silentUpdateCallbackData[0],t=FLBuilder._silentUpdateCallbackData[1],FLBuilder._silentUpdateCallbackData=null,FLBuilder.ajax(e,t)):FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),l=null;if("undefined"!=typeof e)for(l in e)t+=t.indexOf("?")>-1?"&":"?",t+=l+"="+e[l];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_showLightbox:function(e){e="undefined"==typeof e||e,FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),e?FLBuilder._lightbox.draggable({handle:".fl-lightbox-header"}):FLBuilder._lightbox.draggable(!1),FLBuilder._removeAllOverlays(),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},_resizeLightbox:function(){var t=e(this),l=t.hasClass("fa-expand")?"expand":"contract";FLBuilder._lightbox.renderResize(l),e(this).toggleClass("fa-expand").toggleClass("fa-compress")},alert:function(e){var t=new FLLightbox({className:"fl-builder-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),l=wp.template("fl-alert-lightbox");t.open(l({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},triggerHook:function(t,l){e("body").trigger("fl-builder."+t,l)},addHook:function(t,l){e("body").on("fl-builder."+t,l)},removeHook:function(t,l){e("body").off("fl-builder."+t,l)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,l,i,o){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",l).replace("{file}",t)),"undefined"!=typeof o&&"undefined"!=typeof o.stack&&(FLBuilder.log(o.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery);var FLBuilderColorPicker;!function(e,t){function l(){var t,l,i="backgroundImage";f?h="filter":(t=e('<div id="iris-gradtest" />'),l="linear-gradient(top,#fff,#000)",e.each(p,function(e,o){if(t.css(i,o+l),t.css(i).match("gradient"))return h=e,!1}),h===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css(this.bgImageString).match("gradient")&&(h="webkit")),t.remove())}function i(t,l){return t="top"===t?"top":"left",l=e.isArray(l)?l:Array.prototype.slice.call(arguments,1),"webkit"===h?s(t,l):p[h]+"linear-gradient("+t+", "+l.join(", ")+")"}function o(t,l){var i,o,s,n,a,d,u,c,f;t="top"===t?"top":"left",l=e.isArray(l)?l:Array.prototype.slice.call(arguments,1),i="top"===t?0:1,o=e(this),s=l.length-1,n="filter",a=1===i?"left":"top",d=1===i?"right":"bottom",u=1===i?"height":"width",c='<div class="iris-ie-gradient-shim" style="position:absolute;'+u+":100%;"+a+":%start%;"+d+":%end%;"+n+':%filter%;" data-color:"%color%"></div>',f="","static"===o.css("position")&&o.css({position:"relative"}),l=r(l),e.each(l,function(e,t){var o,r,n;return e!==s&&(o=l[e+1],void(t.stop!==o.stop&&(r=100-parseFloat(o.stop)+"%",t.octoHex=new Color(t.color).toIEOctoHex(),o.octoHex=new Color(o.color).toIEOctoHex(),n="progid:DXImageTransform.Microsoft.Gradient(GradientType="+i+", StartColorStr='"+t.octoHex+"', EndColorStr='"+o.octoHex+"')",f+=c.replace("%start%",t.stop).replace("%end%",r).replace("%filter%",n))))}),o.find(".iris-ie-gradient-shim").remove(),e(f).prependTo(o)}function s(t,l){var i=[];return t="top"===t?"0% 0%,0% 100%,":"0% 100%,100% 100%,",l=r(l),e.each(l,function(e,t){i.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+i.join(",")+")"}function r(t){var l=[],i=[],o=[],s=t.length-1;return e.each(t,function(e,t){var o=t,s=!1,r=t.match(/1?[0-9]{1,2}%$/);r&&(o=t.replace(/\s?1?[0-9]{1,2}%$/,""),s=r.shift()),l.push(o),i.push(s)}),i[0]===!1&&(i[0]="0%"),i[s]===!1&&(i[s]="100%"),i=n(i),e.each(i,function(e){o[e]={color:l[e],stop:i[e]}}),o}function n(t){var l,i,o,s,r=0,a=t.length-1,d=0,u=!1;if(t.length<=2||e.inArray(!1,t)<0)return t;for(;d<t.length-1;)u||t[d]!==!1?u&&t[d]!==!1&&(a=d,d=t.length):(r=d-1,u=!0),d++;for(i=a-r,s=parseInt(t[r].replace("%"),10),l=(parseFloat(t[a].replace("%"))-s)/i,d=r+1,o=1;d<a;)t[d]=s+o*l+"%",o++,d++;return n(t)}var a=[],d=navigator.userAgent.toLowerCase(),u="Microsoft Internet Explorer"===navigator.appName,c=u?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,f=u&&c<10,h=!1,p=["-moz-","-webkit-","-o-","-ms-"];flBuilderParseColorValue=function(e){var t=e.replace(/\s+/g,""),l=t.indexOf("rgba")!==-1?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100,i=l<100;return{value:t,alpha:l,rgba:i}},e.fn.flBuilderColorPickerGradient=function(){var t=arguments;return this.each(function(){f?o.apply(this,t):e(this).css("backgroundImage",i.apply(this,t))})},e.fn.flBuilderColorPickerRaninbowGradient=function(t,l){var i,o,s,r;for(t=t||"top",i=e.extend({},{s:100,l:50},l),o="hsl(%h%,"+i.s+"%,"+i.l+"%)",s=0,r=[];s<=360;)r.push(o.replace("%h%",s)),s+=30;return this.each(function(){e(this).flBuilderColorPickerGradient(t,r)})},FLBuilderColorPicker=function(t){this._html='<div class="fl-color-picker-ui"><div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div></div>';var l={elements:null,color:"",mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},target:!1,width:200,presets:[],labels:{colorPresets:"Color Presets",colorPicker:"Color Picker",placeholder:"Paste color here...",removePresetConfirm:"Are you sure?",noneColorSelected:"None color selected.",alreadySaved:"%s is already a saved preset.",noPresets:"Add a color preset first.",presetAdded:"%s added to presets!"}};this.options=e.extend({},l,t),(f===!1||f===!0&&c>7)&&this._init()},FLBuilderColorPicker.prototype={_html:"",_color:"",_currentElement:"",_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_init:function(){var t=this;e(t.options.elements);this._color=new Color("#ff0000").setHSpace(t.options.mode),a=this.options.presets,h===!1&&l(),e("html").hasClass("fl-color-picker-init")?t.picker=e(".fl-color-picker-ui"):t.picker=e(this._html).appendTo("body"),u?9===c?t.picker.addClass("iris-ie-9"):c<=8&&t.picker.addClass("iris-ie-lt9"):d.indexOf("compatible")<0&&d.indexOf("khtml")<0&&d.match(/mozilla/)&&t.picker.addClass("iris-mozilla"),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},"hsv"===t.options.mode&&t._has("l",t.options.controls)?t.options.controls=t._defaultHSVControls:"hsl"===t.options.mode&&t._has("v",t.options.controls)&&(t.options.controls=t._defaultHSLControls),t.hue=t._color.h(),this._setTemplates(),this._ui=e(".fl-color-picker-ui"),this._iris=e(".iris-picker"),this._wrapper=e("body"),e("html").hasClass("fl-color-picker-init")||this._ui.prepend(this._hexHtml).append(this._presetsHtml),t.element=this._ui.find(".fl-color-picker-input"),t._initControls(),t.active="external",t._change(),t._addInputListeners(t.element),this._buildUI(),this._prepareColorFields(),this._pickerControls(),this._presetsControls(),this._buildAlphaUI(),e("html").addClass("fl-color-picker-init")},_prepareColorFields:function(){var t=this;e(".fl-color-picker-value").each(function(){var l=e(this),i=l.val(),o=l.parent().find(".fl-color-picker-color"),s=flBuilderParseColorValue(i),r="";if(i){if(o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba)r=l.val().toString();else if(!o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba){var n=i.replace("rgba","rgb");n=n.substr(0,n.lastIndexOf(","))+")",t._color._alpha=1,r=n,l.val(n)}else r="#"+l.val().toString();o.css({backgroundColor:r})}})},_setTemplates:function(){this._alphaHtml='<div class="fl-alpha-wrap"><div class="fl-alpha-slider"></div><div class="fl-alpha-slider-offset"></div><div class="fl-alpha-text"></div></div>',this._presetsHtml='<div class="fl-color-picker-presets"><div class="fl-color-picker-presets-toggle"><div class="fl-color-picker-presets-open-label fl-color-picker-active">'+this.options.labels.colorPresets+' <span class="fl-color-picker-icon-arrow-up"></span></div><div class="fl-color-picker-presets-close-label">'+this.options.labels.colorPicker+' <span class="fl-color-picker-icon-arrow-down"></span></div></div><ul class="fl-color-picker-presets-list"></ul></div>',this._hexHtml='<input type="text" class="fl-color-picker-input" maxlength="7" placeholder="'+this.options.labels.placeholder+'"><div class="fl-color-picker-preset-add"></div>',this._presetsTpl='<li class="fl-color-picker-preset"><span class="fl-color-picker-preset-color"></span> <span class="fl-color-picker-preset-label"></span> <span class="fl-color-picker-preset-remove fl-color-picker-icon-remove"></span></li>',this._noPresetsTpl='<li class="fl-color-picker-no-preset"><span class="fl-color-picker-preset-label">'+this.options.labels.noPresets+"</span></li>"},_has:function(t,l){var i=!1;return e.each(l,function(e,l){if(t===l)return i=!0,!1}),i},_buildUI:function(){var t=this;t._presetsList=this._ui.find(".fl-color-picker-presets-list"),t._presetsList.html(""),this.options.presets.length>0?e.each(this.options.presets,function(e,l){t._addPresetView(l)}):t._presetsList.append(this._noPresetsTpl)},_addPresetView:function(t){var l=this._presetsList.find(".fl-color-picker-no-preset");l.length>0&&l.remove();var i=e(this._presetsTpl),o=Color(t);i.attr("data-color",t).find(".fl-color-picker-preset-color").css({backgroundColor:o.toString()}).end().find(".fl-color-picker-preset-label").html(o.toString()),this._presetsList.append(i)},_addPresetFeedback:function(){this._ui.append('<div class="fl-color-picker-added"><div class="fl-color-picker-added-text"><div class="fl-color-picker-icon-check"></div> "'+this.options.labels.presetAdded.replace("%s",this._color.toString())+'"</div></div>'),this._ui.find(".fl-color-picker-added").hide().fadeIn(200).delay(2e3).fadeOut(200,function(){e(this).remove()})},_pickerControls:function(){var t=this;this._wrapper.on("click",".fl-color-picker-color",function(){var l=e(this);t._currentElement=l.parent().find(".fl-color-picker-value"),t._ui.position({my:"left top",at:"left bottom",of:l,collision:"flipfit",using:function(e,l){t._togglePicker(e)}})}).on("click",".fl-color-picker-clear",function(){var l=e(this);t._currentElement=l.parent().find(".fl-color-picker-value"),l.prev(".fl-color-picker-color").css({backgroundColor:"transparent"}).addClass("fl-color-picker-empty"),t._setColor(""),t.element.val(""),t._currentElement.val("").trigger("change")}),e(document).on("click",function(t){0===e(t.target).closest(".fl-color-picker-ui").length&&e(".fl-color-picker-ui.fl-color-picker-active").removeClass("fl-color-picker-active")})},_presetsControls:function(){var t=this,l=t._ui.find(".fl-color-picker-preset-add"),i=t._ui.find(".fl-color-picker-presets"),o=i.find(".fl-color-picker-presets-open-label"),s=i.find(".fl-color-picker-presets-close-label"),r=i.find(".fl-color-picker-presets-list");
|
6 |
l.off("click").on("click",function(){t._addPreset(t.element.val())}),r.css({height:t.element.innerHeight()+t._iris.innerHeight()+14+"px"}).hide(),i.off("click").on("click",".fl-color-picker-presets-toggle",function(){o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),r.slideToggle(500)}).on("click",".fl-color-picker-preset",function(l){var i=new Color(e(this).data("color").toString());t._setColor(i),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:i.toString()}).removeClass("fl-color-picker-empty"),o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),r.slideToggle(500)}).on("click",".fl-color-picker-preset-remove",function(l){l.stopPropagation(),t._removePreset(e(this).parent().data("color"))})},_removePreset:function(t){if(confirm(this.options.labels.removePresetConfirm)){var l=t.toString(),i=a.indexOf(l);i>-1&&(a.splice(i,1),this.options.presets=a,this._presetsList.find('.fl-color-picker-preset[data-color="'+l+'"]').slideUp(function(){e(this).remove()})),a.length<1&&this._presetsList.append(this._noPresetsTpl),e(this).trigger("presetRemoved",{presets:a})}},_addPreset:function(t){var l=t.toString().replace(/^#/,"");""===l?alert(this.options.labels.noneColorSelected):a.indexOf(l)>-1?alert(this.options.labels.alreadySaved.replace("%s","#"+l)):(this._addPresetView(l),this._addPresetFeedback(),a.push(l),this.options.presets=a,e(this).trigger("presetAdded",{presets:a}))},_togglePicker:function(e){var t=this;this._ui.hasClass("fl-color-picker-active")?(this._ui.removeClass("fl-color-picker-active"),e&&setTimeout(function(){t._ui.css(e),t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200)):(e&&t._ui.css(e),setTimeout(function(){t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200))},_paint:function(){var e=this;e._paintDimension("right","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var l,i=this,o=i._color,s=i.options.mode,r=i._getHSpaceColor(),n=i.controls[t],a=i.options.controls;if(t!==i.active&&("square"!==i.active||"strip"===t))switch(a[t]){case"h":if("hsv"===s){switch(r=o.clone(),t){case"horiz":r[a.vert](100);break;case"vert":r[a.horiz](100);break;case"strip":r.setHSpace("hsl")}l=r.toHsl()}else l="strip"===t?{s:r.s,l:r.l}:{s:100,l:r.l};n.flBuilderColorPickerRaninbowGradient(e,l);break;case"s":"hsv"===s?"vert"===t?l=[o.clone().a(0).s(0).toCSS("rgba"),o.clone().a(1).s(0).toCSS("rgba")]:"strip"===t?l=[o.clone().s(100).toCSS("hsl"),o.clone().s(0).toCSS("hsl")]:"horiz"===t&&(l=["#fff","hsl("+r.h+",100%,50%)"]):l="vert"===t&&"h"===i.options.controls.horiz?["hsla(0, 0%, "+r.l+"%, 0)","hsla(0, 0%, "+r.l+"%, 1)"]:["hsl("+r.h+",0%,50%)","hsl("+r.h+",100%,50%)"],n.flBuilderColorPickerGradient(e,l);break;case"l":l="strip"===t?["hsl("+r.h+",100%,100%)","hsl("+r.h+", "+r.s+"%,50%)","hsl("+r.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],n.flBuilderColorPickerGradient(e,l);break;case"v":l="strip"===t?[o.clone().v(100).toCSS(),o.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],n.flBuilderColorPickerGradient(e,l)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(e){var t,l=this,i=l.options,o=l.controls,s=o.square,r=l.picker.find(".iris-strip"),n="77.5%",a="12%",d=20,u=i.border?i.width-d:i.width;if(e&&(s.css("width",""),r.css("width",""),l.picker.css({width:"",height:""})),n=u*(parseFloat(n)/100),a=u*(parseFloat(a)/100),t=i.border?n+d:n,s.width(n).height(n),r.height(n).width(a),l.picker.css({width:i.width,height:t}),!i.palettes)return l.picker.css("paddingBottom","")},_addInputListeners:function(e){var t=this,l=100,i=function(l){var i=new Color(e.val()),o=e.val().replace(/^#/,"");if(e.removeClass("iris-error"),i.error)""!==o&&e.addClass("iris-error");else if(i.toString()!==t._color.toString())if("keyup"===l.type){if(o.match(/^[0-9a-fA-F]{3}$/))return;t._setColor(o),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:Color(o).toString()}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change")}else if("paste"===l.type)return o=l.originalEvent.clipboardData.getData("text").replace(/^#/,""),hex=Color(o).toString(),t._setColor(o),e.val(hex),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:hex}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change"),!1};e.on("change",i).on("keyup",t._debounce(i,l))},_initControls:function(){var t=this,l=t.controls,i=l.square,o=t.options.controls,s=t._scale[o.strip];l.stripSlider.slider({orientation:"horizontal",max:s,slide:function(e,l){t.active="strip","h"===o.strip&&(l.value=s-l.value),t._color[o.strip](l.value),t._change.apply(t,arguments)}}),l.squareDrag.draggable({containment:l.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(e,l){t._squareDrag(e,l)},start:function(){i.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){i.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(l){var i="ui-state-focus";l.preventDefault(),"mousedown"===l.type?(t.picker.find("."+i).removeClass(i).blur(),e(this).addClass(i).focus()):e(this).removeClass(i)}).on("keydown",function(e){var i=l.square,o=l.squareDrag,s=o.position(),r=2;switch(e.altKey&&(r*=10),e.keyCode){case 37:s.left-=r;break;case 38:s.top-=r;break;case 39:s.left+=r;break;case 40:s.top+=r;break;default:return!0}s.left=Math.max(0,Math.min(s.left,i.width())),s.top=Math.max(0,Math.min(s.top,i.height())),o.css(s),t._squareDrag(e,{position:s}),e.preventDefault()}),i.mousedown(function(l){var i,o;1===l.which&&e(l.target).is("div")&&(i=t.controls.square.offset(),o={top:l.pageY-i.top,left:l.pageX-i.left},l.preventDefault(),t._squareDrag(l,{position:o}),l.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(o).trigger(l))})},_squareDrag:function(e,t){var l=this,i=l.options.controls,o=l._squareDimensions(),s=Math.round((o.h-t.position.top)/o.h*l._scale[i.vert]),r=l._scale[i.horiz]-Math.round((o.w-t.position.left)/o.w*l._scale[i.horiz]);l._color[i.horiz](r)[i.vert](s),l.active="square",l._change.apply(l,arguments)},_setColor:function(e){var t,l,i=this,o=i.options.color;i.options.color=e,e=""+e,t=e.replace(/^#/,""),l=new Color(e).setHSpace(i.options.mode),l.error?i.options.color=o:(i._color=l,i.options.color=i._color.toString(),i.active="external",i._change())},_squareDimensions:function(e){var l,i,o=this.controls.square;return e!==t&&o.data("dimensions")?o.data("dimensions"):(i=this.controls.squareDrag,l={w:o.width(),h:o.height()},o.data("dimensions",l),l)},_isNonHueControl:function(e,t){return"square"===e&&"h"===this.options.controls.strip||"external"!==t&&("h"!==t||"strip"!==e)},_change:function(){var t=this,l=t.controls,i=t._getHSpaceColor(),o=["square","strip"],s=t.options.controls,r=s[t.active]||"external",n=t.hue;"strip"===t.active?o=[]:"external"!==t.active&&o.pop(),e.each(o,function(e,o){var r,n,a;if(o!==t.active)switch(o){case"strip":r="h"===s.strip?t._scale[s.strip]-i[s.strip]:i[s.strip],l.stripSlider.slider("value",r);break;case"square":n=t._squareDimensions(),a={left:i[s.horiz]/t._scale[s.horiz]*n.w,top:n.h-i[s.vert]/t._scale[s.vert]*n.h},t.controls.squareDrag.css(a)}}),i.h!==n&&t._isNonHueControl(t.active,r)&&t._color.h(n),t.hue=t._color.h(),t.options.color=t._color.toString(),t.element.is(":input")&&!t._color.error&&(t.element.removeClass("iris-error"),t.element.val()!==t._color.toString()&&(t.element.val(t._color.toString()),this._currentElement&&(this._currentElement.val(t._color.toString().replace(/^#/,"")).parent().find(".fl-color-picker-color").css({backgroundColor:t._color.toString()}).removeClass("fl-color-picker-empty"),t._wrapper.find(".fl-alpha-slider-offset").css("background-color",t._color.toString()),this._currentElement.trigger("change")))),t._paint(),t._inited=!0,t.active=!1},_debounce:function(e,t,l){var i,o;return function(){var s,r,n=this,a=arguments;return s=function(){i=null,l||(o=e.apply(n,a))},r=l&&!i,clearTimeout(i),i=setTimeout(s,t),r&&(o=e.apply(n,a)),o}},_buildAlphaUI:function(){var t=this;t._wrapper.on("click",".fl-color-picker-color",function(){var l=e(this);t._currentElement.val();l.hasClass("fl-color-picker-alpha-enabled")?(t._ui.find(".fl-alpha-wrap").length<=0&&e(t._alphaHtml).insertAfter(t._iris),t._pickerAlphaControls()):t._ui.find(".fl-alpha-wrap").remove()})},_pickerAlphaControls:function(){var e=this,t=e._currentElement,l=flBuilderParseColorValue(t.val()),i=parseFloat(l.alpha/100),o=e._wrapper,s=e._ui,r=s.find(".fl-alpha-wrap"),n=r.find(".fl-alpha-slider"),a=r.find(".fl-alpha-text"),d=r.find(".fl-alpha-slider-offset");alphaHandle=r.find(".ui-slider-handle"),a.text(i<1?i:""),n.slider({orientation:"vertical",slide:function(t,l){var i=parseFloat(l.value/100);e._color._alpha=i,a.text(i<1?i:""),e._change.apply(e,arguments)},create:function(){d.css({backgroundColor:l.value}),o.on("click",".fl-color-picker-clear",function(){e._color._alpha=1,a.text(""),n.slider("value",100).trigger("slide")})},value:l.alpha,step:1,min:1,max:100})}}}(jQuery),function(e,t){var l=function(e,t){return this instanceof l?this._init(e,t):new l(e,t)};l.fn=l.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var l="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),l=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":l,this[l](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var e=new l(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"],i=t.length-1;i>=0;i--)e[t[i]]=this[t[i]];return e},setHSpace:function(e){return this._hSpace="hsv"===e?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,l=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),e.match(l)&&e.match(/\)$/)){if(t=e.replace(/(\s|%)/g,"").replace(l,"").replace(/,?\);?$/,"").split(","),t.length<3)return this._error();if(4===t.length&&(this.a(parseFloat(t.pop())),this.error))return this;for(var i=t.length-1;i>=0;i--)if(t[i]=parseInt(t[i],10),isNaN(t[i]))return this._error();return e.match(/^rgb/)?this.fromRgb({r:t[0],g:t[1],b:t[2]}):e.match(/^hsv/)?this.fromHsv({h:t[0],s:t[1],v:t[2]}):this.fromHsl({h:t[0],s:t[1],l:t[2]})}return this.fromHex(e)},fromRgb:function(e,l){return"object"!=typeof e||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),l))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var l,i,o,s,r,n,a,d;return"object"!=typeof e||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",n=e.h/360,a=e.s/100,d=e.l/100,0===a?l=i=o=d:(s=d<.5?d*(1+a):d+a-d*a,r=2*d-s,l=this.hue2rgb(r,s,n+1/3),i=this.hue2rgb(r,s,n),o=this.hue2rgb(r,s,n-1/3)),this.fromRgb({r:255*l,g:255*i,b:255*o},!0))},fromHsv:function(e){var l,i,o,s,r,n,a,d,u,c,f;if("object"!=typeof e||e.h===t||e.s===t||e.v===t)return this._error();switch(this._hsv=e,this._hSpace="hsv",l=e.h/360,i=e.s/100,o=e.v/100,a=Math.floor(6*l),d=6*l-a,u=o*(1-i),c=o*(1-d*i),f=o*(1-(1-d)*i),a%6){case 0:s=o,r=f,n=u;break;case 1:s=c,r=o,n=u;break;case 2:s=u,r=o,n=f;break;case 3:s=u,r=c,n=o;break;case 4:s=f,r=u,n=o;break;case 5:s=o,r=u,n=c}return this.fromRgb({r:255*s,g:255*r,b:255*n},!0)},fromInt:function(e,l){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),l===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,l){return l<0&&(l+=1),l>1&&(l-=1),l<1/6?e+6*(t-e)*l:l<.5?t:l<2/3?e+(t-e)*(2/3-l)*6:e},toString:function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){switch(e=e||"hex",t=parseFloat(t||this._alpha),e){case"rgb":case"rgba":var l=this.toRgb();return t<1?"rgba( "+l.r+", "+l.g+", "+l.b+", "+t+" )":"rgb( "+l.r+", "+l.g+", "+l.b+" )";case"hsl":case"hsla":var i=this.toHsl();return t<1?"hsla( "+i.h+", "+i.s+"%, "+i.l+"%, "+t+" )":"hsl( "+i.h+", "+i.s+"%, "+i.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e,t,l=this.toRgb(),i=l.r/255,o=l.g/255,s=l.b/255,r=Math.max(i,o,s),n=Math.min(i,o,s),a=(r+n)/2;if(r===n)e=t=0;else{var d=r-n;switch(t=a>.5?d/(2-r-n):d/(r+n),r){case i:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-i)/d+2;break;case s:e=(i-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsl.h!==e&&(e=this._hsl.h),t=Math.round(100*t),0===t&&this._hsl.s&&(t=this._hsl.s),{h:e,s:t,l:Math.round(100*a)}},toHsv:function(){var e,t,l=this.toRgb(),i=l.r/255,o=l.g/255,s=l.b/255,r=Math.max(i,o,s),n=Math.min(i,o,s),a=r,d=r-n;if(t=0===r?0:d/r,r===n)e=t=0;else{switch(r){case i:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-i)/d+2;break;case s:e=(i-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsv.h!==e&&(e=this._hsv.h),t=Math.round(100*t),0===t&&this._hsv.s&&(t=this._hsv.s),{h:e,s:t,v:Math.round(100*a)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return 1===t.length&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(!(e instanceof l))throw"getDistanceLuminosityFrom requires a Color object";var t=this.toLuminosity(),i=e.toLuminosity();return t>i?(t+.05)/(i+.05):(i+.05)/(t+.05)},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new l(t)},getReadableContrastingColor:function(e,i){if(!(e instanceof l))return this;var o=i===t?5:i,s=e.getDistanceLuminosityFrom(this),r=e.getMaxContrastColor(),n=r.getDistanceLuminosityFrom(e);if(n<=o)return r;if(s>=o)return this;for(var a=0===r.toInt()?-1:1;s<o&&(this.l(a,!0),s=this.getDistanceLuminosityFrom(e),0!==this._color&&16777215!==this._color););return this},a:function(e){if(e===t)return this._alpha;var l=parseFloat(e);return isNaN(l)?this._error():(this._alpha=l,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+30*e;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=30*e;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=60*e;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=120*e;return this.h(t,!0)},_partial:function(e){var l=i[e];return function(i,o){var s=this._spaceFunc("to",l.space);return i===t?s[e]:(o===!0&&(i=s[e]+i),l.mod&&(i%=l.mod),l.range&&(i=i<l.range[0]?l.range[0]:i>l.range[1]?l.range[1]:i),s[e]=i,this._spaceFunc("from",l.space,s))}},_spaceFunc:function(e,t,l){var i=t||this._hSpace,o=e+i.charAt(0).toUpperCase()+i.substr(1);return this[o](l)}};var i={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var o in i)i.hasOwnProperty(o)&&(l.fn[o]=l.fn._partial(o));"object"==typeof exports?module.exports=l:e.Color=l}(this),function(e){FLIconSelector={_content:null,_lightbox:null,_rendered:!1,_filterText:"",open:function(e){FLIconSelector._rendered||FLIconSelector._render(),null===FLIconSelector._content?(FLIconSelector._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder.ajax({action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelector._lightbox.open(),FLIconSelector._lightbox.on("icon-selected",function(t,l){FLIconSelector._lightbox.off("icon-selected"),FLIconSelector._lightbox.close(),e(l)})},_render:function(){FLIconSelector._lightbox=new FLLightbox({className:"fl-icon-selector"}),FLIconSelector._rendered=!0},_getContentComplete:function(t){var l=JSON.parse(t);FLIconSelector._content=l.html,FLIconSelector._lightbox.setContent(l.html),e(".fl-icons-filter-select").on("change",FLIconSelector._filter),e(".fl-icons-filter-text").on("keyup",FLIconSelector._filter),e(".fl-icons-list i").on("click",FLIconSelector._select),e(".fl-icon-selector-cancel").on("click",e.proxy(FLIconSelector._lightbox.close,FLIconSelector._lightbox))},_filter:function(){var t=e(".fl-icons-filter-select").val(),l=e(".fl-icons-filter-text").val();"all"==t?e(".fl-icons-section").show():(e(".fl-icons-section").hide(),e(".fl-"+t).show()),FLIconSelector._filterText=l,""!==l?e(".fl-icons-list i").each(FLIconSelector._filterIcon):e(".fl-icons-list i").show()},_filterIcon:function(){var t=e(this);-1==t.attr("class").indexOf(FLIconSelector._filterText)?t.hide():t.show()},_select:function(){var t=e(this).attr("class");FLIconSelector._lightbox.trigger("icon-selected",t)}}}(jQuery),function(e){FLLightbox=function(e){this._init(e),this._render(),this._bind()},FLLightbox.closeParent=function(t){var l=e(t).closest(".fl-lightbox-wrap").attr("data-instance-id");FLLightbox._instances[l].close()},FLLightbox._instances={},FLLightbox.prototype={_id:null,_node:null,_visible:!1,_resizeTimer:null,_draggable:!1,_defaults:{className:"",destroyOnClose:!1},open:function(e){this._node.find(".fl-lightbox").attr("style",""),this._node.show(),this._visible=!0,"undefined"!=typeof e?this.setContent(e):this._resize(),this.trigger("open")},close:function(){"undefined"!=typeof tinymce&&"undefined"!=typeof tinymce.EditorManager.activeEditor&&null!=tinymce.EditorManager.activeEditor&&tinymce.EditorManager.activeEditor.hide(),this._node.hide(),this._visible=!1,this.trigger("close"),this._defaults.destroyOnClose&&this.destroy()},setContent:function(e){this._node.find(".fl-lightbox-content").html(e),this._resize()},empty:function(){this._node.find(".fl-lightbox-content").empty(),this._node.find(".fl-lightbox").removeClass("fl-lightbox-expanded")},on:function(e,t){this._node.on(e,t)},off:function(e){this._node.off(e)},trigger:function(e,t){this._node.trigger(e,t)},draggable:function(e){var t=this._node.find(".fl-lightbox-mask"),l=this._node.find(".fl-lightbox");e="undefined"!=typeof e&&e,this._draggable&&l.draggable("destroy"),e?(this._unbind(),this._draggable=!0,t.hide(),l.draggable({cursor:"move",handle:e.handle||""})):(t.show(),this._bind(),this._draggable=!1),this._resize()},destroy:function(){e(window).off("resize.fl-lightbox-"+this._id),this._node.empty(),this._node.remove(),FLLightbox._instances[this._id]="undefined";try{delete FLLightbox._instances[this._id]}catch(t){}},renderResize:function(t){if("undefined"!=typeof t){var l=this._getActiveNode();if(lightbox=l.find(".fl-lightbox"),boxFields=lightbox.find(".fl-builder-settings-fields"),win=e(window),winHeight=win.height(),winWidth=win.width(),boxHeaderHeight=lightbox.find(".fl-lightbox-header").height(),boxTabsHeight=lightbox.find(".fl-builder-settings-tabs").height(),boxFooterHeight=lightbox.find(".fl-lightbox-footer").height(),boxFieldHeight=winHeight-(boxHeaderHeight+boxTabsHeight+boxFooterHeight+103),editor="undefined"!=typeof tinymce&&tinymce.EditorManager.activeEditor?tinymce:null,editorId=editor?editor.EditorManager.activeEditor.id:"flhiddeneditor",editorIframeEl=lightbox.find("#"+editorId+"_ifr"),editorTextarea=lightbox.find("#"+editorId),codeField=lightbox.find(".fl-code-field .ace_editor"),"expand"==t||"window_resize"==t){if("window_resize"==t&&!lightbox.hasClass("fl-lightbox-expanded"))return!1;boxFields.css("height",boxFieldHeight+"px"),"expand"==t&&(lightbox.addClass("fl-lightbox-expanded"),lightbox.draggable("disable")),editorIframeEl.length>0&&editorIframeEl.css("height",boxFieldHeight-145+"px"),editorTextarea.length>0&&editorTextarea.css("height",boxFieldHeight-145+"px"),codeField.length>0&&codeField.css("height",boxFieldHeight-30+"px")}else setTimeout(e.proxy(this._resize,this),250),lightbox.removeClass("fl-lightbox-expanded"),boxFields.removeAttr("style"),null!==editorId&&(editorIframeEl.css("height","232px"),editorTextarea.css("height","232px")),codeField.length>0&&codeField.css("height","380px"),lightbox.draggable("enable")}},_init:function(t){var l=0,i=null;for(i in FLLightbox._instances)l++;this._defaults=e.extend({},this._defaults,t),this._id=(new Date).getTime()+l,FLLightbox._instances[this._id]=this},_render:function(){this._node=e('<div class="fl-lightbox-wrap" data-instance-id="'+this._id+'"><div class="fl-lightbox-mask"></div><div class="fl-lightbox"><div class="fl-lightbox-content-wrap"><div class="fl-lightbox-content"></div></div></div></div>'),this._node.addClass(this._defaults.className),e("body").append(this._node)},_bind:function(){e(window).on("resize.fl-lightbox-"+this._id,e.proxy(this._delayedResize,this))},_unbind:function(){e(window).off("resize.fl-lightbox-"+this._id)},_delayedResize:function(){clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(e.proxy(this._resize,this),250),this.renderResize("window_resize")},_resize:function(){if(this._visible){var t=this._node.find(".fl-lightbox"),l=t.height(),i=t.width(),o=e(window),s=o.height(),r=o.width(),n="0px",a=(r-i)/2-30+"px";t.css({margin:"0px",top:"auto",left:"auto"}),s-80>l&&(n=(s-l)/2-40+"px"),this._draggable?(t.css("top",n),t.css("left",FLBuilderConfig.isRtl?"-"+a:a)):(t.css("margin-top",n),t.css("margin-left","auto"),t.css("margin-right","auto"))}},_onKeypress:function(e){27==e.which&&this._visible&&this.close()},_getActiveNode:function(){var t=this._node;return e.each(FLLightbox._instances,function(l,i){e(i._node).is(":visible")&&(t=e(i._node))}),t}}}(jQuery),function(e){FLStyleSheet=function(t){"object"==typeof t&&e.extend(this,t),this._createSheet()},FLStyleSheet.prototype={id:null,_sheet:null,_sheetElement:null,updateRule:function(e,t,l){for(var i=this._sheet.cssRules?this._sheet.cssRules:this._sheet.rules,o=null,s=0;s<i.length;s++)i[s].selectorText.toLowerCase()==e.toLowerCase()&&(o=i[s]);if(o)if("object"==typeof t)for(s in t)o.style[this._toCamelCase(s)]=t[s];else o.style[this._toCamelCase(t)]=l;else this.addRule(e,t,l)},addRule:function(e,t,l){var i="",o="";if("object"==typeof t)for(o in t)i+=o+":"+t[o]+";";else i=t+":"+l+";";this._sheet.insertRule?this._sheet.insertRule(e+" { "+i+" }",this._sheet.cssRules.length):this._sheet.addRule(e,i)},destroy:function(){this._sheetElement&&(this._sheetElement.remove(),this._sheetElement=null),this._sheet&&(this._sheet=null)},disable:function(){this._sheet.disabled=!0},enable:function(){this._sheet.disabled=!1},_createSheet:function(){var t=this.id?' id="'+this.id+'"':"";this._sheet||(this._sheetElement=e('<style type="text/css"'+t+"></style>"),e("body").append(this._sheetElement),this._sheet=this._sheetElement[0].sheet)},_toCamelCase:function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}}(jQuery);
|