Nimble Page Builder - Version 1.1.8

Version Description

: October 23rd, 2018 = * improved : performance improvements with new options to lazy load images * added : an admin page for Nimble Builder, to display the system informations * added : a dismissable update notifications in admin

Download this release

Release Info

Developer nikeo
Plugin Icon 128x128 Nimble Page Builder
Version 1.1.8
Comparing to
See all releases

Code changes from version 1.1.7 to 1.1.8

assets/admin/css/nimble-admin.css ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* UPDATE NOTICE */
2
+ .czr-update-notice h3, .czr-update-notice h4 {
3
+ font-weight: normal;
4
+ }
5
+ .czr-update-notice .button {
6
+ font-weight: normal;
7
+ }
8
+ .czr-update-notice .button.upgrade-to-pro {
9
+ height: 40px;
10
+ font-size: 1.2em;
11
+ padding: 5px 22px;
12
+ display: inline-block;
13
+ color: #de8200;
14
+ color: #fff;
15
+ background: #eea236;
16
+ border: 1px solid #eea236;
17
+ -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.1);
18
+ box-shadow: inset 0 -1px 0 rgba(0,0,0,.1);
19
+ text-align: center;
20
+ white-space: nowrap;
21
+ vertical-align: middle;
22
+ cursor: pointer;
23
+ border-radius: 3px;
24
+ -webkit-transition: all .2s ease-in-out;
25
+ -moz-transition: all .2s ease-in-out;
26
+ -o-transition: all .2s ease-in-out;
27
+ -ms-transition: all .2s ease-in-out;
28
+ transition: all .2s ease-in-out;
29
+ -webkit-user-select: none;
30
+ -moz-user-select: none;
31
+ -ms-user-select: none;
32
+ user-select: none;
33
+ margin-top: -4px;
34
+ font-weight: 400;
35
+ margin-left: 8px;
36
+ text-shadow: none;
37
+ }
38
+ .czr-update-notice .button.upgrade-to-pro:hover {
39
+ color: #fff;
40
+ background: #ed9c28;
41
+ border-color: #d58512;
42
+ }
43
+ /*a.czr-rating-link {
44
+ color: #eea236;
45
+ }*/
46
+ a.czr-rating-link:hover {
47
+ color: #eea236;
48
+ }
assets/czr/sek/js/ccat-sek-control.js CHANGED
@@ -515,7 +515,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
515
  sektionsLocalizedData.i18n['If this problem locks the Nimble builder, you might try to reset the sections for this page.'],
516
  '<br>',
517
  '<span style="text-align:center;display:block">',
518
- '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n['Reset'] + '" data-sek-reset="true">' + sektionsLocalizedData.i18n['Reset'] + '</button>',
519
  '</span>',
520
  '</span>'
521
  ].join('')
@@ -720,8 +720,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
720
  in_column : params.apiParams.in_column
721
  });
722
  self.updateAPISetting({ action : 'sek-update-fonts' } );
723
- api.previewer.send( 'sek-refresh-stylesheet', {
724
- skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
 
725
  });
726
  }
727
  },
@@ -892,6 +893,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
892
  return self.updateAPISetting( apiParams );
893
  },
894
  complete : function( params ) {
 
895
  switch( params.apiParams.action ) {
896
  case 'sek-duplicate-section' :
897
  api.previewer.trigger('sek-edit-options', {
@@ -899,6 +901,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
899
  level : 'section',
900
  in_sektion : params.apiParams.id
901
  });
 
902
  api.previewer.send('sek-animate-to-level', { id : params.apiParams.id });
903
  break;
904
  case 'sek-duplicate-column' :
@@ -908,6 +911,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
908
  in_sektion : params.apiParams.in_sektion,
909
  in_column : params.apiParams.in_column
910
  });
 
911
  break;
912
  case 'sek-duplicate-module' :
913
  api.previewer.trigger('sek-edit-module', {
@@ -916,10 +920,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
916
  in_sektion : params.apiParams.in_sektion,
917
  in_column : params.apiParams.in_column
918
  });
 
919
  break;
920
  }
921
- api.previewer.send( 'sek-refresh-stylesheet', {
922
- skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
 
923
  });
924
 
925
  }
@@ -961,8 +967,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
961
  break;
962
  }
963
  self.updateAPISetting({ action : 'sek-update-fonts' } );
964
- api.previewer.send( 'sek-refresh-stylesheet', {
965
- skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
966
  });
967
  if ( params.apiParams.is_first_section ) {
968
  api.previewer.trigger( 'sek-refresh-level', {
@@ -991,8 +997,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
991
  return self.updateAPISetting( apiParams );
992
  },
993
  complete : function( params ) {
994
- api.previewer.send( 'sek-refresh-stylesheet', {
995
- skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
 
996
  });
997
  self.updateAPISetting({ action : 'sek-update-fonts' } );
998
 
@@ -1065,14 +1072,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1065
 
1066
  'sek-refresh-level' : function( params ) {
1067
  sendToPreview = true;
1068
- return $.Deferred(function() {
1069
  apiParams = {
1070
  action : 'sek-refresh-level',
1071
  level : params.level,
1072
  id : params.id
1073
  };
1074
  uiParams = {};
1075
- this.resolve();
 
 
 
 
 
 
 
 
 
 
1076
  });
1077
  }
1078
  };//msgCollection
@@ -1117,7 +1134,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1117
  sektionsLocalizedData.i18n['If this problem locks the Nimble builder, you might try to reset the sections for this page.'],
1118
  '<br>',
1119
  '<span style="text-align:center;display:block">',
1120
- '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n['Reset'] + '" data-sek-reset="true">' + sektionsLocalizedData.i18n['Reset'] + '</button>',
1121
  '</span>',
1122
  '</span>'
1123
  ].join('')
@@ -1661,7 +1678,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1661
  });
1662
  }
1663
  } else {
1664
- modulesRegistrationParams[ '__no_option_group_to_be_updated_by_children_modules__' ] = {
1665
  settingControlId : params.id,
1666
  module_type : moduleType,
1667
  controlLabel : moduleName
@@ -2014,6 +2031,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2014
  controlLabel : sektionsLocalizedData.i18n['Custom CSS'],
2015
  icon : '<i class="material-icons sek-level-option-icon">code</i>'
2016
  },
 
 
 
 
 
 
2017
  local_reset : {
2018
  settingControlId : _id_ + '__local_reset',
2019
  module_type : 'sek_local_reset',
@@ -2126,6 +2149,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2126
  module_type : 'sek_global_widths',
2127
  controlLabel : sektionsLocalizedData.i18n['Site wide inner and outer sections widths'],
2128
  icon : '<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'
 
 
 
 
 
 
2129
  }
2130
  });
2131
 
@@ -2224,7 +2253,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2224
  reorderedCollection,
2225
  cloneId, //will be passed in resolve()
2226
  startingModuleValue,// will be populated by the optional starting value specificied on module registration
2227
- __presetSectionInjected__ = false;
 
2228
  newSetValue.collection = _.isArray( newSetValue.collection ) ? newSetValue.collection : self.defaultSektionSettingValue.collection;
2229
 
2230
  switch( params.action ) {
@@ -2238,7 +2268,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2238
  }
2239
  if ( true === params.is_nested ) {
2240
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
2241
- var parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
2242
  if ( 'no_match' == parentSektionCandidate ) {
2243
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
2244
  break;
@@ -2871,7 +2901,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2871
  }
2872
 
2873
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
2874
- var parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
2875
  if ( 'no_match' == parentSektionCandidate ) {
2876
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
2877
  break;
@@ -3062,8 +3092,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3062
  _.each( data, function( val, key ) {
3063
  if ( _.isObject( val ) || _.isArray( val ) ) {
3064
  _replaceImgPlaceholderById( val, imgList );
3065
- } else if ( _.isString( val ) && -1 != val.indexOf( '::img-path::' ) && _.has( imgList, val ) ) {
3066
- data[ key ] = imgList[ val ][ 'id'];
3067
  }
3068
  });
3069
  return columnCollection;
@@ -3239,11 +3269,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3239
  if ( ! this.isModuleRegistered( moduleType ) ) {
3240
  return {};
3241
  }
3242
- if ( sektionsLocalizedData.registeredModules[moduleType]['is_father'] ) {
3243
  api.errare( 'getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically' );
3244
  return;
3245
  }
3246
- var data = sektionsLocalizedData.registeredModules[ moduleType ]['tmpl']['item-inputs'],
3247
  defaultItemModel = {
3248
  id : '',
3249
  title : ''
@@ -3254,7 +3284,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3254
  switch ( _key_ ) {
3255
  case 'tabs' :
3256
  _.each( _d_ , function( _tabData_ ) {
3257
- _.each( _tabData_['inputs'], function( _inputData_, _id_ ) {
3258
  defaultItemModel[ _id_ ] = _inputData_['default'] || '';
3259
  });
3260
  });
@@ -3313,12 +3343,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3313
  api.errare( 'getInputDefaultValue => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
3314
  return;
3315
  }
3316
- if ( sektionsLocalizedData.registeredModules[module_type]['is_father'] ) {
3317
  api.errare( 'getInputDefaultValue => Father modules should be treated specifically' );
3318
  return;
3319
  }
3320
  if ( _.isUndefined( level ) ) {
3321
- level = sektionsLocalizedData.registeredModules[ module_type ][ 'tmpl' ];
3322
  }
3323
  var _defaultVal_ = 'no_default_value_specified';
3324
  _.each( level, function( levelData, _key_ ) {
@@ -3351,12 +3381,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3351
  api.errare( 'getInputType => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
3352
  return;
3353
  }
3354
- if ( sektionsLocalizedData.registeredModules[module_type]['is_father'] ) {
3355
  api.errare( 'getInputType => Father modules should be treated specifically' );
3356
  return;
3357
  }
3358
  if ( _.isUndefined( level ) ) {
3359
- level = sektionsLocalizedData.registeredModules[ module_type ][ 'tmpl' ];
3360
  }
3361
  var _inputType_ = 'no_input_type_specified';
3362
  _.each( level, function( levelData, _key_ ) {
@@ -3389,12 +3419,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3389
  api.errare( 'getInputRegistrationParams => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
3390
  return;
3391
  }
3392
- if ( sektionsLocalizedData.registeredModules[module_type]['is_father'] ) {
3393
  api.errare( 'getInputRegistrationParams => Father modules should be treated specifically' );
3394
  return;
3395
  }
3396
  if ( _.isUndefined( level ) ) {
3397
- level = sektionsLocalizedData.registeredModules[ module_type ][ 'tmpl' ];
3398
  }
3399
  var _params_ = {};
3400
  _.each( level, function( levelData, _key_ ) {
@@ -3450,7 +3480,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3450
  api.errare( 'getModuleStartingValue => the module type ' + module_type + ' is not registered' );
3451
  return 'no_starting_value';
3452
  }
3453
- var starting_value = sektionsLocalizedData.registeredModules[ module_type ][ 'starting_value' ];
3454
  return _.isEmpty( starting_value ) ? 'no_starting_value' : starting_value;
3455
  },
3456
 
@@ -6411,6 +6441,34 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6411
  },
6412
  });
6413
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6414
  ( function ( api, $, _ ) {
6415
  var Constructor = {
6416
  initialize: function( id, options ) {
@@ -6539,6 +6597,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6539
  )
6540
  },
6541
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6542
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
6543
  * IMAGE MAIN SETTINGS
6544
  /* ------------------------------------------------------------------------- */
515
  sektionsLocalizedData.i18n['If this problem locks the Nimble builder, you might try to reset the sections for this page.'],
516
  '<br>',
517
  '<span style="text-align:center;display:block">',
518
+ '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n.Reset + '" data-sek-reset="true">' + sektionsLocalizedData.i18n.Reset + '</button>',
519
  '</span>',
520
  '</span>'
521
  ].join('')
720
  in_column : params.apiParams.in_column
721
  });
722
  self.updateAPISetting({ action : 'sek-update-fonts' } );
723
+ api.previewer.trigger('sek-refresh-stylesheet', {
724
+ id : params.apiParams.in_column,
725
+ skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
726
  });
727
  }
728
  },
893
  return self.updateAPISetting( apiParams );
894
  },
895
  complete : function( params ) {
896
+ var idForStyleSheetRefresh;
897
  switch( params.apiParams.action ) {
898
  case 'sek-duplicate-section' :
899
  api.previewer.trigger('sek-edit-options', {
901
  level : 'section',
902
  in_sektion : params.apiParams.id
903
  });
904
+ idForStyleSheetRefresh = params.apiParams.location;
905
  api.previewer.send('sek-animate-to-level', { id : params.apiParams.id });
906
  break;
907
  case 'sek-duplicate-column' :
911
  in_sektion : params.apiParams.in_sektion,
912
  in_column : params.apiParams.in_column
913
  });
914
+ idForStyleSheetRefresh = params.apiParams.in_sektion;
915
  break;
916
  case 'sek-duplicate-module' :
917
  api.previewer.trigger('sek-edit-module', {
920
  in_sektion : params.apiParams.in_sektion,
921
  in_column : params.apiParams.in_column
922
  });
923
+ idForStyleSheetRefresh = params.apiParams.in_column;
924
  break;
925
  }
926
+ api.previewer.trigger('sek-refresh-stylesheet', {
927
+ id : idForStyleSheetRefresh,
928
+ skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
929
  });
930
 
931
  }
967
  break;
968
  }
969
  self.updateAPISetting({ action : 'sek-update-fonts' } );
970
+ api.previewer.trigger('sek-refresh-stylesheet', {
971
+ skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
972
  });
973
  if ( params.apiParams.is_first_section ) {
974
  api.previewer.trigger( 'sek-refresh-level', {
997
  return self.updateAPISetting( apiParams );
998
  },
999
  complete : function( params ) {
1000
+ api.previewer.trigger('sek-refresh-stylesheet', {
1001
+ id : params.apiParams.in_sektion,
1002
+ skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
1003
  });
1004
  self.updateAPISetting({ action : 'sek-update-fonts' } );
1005
 
1072
 
1073
  'sek-refresh-level' : function( params ) {
1074
  sendToPreview = true;
1075
+ return $.Deferred(function(_dfd_) {
1076
  apiParams = {
1077
  action : 'sek-refresh-level',
1078
  level : params.level,
1079
  id : params.id
1080
  };
1081
  uiParams = {};
1082
+ _dfd_.resolve();
1083
+ });
1084
+ },
1085
+
1086
+ 'sek-refresh-stylesheet' : function( params ) {
1087
+ sendToPreview = true;
1088
+ params = params || {};
1089
+ return $.Deferred(function(_dfd_) {
1090
+ apiParams = {id : params.id};
1091
+ uiParams = {};
1092
+ _dfd_.resolve();
1093
  });
1094
  }
1095
  };//msgCollection
1134
  sektionsLocalizedData.i18n['If this problem locks the Nimble builder, you might try to reset the sections for this page.'],
1135
  '<br>',
1136
  '<span style="text-align:center;display:block">',
1137
+ '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n.Reset + '" data-sek-reset="true">' + sektionsLocalizedData.i18n.Reset + '</button>',
1138
  '</span>',
1139
  '</span>'
1140
  ].join('')
1678
  });
1679
  }
1680
  } else {
1681
+ modulesRegistrationParams.__no_option_group_to_be_updated_by_children_modules__ = {
1682
  settingControlId : params.id,
1683
  module_type : moduleType,
1684
  controlLabel : moduleName
2031
  controlLabel : sektionsLocalizedData.i18n['Custom CSS'],
2032
  icon : '<i class="material-icons sek-level-option-icon">code</i>'
2033
  },
2034
+ local_performances : {
2035
+ settingControlId : _id_ + '__local_performances',
2036
+ module_type : 'sek_local_performances',
2037
+ controlLabel : sektionsLocalizedData.i18n['Page speed optimizations'],
2038
+ icon : '<i class="fas fa-fighter-jet sek-level-option-icon"></i>'
2039
+ },
2040
  local_reset : {
2041
  settingControlId : _id_ + '__local_reset',
2042
  module_type : 'sek_local_reset',
2149
  module_type : 'sek_global_widths',
2150
  controlLabel : sektionsLocalizedData.i18n['Site wide inner and outer sections widths'],
2151
  icon : '<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'
2152
+ },
2153
+ performances : {
2154
+ settingControlId : _id_ + '__performances',
2155
+ module_type : 'sek_global_performances',
2156
+ controlLabel : sektionsLocalizedData.i18n['Site wide page speed optimizations'],
2157
+ icon : '<i class="fas fa-fighter-jet sek-level-option-icon"></i>'
2158
  }
2159
  });
2160
 
2253
  reorderedCollection,
2254
  cloneId, //will be passed in resolve()
2255
  startingModuleValue,// will be populated by the optional starting value specificied on module registration
2256
+ __presetSectionInjected__ = false,
2257
+ parentSektionCandidate;
2258
  newSetValue.collection = _.isArray( newSetValue.collection ) ? newSetValue.collection : self.defaultSektionSettingValue.collection;
2259
 
2260
  switch( params.action ) {
2268
  }
2269
  if ( true === params.is_nested ) {
2270
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
2271
+ parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
2272
  if ( 'no_match' == parentSektionCandidate ) {
2273
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
2274
  break;
2901
  }
2902
 
2903
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
2904
+ parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
2905
  if ( 'no_match' == parentSektionCandidate ) {
2906
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
2907
  break;
3092
  _.each( data, function( val, key ) {
3093
  if ( _.isObject( val ) || _.isArray( val ) ) {
3094
  _replaceImgPlaceholderById( val, imgList );
3095
+ } else if ( _.isString( val ) && -1 != val.indexOf( '::img-path::' ) && _.has( imgList, val ) && _.isObject( imgList[ val ] ) ) {
3096
+ data[ key ] = imgList[ val ].id;
3097
  }
3098
  });
3099
  return columnCollection;
3269
  if ( ! this.isModuleRegistered( moduleType ) ) {
3270
  return {};
3271
  }
3272
+ if ( sektionsLocalizedData.registeredModules[moduleType].is_father ) {
3273
  api.errare( 'getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically' );
3274
  return;
3275
  }
3276
+ var data = sektionsLocalizedData.registeredModules[ moduleType ].tmpl['item-inputs'],
3277
  defaultItemModel = {
3278
  id : '',
3279
  title : ''
3284
  switch ( _key_ ) {
3285
  case 'tabs' :
3286
  _.each( _d_ , function( _tabData_ ) {
3287
+ _.each( _tabData_.inputs, function( _inputData_, _id_ ) {
3288
  defaultItemModel[ _id_ ] = _inputData_['default'] || '';
3289
  });
3290
  });
3343
  api.errare( 'getInputDefaultValue => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
3344
  return;
3345
  }
3346
+ if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
3347
  api.errare( 'getInputDefaultValue => Father modules should be treated specifically' );
3348
  return;
3349
  }
3350
  if ( _.isUndefined( level ) ) {
3351
+ level = sektionsLocalizedData.registeredModules[ module_type ].tmpl;
3352
  }
3353
  var _defaultVal_ = 'no_default_value_specified';
3354
  _.each( level, function( levelData, _key_ ) {
3381
  api.errare( 'getInputType => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
3382
  return;
3383
  }
3384
+ if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
3385
  api.errare( 'getInputType => Father modules should be treated specifically' );
3386
  return;
3387
  }
3388
  if ( _.isUndefined( level ) ) {
3389
+ level = sektionsLocalizedData.registeredModules[ module_type ].tmpl;
3390
  }
3391
  var _inputType_ = 'no_input_type_specified';
3392
  _.each( level, function( levelData, _key_ ) {
3419
  api.errare( 'getInputRegistrationParams => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
3420
  return;
3421
  }
3422
+ if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
3423
  api.errare( 'getInputRegistrationParams => Father modules should be treated specifically' );
3424
  return;
3425
  }
3426
  if ( _.isUndefined( level ) ) {
3427
+ level = sektionsLocalizedData.registeredModules[ module_type ].tmpl;
3428
  }
3429
  var _params_ = {};
3430
  _.each( level, function( levelData, _key_ ) {
3480
  api.errare( 'getModuleStartingValue => the module type ' + module_type + ' is not registered' );
3481
  return 'no_starting_value';
3482
  }
3483
+ var starting_value = sektionsLocalizedData.registeredModules[ module_type ].starting_value;
3484
  return _.isEmpty( starting_value ) ? 'no_starting_value' : starting_value;
3485
  },
3486
 
6441
  },
6442
  });
6443
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
6444
+ ( function ( api, $, _ ) {
6445
+ var Constructor = {
6446
+ initialize: function( id, options ) {
6447
+ var module = this;
6448
+ module.inputConstructor = api.CZRInput.extend({
6449
+ setupSelect : function() {
6450
+ api.czr_sektions.setupSelectInput.call( this );
6451
+ }
6452
+ });
6453
+ api.CZRDynModule.prototype.initialize.call( module, id, options );
6454
+
6455
+ }//initialize
6456
+ };
6457
+ api.czrModuleMap = api.czrModuleMap || {};
6458
+ $.extend( api.czrModuleMap, {
6459
+ sek_local_performances : {
6460
+ mthds : Constructor,
6461
+ crud : false,
6462
+ name : api.czr_sektions.getRegisteredModuleProperty( 'sek_local_performances', 'name' ),
6463
+ has_mod_opt : false,
6464
+ ready_on_section_expanded : true,
6465
+ defaultItemModel : _.extend(
6466
+ { id : '', title : '' },
6467
+ api.czr_sektions.getDefaultItemModelFromRegisteredModuleData( 'sek_local_performances' )
6468
+ )
6469
+ },
6470
+ });
6471
+ })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
6472
  ( function ( api, $, _ ) {
6473
  var Constructor = {
6474
  initialize: function( id, options ) {
6597
  )
6598
  },
6599
  });
6600
+ })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
6601
+ ( function ( api, $, _ ) {
6602
+ api.czrModuleMap = api.czrModuleMap || {};
6603
+ $.extend( api.czrModuleMap, {
6604
+ sek_global_performances : {
6605
+ crud : false,
6606
+ name : api.czr_sektions.getRegisteredModuleProperty( 'sek_global_performances', 'name' ),
6607
+ has_mod_opt : false,
6608
+ ready_on_section_expanded : true,
6609
+ defaultItemModel : _.extend(
6610
+ { id : '', title : '' },
6611
+ api.czr_sektions.getDefaultItemModelFromRegisteredModuleData( 'sek_global_performances' )
6612
+ )
6613
+ },
6614
+ });
6615
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
6616
  * IMAGE MAIN SETTINGS
6617
  /* ------------------------------------------------------------------------- */
assets/czr/sek/js/ccat-sek-control.min.js CHANGED
@@ -1 +1 @@
1
- var CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{initialize:function(){var o=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(r.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");o.MAX_NUMBER_OF_COLUMNS=12,o.SETTING_UPDATE_BUFFER=50,o.defaultSektionSettingValue=sektionsLocalizedData.defaultSektionSettingValue,o.sekCollectionSettingId=new r.Value({}),o.registered=new r.Value([]),r.bind("ready",function(){o.registerAndSetupDefaultPanelSectionOptions(),o.sekCollectionSettingId.callbacks.add(function(e,t){try{o.setupSettingToBeSaved()}catch(e){r.errare("Error in self.sekCollectionSettingId.callbacks => self.setupSettingsToBeSaved()",e)}});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),o.generateUI({action:"sek-generate-local-skope-options-ui"}),o.generateUI({action:"sek-generate-global-options-ui"})};_.isEmpty(r.czr_activeSkopes().local)||i(),r.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),o.bind("sek-ui-removed",function(){r.previewedDevice("desktop")}),r.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){r.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){s(this).trigger("click")})})})}),s("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){o.resetCollectionSetting()}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&r.control(e.id,function(e){e.container.find("[draggable]").each(function(){s(this).off("dragstart dragend")})}),"control"==e.what&&r.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(s(this).data("select2"))||s(this).select2("destroy")})})}),r.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=s.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.setupTopBar()})},registerAndSetupDefaultPanelSectionOptions:function(){var n=this,e=r.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});r.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.find("h3.accordion-section-title"),t=(n.container.find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg",'"/>'].join(""));if(0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}})}),r.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:"__globalAndLocalOptionsSection",title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section("__globalAndLocalOptionsSection",function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:"__localOptionsSection",title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section("__localOptionsSection",function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"refresh",type:"option"}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:"__content_picker__",title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section("__content_picker__",function(e){"resolved"!=r.czr_initialSkopeCollectionPopulated.state()?r.czr_initialSkopeCollectionPopulated.done(function(){r.previewer.trigger("sek-pick-content",{focus:!1})}):r.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&r.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&r.previewer.trigger("sek-pick-content"),sektionsData=r.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&r.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.sekCollectionSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarVisible=new l.Value(!1),t.topBarVisible.bind(function(e){t.toggleTopBar(e)}),t.mouseMovedRecently=new l.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(d(window).data("_scroll_move_timer_")),d(window).data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};d(window).on("mousemove scroll,",_.throttle(e,50)),l.previewer.bind("ready",function(){d(l.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.historyLog=new l.Value([]),t.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),d("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===d(this).data("nimble-history")?d(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):d(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?d.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){d("body").addClass("nimble-top-bar-visible")},200)}):(t=d.Deferred(),d("body").removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){if(0<d("#nimble-top-bar").length)return d("#nimble-top-bar");var t=this;try{_tmpl=wp.template("nimble-top-bar")({})}catch(e){return l.errare("Error when parsing the the top note template",e),!1}return d("#customize-preview").after(d(_tmpl)),d("[data-nimble-history]","#nimble-top-bar").on("click",function(e){try{t.navigateHistory(d(this).data("nimble-history"))}catch(e){l.errare("Error when firing self.navigateHistory",e)}}),d(".sek-settings","#nimble-top-bar").on("click",function(e){l.panel(sektionsLocalizedData.sektionsPanelId,function(e){t.rootPanelFocus(),e.focus()})}),d(".sek-add-content","#nimble-top-bar").on("click",function(e){e.preventDefault(),l.previewer.trigger("sek-pick-content",{})}),d(".sek-nimble-doc","#nimble-top-bar").on("click",function(e){e.preventDefault(),window.open(d(this).data("doc-href"),"_blank")}),d("#nimble-top-bar")},navigateHistory:function(i){var t,n,o,r,e=this,s=d.extend(!0,[],e.historyLog()),a=[];if(_.each(s,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){l(e.sekCollectionSettingId())(e.validateSettingValue(r),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(s,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(s,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":s.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}a.push(newLog)}),e.historyLog(a)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,c){c.extend(CZRSeksPrototype,{setupSettingToBeSaved:function(){var e,s=this;e=a.czr_skopeBase.getSkopeProperty("sektions","local").db_values;var t=s.sekCollectionSettingId();if(_.isEmpty(t))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!a.has(t)){a.CZR_Helpers.register({what:"setting",id:t,value:s.validateSettingValue(_.isObject(e)?e:s.defaultSektionSettingValue),transport:"postMessage",type:"option",track:!1,origin:"nimble"});a(t,function(e){s.historyLog([{status:"current",value:e(),action:"initial"}]),e.bind(_.debounce(function(e,t,i){if(i&&!0!==i.navigatingHistoryLogs){var n,o=[],r=c.extend(!0,[],s.historyLog());_.isEmpty(i.in_sektion)?_.isEmpty(i.to_sektion)||(n=i.to_sektion):n=i.in_sektion,_.each(r,function(e){"future"!=e.status&&(c.extend(e,{status:"previous"}),o.push(e))}),o.push({status:"current",value:e,action:_.isObject(i)&&i.action||"",sektionToRefresh:n}),s.historyLog(o)}},1e3))})}},validateSettingValue:function(i){if(!_.isObject(i))return a.errare("validation error => the setting should be an object",i),null;var n={},o=!1,e=[],r=function(e){a.errare(e,i),a.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks the Nimble builder, you might try to reset the sections for this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),o=!0},s=function(t){if(!o)if(_.isUndefined(t)&&_.isEmpty(n)){if(t=c.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void r("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void r('validation error => the root level should not have a "level" or an "id" property');_.each(i.collection,function(e){n=t,s(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void r("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void r("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void r("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void r('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void r("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void r("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&a.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(n.level))return void r("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=n.level)return void r("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=n.level)return void r("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=n.level)return void r("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=n.level)return void r("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){n=c.extend(!0,{},t),s(e)})}};return s(),o?null:i},resetCollectionSetting:function(){if(_.isEmpty(this.sekCollectionSettingId()))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");a(this.sekCollectionSettingId())(this.defaultSektionSettingValue),a.previewer.refresh(),a.notifications.remove("sek-notify"),a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("sek-reset-done",{type:"success",message:sektionsLocalizedData.i18n["Reset complete"],dismissible:!0})),_.delay(function(){a.notifications.remove("sek-reset-done")},5e3)})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},s={},a=!0,e={"sek-add-section":{callback:function(e){return a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module:e.before_module,after_module:e.after_module},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts"}),c.previewer.send("sek-refresh-stylesheet",{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(a=!0,s={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts"}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-duplicate":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}c.previewer.send("sek-refresh-stylesheet",{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return a=!0,s={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts"}),c.previewer.send("sek-refresh-stylesheet",{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return a=!1,s={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){c.previewer.send("sek-refresh-stylesheet",{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),o.updateAPISetting({action:"sek-update-fonts"}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return a=!0,r={},s={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"section",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(s)},"sek-edit-options":function(e){return a=!0,r={},_.isEmpty(e.id)?l.Deferred(function(){this.reject("missing id")}):(s={action:"sek-generate-level-options-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s))},"sek-edit-module":function(e){return a=!0,r={},s={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s)},"sek-notify":function(t){return a=!1,l.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("sek-notify",{type:t.type||"info",message:t.message,dismissible:!0})),_.delay(function(){c.notifications.remove("sek-notify")},t.duration||5e3)}),this.resolve()})},"sek-refresh-level":function(e){return a=!0,l.Deferred(function(){r={action:"sek-refresh-level",level:e.level,id:e.id},s={},this.resolve()})}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}try{e(t).done(function(e){a?c.previewer.send(n,{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:s,cloneId:!_.isEmpty(e)&&e}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:s}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => error when firing "+n,e),c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks the Nimble builder, you might try to reset the sections for this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this,n=function(e){return e.id="",_.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&n(e)}),e};c.previewer.bind("sek-to-json",function(e){var t=l.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(n(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(k,y){y.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=y.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var o,r=this,e=n.settingParams.to,t=null,i=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var s=n.settingParams.args.moduleRegistrationParams.control,a=n.settingParams.args.moduleRegistrationParams.id,c=s.czr_Module(a);if(_.isEmpty(c)?k.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=c.module_type,i=c.isMultiItem()),!i&&_.isObject(e)?o=r.normalizeAndSanitizeSingleItemInputValues(e,t):(o=[],_.each(e,function(e){o.push(r.normalizeAndSanitizeSingleItemInputValues(e,t))})),_.isEmpty(n.defaultPreviewAction))k.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed;_.isUndefined(f)||(l=r.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var h=function(){if(!0!==n.isGlobalOptions)return r.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:o,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(){!0===d&&k.previewer.send("sek-refresh-stylesheet",{skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}}),!0===u&&k.previewer.send("sek-refresh-level",{apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")}),!0===m&&k.previewer.refresh()});if(_.isEmpty(n.options_type))k.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=k(sektionsLocalizedData.optNameForGlobalOptions)(),t=y.extend(!0,{},_.isObject(e)?e:{}),i={};_.each(o||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,k(sektionsLocalizedData.optNameForGlobalOptions)(t)}};if(!0===p){var g=n.settingParams.args.input_value;if(!_.isString(g))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",g);-1<g.indexOf("gfont")?r.updateAPISetting({action:"sek-update-fonts",font_family:g}).always(function(){h().then(function(){r.updateAPISetting({action:"sek-update-fonts"})})}):h()}else h()}}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},normalizeAndSanitizeSingleItemInputValues:function(e,o){var i,r={},n={},s=null,a=this;return _.each(e,function(e,t){var i,n;_.contains(["title","id"],t)||(null!==o&&"no_default_value_specified"===(s=a.getInputDefaultValue(t,o))&&k.infoLog("::updateAPISettingAndExecutePreviewActions => missing default value for input "+t+" in module "+o),i=e,n=s,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(r[t]=e))}),_.each(r,function(e,t){switch(a.getInputType(t,o)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"tiny_mce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=k.control.has(t):(i=!0,1<e.length&&k.errare("generateUI => why is this control registered more than once ? => "+t)),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(n,e){var o=this,t={};a.extend(t,{content_type_switcher:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:sektionsLocalizedData.i18n["Select a content type"],priority:0,settingValue:{content_type:n.content_type}},module_picker:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:sektionsLocalizedData.i18n["Pick a module"],content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_intro_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_intro_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for an introduction"],content_type:"section",expandAndFocusOnInit:!0,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_features_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_features_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for services and features"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_contact_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_contact_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Contact-us sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_column_layouts_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_column_layouts_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Empty sections with columns layout"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var i=_.keys(t)[0],r=t[i].settingControlId;return o.isUIControlAlreadyRegistered(r)?s.control(r,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}),s.section(t.section()).container.first().trigger("sek-content-type-refreshed",{content_type:n.content_type})}):(_do_register_=function(){_.each(t,function(i,e){s.has(i.settingControlId)||(s(i.settingControlId,function(e){e.bind(function(e,t){s.errare("generateUIforDraggableContent => the setting() should not changed")})}),s.CZR_Helpers.register({origin:"nimble",level:n.level,what:"setting",id:i.settingControlId,dirty:!1,value:i.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),s.CZR_Helpers.register({origin:"nimble",level:n.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:"__content_picker__",priority:i.priority||10,settings:{default:i.settingControlId},track:!1}).done(function(){s.control(i.settingControlId,function(e){e.content_type=i.content_type,!0===n.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),"section"===e.content_type?(e.container.find(".czr-items-wrapper").hide(),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&(e.container.find(".czr-items-wrapper").show(),t.trigger("click"))):e.container.attr("data-sek-accordion","no")})})})},s.section("__content_picker__",function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e,{expand_first_module:!0}),o._maybeFetchSectionsFromServer()})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(o,e){var r=this;_.isEmpty(o.id)&&e.reject("generateUI => missing id");var t=r.getLevelProperty({property:"value",id:o.id}),i=r.getLevelProperty({property:"module_type",id:o.id}),n=r.getRegisteredModuleProperty(i,"name");_.isEmpty(i)&&e.reject("generateUI => module => invalid module_type");var s={};if(!0===r.getRegisteredModuleProperty(i,"is_father")){var a=r.getRegisteredModuleProperty(i,"children");if(_.isEmpty(a))throw new Error("::generateUIforFrontModules => a father module "+i+" is missing children modules ");_.each(a,function(e,t){s[t]={settingControlId:o.id+"__"+t,module_type:e,controlLabel:r.getRegisteredModuleProperty(e,"name")}})}else s.__no_option_group_to_be_updated_by_children_modules__={settingControlId:o.id,module_type:i,controlLabel:n};var c=_.keys(s)[0],l=s[c].settingControlId;return r.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(r.cleanRegistered(),_do_register_=function(){_.each(s,function(i,n){if(!d.has(i.settingControlId)){d(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{r.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(o,{action:"sek-set-module-value"}),options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},r.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},t);"__no_option_group_to_be_updated_by_children_modules__"!==n&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[n])?e[n]:{}),d.CZR_Helpers.register({origin:"nimble",level:o.level,what:"setting",id:i.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:o.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:o.id,priority:10,settings:{default:i.settingControlId}}).done(function(){d.control(i.settingControlId).focus({completeCallback:function(){}}),d.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})})},d.section.when(o.id,function(){d.section(o.id).focus(),_do_register_()}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:o.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){d.section(o.id,function(e){e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),r.scheduleModuleAccordion.call(e)})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(r,e){var s=this,a=s.getLevelProperty({property:"options",id:r.id});a=_.isObject(a)?a:{};var t={};l.extend(t,{bg:{settingControlId:r.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[r.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'},border:{settingControlId:r.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:r.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:r.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Set a custom anchor for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:r.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:r.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),"section"===r.level&&(l.extend(t,{width:{settingControlId:r.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),l.extend(t,{breakpoint:{settingControlId:r.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}})),"module"===r.level&&l.extend(t,{width:{settingControlId:r.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return s.isUIControlAlreadyRegistered(n)?c.control(n).focus({completeCallback:function(){var e=c.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(t,function(i,n){if(s.isUIControlAlreadyRegistered(i.settingControlId))c.section(c.control(i.settingControlId).section()).expanded(!0);else{if(!c.has(i.settingControlId)){c(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:r,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){c.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},s.SETTING_UPDATE_BUFFER))});var e=a[n]||{},t=s.getModuleStartingValue(i.module_type);if("no_starting_value"!==t&&_.isObject(t)){var o=l.extend(!0,{},t);e=l.extend(o,e)}c.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:i.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}c.CZR_Helpers.register({origin:"nimble",level:r.level,level_id:r.id,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:r.id,priority:0,settings:{default:i.settingControlId}}).done(function(){!0===i.expandAndFocusOnInit&&c.control(i.settingControlId).focus({completeCallback:function(){}}),c.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})}})},c.section.has(r.id)||c.section(r.id,function(e){s.scheduleModuleAccordion.call(e,{expand_first_module:!0})}),c.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+r.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){c.section(r.id,function(e){_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>')})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=l.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(l.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(a,e){var c=this,t=c.getLocalSkopeOptionId();if(c.isUIControlAlreadyRegistered(t))return e;var i={};return d.extend(i,{template:{settingControlId:t+"__template",module_type:"sek_local_template",controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'},widths:{settingControlId:t+"__widths",module_type:"sek_local_widths",controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'},custom_css:{settingControlId:t+"__custom_css",module_type:"sek_local_custom_css",controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'},local_reset:{settingControlId:t+"__local_reset",module_type:"sek_local_reset",controlLabel:sektionsLocalizedData.i18n["Remove the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'}}),_do_register_=function(){_.each(i,function(i,n){if(!l.has(i.settingControlId)){l(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{c.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh",uiParams:a,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},c.SETTING_UPDATE_BUFFER))});var e=c.getModuleStartingValue(i.module_type),t=l(c.sekCollectionSettingId())(),o=d.extend(!0,{},_.isObject(t.local_options)?t.local_options:{}),r=_.isObject(o[n])?o[n]:{};if("no_starting_value"!==e&&_.isObject(e)){var s=d.extend(!0,{},e);r=d.extend(s,r)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:i.settingControlId,dirty:!1,value:r,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:"__localOptionsSection",priority:10,settings:{default:i.settingControlId}}).done(function(){l.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},l.section("__localOptionsSection",function(e){l(c.sekCollectionSettingId(),function(){_do_register_(),e.container.on("click",".accordion-section-title",function(){c.generateUI({action:"sek-generate-local-skope-options-ui"})})})}),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(s,e){var a=this,t=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(a.isUIControlAlreadyRegistered(t))return e;var i={};return l.extend(i,{breakpoint:{settingControlId:t+"__breakpoint",module_type:"sek_global_breakpoint",controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">devices</i>'},widths:{settingControlId:t+"__widths",module_type:"sek_global_widths",controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),_do_register_=function(){_.each(i,function(i,n){if(!c.has(i.settingControlId)){c(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh",uiParams:s,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){c.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},a.SETTING_UPDATE_BUFFER))});var e=sektionsLocalizedData.globalOptionDBValues,t=a.getModuleStartingValue(i.module_type),o=_.isObject(e)&&!_.isEmpty(e[n])?e[n]:{};if("no_starting_value"!==t&&_.isObject(t)){var r=l.extend(!0,{},t);o=l.extend(r,o)}c.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:i.settingControlId,dirty:!1,value:o,transport:"postMessage",type:"_nimble_ui_"})}c.CZR_Helpers.register({origin:"nimble",level:s.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:"__globalAndLocalOptionsSection",priority:20,settings:{default:i.settingControlId},track:!1}).done(function(){c.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},c.section("__globalAndLocalOptionsSection",function(e){c(a.sekCollectionSettingId(),function(){_do_register_()})}),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(Y,J){J.extend(CZRSeksPrototype,{updateAPISetting:function($){var q=this,G=J.Deferred();return Y(q.sekCollectionSettingId(),function(e){var n,t,o,i,r,s,a,c,l=e(),d=_.isObject(l)?J.extend(!0,{},l):q.defaultSektionSettingValue,u=!1;switch(d.collection=_.isArray(d.collection)?d.collection:q.defaultSektionSettingValue.collection,$.action){case"sek-add-section":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(_.isEmpty($.location))throw new Error("updateAPISetting => "+$.action+" => missing location");if(!0===$.is_nested){if(o=q.getLevelModel($.in_column,d.collection),"no_match"==(Q=q.getLevelModel($.in_sektion,d.collection))){G.reject("updateAPISetting => "+$.action+" => no grand parent sektion found");break}if(!0===Q.is_nested){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.push({id:$.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+q.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(n=q.getLevelModel($.location,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){$.before_section===e.id&&(x=t),$.after_section===e.id&&(x=t+1)}),n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(x,0,{id:$.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+q.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(_.isEmpty($.location))throw new Error("updateAPISetting => "+$.action+" => missing location");var p;try{p=q.cloneLevel($.id)}catch(e){Y.errare("updateAPISetting => "+$.action,e);break}var m=q.getLevelPositionInCollection($.id,d.collection);if(!0===$.is_nested){if("no_match"==(o=q.getLevelModel($.in_column,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(parseInt(m+1,10),0,p)}else{if("no_match"==(n=q.getLevelModel($.location,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(parseInt(m+1,10),0,p)}a=p.id;break;case"sek-remove-section":if(!0===$.is_nested)"no_match"!=(o=q.getLevelModel($.in_column,d.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=$.id})):Y.errare("updateAPISetting => "+$.action+" => no parent column matched");else{if("no_match"==(n=q.getLevelModel($.location,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}n.collection=_.filter(n.collection,function(e){return e.id!=$.id})}break;case"sek-move-section":var f,h,g=q.getLevelModel($.to_location,d.collection);if(_.isEmpty(g)||"no_match"==g)throw new Error("updateAPISetting => "+$.action+" => missing target location");if($.from_location!=$.to_location){var k=q.getLevelModel($.from_location,d.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+$.action+" => missing source location");k.collection=_.isArray(k.collection)?k.collection:[],f=q.getLevelModel($.id,k.collection),h=J.extend(!0,{},f),k.collection=_.filter(k.collection,function(e){return e.id!=$.id})}g.collection=_.isArray(g.collection)?g.collection:[],r=J.extend(!0,[],g.collection),s=[],_.each($.newOrder,function(e){if($.from_location!=$.to_location&&e==h.id)s.push(h);else{if(t=q.getLevelModel(e,r),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => move section => missing section candidate");s.push(t)}}),g.collection=s;break;case"sek-add-column":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if("no_match"==(t=q.getLevelModel($.in_sektion,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched"),G.reject("updateAPISetting => "+$.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],q.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}_.each(t.collection,function(e){e.width=""}),t.collection.push({id:$.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=q.getLevelModel($.in_sektion,d.collection))){if(1===_.size(t.collection)){G.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=$.id}),_.each(t.collection,function(e){e.width=""})}else Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if("no_match"==(t=q.getLevelModel($.in_sektion,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched"),G.reject("updateAPISetting => "+$.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],q.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var y;try{y=q.cloneLevel($.id)}catch(e){Y.errare("updateAPISetting => "+$.action,e);break}var v=q.getLevelPositionInCollection($.id,d.collection);a=y.id,t.collection.splice(parseInt(v+1,10),0,y),_.each(t.collection,function(e){e.width=""});break;case"sek-resize-columns":if($.col_number<2)break;var b=q.getLevelModel($.resized_column,d.collection),z=q.getLevelModel($.sister_column,d.collection);if("no_match"==b){Y.errare("updateAPISetting => "+$.action+" => no resized column matched"),G.reject("updateAPISetting => "+$.action+" => no resized column matched");break}b.width=parseFloat($.resizedColumnWidthInPercent);var I=q.getLevelModel($.in_sektion,d.collection),w=_.filter(I.collection,function(e){return e.id!=b.id&&e.id!=z.id}),M=parseFloat(b.width.toFixed(3));_.isEmpty(w)||_.each(w,function(e){currentColWidth=parseFloat(1*e.width),(!_.has(e,"width")||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(e.width=parseFloat((100/$.col_number).toFixed(3))),M=parseFloat((M+e.width).toFixed(3))}),z.width=parseFloat((100-M).toFixed(3));break;case"sek-move-column":var C,D,S=q.getLevelModel($.to_sektion,d.collection);if(_.isEmpty(S)||"no_match"==S)throw new Error("updateAPISetting => "+$.action+" => missing target sektion");if($.from_sektion!=$.to_sektion){var P=q.getLevelModel($.from_sektion,d.collection);if(_.isEmpty(P)||"no_match"==P)throw new Error("updateAPISetting => "+$.action+" => missing source column");P.collection=_.isArray(P.collection)?P.collection:[],C=q.getLevelModel($.id,P.collection),D=J.extend(!0,{},C),P.collection=_.filter(P.collection,function(e){return e.id!=$.id}),_.each(P.collection,function(e){e.width=""})}S.collection=_.isArray(S.collection)?S.collection:[],r=J.extend(!0,[],S.collection),s=[],_.each($.newOrder,function(e){if($.from_sektion!=$.to_sektion&&e==D.id)s.push(D);else{if(o=q.getLevelModel(e,r),_.isEmpty(o)||"no_match"==o)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");s.push(o)}}),S.collection=s,_.each(S.collection,function(e){e.width=""});break;case"sek-add-module":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(_.isEmpty($.module_type))throw new Error("updateAPISetting => "+$.action+" => missing module_type");if("no_match"===(o=q.getLevelModel($.in_column,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}var x=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){$.before_module===e.id&&(x=t),$.after_module===e.id&&(x=t+1)});var E={id:$.id,level:"module",module_type:$.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(c=q.getModuleStartingValue($.module_type))&&(E.value=c),o.collection.splice(x,0,E);break;case"sek-duplicate-module":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if("no_match"==(o=q.getLevelModel($.in_column,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}var R;o.collection=_.isArray(o.collection)?o.collection:[];try{R=q.cloneLevel($.id)}catch(e){Y.errare("updateAPISetting => "+$.action,e),G.reject("updateAPISetting => "+$.action+" => error when cloning the level");break}var L=q.getLevelPositionInCollection($.id,d.collection);a=R.id,o.collection.splice(parseInt(L+1,10),0,R);break;case"sek-remove-module":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");"no_match"!=(o=q.getLevelModel($.in_column,d.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=$.id})):Y.errare("updateAPISetting => "+$.action+" => no parent column matched");break;case"sek-move-module":var A,Z,j;if(A=q.getLevelModel($.to_column,d.collection),_.isEmpty(A)||"no_match"==A)throw new Error("updateAPISetting => "+$.action+" => missing target column");if($.from_column!=$.to_column){var F;if(F=q.getLevelModel($.from_column,d.collection),_.isEmpty(F)||"no_match"==F)throw new Error("updateAPISetting => "+$.action+" => missing source column");F.collection=_.isArray(F.collection)?F.collection:[],Z=q.getLevelModel($.id,d.collection),j=J.extend(!0,{},Z),F.collection=_.filter(F.collection,function(e){return e.id!=$.id})}if(A.collection=_.isArray(A.collection)?A.collection:[],r=J.extend(!0,[],A.collection),s=[],_.each($.newOrder,function(e){if($.from_column!=$.to_column&&e==j.id)s.push(j);else{if(i=q.getLevelModel(e,d.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+$.action+" => missing moduleCandidate");s.push(i)}}),s.length!=_.uniq(s).length)throw new Error("updateAPISetting => "+$.action+" => there are duplicated modules in column : "+A.id);A.collection=s;break;case"sek-set-module-value":i=q.getLevelModel($.id,d.collection);var V={};if(_.each($.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(V[t]=e)}),"no_match"==i){Y.errare("updateAPISetting => "+$.action+" => no module matched",$),G.reject("updateAPISetting => "+$.action+" => error no module matched");break}if(_.isEmpty($.options_type)){Y.errare("updateAPISetting => "+$.action+" => missing options_type"),G.reject("updateAPISetting => "+$.action+" => missing options_type");break}"__no_option_group_to_be_updated_by_children_modules__"===$.options_type?i.value=V:(i.value=_.isEmpty(i.value)?{}:i.value,i.value[$.options_type]=V);break;case"sek-generate-level-options-ui":var O=q.getLevelModel($.id,d.collection),T={};if("no_match"===O){Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched"),G.reject("updateAPISetting => "+$.action+" => no parent sektion matched");break}O.options=O.options||{},_.each($.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(T[t]=e)}),_.isEmpty($.options_type)&&Y.errare("updateAPISetting => "+$.action+" => missing options_type"),O.options[$.options_type]=T;break;case"sek-generate-local-skope-options-ui":T={};var U=J.extend(!0,{},_.isObject(d.local_options)?d.local_options:{});if(_.each($.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(T[t]=e)}),_.isEmpty($.options_type)||!_.isString($.options_type))Y.errare("updateAPISetting => "+$.action+" => missing options_type");else{var N={};N[$.options_type]=T,d.local_options=J.extend(U,N)}break;case"sek-add-content-in-new-sektion":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(x=0,"no_match"==(n=q.getLevelModel($.location,d.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}switch(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){$.before_section===e.id&&(x=t),$.after_section===e.id&&(x=t+1)}),$.content_type){case"module":c=q.getModuleStartingValue($.content_id),n.collection.splice(x,0,{id:$.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+q.guid(),level:"column",collection:[{id:$.droppedModuleId,level:"module",module_type:$.content_id,value:"no_starting_value"!==c?c:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":u=J.Deferred();var B=function(e){q.preparePresetSectionForInjection(e).fail(function(e){G.reject("updateAPISetting => error when preparePresetSectionForInjection => "+$.action+" => "+e),u.reject(e)}).done(function(e){var t=!1;if(!_.isEmpty($.sektion_to_replace)){var i=q.getLevelModel($.sektion_to_replace,d.collection);"no_match"===i&&(Y.errare("updateAPISetting => "+$.action+" => no sektionToReplace matched"),G.reject("updateAPISetting => "+$.action+" => no sektionToReplace matched")),t=!0===i.is_nested}t?("no_match"===(o=q.getLevelModel($.in_column,d.collection))&&(Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched")),o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){$.before_section===e.id&&(x=t),$.after_section===e.id&&(x=t+1)}),o.collection.splice(x,0,{id:$.id,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):n.collection.splice(x,0,{id:$.id,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion}),u.resolve()})};q.getPresetSectionCollection({presetSectionType:$.content_id,section_id:$.id}).fail(function(){Y.errare("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()",_er_),G.reject("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(Y.errare("updateAPISetting => "+$.action+" => preset section type not found or empty : "+$.content_id,e),G.reject("updateAPISetting => "+$.action+" => preset section type not found or empty")),B(e)})}break;case"sek-add-preset-section-in-new-nested-sektion":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");var Q;if(o=q.getLevelModel($.in_column,d.collection),"no_match"==(Q=q.getLevelModel($.in_sektion,d.collection))){G.reject("updateAPISetting => "+$.action+" => no grand parent sektion found");break}if(!0===Q.is_nested){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],u=J.Deferred(),B=function(e){q.preparePresetSectionForInjection(e).fail(function(e){G.reject("updateAPISetting => error when preparePresetSectionForInjection => "+$.action+" => "+e),u.reject(e)}).done(function(e){o.collection.push({id:$.id,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}),u.resolve()})},q.getPresetSectionCollection({presetSectionType:$.content_id,section_id:$.id}).fail(function(){Y.errare("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()",_er_),G.reject("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(Y.errare("updateAPISetting => "+$.action+" => preset section type not found or empty : "+$.content_id,e),G.reject("updateAPISetting => "+$.action+" => preset section type not found or empty")),B(e)});break;case"sek-update-fonts":var W=q.sniffGFonts();if(!_.isEmpty($.font_family)&&_.isString($.font_family)&&!_.contains(W,$.font_family)){if($.font_family.indexOf("gfont")<0){Y.errare("updateAPISetting => "+$.action+" => error => must be a google font, prefixed gfont"),G.reject("updateAPISetting => "+$.action+" => error => must be a google font, prefixed gfont");break}W.push($.font_family)}d.fonts=W}if("pending"==G.state()){var H=function(){_.isEqual(l,d)?G.reject("updateAPISetting => the new setting value is unchanged when firing action : "+$.action):null!==q.validateSettingValue(d)?(e(d,$),G.resolve(a)):G.reject("updateAPISetting => the new setting value did not pass the validation checks for action "+$.action)};!1===u?H():u.done(function(){H()}).fail(function(e){Y.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}}),G.promise()},_maybeFetchSectionsFromServer:function(){var e,t=J.Deferred();_.isEmpty(Y.sek_presetSections)?(_.isUndefined(Y.sek_fetchingPresetSections)||"pending"!=Y.sek_fetchingPresetSections.state()?(e=Y.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"preset_sections_server_collection",module_id:"no_module_id"}),Y.sek_fetchingPresetSections=e):e=Y.sek_fetchingPresetSections,e.done(function(e){Y.sek_presetSections=e,t.resolve(Y.sek_presetSections)}).fail(function(e){t.reject(e)})):t.resolve(Y.sek_presetSections);return t.promise()},getPresetSectionCollection:function(r){var s=this,a=J.Deferred();return s._maybeFetchSectionsFromServer().fail(function(e){a.reject(e)}).done(function(e){var t=J.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[r.presetSectionType]))throw new Error('getPresetSectionCollection => the preset section : "'+r.presetSectionType+'" has not been found in the collection');var i=t[r.presetSectionType],n=function(e){return _.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+s.guid(),_.isArray(e.collection)&&n(e.collection)}),e},o=function(e){return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&o(e.collection)}),e};i.id=r.section_id,i.collection=n(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o(i.collection),a.resolve(i)}),a.promise()},preparePresetSectionForInjection:function(o){var i=this,n={},r=J.Deferred(),s=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?s(e):_.isString(e)&&-1!=e.indexOf("::img-path::")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("::img-path::",""))))}),n},a=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?a(e,n):_.isString(e)&&-1!=e.indexOf("::img-path::")&&_.has(n,e)&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(s(o)).done(function(e){var t=a(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return _.isEmpty(e.level)||"setting"!==e.what||n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"!==e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{rootPanelFocus:function(){s.section.has(s.czr_activeSectionId())?s.section(s.czr_activeSectionId()).expanded(!1):s.section.each(function(e){e.expanded(!1)}),s.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getLevelModel:function(t,e){var i=this,n="no_match";if(_.isUndefined(e)){var o=s(i.sekCollectionSettingId())(),r=_.isObject(o)?a.extend(!0,{},o):i.defaultSektionSettingValue;e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==n&&(t===e.id?n=e:_.isArray(e.collection)&&(n=i.getLevelModel(t,e.collection)))}),n},getLevelPositionInCollection:function(i,e){var n=this,o="no_match";if(_.isUndefined(e)){var t=s(n.sekCollectionSettingId())(),r=_.isObject(t)?a.extend(!0,{},t):n.defaultSektionSettingValue;e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e,t){"no_match"==o&&(i===e.id?o=t:_.isArray(e.collection)&&(o=n.getLevelPositionInCollection(i,e.collection)))}),o},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))s.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];s.errare("getLevelProperty => invalid model for id : "+e.id,t)}else s.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=a.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(!sektionsLocalizedData.registeredModules[e].is_father){var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i}s.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically")},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},sniffGFonts:function(i,e){var n=this;if(i=i||[],_.isUndefined(e)){var t=s(n.sekCollectionSettingId())();e=_.isObject(t)?a.extend(!0,{},t):n.defaultSektionSettingValue}return _.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===n.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(i,e)&&i.push(e),(_.isArray(e)||_.isObject(e))&&n.sniffGFonts(i,e)}),i},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))s.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))s.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}s.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))s.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))s.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}s.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))s.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))s.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}s.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}s.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){if(!sektionsLocalizedData.registeredModules)return s.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return s.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t=sektionsLocalizedData.registeredModules[e].starting_value;return _.isEmpty(t)?"no_starting_value":t},selectNextTabbableOrFocusable:function(e){var t=a(e),i=a(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=a(e),i=a(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(){var n=this,e=(n.input_parent,n.module,s.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type).choices);_.isEmpty(e)?s.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in image module"):(_.each(e,function(e,t){var i={value:t,html:e};t==n()?a.extend(i,{selected:"selected"}):"px"===t&&a.extend(i,{selected:"selected"}),a("select[data-czrtype]",n.container).append(a("<option>",i))}),a("select[data-czrtype]",n.container).selecter())},setupFontSizeAndLineHeightInputs:function(e){var t=this,i=a(".sek-font-size-line-height-wrapper",t.container),n=i.find("input[data-czrtype]").data("sek-unit"),o=function(e){return _.contains(["px","em","%"],e)||(s.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new s.Value(_.isEmpty(n)?"px":o(n)),t.css_unit.bind(function(e){e=_.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("change")}),i.find('input[type="number"]').on("input change",function(e){t(a(this).val()+o(t.css_unit()))}).stepper(),i.on("click","[data-sek-unit]",function(e){e.preventDefault(),i.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),a(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",a(this).data("sek-unit")),t.css_unit(a(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0)},maybeSetupDeviceSwitcherForInput:function(){var i=this,e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");i.container.find(".customize-control-title").prepend(e),i.previewedDevice=new s.Value(s.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),i.container.find("[data-sek-device]").removeClass("active"),a(this).addClass("active");var t="desktop";try{t=a(this).data("sek-device")}catch(e){s.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{s.previewedDevice(t)}catch(e){s.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}i.previewedDevice(t)},i.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=i.container.find('[data-sek-device="'+s.previewedDevice()+'"]');0<t.length&&t.trigger("click")},scheduleModuleAccordion:function(e){e=e||{expand_first_module:!0};var i=this;a(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=a(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){a(this).attr("data-sek-accordion")||(a(this).attr("data-sek-expanded","false"),a(this).find(".czr-items-wrapper").stop(!0,!0).slideUp("fast"))}),t.find(".czr-items-wrapper").stop(!0,!0).slideToggle({duration:"fast",start:function(){t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),"true"==t.attr("data-sek-expanded")?t.trigger("sek-accordion-expanded"):t.trigger("sek-accordion-collapsed")}}))}),e.expand_first_module&&i.container.find(".customize-control").first().find("label > .customize-control-title").trigger("click")},isPromise:function(e){return e&&"function"==typeof e.then&&String(a.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=a.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(a.Deferred(function(t){(i.isPromise(e)?e:a.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),a.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||a.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:a.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{rel_path:t,nonce:s.settings.nonce.save}).fail(function(e){s.errare("sek_import_attachment ajax action failed for image "+t,e)})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,f){f.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){"draggable"in document.createElement("span")?t.setupNimbleDragZones(e.input_container):a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)})}),a.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){a.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var t=this;e.find("[draggable]").each(function(){f(this).on("dragstart",function(e){(function(e){e.originalEvent.dataTransfer.setData("sek-content-type",f(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-content-id",f(this).data("sek-content-id"));try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)})}t.dnd_draggedType=f(this).data("sek-content-type"),f(this).addClass("sek-dragged"),f("body").addClass("sek-dragging"),a.previewer.send("sek-drag-start",{type:t.dnd_draggedType})}).call(f(this),e)}).on("dragend",function(e){(function(e){f("body").removeClass("sek-dragging"),f(this).removeClass("sek-dragged"),a.previewer.send("sek-drag-stop")}).call(f(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=f("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=f(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop(f(this))&&(e.stopPropagation(),t.dnd_OnEnterOver(f(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(f(this),e)||t.dnd_cleanOnLeaveDrop(f(this),e);break;case"drop":if(this.$cachedDropZoneCandidates=null,!t.dnd_canDrop(f(this)))return;e.preventDefault(),t.dnd_onDrop(f(this),e),t.dnd_cleanOnLeaveDrop(f(this),e),a.previewer.send("sek-drag-stop")}}).data("zone-droppable-setup",!0))})},dnd_toggleDragApproachClassesToDropZones:function(m){this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.$dropZones.find(".sek-drop-zone").each(function(){var e=m.clientY,t=m.clientX,i=f(this)[0].getBoundingClientRect(),n=Math.abs(e-(i.bottom-(i.bottom-i.top)/2)),o=(Math.abs(i.top-e),Math.abs(t-(i.right-(i.right-i.left)/2))),r=(i.right,i.left,n<60),s=o<60,a=n<80,c=o<80,l=n<120,d=o<120,u=t<=i.right&&i.left<=t,p=e>=i.top&&i.bottom>=e;p&&u?(f(this).removeClass("sek-drag-is-approaching"),f(this).removeClass("sek-drag-is-close"),f(this).removeClass("sek-drag-is-very-close"),f(this).addClass("sek-drag-is-in")):((r||p)&&(s||u)?(f(this).removeClass("sek-drag-is-approaching"),f(this).removeClass("sek-drag-is-close"),f(this).addClass("sek-drag-is-very-close")):((a||p)&&(c||u)?(f(this).removeClass("sek-drag-is-approaching"),f(this).addClass("sek-drag-is-close")):((l||p)&&(d||u)?f(this).addClass("sek-drag-is-approaching"):f(this).removeClass("sek-drag-is-approaching"),f(this).removeClass("sek-drag-is-close")),f(this).removeClass("sek-drag-is-very-close")),f(this).removeClass("sek-drag-is-in"))}),this.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=f(e.currentTarget);switch(this.dnd_draggedType){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:a.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return f(a.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=e&&0<e.length&&e.hasClass("sek-content-preset_section-drop-zone"),i=e&&0<e.length&&e.hasClass("sek-module-drop-zone-for-first-module");return e.hasClass("sek-drop-zone")&&("preset_section"===this.dnd_draggedType&&t||"module"===this.dnd_draggedType&&!t||"preset_section"===this.dnd_draggedType&&i)},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){a.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),f(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(f(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"))},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");f.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,s=i.right,a=i.top,c=i.bottom;return r<=n&&n-r<=s-r&&(a<=o&&o-a<=c-a)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();a.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module:e.data("drop-zone-before-module-or-nested-section"),after_module:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t=e.drop_target_element,i="content-in-column";switch(t.data("sek-location")){case"between-sections":i="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,i="content-in-empty-location";break;case"between-columns":i="content-in-new-column"}if("preset_section"===e.content_type)if(t.hasClass("sek-module-drop-zone-for-first-module")){var n=t.closest('div[data-sek-level="section"]');1<n.find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(i="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=n.data("sek-id")):(e.sektion_to_replace=n.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=n.closest('[data-sek-level="column"]').data("sek-id"),i="content-in-a-section-to-replace")}else"between-sections"===t.data("sek-location")&&(i="content-in-a-section-to-create");switch(i){case"content-in-column":var o=t.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),s=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(s))throw new Error("No valid level id found");a.previewer.trigger("sek-add-module",{level:r,id:s,in_column:t.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:t.closest('div[data-sek-level="section"]').data("sek-id"),before_module:e.before_module,after_module:e.after_module,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":a.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"content-in-empty-location":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;default:a.errare("sek control panel => ::reactToDrop => invalid drop case : "+i)}}(e)}catch(e){a.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;r.sekEditorExpanded=new r.Value(!1),r.sekEditorSynchronizedInput=new r.Value,n.editorEventsListenerSetup=!1;var o=function(){r.sekTinyMceEditor=r.sekTinyMceEditor||tinyMCE.get("czr-customize-content_editor"),!1===n.editorEventsListenerSetup&&(n.attachEventsToEditor(),n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};n.bind("sek-edit-module_done",function(e){if("tiny_mce_editor"==e.clicked_input_type){var i=e.id;if(!0===n.getRegisteredModuleProperty(e.module_type,"is_father")){var t=n.getRegisteredModuleProperty(e.module_type,"children");if(_.isEmpty(t))throw new Error("::generateUIforFrontModules => a father module "+e.module_type+" is missing children modules ");_.each(t,function(e,t){"czr_tinymce_child"===e&&(i=i+"__"+t)})}r.sekEditorSynchronizedInput({control_id:i,input_id:e.clicked_input_id}),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),s("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=s(this).data("czr-control-id"),t=s(this).data("czr-input-id");if(_.isEmpty(e)||_.isEmpty(t))r.errare("toggle-tinymce-editor => missing input or control id");else{var i=s.extend(!0,{},r.sekEditorSynchronizedInput()),n=_.extend(i,{input_id:t,control_id:e});r.sekEditorSynchronizedInput(n),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),r.sekEditorSynchronizedInput.bind(function(n,e){o(),r(n.control_id,function(e){var t=e(),i=_.isObject(t)&&!_.isEmpty(t[n.input_id])?t[n.input_id]:"";try{r.sekTinyMceEditor.setContent(i)}catch(e){r.errare("Error when setting the tiny mce editor content in setupTinyMceEditor",e)}r.sekTinyMceEditor.focus()})}),r.sekEditorExpanded.bind(function(e,t,i){o(),e&&r.sekTinyMceEditor.focus(),s(document.body).toggleClass("czr-customize-content_editor-pane-open",e),s(window)[e?"on":"off"]("resize",function(){r.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?n.czrResizeEditor(window.innerHeight-n.$editorPane.height()):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),s("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){r.sekEditorExpanded(!1)}),s("#customize-controls").on("click",function(e){"open-tinymce-editor"!=s(e.target).data("czr-action")&&r.sekEditorExpanded(!1,{context:"clicked anywhere"})}),s(document).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=s(r.sekTinyMceEditor.iframeElement).contents().get(0);s(e).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?r.previewer.bind(e,function(){r.sekEditorExpanded(!1)}):r.previewer.bind(e,function(e){r.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachEventsToEditor:function(){var t=this;t.$editorTextArea=s("#czr-customize-content_editor"),t.$editorPane=s("#czr-customize-content_editor-pane"),t.$editorDragbar=s("#czr-customize-content_editor-dragbar"),t.$editorFrame=s("#czr-customize-content_editor_ifr"),t.$mceTools=s("#wp-czr-customize-content_editor-tools"),t.$mceToolbar=t.$editorPane.find(".mce-toolbar-grp"),t.$mceStatusbar=t.$editorPane.find(".mce-statusbar"),t.$preview=s("#customize-preview"),t.$collapseSidebar=s(".collapse-sidebar"),r.sekTinyMceEditor.on("input change keyup",function(e){if(r.control.has(r.sekEditorSynchronizedInput().control_id))try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:r.sekTinyMceEditor.getContent(),modified_editor_element:r.sekTinyMceEditor})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),t.$editorTextArea.on("input",function(e){try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:t.$editorTextArea.val(),modified_editor_element:t.$editorTextArea})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),s("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===s(e.target).attr("id")||s(e.target).hasClass("czr-resize-handle"))&&r.sekEditorExpanded())switch(e.type){case"mousedown":s(document).on("mousemove.czr-customize-content_editor",function(e){e.preventDefault(),s(document.body).addClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":s(document).off("mousemove.czr-customize-content_editor"),s(document.body).removeClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{});r.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=i.$mceTools.outerHeight()+i.$mceToolbar.outerHeight()+i.$mceStatusbar.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),i.$editorFrame.css("height",o.height-o.components),i.$collapseSidebar.css("bottom",n-o.height<56?i.$mceStatusbar.outerHeight()+4:o.height+8))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var s=o();o.initial_unit="px",u.isEmpty(s)||(o.initial_unit=u.isEmpty(s.unit)?"px":s.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,s=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},a);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",s).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),s.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),r(t)}),m.call(r,s,a),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,s);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,a,c){n.czrInputMap=n.czrInputMap||{},a.extend(n.czrInputMap,{bg_position:function(e){var t=this;a(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(a(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},i=function(e){var t=a.extend(!0,{},c.isObject(o())?o():{}),i=a.extend(!0,{},r);t=c.isObject(t)?a.extend(i,t):i;var n=s(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};a(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=a(this).val();(t=a.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",s=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=a(t,e);s.find(".selected").removeClass("selected"),s.find('div[data-sek-align="'+n+'"]').addClass("selected")};s.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),s.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{font_size:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{line_height:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(i,c,l){i.czrInputMap=i.czrInputMap||{},c.extend(i.czrInputMap,{font_picker:function(e){var a=this,o=a.input_parent,n=function(e,t){o();var n=c('select[data-czrtype="'+a.id+'"]',a.container);l.isNull(a())||l.isEmpty(a())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"),l.each([{title:sektionsLocalizedData.i18n["Web Safe Fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google Fonts"],type:"gfont",list:t.gfonts}],function(e){var t,r,s,i=c("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,s="",l.each(t,function(e){var t,i,n=e.name,o=l.isString(n)?n.replace(/[+|:]/g," "):n;t=n,i=r,(n=l.isString(t)?["[",i,"]",t].join(""):"")==a()?s+='<option selected="selected" value="'+n+'">'+o+"</option>":s+='<option value="'+n+'">'+o+"</option>"}),s)});n.append(i)});var i={escapeMarkup:function(e){return e}};e&&c.extend(i,{resultsAdapter:e,closeOnSelect:!1}),n.select2(i),c(".select2-selection__rendered",a.container).css(r(a()))},r=function(e){if(!l.isString(e)||l.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=s(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=l.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},s=function(e){if(!l.isString(e)||l.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return l.isString(t[0])?t[0].replace(/[+|:]/g," "):""};c.when(function(){var e,t=c.Deferred();l.isEmpty(i.sek_fontCollections)?(l.isUndefined(i.sek_fetchingFontCollection)||"pending"!=i.sek_fetchingFontCollection.state()?(e=i.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:a.module.id}),i.sek_fetchingFontCollection=e):e=i.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");i.sek_fontCollections=JSON.parse(e),t.resolve(i.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(i.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=c.Deferred(),void 0!==c.fn.select2&&void 0!==c.fn.select2.amd&&"function"==typeof c.fn.select2.amd.require?c.fn.select2.amd.require(["select2/results","select2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){i.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(s,a,c){s.czrInputMap=s.czrInputMap||{},a.extend(s.czrInputMap,{fa_icon_picker:function(){var t,n=this,o=n.input_parent,r=!1;a.when((t=a.Deferred(),c.isEmpty(n.sek_faIconCollection)?s.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection),t.promise())).done(function(e){!function(e){c.each(e,function(e){var t={value:e,html:s.CZR_Helpers.capitalize(e.substring(7))};t.value==o().icon&&(a.extend(t,{selected:"selected"}),r=!0),a("select[data-czrtype]",n.container).append(a("<option>",t))});var t,i=function(e){return e.id?a('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=r?a("<option>"):a("<option>",{selected:"selected"}),a("select[data-czrtype]",n.container).prepend(t).select2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e)}).fail(function(e){s.errare("fa_icon_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,t=(n.input_parent(),!1),r=n.container.find("textarea"),o=n.container.find(".customize-control-title"),s=r.data("editor-params");wp.codeEditor&&(p.isUndefined(s)||!1!==s)&&(t=s),n.isReady.done(function(){var e=function(e){p.isEmpty(this.editor)&&(p.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(t)try{a(t)}catch(e){d.errare("error in sek_control => code_editor() input",e),c()}else c();o.click()},10))};e.call(n),n.module.control.container.on("sek-accordion-expanded",function(){e.call(n)})});var a=function(e){var t,i=!1;t=p.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:l}),n.editor=wp.codeEditor.initialize(r,t),u(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":o.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),o.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},c=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},l=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",o.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",o.html()),i.setting.notifications.add(n.id,new d.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),s=function(e){return l.contains(["px","em","%"],e)||(a.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new a.Value(l.isEmpty(r)?"px":s(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+s(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(a,_,m){a.czrInputMap=a.czrInputMap||{},_.extend(a.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),s=function(e){return m.contains(["px","em","%"],e)||(a.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=a.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),s=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),a=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+s+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+s+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(a).trigger("input",{previewed_device_switched:!0})};a.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new a.Value(m.isEmpty(i())?"px":s(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=a.previewedDevice()||"desktop",o=_(this).val()+s(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=a.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(a.previewedDevice()))}),r.val(d.val()||0);try{n(a.previewedDevice())}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(h,g,k){h.czrInputMap=h.czrInputMap||{},g.extend(h.czrInputMap,{borders:function(e){var a=this,c=g(".sek-borders",a.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return k.contains(["px","em","%"],e)||(h.errare("borders => error : invalid unit for input "+a.id,e),e="px"),e},_=function(e){return k.isEmpty(e)||!k.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return k.isEmpty(e)||!k.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=h.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),f=k.isEmpty(t)||k.isEmpty(t.default)?{}:t.default;a.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=a(),t="px";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=a(),t="#000000";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.col)&&(t=e._all_.col),t},s=function(e){if(!k.contains(k.union(a.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=a(),i={},n=g.extend(!0,{},f);k.isObject(t)?i=g.extend(!0,{},t):k.isString(t)&&(i={_all_:{wght:t}});var o,r,s=function(e,t){var i,n=g.extend(!0,{},f);if(!k.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=k.isObject(e)&&k.has(e,"_all_")?k.extend(n._all_,e._all_):n._all_,k.has(e,t)&&k.isObject(e[t])?k.extend(i,e[t]):n._all_}(i=g.extend(n,i),e);if(k.isEmpty(s)||!k.isObject(s)||k.isEmpty(s.wght)||k.isEmpty(s.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(s.wght),r=_(s.wght),g(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(s.col).trigger("change"),u.data("border_type_switched",!1)};a.borderColor=new h.Value(k.isEmpty(r())?"#000000":r()),a.css_unit=new h.Value(k.isEmpty(o())?"px":p(o())),a.borderType=new h.Value("_all_"),l.val((i=a(),n=1,k.isObject(i)&&k.has(i,"_all_")&&k.isObject(i._all_)&&!k.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!k.isNumber(n)||n<0)&&(h.errare("Error in borders input type for module : "+a.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(a.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){g(this).val(t.color.toString()).trigger("colorpickerchange"),a.borderColor(t.color.toString(),{border_type_switched:!0===g(this).data("border_type_switched")})},clear:function(e,t){g(this).val("").trigger("colorpickerchange"),a.borderColor("")}}),a.css_unit.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.borderColor.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),a.borderType.bind(function(e){try{s(e)}catch(e){h.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}}),d.on("input",function(e){l.val(g(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.borderType()||"_all_",o=a.borderColor(),r=g(this).val()+p(a.css_unit()),s=g.extend(!0,{},f);(i=g.extend(!0,{},k.isObject(a())?a():s))[n]=g.extend(!0,{},i[n]||s[n]),k.isString(r)&&!k.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(k.isEmpty(t)||k.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&k.each(a.cssBorderTypes,function(e){i=k.omit(i,e)}),a(i)),d.val(g(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),g(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",g(this).data("sek-unit")),a.css_unit(g(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),g(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=g(this).data("sek-border-type")}catch(e){h.errare("borders input type => error when attaching click event",e)}a.borderType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.borderType()||"_all_",i=g.extend(!0,{},k.isObject(a())?a():{});k.isEmpty(i[t])||(i=k.omit(i,t),a(i),s(t))}),d.val(l.val()||0);try{s(a.borderType())}catch(e){h.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}g('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,h){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var a=this,c=f(".sek-borders",a.container),l=c.find('input[type="number"]'),s=c.find('input[type="range"]'),d=function(e){return h.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+a.id,e),e="px"),e},u=function(e){return h.isEmpty(e)||!h.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return h.isEmpty(e)||!h.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),_=h.isEmpty(t)||h.isEmpty(t.default)?{}:t.default;a.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=a(),t="px";return h.isObject(e)&&h.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!h.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=a(),i={},n=f.extend(!0,{},_);h.isObject(t)?i=f.extend(!0,{},t):h.isString(t)&&(i={_all_:"0px"});var o,r,s=function(e,t){var i,n=f.extend(!0,{},_);if(!h.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=h.isObject(e)&&h.has(e,"_all_")?e._all_:n._all_,h.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(h.isEmpty(s)||!h.isString(s))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(s),r=u(s),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};a.css_unit=new m.Value(h.isEmpty(o())?"px":d(o())),a.radiusType=new m.Value("_all_"),l.val((i=a(),n=0,h.isObject(i)&&h.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!h.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+a.module.module_type+" the initial radius is invalid : "+n),n=0),n)),a.css_unit.bind(function(e,t,i){(!h.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}}),s.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.radiusType()||"_all_",o=f(this).val()+d(a.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},h.isObject(a())?a():r))[n]=f.extend(!0,{},i[n]||r[n]),h.isString(o)&&!h.isEmpty(o)&&(i[n]=o),(h.isEmpty(t)||h.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&h.each(a.cssRadiusTypes,function(e){i=h.omit(i,e)}),a(i)),s.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),a.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}a.radiusType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.radiusType()||"_all_",i=f.extend(!0,{},h.isObject(a())?a():{});h.isEmpty(i[t])||(i=h.omit(i,t),a(i),r(t))}),s.val(l.val()||0);try{r(a.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}f('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=s(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);a.isEmpty(i)||a.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),s(this).addClass("is-selected").attr("aria-pressed",!0);try{i=s(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),s('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(i,n,e){i.czrInputMap=i.czrInputMap||{},n.extend(i.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){if(e.stopPropagation(),"local"===n(this).data("sek-reset-scope"))try{i.czr_sektions.resetCollectionSetting()}catch(e){i.errare("reset_button => error when firing resetCollectionSetting() on click event",e)}})}})}(wp.customize,jQuery,_),function(t,o,r){t.czrModuleMap=t.czrModuleMap||{},o.extend(t.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}}),t.czrInputMap=t.czrInputMap||{},o.extend(t.czrInputMap,{content_type_switcher:function(e){var i,n=this;if(!t.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=t.section(n.module.control.section()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault(),n.container.find("[data-sek-content-type]").removeClass("is-selected").attr("aria-pressed",!1),o(this).addClass("is-selected").attr("aria-pressed",!0),n.contentType(o(this).data("sek-content-type"))}),n.contentType=new t.Value,n.contentType.bind(function(t){n.container.find('[data-sek-content-type="'+n.contentType()+'"]').trigger("click"),r.each(i.controls(),function(e){r.isUndefined(e.content_type)||e.active(t===e.content_type)})}),n.contentType(n()),i.container.first().bind("sek-content-type-refreshed",function(e,t){n.contentType(t.content_type||"section")})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},e.extend(t.czrModuleMap,{sek_module_picker_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},i.each(["sek_intro_sec_picker_module","sek_features_sec_picker_module","sek_contact_sec_picker_module","sek_column_layouts_sec_picker_module"],function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(s,e,a){var t={initialize:function(e,t){var i=this;i.inputConstructor=s.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=s.CZRItem.extend(i.CZRItemConstructor||{}),s.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){s.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){s.errorLog("item.setInputVisibilityDeps() : "+e)}}),s.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module,r=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(i){switch(i.id){case"bg-image":a.each(["bg-position","bg-attachment","bg-scale","bg-apply-overlay","bg-color-overlay","bg-opacity-overlay"],function(t){try{r.call(i,t,function(){var e=!1;switch(t){case"bg-color-overlay":case"bg-opacity-overlay":e=!a.isEmpty(i()+"")&&s.CZR_Helpers.isChecked(n.czr_Input("bg-apply-overlay")());break;default:e=!a.isEmpty(i()+"")}return e})}catch(e){s.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":a.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.call(i,e,function(){return!a.isEmpty(n.czr_Input("bg-image")()+"")&&s.CZR_Helpers.isChecked(i())})}catch(e){s.errare(o.id+" => error in setInputVisibilityDeps",e)}})}})}}};s.czrModuleMap=s.czrModuleMap||{},e.extend(s.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:s.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:a.extend({id:"",title:""},s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(e,"custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(e){switch(e.id){case"height-type":(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(e,"custom-height",function(){return"custom"===e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"width-type":t.call(e,"custom-width",function(){return"custom"===e()}),t.call(e,"h_alignment",function(){return"custom"===e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":t.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":t.call(e,"inner-section-width",function(){return e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_template:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":t.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":t.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(e,"global-custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":t.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":t.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){var i=this;i.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=r.CZRItem.extend(i.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(i,e,t),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module,o=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(i){switch(i.id){case"img":o.call(i,"img-size",function(){return!s.isEmpty(i()+"")&&s.isNumber(i())});break;case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e="no-link"!==i()}return e})}catch(e){r.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":s.each(["borders"],function(e){try{o.call(i,e,function(){return"none"!==i()})}catch(e){r.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":s.each(["custom_width"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"tiny_mce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)},setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRFPItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRFPItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(i){switch(i.id){case"img-type":s.each(["img-id","img-size"],function(t){try{o.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){r.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":s.each(["content-custom-text"],function(e){try{o.call(i,e,function(){return"custom"===i()})}catch(e){r.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":s.each(["btn-custom-text"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:r.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(s,e,a){var t={initialize:function(e,t){var i=this;i.inputConstructor=s.CZRInput.extend({setupSelect:function(){s.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=s.CZRItem.extend(i.CZRIconItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),s.CZRDynModule.prototype.initialize.call(i,e,t)},CZRIconItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){s.errorLog("item.setInputVisibilityDeps() : "+e)}}),s.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module,r=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(i){switch(i.id){case"link-to":a.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){s.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":a.each(["color_hover"],function(e){try{r.call(i,e,function(){return i()})}catch(e){s.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};s.czrModuleMap=s.czrModuleMap||{},e.extend(s.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:s.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRHeadingInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRHeadingInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_heading_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRHeadingInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRHeadingInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_heading_spacing_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRDividerInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRDividerInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_divider_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRButtonItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(t){switch(t.id){case"quote_design":r.each(["border_width_css","border_color_css"],function(e){try{i.call(t,e,function(){return"border-before"==t()})}catch(e){o.errare("Quote module => error in setInputVisibilityDeps",e)}}),r.each(["icon_color_css","icon_size_css"],function(e){try{i.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){o.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_quote_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_cite_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=o.CZRItem.extend(i.CZRButtonItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,e=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{e.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":e.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":e.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRButtonItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module,o=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":s.each(["bg_color_hover"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":s.each(["borders"],function(e){try{o.call(t,e,function(){return"none"!==t()})}catch(e){r.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":s.each(["push_effect"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(t){switch(t.id){case"show_name_field":r.each(["name_field_label","name_field_required"],function(e){try{i.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":r.each(["subject_field_label","subject_field_required"],function(e){try{i.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":r.each(["message_field_label","message_field_required"],function(e){try{i.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.call(t,"link-custom-url",function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module,o=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":s.each(["bg_color_hover"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":s.each(["borders"],function(e){try{o.call(t,e,function(){return"none"!==t()})}catch(e){r.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":s.each(["push_effect"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fonts_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_submission_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRButtonItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(i){switch(i.id){case"use_custom_bg_color_on_hover":s.each(["bg_color_hover"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":s.each(["push_effect"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_font_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_);
1
+ var CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{initialize:function(){var o=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(r.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");o.MAX_NUMBER_OF_COLUMNS=12,o.SETTING_UPDATE_BUFFER=50,o.defaultSektionSettingValue=sektionsLocalizedData.defaultSektionSettingValue,o.sekCollectionSettingId=new r.Value({}),o.registered=new r.Value([]),r.bind("ready",function(){o.registerAndSetupDefaultPanelSectionOptions(),o.sekCollectionSettingId.callbacks.add(function(e,t){try{o.setupSettingToBeSaved()}catch(e){r.errare("Error in self.sekCollectionSettingId.callbacks => self.setupSettingsToBeSaved()",e)}});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),o.generateUI({action:"sek-generate-local-skope-options-ui"}),o.generateUI({action:"sek-generate-global-options-ui"})};_.isEmpty(r.czr_activeSkopes().local)||i(),r.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),o.bind("sek-ui-removed",function(){r.previewedDevice("desktop")}),r.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){r.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){s(this).trigger("click")})})})}),s("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){o.resetCollectionSetting()}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&r.control(e.id,function(e){e.container.find("[draggable]").each(function(){s(this).off("dragstart dragend")})}),"control"==e.what&&r.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(s(this).data("select2"))||s(this).select2("destroy")})})}),r.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=s.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.setupTopBar()})},registerAndSetupDefaultPanelSectionOptions:function(){var n=this,e=r.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});r.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.find("h3.accordion-section-title"),t=(n.container.find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg",'"/>'].join(""));if(0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}})}),r.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:"__globalAndLocalOptionsSection",title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section("__globalAndLocalOptionsSection",function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:"__localOptionsSection",title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section("__localOptionsSection",function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"refresh",type:"option"}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:"__content_picker__",title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section("__content_picker__",function(e){"resolved"!=r.czr_initialSkopeCollectionPopulated.state()?r.czr_initialSkopeCollectionPopulated.done(function(){r.previewer.trigger("sek-pick-content",{focus:!1})}):r.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&r.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&r.previewer.trigger("sek-pick-content"),sektionsData=r.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&r.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.sekCollectionSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarVisible=new l.Value(!1),t.topBarVisible.bind(function(e){t.toggleTopBar(e)}),t.mouseMovedRecently=new l.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(d(window).data("_scroll_move_timer_")),d(window).data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};d(window).on("mousemove scroll,",_.throttle(e,50)),l.previewer.bind("ready",function(){d(l.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.historyLog=new l.Value([]),t.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),d("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===d(this).data("nimble-history")?d(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):d(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?d.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){d("body").addClass("nimble-top-bar-visible")},200)}):(t=d.Deferred(),d("body").removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){if(0<d("#nimble-top-bar").length)return d("#nimble-top-bar");var t=this;try{_tmpl=wp.template("nimble-top-bar")({})}catch(e){return l.errare("Error when parsing the the top note template",e),!1}return d("#customize-preview").after(d(_tmpl)),d("[data-nimble-history]","#nimble-top-bar").on("click",function(e){try{t.navigateHistory(d(this).data("nimble-history"))}catch(e){l.errare("Error when firing self.navigateHistory",e)}}),d(".sek-settings","#nimble-top-bar").on("click",function(e){l.panel(sektionsLocalizedData.sektionsPanelId,function(e){t.rootPanelFocus(),e.focus()})}),d(".sek-add-content","#nimble-top-bar").on("click",function(e){e.preventDefault(),l.previewer.trigger("sek-pick-content",{})}),d(".sek-nimble-doc","#nimble-top-bar").on("click",function(e){e.preventDefault(),window.open(d(this).data("doc-href"),"_blank")}),d("#nimble-top-bar")},navigateHistory:function(i){var t,n,o,r,e=this,s=d.extend(!0,[],e.historyLog()),a=[];if(_.each(s,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){l(e.sekCollectionSettingId())(e.validateSettingValue(r),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(s,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(s,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":s.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}a.push(newLog)}),e.historyLog(a)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,c){c.extend(CZRSeksPrototype,{setupSettingToBeSaved:function(){var e,s=this;e=a.czr_skopeBase.getSkopeProperty("sektions","local").db_values;var t=s.sekCollectionSettingId();if(_.isEmpty(t))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!a.has(t)){a.CZR_Helpers.register({what:"setting",id:t,value:s.validateSettingValue(_.isObject(e)?e:s.defaultSektionSettingValue),transport:"postMessage",type:"option",track:!1,origin:"nimble"});a(t,function(e){s.historyLog([{status:"current",value:e(),action:"initial"}]),e.bind(_.debounce(function(e,t,i){if(i&&!0!==i.navigatingHistoryLogs){var n,o=[],r=c.extend(!0,[],s.historyLog());_.isEmpty(i.in_sektion)?_.isEmpty(i.to_sektion)||(n=i.to_sektion):n=i.in_sektion,_.each(r,function(e){"future"!=e.status&&(c.extend(e,{status:"previous"}),o.push(e))}),o.push({status:"current",value:e,action:_.isObject(i)&&i.action||"",sektionToRefresh:n}),s.historyLog(o)}},1e3))})}},validateSettingValue:function(i){if(!_.isObject(i))return a.errare("validation error => the setting should be an object",i),null;var n={},o=!1,e=[],r=function(e){a.errare(e,i),a.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks the Nimble builder, you might try to reset the sections for this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),o=!0},s=function(t){if(!o)if(_.isUndefined(t)&&_.isEmpty(n)){if(t=c.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void r("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void r('validation error => the root level should not have a "level" or an "id" property');_.each(i.collection,function(e){n=t,s(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void r("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void r("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void r("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void r('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void r("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void r("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&a.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(n.level))return void r("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=n.level)return void r("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=n.level)return void r("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=n.level)return void r("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=n.level)return void r("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){n=c.extend(!0,{},t),s(e)})}};return s(),o?null:i},resetCollectionSetting:function(){if(_.isEmpty(this.sekCollectionSettingId()))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");a(this.sekCollectionSettingId())(this.defaultSektionSettingValue),a.previewer.refresh(),a.notifications.remove("sek-notify"),a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("sek-reset-done",{type:"success",message:sektionsLocalizedData.i18n["Reset complete"],dismissible:!0})),_.delay(function(){a.notifications.remove("sek-reset-done")},5e3)})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},s={},a=!0,e={"sek-add-section":{callback:function(e){return a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module:e.before_module,after_module:e.after_module},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts"}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(a=!0,s={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts"}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-duplicate":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return a=!0,s={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts"}),c.previewer.trigger("sek-refresh-stylesheet",{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return a=!1,s={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),o.updateAPISetting({action:"sek-update-fonts"}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return a=!0,r={},s={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"section",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(s)},"sek-edit-options":function(e){return a=!0,r={},_.isEmpty(e.id)?l.Deferred(function(){this.reject("missing id")}):(s={action:"sek-generate-level-options-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s))},"sek-edit-module":function(e){return a=!0,r={},s={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s)},"sek-notify":function(t){return a=!1,l.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("sek-notify",{type:t.type||"info",message:t.message,dismissible:!0})),_.delay(function(){c.notifications.remove("sek-notify")},t.duration||5e3)}),this.resolve()})},"sek-refresh-level":function(t){return a=!0,l.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id},s={},e.resolve()})},"sek-refresh-stylesheet":function(t){return a=!0,t=t||{},l.Deferred(function(e){r={id:t.id},s={},e.resolve()})}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}try{e(t).done(function(e){a?c.previewer.send(n,{skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:s,cloneId:!_.isEmpty(e)&&e}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:s}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => error when firing "+n,e),c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks the Nimble builder, you might try to reset the sections for this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this,n=function(e){return e.id="",_.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&n(e)}),e};c.previewer.bind("sek-to-json",function(e){var t=l.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(n(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(k,y){y.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=y.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var o,r=this,e=n.settingParams.to,t=null,i=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var s=n.settingParams.args.moduleRegistrationParams.control,a=n.settingParams.args.moduleRegistrationParams.id,c=s.czr_Module(a);if(_.isEmpty(c)?k.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=c.module_type,i=c.isMultiItem()),!i&&_.isObject(e)?o=r.normalizeAndSanitizeSingleItemInputValues(e,t):(o=[],_.each(e,function(e){o.push(r.normalizeAndSanitizeSingleItemInputValues(e,t))})),_.isEmpty(n.defaultPreviewAction))k.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed;_.isUndefined(f)||(l=r.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var h=function(){if(!0!==n.isGlobalOptions)return r.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:o,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(){!0===d&&k.previewer.send("sek-refresh-stylesheet",{skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}}),!0===u&&k.previewer.send("sek-refresh-level",{apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")}),!0===m&&k.previewer.refresh()});if(_.isEmpty(n.options_type))k.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=k(sektionsLocalizedData.optNameForGlobalOptions)(),t=y.extend(!0,{},_.isObject(e)?e:{}),i={};_.each(o||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,k(sektionsLocalizedData.optNameForGlobalOptions)(t)}};if(!0===p){var g=n.settingParams.args.input_value;if(!_.isString(g))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",g);-1<g.indexOf("gfont")?r.updateAPISetting({action:"sek-update-fonts",font_family:g}).always(function(){h().then(function(){r.updateAPISetting({action:"sek-update-fonts"})})}):h()}else h()}}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},normalizeAndSanitizeSingleItemInputValues:function(e,o){var i,r={},n={},s=null,a=this;return _.each(e,function(e,t){var i,n;_.contains(["title","id"],t)||(null!==o&&"no_default_value_specified"===(s=a.getInputDefaultValue(t,o))&&k.infoLog("::updateAPISettingAndExecutePreviewActions => missing default value for input "+t+" in module "+o),i=e,n=s,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(r[t]=e))}),_.each(r,function(e,t){switch(a.getInputType(t,o)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"tiny_mce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=k.control.has(t):(i=!0,1<e.length&&k.errare("generateUI => why is this control registered more than once ? => "+t)),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(n,e){var o=this,t={};a.extend(t,{content_type_switcher:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:sektionsLocalizedData.i18n["Select a content type"],priority:0,settingValue:{content_type:n.content_type}},module_picker:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:sektionsLocalizedData.i18n["Pick a module"],content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_intro_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_intro_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for an introduction"],content_type:"section",expandAndFocusOnInit:!0,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_features_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_features_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for services and features"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_contact_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_contact_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Contact-us sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_column_layouts_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_column_layouts_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Empty sections with columns layout"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var i=_.keys(t)[0],r=t[i].settingControlId;return o.isUIControlAlreadyRegistered(r)?s.control(r,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}),s.section(t.section()).container.first().trigger("sek-content-type-refreshed",{content_type:n.content_type})}):(_do_register_=function(){_.each(t,function(i,e){s.has(i.settingControlId)||(s(i.settingControlId,function(e){e.bind(function(e,t){s.errare("generateUIforDraggableContent => the setting() should not changed")})}),s.CZR_Helpers.register({origin:"nimble",level:n.level,what:"setting",id:i.settingControlId,dirty:!1,value:i.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),s.CZR_Helpers.register({origin:"nimble",level:n.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:"__content_picker__",priority:i.priority||10,settings:{default:i.settingControlId},track:!1}).done(function(){s.control(i.settingControlId,function(e){e.content_type=i.content_type,!0===n.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),"section"===e.content_type?(e.container.find(".czr-items-wrapper").hide(),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&(e.container.find(".czr-items-wrapper").show(),t.trigger("click"))):e.container.attr("data-sek-accordion","no")})})})},s.section("__content_picker__",function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e,{expand_first_module:!0}),o._maybeFetchSectionsFromServer()})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(o,e){var r=this;_.isEmpty(o.id)&&e.reject("generateUI => missing id");var t=r.getLevelProperty({property:"value",id:o.id}),i=r.getLevelProperty({property:"module_type",id:o.id}),n=r.getRegisteredModuleProperty(i,"name");_.isEmpty(i)&&e.reject("generateUI => module => invalid module_type");var s={};if(!0===r.getRegisteredModuleProperty(i,"is_father")){var a=r.getRegisteredModuleProperty(i,"children");if(_.isEmpty(a))throw new Error("::generateUIforFrontModules => a father module "+i+" is missing children modules ");_.each(a,function(e,t){s[t]={settingControlId:o.id+"__"+t,module_type:e,controlLabel:r.getRegisteredModuleProperty(e,"name")}})}else s.__no_option_group_to_be_updated_by_children_modules__={settingControlId:o.id,module_type:i,controlLabel:n};var c=_.keys(s)[0],l=s[c].settingControlId;return r.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(r.cleanRegistered(),_do_register_=function(){_.each(s,function(i,n){if(!d.has(i.settingControlId)){d(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{r.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(o,{action:"sek-set-module-value"}),options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},r.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},t);"__no_option_group_to_be_updated_by_children_modules__"!==n&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[n])?e[n]:{}),d.CZR_Helpers.register({origin:"nimble",level:o.level,what:"setting",id:i.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:o.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:o.id,priority:10,settings:{default:i.settingControlId}}).done(function(){d.control(i.settingControlId).focus({completeCallback:function(){}}),d.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})})},d.section.when(o.id,function(){d.section(o.id).focus(),_do_register_()}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:o.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){d.section(o.id,function(e){e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),r.scheduleModuleAccordion.call(e)})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(r,e){var s=this,a=s.getLevelProperty({property:"options",id:r.id});a=_.isObject(a)?a:{};var t={};l.extend(t,{bg:{settingControlId:r.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[r.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'},border:{settingControlId:r.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:r.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:r.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Set a custom anchor for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:r.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:r.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),"section"===r.level&&(l.extend(t,{width:{settingControlId:r.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),l.extend(t,{breakpoint:{settingControlId:r.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}})),"module"===r.level&&l.extend(t,{width:{settingControlId:r.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[r.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return s.isUIControlAlreadyRegistered(n)?c.control(n).focus({completeCallback:function(){var e=c.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(t,function(i,n){if(s.isUIControlAlreadyRegistered(i.settingControlId))c.section(c.control(i.settingControlId).section()).expanded(!0);else{if(!c.has(i.settingControlId)){c(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:r,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){c.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},s.SETTING_UPDATE_BUFFER))});var e=a[n]||{},t=s.getModuleStartingValue(i.module_type);if("no_starting_value"!==t&&_.isObject(t)){var o=l.extend(!0,{},t);e=l.extend(o,e)}c.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:i.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}c.CZR_Helpers.register({origin:"nimble",level:r.level,level_id:r.id,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:r.id,priority:0,settings:{default:i.settingControlId}}).done(function(){!0===i.expandAndFocusOnInit&&c.control(i.settingControlId).focus({completeCallback:function(){}}),c.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})}})},c.section.has(r.id)||c.section(r.id,function(e){s.scheduleModuleAccordion.call(e,{expand_first_module:!0})}),c.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+r.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){c.section(r.id,function(e){_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>')})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=l.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(l.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(a,e){var c=this,t=c.getLocalSkopeOptionId();if(c.isUIControlAlreadyRegistered(t))return e;var i={};return d.extend(i,{template:{settingControlId:t+"__template",module_type:"sek_local_template",controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'},widths:{settingControlId:t+"__widths",module_type:"sek_local_widths",controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'},custom_css:{settingControlId:t+"__custom_css",module_type:"sek_local_custom_css",controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'},local_performances:{settingControlId:t+"__local_performances",module_type:"sek_local_performances",controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'},local_reset:{settingControlId:t+"__local_reset",module_type:"sek_local_reset",controlLabel:sektionsLocalizedData.i18n["Remove the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'}}),_do_register_=function(){_.each(i,function(i,n){if(!l.has(i.settingControlId)){l(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{c.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh",uiParams:a,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},c.SETTING_UPDATE_BUFFER))});var e=c.getModuleStartingValue(i.module_type),t=l(c.sekCollectionSettingId())(),o=d.extend(!0,{},_.isObject(t.local_options)?t.local_options:{}),r=_.isObject(o[n])?o[n]:{};if("no_starting_value"!==e&&_.isObject(e)){var s=d.extend(!0,{},e);r=d.extend(s,r)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:i.settingControlId,dirty:!1,value:r,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:"__localOptionsSection",priority:10,settings:{default:i.settingControlId}}).done(function(){l.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},l.section("__localOptionsSection",function(e){l(c.sekCollectionSettingId(),function(){_do_register_(),e.container.on("click",".accordion-section-title",function(){c.generateUI({action:"sek-generate-local-skope-options-ui"})})})}),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(s,e){var a=this,t=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(a.isUIControlAlreadyRegistered(t))return e;var i={};return l.extend(i,{breakpoint:{settingControlId:t+"__breakpoint",module_type:"sek_global_breakpoint",controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">devices</i>'},widths:{settingControlId:t+"__widths",module_type:"sek_global_widths",controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'},performances:{settingControlId:t+"__performances",module_type:"sek_global_performances",controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'}}),_do_register_=function(){_.each(i,function(i,n){if(!c.has(i.settingControlId)){c(i.settingControlId,function(e){e.bind(_.debounce(function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh",uiParams:s,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){c.errare("Error in updateAPISettingAndExecutePreviewActions",e)}},a.SETTING_UPDATE_BUFFER))});var e=sektionsLocalizedData.globalOptionDBValues,t=a.getModuleStartingValue(i.module_type),o=_.isObject(e)&&!_.isEmpty(e[n])?e[n]:{};if("no_starting_value"!==t&&_.isObject(t)){var r=l.extend(!0,{},t);o=l.extend(r,o)}c.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:i.settingControlId,dirty:!1,value:o,transport:"postMessage",type:"_nimble_ui_"})}c.CZR_Helpers.register({origin:"nimble",level:s.level,what:"control",id:i.settingControlId,label:i.controlLabel,type:"czr_module",module_type:i.module_type,section:"__globalAndLocalOptionsSection",priority:20,settings:{default:i.settingControlId},track:!1}).done(function(){c.control(i.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title");_.isUndefined(i.icon)||t.addClass("sek-flex-vertical-center").prepend(i.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===i.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},c.section("__globalAndLocalOptionsSection",function(e){c(a.sekCollectionSettingId(),function(){_do_register_()})}),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(Y,J){J.extend(CZRSeksPrototype,{updateAPISetting:function($){var q=this,G=J.Deferred();return Y(q.sekCollectionSettingId(),function(e){var n,t,o,i,r,s,a,c,l,d=e(),u=_.isObject(d)?J.extend(!0,{},d):q.defaultSektionSettingValue,p=!1;switch(u.collection=_.isArray(u.collection)?u.collection:q.defaultSektionSettingValue.collection,$.action){case"sek-add-section":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(_.isEmpty($.location))throw new Error("updateAPISetting => "+$.action+" => missing location");if(!0===$.is_nested){if(o=q.getLevelModel($.in_column,u.collection),"no_match"==(l=q.getLevelModel($.in_sektion,u.collection))){G.reject("updateAPISetting => "+$.action+" => no grand parent sektion found");break}if(!0===l.is_nested){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.push({id:$.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+q.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(n=q.getLevelModel($.location,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){$.before_section===e.id&&(E=t),$.after_section===e.id&&(E=t+1)}),n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(E,0,{id:$.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+q.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(_.isEmpty($.location))throw new Error("updateAPISetting => "+$.action+" => missing location");var m;try{m=q.cloneLevel($.id)}catch(e){Y.errare("updateAPISetting => "+$.action,e);break}var f=q.getLevelPositionInCollection($.id,u.collection);if(!0===$.is_nested){if("no_match"==(o=q.getLevelModel($.in_column,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(parseInt(f+1,10),0,m)}else{if("no_match"==(n=q.getLevelModel($.location,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(parseInt(f+1,10),0,m)}a=m.id;break;case"sek-remove-section":if(!0===$.is_nested)"no_match"!=(o=q.getLevelModel($.in_column,u.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=$.id})):Y.errare("updateAPISetting => "+$.action+" => no parent column matched");else{if("no_match"==(n=q.getLevelModel($.location,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}n.collection=_.filter(n.collection,function(e){return e.id!=$.id})}break;case"sek-move-section":var h,g,k=q.getLevelModel($.to_location,u.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+$.action+" => missing target location");if($.from_location!=$.to_location){var y=q.getLevelModel($.from_location,u.collection);if(_.isEmpty(y)||"no_match"==y)throw new Error("updateAPISetting => "+$.action+" => missing source location");y.collection=_.isArray(y.collection)?y.collection:[],h=q.getLevelModel($.id,y.collection),g=J.extend(!0,{},h),y.collection=_.filter(y.collection,function(e){return e.id!=$.id})}k.collection=_.isArray(k.collection)?k.collection:[],r=J.extend(!0,[],k.collection),s=[],_.each($.newOrder,function(e){if($.from_location!=$.to_location&&e==g.id)s.push(g);else{if(t=q.getLevelModel(e,r),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => move section => missing section candidate");s.push(t)}}),k.collection=s;break;case"sek-add-column":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if("no_match"==(t=q.getLevelModel($.in_sektion,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched"),G.reject("updateAPISetting => "+$.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],q.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}_.each(t.collection,function(e){e.width=""}),t.collection.push({id:$.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=q.getLevelModel($.in_sektion,u.collection))){if(1===_.size(t.collection)){G.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=$.id}),_.each(t.collection,function(e){e.width=""})}else Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if("no_match"==(t=q.getLevelModel($.in_sektion,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched"),G.reject("updateAPISetting => "+$.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],q.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var v;try{v=q.cloneLevel($.id)}catch(e){Y.errare("updateAPISetting => "+$.action,e);break}var b=q.getLevelPositionInCollection($.id,u.collection);a=v.id,t.collection.splice(parseInt(b+1,10),0,v),_.each(t.collection,function(e){e.width=""});break;case"sek-resize-columns":if($.col_number<2)break;var z=q.getLevelModel($.resized_column,u.collection),I=q.getLevelModel($.sister_column,u.collection);if("no_match"==z){Y.errare("updateAPISetting => "+$.action+" => no resized column matched"),G.reject("updateAPISetting => "+$.action+" => no resized column matched");break}z.width=parseFloat($.resizedColumnWidthInPercent);var w=q.getLevelModel($.in_sektion,u.collection),M=_.filter(w.collection,function(e){return e.id!=z.id&&e.id!=I.id}),C=parseFloat(z.width.toFixed(3));_.isEmpty(M)||_.each(M,function(e){currentColWidth=parseFloat(1*e.width),(!_.has(e,"width")||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(e.width=parseFloat((100/$.col_number).toFixed(3))),C=parseFloat((C+e.width).toFixed(3))}),I.width=parseFloat((100-C).toFixed(3));break;case"sek-move-column":var D,S,P=q.getLevelModel($.to_sektion,u.collection);if(_.isEmpty(P)||"no_match"==P)throw new Error("updateAPISetting => "+$.action+" => missing target sektion");if($.from_sektion!=$.to_sektion){var x=q.getLevelModel($.from_sektion,u.collection);if(_.isEmpty(x)||"no_match"==x)throw new Error("updateAPISetting => "+$.action+" => missing source column");x.collection=_.isArray(x.collection)?x.collection:[],D=q.getLevelModel($.id,x.collection),S=J.extend(!0,{},D),x.collection=_.filter(x.collection,function(e){return e.id!=$.id}),_.each(x.collection,function(e){e.width=""})}P.collection=_.isArray(P.collection)?P.collection:[],r=J.extend(!0,[],P.collection),s=[],_.each($.newOrder,function(e){if($.from_sektion!=$.to_sektion&&e==S.id)s.push(S);else{if(o=q.getLevelModel(e,r),_.isEmpty(o)||"no_match"==o)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");s.push(o)}}),P.collection=s,_.each(P.collection,function(e){e.width=""});break;case"sek-add-module":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(_.isEmpty($.module_type))throw new Error("updateAPISetting => "+$.action+" => missing module_type");if("no_match"===(o=q.getLevelModel($.in_column,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}var E=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){$.before_module===e.id&&(E=t),$.after_module===e.id&&(E=t+1)});var R={id:$.id,level:"module",module_type:$.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(c=q.getModuleStartingValue($.module_type))&&(R.value=c),o.collection.splice(E,0,R);break;case"sek-duplicate-module":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if("no_match"==(o=q.getLevelModel($.in_column,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}var L;o.collection=_.isArray(o.collection)?o.collection:[];try{L=q.cloneLevel($.id)}catch(e){Y.errare("updateAPISetting => "+$.action,e),G.reject("updateAPISetting => "+$.action+" => error when cloning the level");break}var A=q.getLevelPositionInCollection($.id,u.collection);a=L.id,o.collection.splice(parseInt(A+1,10),0,L);break;case"sek-remove-module":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");"no_match"!=(o=q.getLevelModel($.in_column,u.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=$.id})):Y.errare("updateAPISetting => "+$.action+" => no parent column matched");break;case"sek-move-module":var Z,j,F;if(Z=q.getLevelModel($.to_column,u.collection),_.isEmpty(Z)||"no_match"==Z)throw new Error("updateAPISetting => "+$.action+" => missing target column");if($.from_column!=$.to_column){var V;if(V=q.getLevelModel($.from_column,u.collection),_.isEmpty(V)||"no_match"==V)throw new Error("updateAPISetting => "+$.action+" => missing source column");V.collection=_.isArray(V.collection)?V.collection:[],j=q.getLevelModel($.id,u.collection),F=J.extend(!0,{},j),V.collection=_.filter(V.collection,function(e){return e.id!=$.id})}if(Z.collection=_.isArray(Z.collection)?Z.collection:[],r=J.extend(!0,[],Z.collection),s=[],_.each($.newOrder,function(e){if($.from_column!=$.to_column&&e==F.id)s.push(F);else{if(i=q.getLevelModel(e,u.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+$.action+" => missing moduleCandidate");s.push(i)}}),s.length!=_.uniq(s).length)throw new Error("updateAPISetting => "+$.action+" => there are duplicated modules in column : "+Z.id);Z.collection=s;break;case"sek-set-module-value":i=q.getLevelModel($.id,u.collection);var O={};if(_.each($.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(O[t]=e)}),"no_match"==i){Y.errare("updateAPISetting => "+$.action+" => no module matched",$),G.reject("updateAPISetting => "+$.action+" => error no module matched");break}if(_.isEmpty($.options_type)){Y.errare("updateAPISetting => "+$.action+" => missing options_type"),G.reject("updateAPISetting => "+$.action+" => missing options_type");break}"__no_option_group_to_be_updated_by_children_modules__"===$.options_type?i.value=O:(i.value=_.isEmpty(i.value)?{}:i.value,i.value[$.options_type]=O);break;case"sek-generate-level-options-ui":var T=q.getLevelModel($.id,u.collection),U={};if("no_match"===T){Y.errare("updateAPISetting => "+$.action+" => no parent sektion matched"),G.reject("updateAPISetting => "+$.action+" => no parent sektion matched");break}T.options=T.options||{},_.each($.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(U[t]=e)}),_.isEmpty($.options_type)&&Y.errare("updateAPISetting => "+$.action+" => missing options_type"),T.options[$.options_type]=U;break;case"sek-generate-local-skope-options-ui":U={};var N=J.extend(!0,{},_.isObject(u.local_options)?u.local_options:{});if(_.each($.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(U[t]=e)}),_.isEmpty($.options_type)||!_.isString($.options_type))Y.errare("updateAPISetting => "+$.action+" => missing options_type");else{var B={};B[$.options_type]=U,u.local_options=J.extend(N,B)}break;case"sek-add-content-in-new-sektion":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(E=0,"no_match"==(n=q.getLevelModel($.location,u.collection))){Y.errare("updateAPISetting => "+$.action+" => no location matched"),G.reject("updateAPISetting => "+$.action+" => no location matched");break}switch(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){$.before_section===e.id&&(E=t),$.after_section===e.id&&(E=t+1)}),$.content_type){case"module":c=q.getModuleStartingValue($.content_id),n.collection.splice(E,0,{id:$.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+q.guid(),level:"column",collection:[{id:$.droppedModuleId,level:"module",module_type:$.content_id,value:"no_starting_value"!==c?c:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":p=J.Deferred();var Q=function(e){q.preparePresetSectionForInjection(e).fail(function(e){G.reject("updateAPISetting => error when preparePresetSectionForInjection => "+$.action+" => "+e),p.reject(e)}).done(function(e){var t=!1;if(!_.isEmpty($.sektion_to_replace)){var i=q.getLevelModel($.sektion_to_replace,u.collection);"no_match"===i&&(Y.errare("updateAPISetting => "+$.action+" => no sektionToReplace matched"),G.reject("updateAPISetting => "+$.action+" => no sektionToReplace matched")),t=!0===i.is_nested}t?("no_match"===(o=q.getLevelModel($.in_column,u.collection))&&(Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched")),o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){$.before_section===e.id&&(E=t),$.after_section===e.id&&(E=t+1)}),o.collection.splice(E,0,{id:$.id,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):n.collection.splice(E,0,{id:$.id,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion}),p.resolve()})};q.getPresetSectionCollection({presetSectionType:$.content_id,section_id:$.id}).fail(function(){Y.errare("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()",_er_),G.reject("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(Y.errare("updateAPISetting => "+$.action+" => preset section type not found or empty : "+$.content_id,e),G.reject("updateAPISetting => "+$.action+" => preset section type not found or empty")),Q(e)})}break;case"sek-add-preset-section-in-new-nested-sektion":if(_.isEmpty($.id))throw new Error("updateAPISetting => "+$.action+" => missing id");if(o=q.getLevelModel($.in_column,u.collection),"no_match"==(l=q.getLevelModel($.in_sektion,u.collection))){G.reject("updateAPISetting => "+$.action+" => no grand parent sektion found");break}if(!0===l.is_nested){G.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){Y.errare("updateAPISetting => "+$.action+" => no parent column matched"),G.reject("updateAPISetting => "+$.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],p=J.Deferred(),Q=function(e){q.preparePresetSectionForInjection(e).fail(function(e){G.reject("updateAPISetting => error when preparePresetSectionForInjection => "+$.action+" => "+e),p.reject(e)}).done(function(e){o.collection.push({id:$.id,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}),p.resolve()})},q.getPresetSectionCollection({presetSectionType:$.content_id,section_id:$.id}).fail(function(){Y.errare("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()",_er_),G.reject("updateAPISetting => "+$.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(Y.errare("updateAPISetting => "+$.action+" => preset section type not found or empty : "+$.content_id,e),G.reject("updateAPISetting => "+$.action+" => preset section type not found or empty")),Q(e)});break;case"sek-update-fonts":var W=q.sniffGFonts();if(!_.isEmpty($.font_family)&&_.isString($.font_family)&&!_.contains(W,$.font_family)){if($.font_family.indexOf("gfont")<0){Y.errare("updateAPISetting => "+$.action+" => error => must be a google font, prefixed gfont"),G.reject("updateAPISetting => "+$.action+" => error => must be a google font, prefixed gfont");break}W.push($.font_family)}u.fonts=W}if("pending"==G.state()){var H=function(){_.isEqual(d,u)?G.reject("updateAPISetting => the new setting value is unchanged when firing action : "+$.action):null!==q.validateSettingValue(u)?(e(u,$),G.resolve(a)):G.reject("updateAPISetting => the new setting value did not pass the validation checks for action "+$.action)};!1===p?H():p.done(function(){H()}).fail(function(e){Y.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}}),G.promise()},_maybeFetchSectionsFromServer:function(){var e,t=J.Deferred();_.isEmpty(Y.sek_presetSections)?(_.isUndefined(Y.sek_fetchingPresetSections)||"pending"!=Y.sek_fetchingPresetSections.state()?(e=Y.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"preset_sections_server_collection",module_id:"no_module_id"}),Y.sek_fetchingPresetSections=e):e=Y.sek_fetchingPresetSections,e.done(function(e){Y.sek_presetSections=e,t.resolve(Y.sek_presetSections)}).fail(function(e){t.reject(e)})):t.resolve(Y.sek_presetSections);return t.promise()},getPresetSectionCollection:function(r){var s=this,a=J.Deferred();return s._maybeFetchSectionsFromServer().fail(function(e){a.reject(e)}).done(function(e){var t=J.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[r.presetSectionType]))throw new Error('getPresetSectionCollection => the preset section : "'+r.presetSectionType+'" has not been found in the collection');var i=t[r.presetSectionType],n=function(e){return _.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+s.guid(),_.isArray(e.collection)&&n(e.collection)}),e},o=function(e){return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&o(e.collection)}),e};i.id=r.section_id,i.collection=n(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o(i.collection),a.resolve(i)}),a.promise()},preparePresetSectionForInjection:function(o){var i=this,n={},r=J.Deferred(),s=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?s(e):_.isString(e)&&-1!=e.indexOf("::img-path::")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("::img-path::",""))))}),n},a=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?a(e,n):_.isString(e)&&-1!=e.indexOf("::img-path::")&&_.has(n,e)&&_.isObject(n[e])&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(s(o)).done(function(e){var t=a(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return _.isEmpty(e.level)||"setting"!==e.what||n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"!==e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{rootPanelFocus:function(){s.section.has(s.czr_activeSectionId())?s.section(s.czr_activeSectionId()).expanded(!1):s.section.each(function(e){e.expanded(!1)}),s.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getLevelModel:function(t,e){var i=this,n="no_match";if(_.isUndefined(e)){var o=s(i.sekCollectionSettingId())(),r=_.isObject(o)?a.extend(!0,{},o):i.defaultSektionSettingValue;e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==n&&(t===e.id?n=e:_.isArray(e.collection)&&(n=i.getLevelModel(t,e.collection)))}),n},getLevelPositionInCollection:function(i,e){var n=this,o="no_match";if(_.isUndefined(e)){var t=s(n.sekCollectionSettingId())(),r=_.isObject(t)?a.extend(!0,{},t):n.defaultSektionSettingValue;e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e,t){"no_match"==o&&(i===e.id?o=t:_.isArray(e.collection)&&(o=n.getLevelPositionInCollection(i,e.collection)))}),o},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))s.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];s.errare("getLevelProperty => invalid model for id : "+e.id,t)}else s.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=a.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(!sektionsLocalizedData.registeredModules[e].is_father){var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i}s.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically")},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},sniffGFonts:function(i,e){var n=this;if(i=i||[],_.isUndefined(e)){var t=s(n.sekCollectionSettingId())();e=_.isObject(t)?a.extend(!0,{},t):n.defaultSektionSettingValue}return _.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===n.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(i,e)&&i.push(e),(_.isArray(e)||_.isObject(e))&&n.sniffGFonts(i,e)}),i},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))s.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))s.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}s.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))s.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))s.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}s.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))s.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))s.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}s.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}s.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){if(!sektionsLocalizedData.registeredModules)return s.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return s.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t=sektionsLocalizedData.registeredModules[e].starting_value;return _.isEmpty(t)?"no_starting_value":t},selectNextTabbableOrFocusable:function(e){var t=a(e),i=a(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=a(e),i=a(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(){var n=this,e=(n.input_parent,n.module,s.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type).choices);_.isEmpty(e)?s.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in image module"):(_.each(e,function(e,t){var i={value:t,html:e};t==n()?a.extend(i,{selected:"selected"}):"px"===t&&a.extend(i,{selected:"selected"}),a("select[data-czrtype]",n.container).append(a("<option>",i))}),a("select[data-czrtype]",n.container).selecter())},setupFontSizeAndLineHeightInputs:function(e){var t=this,i=a(".sek-font-size-line-height-wrapper",t.container),n=i.find("input[data-czrtype]").data("sek-unit"),o=function(e){return _.contains(["px","em","%"],e)||(s.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new s.Value(_.isEmpty(n)?"px":o(n)),t.css_unit.bind(function(e){e=_.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("change")}),i.find('input[type="number"]').on("input change",function(e){t(a(this).val()+o(t.css_unit()))}).stepper(),i.on("click","[data-sek-unit]",function(e){e.preventDefault(),i.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),a(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",a(this).data("sek-unit")),t.css_unit(a(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0)},maybeSetupDeviceSwitcherForInput:function(){var i=this,e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");i.container.find(".customize-control-title").prepend(e),i.previewedDevice=new s.Value(s.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),i.container.find("[data-sek-device]").removeClass("active"),a(this).addClass("active");var t="desktop";try{t=a(this).data("sek-device")}catch(e){s.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{s.previewedDevice(t)}catch(e){s.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}i.previewedDevice(t)},i.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=i.container.find('[data-sek-device="'+s.previewedDevice()+'"]');0<t.length&&t.trigger("click")},scheduleModuleAccordion:function(e){e=e||{expand_first_module:!0};var i=this;a(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=a(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){a(this).attr("data-sek-accordion")||(a(this).attr("data-sek-expanded","false"),a(this).find(".czr-items-wrapper").stop(!0,!0).slideUp("fast"))}),t.find(".czr-items-wrapper").stop(!0,!0).slideToggle({duration:"fast",start:function(){t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),"true"==t.attr("data-sek-expanded")?t.trigger("sek-accordion-expanded"):t.trigger("sek-accordion-collapsed")}}))}),e.expand_first_module&&i.container.find(".customize-control").first().find("label > .customize-control-title").trigger("click")},isPromise:function(e){return e&&"function"==typeof e.then&&String(a.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=a.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(a.Deferred(function(t){(i.isPromise(e)?e:a.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),a.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||a.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:a.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{rel_path:t,nonce:s.settings.nonce.save}).fail(function(e){s.errare("sek_import_attachment ajax action failed for image "+t,e)})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,f){f.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){"draggable"in document.createElement("span")?t.setupNimbleDragZones(e.input_container):a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)})}),a.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){a.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var t=this;e.find("[draggable]").each(function(){f(this).on("dragstart",function(e){(function(e){e.originalEvent.dataTransfer.setData("sek-content-type",f(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-content-id",f(this).data("sek-content-id"));try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)})}t.dnd_draggedType=f(this).data("sek-content-type"),f(this).addClass("sek-dragged"),f("body").addClass("sek-dragging"),a.previewer.send("sek-drag-start",{type:t.dnd_draggedType})}).call(f(this),e)}).on("dragend",function(e){(function(e){f("body").removeClass("sek-dragging"),f(this).removeClass("sek-dragged"),a.previewer.send("sek-drag-stop")}).call(f(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=f("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=f(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop(f(this))&&(e.stopPropagation(),t.dnd_OnEnterOver(f(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(f(this),e)||t.dnd_cleanOnLeaveDrop(f(this),e);break;case"drop":if(this.$cachedDropZoneCandidates=null,!t.dnd_canDrop(f(this)))return;e.preventDefault(),t.dnd_onDrop(f(this),e),t.dnd_cleanOnLeaveDrop(f(this),e),a.previewer.send("sek-drag-stop")}}).data("zone-droppable-setup",!0))})},dnd_toggleDragApproachClassesToDropZones:function(m){this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.$dropZones.find(".sek-drop-zone").each(function(){var e=m.clientY,t=m.clientX,i=f(this)[0].getBoundingClientRect(),n=Math.abs(e-(i.bottom-(i.bottom-i.top)/2)),o=(Math.abs(i.top-e),Math.abs(t-(i.right-(i.right-i.left)/2))),r=(i.right,i.left,n<60),s=o<60,a=n<80,c=o<80,l=n<120,d=o<120,u=t<=i.right&&i.left<=t,p=e>=i.top&&i.bottom>=e;p&&u?(f(this).removeClass("sek-drag-is-approaching"),f(this).removeClass("sek-drag-is-close"),f(this).removeClass("sek-drag-is-very-close"),f(this).addClass("sek-drag-is-in")):((r||p)&&(s||u)?(f(this).removeClass("sek-drag-is-approaching"),f(this).removeClass("sek-drag-is-close"),f(this).addClass("sek-drag-is-very-close")):((a||p)&&(c||u)?(f(this).removeClass("sek-drag-is-approaching"),f(this).addClass("sek-drag-is-close")):((l||p)&&(d||u)?f(this).addClass("sek-drag-is-approaching"):f(this).removeClass("sek-drag-is-approaching"),f(this).removeClass("sek-drag-is-close")),f(this).removeClass("sek-drag-is-very-close")),f(this).removeClass("sek-drag-is-in"))}),this.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=f(e.currentTarget);switch(this.dnd_draggedType){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:a.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return f(a.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=e&&0<e.length&&e.hasClass("sek-content-preset_section-drop-zone"),i=e&&0<e.length&&e.hasClass("sek-module-drop-zone-for-first-module");return e.hasClass("sek-drop-zone")&&("preset_section"===this.dnd_draggedType&&t||"module"===this.dnd_draggedType&&!t||"preset_section"===this.dnd_draggedType&&i)},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){a.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),f(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(f(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"))},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");f.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,s=i.right,a=i.top,c=i.bottom;return r<=n&&n-r<=s-r&&(a<=o&&o-a<=c-a)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();a.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module:e.data("drop-zone-before-module-or-nested-section"),after_module:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t=e.drop_target_element,i="content-in-column";switch(t.data("sek-location")){case"between-sections":i="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,i="content-in-empty-location";break;case"between-columns":i="content-in-new-column"}if("preset_section"===e.content_type)if(t.hasClass("sek-module-drop-zone-for-first-module")){var n=t.closest('div[data-sek-level="section"]');1<n.find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(i="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=n.data("sek-id")):(e.sektion_to_replace=n.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=n.closest('[data-sek-level="column"]').data("sek-id"),i="content-in-a-section-to-replace")}else"between-sections"===t.data("sek-location")&&(i="content-in-a-section-to-create");switch(i){case"content-in-column":var o=t.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),s=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(s))throw new Error("No valid level id found");a.previewer.trigger("sek-add-module",{level:r,id:s,in_column:t.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:t.closest('div[data-sek-level="section"]').data("sek-id"),before_module:e.before_module,after_module:e.after_module,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":a.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"content-in-empty-location":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;default:a.errare("sek control panel => ::reactToDrop => invalid drop case : "+i)}}(e)}catch(e){a.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;r.sekEditorExpanded=new r.Value(!1),r.sekEditorSynchronizedInput=new r.Value,n.editorEventsListenerSetup=!1;var o=function(){r.sekTinyMceEditor=r.sekTinyMceEditor||tinyMCE.get("czr-customize-content_editor"),!1===n.editorEventsListenerSetup&&(n.attachEventsToEditor(),n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};n.bind("sek-edit-module_done",function(e){if("tiny_mce_editor"==e.clicked_input_type){var i=e.id;if(!0===n.getRegisteredModuleProperty(e.module_type,"is_father")){var t=n.getRegisteredModuleProperty(e.module_type,"children");if(_.isEmpty(t))throw new Error("::generateUIforFrontModules => a father module "+e.module_type+" is missing children modules ");_.each(t,function(e,t){"czr_tinymce_child"===e&&(i=i+"__"+t)})}r.sekEditorSynchronizedInput({control_id:i,input_id:e.clicked_input_id}),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),s("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=s(this).data("czr-control-id"),t=s(this).data("czr-input-id");if(_.isEmpty(e)||_.isEmpty(t))r.errare("toggle-tinymce-editor => missing input or control id");else{var i=s.extend(!0,{},r.sekEditorSynchronizedInput()),n=_.extend(i,{input_id:t,control_id:e});r.sekEditorSynchronizedInput(n),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),r.sekEditorSynchronizedInput.bind(function(n,e){o(),r(n.control_id,function(e){var t=e(),i=_.isObject(t)&&!_.isEmpty(t[n.input_id])?t[n.input_id]:"";try{r.sekTinyMceEditor.setContent(i)}catch(e){r.errare("Error when setting the tiny mce editor content in setupTinyMceEditor",e)}r.sekTinyMceEditor.focus()})}),r.sekEditorExpanded.bind(function(e,t,i){o(),e&&r.sekTinyMceEditor.focus(),s(document.body).toggleClass("czr-customize-content_editor-pane-open",e),s(window)[e?"on":"off"]("resize",function(){r.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?n.czrResizeEditor(window.innerHeight-n.$editorPane.height()):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),s("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){r.sekEditorExpanded(!1)}),s("#customize-controls").on("click",function(e){"open-tinymce-editor"!=s(e.target).data("czr-action")&&r.sekEditorExpanded(!1,{context:"clicked anywhere"})}),s(document).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=s(r.sekTinyMceEditor.iframeElement).contents().get(0);s(e).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?r.previewer.bind(e,function(){r.sekEditorExpanded(!1)}):r.previewer.bind(e,function(e){r.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachEventsToEditor:function(){var t=this;t.$editorTextArea=s("#czr-customize-content_editor"),t.$editorPane=s("#czr-customize-content_editor-pane"),t.$editorDragbar=s("#czr-customize-content_editor-dragbar"),t.$editorFrame=s("#czr-customize-content_editor_ifr"),t.$mceTools=s("#wp-czr-customize-content_editor-tools"),t.$mceToolbar=t.$editorPane.find(".mce-toolbar-grp"),t.$mceStatusbar=t.$editorPane.find(".mce-statusbar"),t.$preview=s("#customize-preview"),t.$collapseSidebar=s(".collapse-sidebar"),r.sekTinyMceEditor.on("input change keyup",function(e){if(r.control.has(r.sekEditorSynchronizedInput().control_id))try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:r.sekTinyMceEditor.getContent(),modified_editor_element:r.sekTinyMceEditor})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),t.$editorTextArea.on("input",function(e){try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:t.$editorTextArea.val(),modified_editor_element:t.$editorTextArea})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),s("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===s(e.target).attr("id")||s(e.target).hasClass("czr-resize-handle"))&&r.sekEditorExpanded())switch(e.type){case"mousedown":s(document).on("mousemove.czr-customize-content_editor",function(e){e.preventDefault(),s(document.body).addClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":s(document).off("mousemove.czr-customize-content_editor"),s(document.body).removeClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{});r.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=i.$mceTools.outerHeight()+i.$mceToolbar.outerHeight()+i.$mceStatusbar.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),i.$editorFrame.css("height",o.height-o.components),i.$collapseSidebar.css("bottom",n-o.height<56?i.$mceStatusbar.outerHeight()+4:o.height+8))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var s=o();o.initial_unit="px",u.isEmpty(s)||(o.initial_unit=u.isEmpty(s.unit)?"px":s.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,s=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},a);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",s).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),s.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),r(t)}),m.call(r,s,a),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,s);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,a,c){n.czrInputMap=n.czrInputMap||{},a.extend(n.czrInputMap,{bg_position:function(e){var t=this;a(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(a(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},i=function(e){var t=a.extend(!0,{},c.isObject(o())?o():{}),i=a.extend(!0,{},r);t=c.isObject(t)?a.extend(i,t):i;var n=s(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};a(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=a(this).val();(t=a.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",s=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=a(t,e);s.find(".selected").removeClass("selected"),s.find('div[data-sek-align="'+n+'"]').addClass("selected")};s.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),s.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{font_size:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{line_height:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(i,c,l){i.czrInputMap=i.czrInputMap||{},c.extend(i.czrInputMap,{font_picker:function(e){var a=this,o=a.input_parent,n=function(e,t){o();var n=c('select[data-czrtype="'+a.id+'"]',a.container);l.isNull(a())||l.isEmpty(a())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"),l.each([{title:sektionsLocalizedData.i18n["Web Safe Fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google Fonts"],type:"gfont",list:t.gfonts}],function(e){var t,r,s,i=c("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,s="",l.each(t,function(e){var t,i,n=e.name,o=l.isString(n)?n.replace(/[+|:]/g," "):n;t=n,i=r,(n=l.isString(t)?["[",i,"]",t].join(""):"")==a()?s+='<option selected="selected" value="'+n+'">'+o+"</option>":s+='<option value="'+n+'">'+o+"</option>"}),s)});n.append(i)});var i={escapeMarkup:function(e){return e}};e&&c.extend(i,{resultsAdapter:e,closeOnSelect:!1}),n.select2(i),c(".select2-selection__rendered",a.container).css(r(a()))},r=function(e){if(!l.isString(e)||l.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=s(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=l.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},s=function(e){if(!l.isString(e)||l.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return l.isString(t[0])?t[0].replace(/[+|:]/g," "):""};c.when(function(){var e,t=c.Deferred();l.isEmpty(i.sek_fontCollections)?(l.isUndefined(i.sek_fetchingFontCollection)||"pending"!=i.sek_fetchingFontCollection.state()?(e=i.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:a.module.id}),i.sek_fetchingFontCollection=e):e=i.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");i.sek_fontCollections=JSON.parse(e),t.resolve(i.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(i.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=c.Deferred(),void 0!==c.fn.select2&&void 0!==c.fn.select2.amd&&"function"==typeof c.fn.select2.amd.require?c.fn.select2.amd.require(["select2/results","select2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){i.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(s,a,c){s.czrInputMap=s.czrInputMap||{},a.extend(s.czrInputMap,{fa_icon_picker:function(){var t,n=this,o=n.input_parent,r=!1;a.when((t=a.Deferred(),c.isEmpty(n.sek_faIconCollection)?s.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection),t.promise())).done(function(e){!function(e){c.each(e,function(e){var t={value:e,html:s.CZR_Helpers.capitalize(e.substring(7))};t.value==o().icon&&(a.extend(t,{selected:"selected"}),r=!0),a("select[data-czrtype]",n.container).append(a("<option>",t))});var t,i=function(e){return e.id?a('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=r?a("<option>"):a("<option>",{selected:"selected"}),a("select[data-czrtype]",n.container).prepend(t).select2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e)}).fail(function(e){s.errare("fa_icon_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,t=(n.input_parent(),!1),r=n.container.find("textarea"),o=n.container.find(".customize-control-title"),s=r.data("editor-params");wp.codeEditor&&(p.isUndefined(s)||!1!==s)&&(t=s),n.isReady.done(function(){var e=function(e){p.isEmpty(this.editor)&&(p.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(t)try{a(t)}catch(e){d.errare("error in sek_control => code_editor() input",e),c()}else c();o.click()},10))};e.call(n),n.module.control.container.on("sek-accordion-expanded",function(){e.call(n)})});var a=function(e){var t,i=!1;t=p.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:l}),n.editor=wp.codeEditor.initialize(r,t),u(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":o.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),o.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},c=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},l=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",o.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",o.html()),i.setting.notifications.add(n.id,new d.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),s=function(e){return l.contains(["px","em","%"],e)||(a.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new a.Value(l.isEmpty(r)?"px":s(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+s(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(a,_,m){a.czrInputMap=a.czrInputMap||{},_.extend(a.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),s=function(e){return m.contains(["px","em","%"],e)||(a.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=a.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),s=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),a=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+s+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+s+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(a).trigger("input",{previewed_device_switched:!0})};a.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new a.Value(m.isEmpty(i())?"px":s(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=a.previewedDevice()||"desktop",o=_(this).val()+s(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=a.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(a.previewedDevice()))}),r.val(d.val()||0);try{n(a.previewedDevice())}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(h,g,k){h.czrInputMap=h.czrInputMap||{},g.extend(h.czrInputMap,{borders:function(e){var a=this,c=g(".sek-borders",a.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return k.contains(["px","em","%"],e)||(h.errare("borders => error : invalid unit for input "+a.id,e),e="px"),e},_=function(e){return k.isEmpty(e)||!k.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return k.isEmpty(e)||!k.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=h.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),f=k.isEmpty(t)||k.isEmpty(t.default)?{}:t.default;a.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=a(),t="px";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=a(),t="#000000";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.col)&&(t=e._all_.col),t},s=function(e){if(!k.contains(k.union(a.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=a(),i={},n=g.extend(!0,{},f);k.isObject(t)?i=g.extend(!0,{},t):k.isString(t)&&(i={_all_:{wght:t}});var o,r,s=function(e,t){var i,n=g.extend(!0,{},f);if(!k.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=k.isObject(e)&&k.has(e,"_all_")?k.extend(n._all_,e._all_):n._all_,k.has(e,t)&&k.isObject(e[t])?k.extend(i,e[t]):n._all_}(i=g.extend(n,i),e);if(k.isEmpty(s)||!k.isObject(s)||k.isEmpty(s.wght)||k.isEmpty(s.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(s.wght),r=_(s.wght),g(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(s.col).trigger("change"),u.data("border_type_switched",!1)};a.borderColor=new h.Value(k.isEmpty(r())?"#000000":r()),a.css_unit=new h.Value(k.isEmpty(o())?"px":p(o())),a.borderType=new h.Value("_all_"),l.val((i=a(),n=1,k.isObject(i)&&k.has(i,"_all_")&&k.isObject(i._all_)&&!k.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!k.isNumber(n)||n<0)&&(h.errare("Error in borders input type for module : "+a.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(a.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){g(this).val(t.color.toString()).trigger("colorpickerchange"),a.borderColor(t.color.toString(),{border_type_switched:!0===g(this).data("border_type_switched")})},clear:function(e,t){g(this).val("").trigger("colorpickerchange"),a.borderColor("")}}),a.css_unit.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.borderColor.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),a.borderType.bind(function(e){try{s(e)}catch(e){h.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}}),d.on("input",function(e){l.val(g(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.borderType()||"_all_",o=a.borderColor(),r=g(this).val()+p(a.css_unit()),s=g.extend(!0,{},f);(i=g.extend(!0,{},k.isObject(a())?a():s))[n]=g.extend(!0,{},i[n]||s[n]),k.isString(r)&&!k.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(k.isEmpty(t)||k.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&k.each(a.cssBorderTypes,function(e){i=k.omit(i,e)}),a(i)),d.val(g(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),g(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",g(this).data("sek-unit")),a.css_unit(g(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),g(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=g(this).data("sek-border-type")}catch(e){h.errare("borders input type => error when attaching click event",e)}a.borderType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.borderType()||"_all_",i=g.extend(!0,{},k.isObject(a())?a():{});k.isEmpty(i[t])||(i=k.omit(i,t),a(i),s(t))}),d.val(l.val()||0);try{s(a.borderType())}catch(e){h.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}g('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,h){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var a=this,c=f(".sek-borders",a.container),l=c.find('input[type="number"]'),s=c.find('input[type="range"]'),d=function(e){return h.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+a.id,e),e="px"),e},u=function(e){return h.isEmpty(e)||!h.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return h.isEmpty(e)||!h.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),_=h.isEmpty(t)||h.isEmpty(t.default)?{}:t.default;a.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=a(),t="px";return h.isObject(e)&&h.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!h.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=a(),i={},n=f.extend(!0,{},_);h.isObject(t)?i=f.extend(!0,{},t):h.isString(t)&&(i={_all_:"0px"});var o,r,s=function(e,t){var i,n=f.extend(!0,{},_);if(!h.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=h.isObject(e)&&h.has(e,"_all_")?e._all_:n._all_,h.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(h.isEmpty(s)||!h.isString(s))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(s),r=u(s),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};a.css_unit=new m.Value(h.isEmpty(o())?"px":d(o())),a.radiusType=new m.Value("_all_"),l.val((i=a(),n=0,h.isObject(i)&&h.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!h.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+a.module.module_type+" the initial radius is invalid : "+n),n=0),n)),a.css_unit.bind(function(e,t,i){(!h.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}}),s.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.radiusType()||"_all_",o=f(this).val()+d(a.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},h.isObject(a())?a():r))[n]=f.extend(!0,{},i[n]||r[n]),h.isString(o)&&!h.isEmpty(o)&&(i[n]=o),(h.isEmpty(t)||h.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&h.each(a.cssRadiusTypes,function(e){i=h.omit(i,e)}),a(i)),s.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),a.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}a.radiusType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.radiusType()||"_all_",i=f.extend(!0,{},h.isObject(a())?a():{});h.isEmpty(i[t])||(i=h.omit(i,t),a(i),r(t))}),s.val(l.val()||0);try{r(a.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}f('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=s(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);a.isEmpty(i)||a.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),s(this).addClass("is-selected").attr("aria-pressed",!0);try{i=s(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),s('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(i,n,e){i.czrInputMap=i.czrInputMap||{},n.extend(i.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){if(e.stopPropagation(),"local"===n(this).data("sek-reset-scope"))try{i.czr_sektions.resetCollectionSetting()}catch(e){i.errare("reset_button => error when firing resetCollectionSetting() on click event",e)}})}})}(wp.customize,jQuery,_),function(t,o,r){t.czrModuleMap=t.czrModuleMap||{},o.extend(t.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}}),t.czrInputMap=t.czrInputMap||{},o.extend(t.czrInputMap,{content_type_switcher:function(e){var i,n=this;if(!t.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=t.section(n.module.control.section()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault(),n.container.find("[data-sek-content-type]").removeClass("is-selected").attr("aria-pressed",!1),o(this).addClass("is-selected").attr("aria-pressed",!0),n.contentType(o(this).data("sek-content-type"))}),n.contentType=new t.Value,n.contentType.bind(function(t){n.container.find('[data-sek-content-type="'+n.contentType()+'"]').trigger("click"),r.each(i.controls(),function(e){r.isUndefined(e.content_type)||e.active(t===e.content_type)})}),n.contentType(n()),i.container.first().bind("sek-content-type-refreshed",function(e,t){n.contentType(t.content_type||"section")})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},e.extend(t.czrModuleMap,{sek_module_picker_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},i.each(["sek_intro_sec_picker_module","sek_features_sec_picker_module","sek_contact_sec_picker_module","sek_column_layouts_sec_picker_module"],function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(s,e,a){var t={initialize:function(e,t){var i=this;i.inputConstructor=s.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=s.CZRItem.extend(i.CZRItemConstructor||{}),s.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){s.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){s.errorLog("item.setInputVisibilityDeps() : "+e)}}),s.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module,r=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(i){switch(i.id){case"bg-image":a.each(["bg-position","bg-attachment","bg-scale","bg-apply-overlay","bg-color-overlay","bg-opacity-overlay"],function(t){try{r.call(i,t,function(){var e=!1;switch(t){case"bg-color-overlay":case"bg-opacity-overlay":e=!a.isEmpty(i()+"")&&s.CZR_Helpers.isChecked(n.czr_Input("bg-apply-overlay")());break;default:e=!a.isEmpty(i()+"")}return e})}catch(e){s.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":a.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.call(i,e,function(){return!a.isEmpty(n.czr_Input("bg-image")()+"")&&s.CZR_Helpers.isChecked(i())})}catch(e){s.errare(o.id+" => error in setInputVisibilityDeps",e)}})}})}}};s.czrModuleMap=s.czrModuleMap||{},e.extend(s.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:s.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:a.extend({id:"",title:""},s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(e,"custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(e){switch(e.id){case"height-type":(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(e,"custom-height",function(){return"custom"===e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"width-type":t.call(e,"custom-width",function(){return"custom"===e()}),t.call(e,"h_alignment",function(){return"custom"===e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":t.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":t.call(e,"inner-section-width",function(){return e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_template:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":t.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":t.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_performances:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(e,"global-custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":t.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":t.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){var i=this;i.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=r.CZRItem.extend(i.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(i,e,t),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module,o=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(i){switch(i.id){case"img":o.call(i,"img-size",function(){return!s.isEmpty(i()+"")&&s.isNumber(i())});break;case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e="no-link"!==i()}return e})}catch(e){r.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":s.each(["borders"],function(e){try{o.call(i,e,function(){return"none"!==i()})}catch(e){r.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":s.each(["custom_width"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"tiny_mce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)},setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRFPItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRFPItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(i){switch(i.id){case"img-type":s.each(["img-id","img-size"],function(t){try{o.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){r.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":s.each(["content-custom-text"],function(e){try{o.call(i,e,function(){return"custom"===i()})}catch(e){r.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":s.each(["btn-custom-text"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:r.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(s,e,a){var t={initialize:function(e,t){var i=this;i.inputConstructor=s.CZRInput.extend({setupSelect:function(){s.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=s.CZRItem.extend(i.CZRIconItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),s.CZRDynModule.prototype.initialize.call(i,e,t)},CZRIconItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!a.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){s.errorLog("item.setInputVisibilityDeps() : "+e)}}),s.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module,r=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(i){switch(i.id){case"link-to":a.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){s.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":a.each(["color_hover"],function(e){try{r.call(i,e,function(){return i()})}catch(e){s.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};s.czrModuleMap=s.czrModuleMap||{},e.extend(s.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:s.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRHeadingInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRHeadingInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_heading_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRHeadingInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRHeadingInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_heading_spacing_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRDividerInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRDividerInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_divider_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRButtonItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(t){switch(t.id){case"quote_design":r.each(["border_width_css","border_color_css"],function(e){try{i.call(t,e,function(){return"border-before"==t()})}catch(e){o.errare("Quote module => error in setInputVisibilityDeps",e)}}),r.each(["icon_color_css","icon_size_css"],function(e){try{i.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){o.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_quote_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_cite_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=o.CZRItem.extend(i.CZRButtonItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,e=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{e.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":e.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":e.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRButtonItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module,o=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":s.each(["bg_color_hover"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":s.each(["borders"],function(e){try{o.call(t,e,function(){return"none"!==t()})}catch(e){r.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":s.each(["push_effect"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(t){switch(t.id){case"show_name_field":r.each(["name_field_label","name_field_required"],function(e){try{i.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":r.each(["subject_field_label","subject_field_required"],function(e){try{i.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":r.each(["message_field_label","message_field_required"],function(e){try{i.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.call(t,"link-custom-url",function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module;n.czr_Input.each(function(t){switch(t.id){case"border-type":r.each(["borders"],function(e){try{(function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}).call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,i=n.module,o=function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})};n.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":s.each(["bg_color_hover"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":s.each(["borders"],function(e){try{o.call(t,e,function(){return"none"!==t()})}catch(e){r.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":s.each(["push_effect"],function(e){try{o.call(t,e,function(){return t()})}catch(e){r.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fonts_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_submission_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=r.CZRItem.extend(this.CZRButtonItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=(n.module,function(t,i){n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})});n.czr_Input.each(function(i){switch(i.id){case"use_custom_bg_color_on_hover":s.each(["bg_color_hover"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":s.each(["push_effect"],function(e){try{o.call(i,e,function(){return i()})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_font_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_);
assets/front/js/_parts/_main_base_2_initialize.part.js DELETED
@@ -1,207 +0,0 @@
1
- //@global sekFrontLocalized
2
- var czrapp = czrapp || {};
3
- /*************************
4
- * ADD BASE CLASS METHODS
5
- *************************/
6
- (function($, czrapp) {
7
- var _methods = {
8
- /**
9
- * Cache properties on Dom Ready
10
- * @return {[type]} [description]
11
- */
12
- cacheProp : function() {
13
- if ( "undefined" === typeof( sekFrontLocalized ) || ! sekFrontLocalized ) {
14
- throw new Error( 'czrapp => cacheProp => missing global sekFrontLocalized ');
15
- }
16
- var self = this;
17
- $.extend( czrapp, {
18
- //cache various jQuery el in czrapp obj
19
- $_window : $(window),
20
- $_html : $('html'),
21
- $_body : $('body'),
22
- $_wpadminbar : $('#wpadminbar'),
23
-
24
- //cache various jQuery body inner el in czrapp obj
25
- $_header : $('.tc-header'),
26
-
27
- //various properties definition
28
- localized : "undefined" != typeof( sekFrontLocalized ) && sekFrontLocalized ? sekFrontLocalized : { _disabled: [] },
29
- is_responsive : self.isResponsive(),//store the initial responsive state of the window
30
- current_device : self.getDevice(),//store the initial device
31
- isRTL : $('html').attr('dir') == 'rtl'//is rtl?
32
- });
33
- },
34
-
35
- //bool
36
- isResponsive : function() {
37
- return this.matchMedia(991);
38
- },
39
-
40
- //@return string of current device
41
- getDevice : function() {
42
- var _devices = {
43
- desktop : 991,
44
- tablet : 767,
45
- smartphone : 575
46
- },
47
- _current_device = 'desktop',
48
- that = this;
49
-
50
-
51
- _.map( _devices, function( max_width, _dev ){
52
- if ( that.matchMedia( max_width ) )
53
- _current_device = _dev;
54
- } );
55
-
56
- return _current_device;
57
- },
58
-
59
- matchMedia : function( _maxWidth ) {
60
- if ( window.matchMedia )
61
- return ( window.matchMedia("(max-width: "+_maxWidth+"px)").matches );
62
-
63
- //old browsers compatibility
64
- var $_window = czrapp.$_window || $(window);
65
- return $_window.width() <= ( _maxWidth - 15 );
66
- },
67
-
68
- emit : function( cbs, args ) {
69
- cbs = _.isArray(cbs) ? cbs : [cbs];
70
- var self = this;
71
- _.map( cbs, function(cb) {
72
- if ( 'function' == typeof(self[cb]) ) {
73
- args = 'undefined' == typeof( args ) ? [] : args ;
74
- self[cb].apply(self, args );
75
- czrapp.trigger( cb, _.object( _.keys(args), args ) );
76
- }
77
- });//_.map
78
- },
79
-
80
- triggerSimpleLoad : function( $_imgs ) {
81
- if ( 0 === $_imgs.length )
82
- return;
83
-
84
- $_imgs.map( function( _ind, _img ) {
85
- $(_img).load( function () {
86
- $(_img).trigger('simple_load');
87
- });//end load
88
- if ( $(_img)[0] && $(_img)[0].complete )
89
- $(_img).load();
90
- } );//end map
91
- },//end of fn
92
-
93
- isUserLogged : function() {
94
- return czrapp.$_body.hasClass('logged-in') || 0 !== czrapp.$_wpadminbar.length;
95
- },
96
-
97
- isSelectorAllowed : function( $_el, skip_selectors, requested_sel_type ) {
98
- var sel_type = 'ids' == requested_sel_type ? 'id' : 'class',
99
- _selsToSkip = skip_selectors[requested_sel_type];
100
-
101
- //check if option is well formed
102
- if ( 'object' != typeof(skip_selectors) || ! skip_selectors[requested_sel_type] || ! $.isArray( skip_selectors[requested_sel_type] ) || 0 === skip_selectors[requested_sel_type].length )
103
- return true;
104
-
105
- //has a forbidden parent?
106
- if ( $_el.parents( _selsToSkip.map( function( _sel ){ return 'id' == sel_type ? '#' + _sel : '.' + _sel; } ).join(',') ).length > 0 )
107
- return false;
108
-
109
- //has requested sel ?
110
- if ( ! $_el.attr( sel_type ) )
111
- return true;
112
-
113
- var _elSels = $_el.attr( sel_type ).split(' '),
114
- _filtered = _elSels.filter( function(classe) { return -1 != $.inArray( classe , _selsToSkip ) ;});
115
-
116
- //check if the filtered selectors array with the non authorized selectors is empty or not
117
- //if empty => all selectors are allowed
118
- //if not, at least one is not allowed
119
- return 0 === _filtered.length;
120
- },
121
-
122
-
123
- //@return bool
124
- _isMobile : function() {
125
- return ( _.isFunction( window.matchMedia ) && matchMedia( 'only screen and (max-width: 768px)' ).matches ) || ( this._isCustomizing() && 'desktop' != this.previewDevice() );
126
- },
127
-
128
- //@return bool
129
- _isCustomizing : function() {
130
- return czrapp.$_body.hasClass('is-customizing') || ( 'undefined' !== typeof wp && 'undefined' !== typeof wp.customize );
131
- },
132
-
133
- //Helpers
134
- //Check if the passed element(s) contains an iframe
135
- //@return list of containers
136
- //@param $_elements = mixed
137
- _has_iframe : function ( $_elements ) {
138
- var to_return = [];
139
- _.each( $_elements, function( $_el, container ){
140
- if ( $_el.length > 0 && $_el.find('IFRAME').length > 0 )
141
- to_return.push(container);
142
- });
143
- return to_return;
144
- },
145
-
146
- //Simple Utility telling if a given Dom element is currently in the window <=> visible.
147
- //Useful to mimic a very basic WayPoint
148
- isInWindow : function( $_el, threshold ) {
149
- if ( ! ( $_el instanceof $ ) )
150
- return;
151
- if ( threshold && ! _.isNumber( threshold ) )
152
- return;
153
-
154
- var wt = $(window).scrollTop(),
155
- wb = wt + $(window).height(),
156
- it = $_el.offset().top,
157
- ib = it + $_el.height(),
158
- th = threshold || 0;
159
-
160
- return ib >= wt - th && it <= wb + th;
161
- },
162
-
163
- //params :
164
- //{
165
- // delay : 3000,
166
- // func : fn,
167
- // instance : {},
168
- // args : []
169
- //}
170
- fireMeWhenStoppedScrolling : function( params ) {
171
- params = _.extend( {
172
- delay : 3000,
173
- func : '',
174
- instance : {},
175
- args : []
176
- }, params );
177
-
178
- if ( ! _.isFunction( params.func ) )
179
- return;
180
- var _timer_ = function() {
181
- $.Deferred( function() {
182
- var dfd = this;
183
- _.delay( function() {
184
- dfd.resolve();
185
- }, params.delay );
186
- }).done( function() {
187
- //user has stopped scrolling since params.delay seconds, or last we check was params.delay seconds ago
188
- //what do we do ?
189
- if ( czrapp.userXP.isScrolling() ) {
190
- //still scrolling, fire me again
191
- _timer_();
192
- } else {
193
- //not scrolling anymore
194
- params.func.apply( params.instance, params.args );
195
- }
196
- });
197
- };
198
- _timer_();
199
- },
200
- //Will store the status of the script to load dynamically
201
- scriptLoadingStatus : {},
202
- };//_methods{}
203
-
204
- czrapp.methods.Base = czrapp.methods.Base || {};
205
- $.extend( czrapp.methods.Base , _methods );//$.extend
206
-
207
- })(jQuery, czrapp);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/front/js/_parts/_main_jquery_plugins.part.js DELETED
@@ -1,96 +0,0 @@
1
- var czrapp = czrapp || {};
2
- /***************************
3
- * ADD JQUERY PLUGINS METHODS
4
- ****************************/
5
- (function($, czrapp, Waypoint ) {
6
- var _methods = {
7
- centerImagesWithDelay : function( delay ) {
8
- var self = this;
9
- //fire the center images plugin
10
- //setTimeout( function(){ self.emit('centerImages'); }, delay || 300 );
11
- setTimeout( function(){ self.emit('centerImages'); }, delay || 50 );
12
- },
13
-
14
-
15
-
16
- /**
17
- * CENTER VARIOUS IMAGES
18
- * @return {void}
19
- */
20
- centerImages : function() {
21
- var $wrappersOfCenteredImagesCandidates = $('.sek-fp-widget .sek-fp-thumb-wrapper, .js-centering.entry-media__holder, .js-centering.entry-media__wrapper');
22
-
23
- //Featured pages and classical grid are always centered
24
- // $('.tc-grid-figure, .widget-front .tc-thumbnail').centerImages( {
25
- // enableCentering : 1,
26
- // oncustom : ['smartload', 'refresh-height', 'simple_load'],
27
- // zeroTopAdjust: 0,
28
- // enableGoldenRatio : false,
29
- // } );
30
- var _css_loader = '<div class="czr-css-loader czr-mr-loader" style="display:none"><div></div><div></div><div></div></div>';
31
- $wrappersOfCenteredImagesCandidates.each( function() {
32
- $( this ).append( _css_loader ).find('.czr-css-loader').fadeIn( 'slow');
33
- });
34
- $wrappersOfCenteredImagesCandidates.centerImages({
35
- onInit : true,
36
- enableCentering : 1,
37
- oncustom : ['smartload', 'refresh-height', 'simple_load'],
38
- enableGoldenRatio : false, //true
39
- zeroTopAdjust: 0,
40
- setOpacityWhenCentered : false,//will set the opacity to 1
41
- addCenteredClassWithDelay : 50,
42
- opacity : 1
43
- });
44
- _.delay( function() {
45
- $wrappersOfCenteredImagesCandidates.find('.czr-css-loader').fadeOut( {
46
- duration: 500,
47
- done : function() { $(this).remove();}
48
- } );
49
- }, 300 );
50
-
51
-
52
- // if for any reasons, the centering did not happen, the imgs will not be displayed because opacity will stay at 0
53
- // => the opacity is set to 1 as soon as v-centered or h-centered has been added to a img element candidate for centering
54
- // @see css
55
- var _mayBeForceOpacity = function( params ) {
56
- params = _.extend( {
57
- el : {},
58
- delay : 0
59
- }, _.isObject( params ) ? params : {} );
60
-
61
- if ( 1 !== params.el.length || ( params.el.hasClass( 'h-centered') || params.el.hasClass( 'v-centered') ) )
62
- return;
63
-
64
- _.delay( function() {
65
- params.el.addClass( 'opacity-forced');
66
- }, params.delay );
67
-
68
- };
69
- //For smartloaded image, let's wait for the smart load to happen, for the others, let's do it now without delay
70
- if ( czrapp.localized.imgSmartLoadEnabled ) {
71
- $wrappersOfCenteredImagesCandidates.on( 'smartload', 'img' , function( ev ) {
72
- if ( 1 != $( ev.target ).length )
73
- return;
74
- _mayBeForceOpacity( { el : $( ev.target ), delay : 200 } );
75
- });
76
- } else {
77
- $wrappersOfCenteredImagesCandidates.find('img').each( function() {
78
- _mayBeForceOpacity( { el : $(this), delay : 100 } );
79
- });
80
- }
81
-
82
- //then last check
83
- _.delay( function() {
84
- $wrappersOfCenteredImagesCandidates.find('img').each( function() {
85
- _mayBeForceOpacity( { el : $(this), delay : 0 } );
86
- });
87
- }, 1000 );
88
-
89
- }//center_images
90
- };//_methods{}
91
-
92
- czrapp.methods.JQPlugins = {};
93
- $.extend( czrapp.methods.JQPlugins , _methods );
94
-
95
-
96
- })(jQuery, czrapp, Waypoint);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/front/js/_parts/_z_main_xfire_app_map.part.js DELETED
@@ -1,61 +0,0 @@
1
- var czrapp = czrapp || {};
2
- //@global sekFrontLocalized
3
- /************************************************
4
- * LET'S DANCE
5
- *************************************************/
6
- ( function ( czrapp ) {
7
- //adds the server params to the app now
8
- //czrapp.localized = window.sekFrontLocalized || {};
9
-
10
- //THE DEFAULT MAP
11
- //Other methods can be hooked. @see czrapp.customMap
12
- var appMap = {
13
- base : {
14
- ctor : czrapp.Base,
15
- ready : [
16
- 'cacheProp'
17
- ]
18
- },
19
- // browserDetect : {
20
- // ctor : czrapp.Base.extend( czrapp.methods.BrowserDetect ),
21
- // ready : [ 'addBrowserClassToBody' ]
22
- // },
23
- jqPlugins : {
24
- ctor : czrapp.Base.extend( czrapp.methods.JQPlugins ),
25
- ready : [
26
- 'centerImagesWithDelay',
27
- // 'imgSmartLoad',
28
- //'dropCaps',
29
- //'extLinks',
30
- // 'lightBox',
31
- // 'parallax'
32
- ]
33
- },
34
- // userXP : {
35
- // ctor : czrapp.Base.extend( czrapp.methods.UserXP ),
36
- // ready : [
37
- // 'setupUIListeners',//<= setup various observable values like this.isScrolling, this.scrollPosition, ...
38
-
39
- // 'variousHoverActions',
40
- // 'formFocusAction',
41
-
42
- // 'smoothScroll',
43
-
44
- // 'attachmentsFadeEffect',
45
-
46
- // 'onEscapeKeyPressed',
47
-
48
- // 'featuredPagesAlignment',
49
-
50
- // 'anchorSmoothScroll',
51
-
52
- // 'mayBePrintFrontNote',
53
- // ]
54
- // }
55
- };//map
56
-
57
- //set the observable value
58
- //listened to by _instantianteAndFireOnDomReady = function( newMap, previousMap, isInitial )
59
- czrapp.appMap( appMap , true );//true for isInitial map
60
-
61
- })( czrapp );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/front/js/ccat-nimble-front.js ADDED
@@ -0,0 +1,1452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ (function() {
4
+ var root = typeof self == 'object' && self.self === self && self ||
5
+ typeof global == 'object' && global.global === global && global ||
6
+ this ||
7
+ {};
8
+ var previousUnderscore = root._;
9
+ var ArrayProto = Array.prototype, ObjProto = Object.prototype;
10
+ var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
11
+ var push = ArrayProto.push,
12
+ slice = ArrayProto.slice,
13
+ toString = ObjProto.toString,
14
+ hasOwnProperty = ObjProto.hasOwnProperty;
15
+ var nativeIsArray = Array.isArray,
16
+ nativeKeys = Object.keys,
17
+ nativeCreate = Object.create;
18
+ var Ctor = function(){};
19
+ var _ = function(obj) {
20
+ if (obj instanceof _) return obj;
21
+ if (!(this instanceof _)) return new _(obj);
22
+ this._wrapped = obj;
23
+ };
24
+ if (typeof exports != 'undefined' && !exports.nodeType) {
25
+ if (typeof module != 'undefined' && !module.nodeType && module.exports) {
26
+ exports = module.exports = _;
27
+ }
28
+ exports._ = _;
29
+ } else {
30
+ root._ = _;
31
+ }
32
+ _.VERSION = '1.9.1';
33
+ var optimizeCb = function(func, context, argCount) {
34
+ if (context === void 0) return func;
35
+ switch (argCount == null ? 3 : argCount) {
36
+ case 1: return function(value) {
37
+ return func.call(context, value);
38
+ };
39
+ case 3: return function(value, index, collection) {
40
+ return func.call(context, value, index, collection);
41
+ };
42
+ case 4: return function(accumulator, value, index, collection) {
43
+ return func.call(context, accumulator, value, index, collection);
44
+ };
45
+ }
46
+ return function() {
47
+ return func.apply(context, arguments);
48
+ };
49
+ };
50
+
51
+ var builtinIteratee;
52
+ var cb = function(value, context, argCount) {
53
+ if (_.iteratee !== builtinIteratee) return _.iteratee(value, context);
54
+ if (value == null) return _.identity;
55
+ if (_.isFunction(value)) return optimizeCb(value, context, argCount);
56
+ if (_.isObject(value) && !_.isArray(value)) return _.matcher(value);
57
+ return _.property(value);
58
+ };
59
+ _.iteratee = builtinIteratee = function(value, context) {
60
+ return cb(value, context, Infinity);
61
+ };
62
+ var restArguments = function(func, startIndex) {
63
+ startIndex = startIndex == null ? func.length - 1 : +startIndex;
64
+ return function() {
65
+ var length = Math.max(arguments.length - startIndex, 0),
66
+ rest = Array(length),
67
+ index = 0;
68
+ for (; index < length; index++) {
69
+ rest[index] = arguments[index + startIndex];
70
+ }
71
+ switch (startIndex) {
72
+ case 0: return func.call(this, rest);
73
+ case 1: return func.call(this, arguments[0], rest);
74
+ case 2: return func.call(this, arguments[0], arguments[1], rest);
75
+ }
76
+ var args = Array(startIndex + 1);
77
+ for (index = 0; index < startIndex; index++) {
78
+ args[index] = arguments[index];
79
+ }
80
+ args[startIndex] = rest;
81
+ return func.apply(this, args);
82
+ };
83
+ };
84
+ var baseCreate = function(prototype) {
85
+ if (!_.isObject(prototype)) return {};
86
+ if (nativeCreate) return nativeCreate(prototype);
87
+ Ctor.prototype = prototype;
88
+ var result = new Ctor;
89
+ Ctor.prototype = null;
90
+ return result;
91
+ };
92
+
93
+ var shallowProperty = function(key) {
94
+ return function(obj) {
95
+ return obj == null ? void 0 : obj[key];
96
+ };
97
+ };
98
+
99
+ var has = function(obj, path) {
100
+ return obj != null && hasOwnProperty.call(obj, path);
101
+ }
102
+
103
+ var deepGet = function(obj, path) {
104
+ var length = path.length;
105
+ for (var i = 0; i < length; i++) {
106
+ if (obj == null) return void 0;
107
+ obj = obj[path[i]];
108
+ }
109
+ return length ? obj : void 0;
110
+ };
111
+ var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
112
+ var getLength = shallowProperty('length');
113
+ var isArrayLike = function(collection) {
114
+ var length = getLength(collection);
115
+ return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
116
+ };
117
+ _.each = _.forEach = function(obj, iteratee, context) {
118
+ iteratee = optimizeCb(iteratee, context);
119
+ var i, length;
120
+ if (isArrayLike(obj)) {
121
+ for (i = 0, length = obj.length; i < length; i++) {
122
+ iteratee(obj[i], i, obj);
123
+ }
124
+ } else {
125
+ var keys = _.keys(obj);
126
+ for (i = 0, length = keys.length; i < length; i++) {
127
+ iteratee(obj[keys[i]], keys[i], obj);
128
+ }
129
+ }
130
+ return obj;
131
+ };
132
+ _.map = _.collect = function(obj, iteratee, context) {
133
+ iteratee = cb(iteratee, context);
134
+ var keys = !isArrayLike(obj) && _.keys(obj),
135
+ length = (keys || obj).length,
136
+ results = Array(length);
137
+ for (var index = 0; index < length; index++) {
138
+ var currentKey = keys ? keys[index] : index;
139
+ results[index] = iteratee(obj[currentKey], currentKey, obj);
140
+ }
141
+ return results;
142
+ };
143
+ var createReduce = function(dir) {
144
+ var reducer = function(obj, iteratee, memo, initial) {
145
+ var keys = !isArrayLike(obj) && _.keys(obj),
146
+ length = (keys || obj).length,
147
+ index = dir > 0 ? 0 : length - 1;
148
+ if (!initial) {
149
+ memo = obj[keys ? keys[index] : index];
150
+ index += dir;
151
+ }
152
+ for (; index >= 0 && index < length; index += dir) {
153
+ var currentKey = keys ? keys[index] : index;
154
+ memo = iteratee(memo, obj[currentKey], currentKey, obj);
155
+ }
156
+ return memo;
157
+ };
158
+
159
+ return function(obj, iteratee, memo, context) {
160
+ var initial = arguments.length >= 3;
161
+ return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);
162
+ };
163
+ };
164
+ _.reduce = _.foldl = _.inject = createReduce(1);
165
+ _.reduceRight = _.foldr = createReduce(-1);
166
+ _.find = _.detect = function(obj, predicate, context) {
167
+ var keyFinder = isArrayLike(obj) ? _.findIndex : _.findKey;
168
+ var key = keyFinder(obj, predicate, context);
169
+ if (key !== void 0 && key !== -1) return obj[key];
170
+ };
171
+ _.filter = _.select = function(obj, predicate, context) {
172
+ var results = [];
173
+ predicate = cb(predicate, context);
174
+ _.each(obj, function(value, index, list) {
175
+ if (predicate(value, index, list)) results.push(value);
176
+ });
177
+ return results;
178
+ };
179
+ _.reject = function(obj, predicate, context) {
180
+ return _.filter(obj, _.negate(cb(predicate)), context);
181
+ };
182
+ _.every = _.all = function(obj, predicate, context) {
183
+ predicate = cb(predicate, context);
184
+ var keys = !isArrayLike(obj) && _.keys(obj),
185
+ length = (keys || obj).length;
186
+ for (var index = 0; index < length; index++) {
187
+ var currentKey = keys ? keys[index] : index;
188
+ if (!predicate(obj[currentKey], currentKey, obj)) return false;
189
+ }
190
+ return true;
191
+ };
192
+ _.some = _.any = function(obj, predicate, context) {
193
+ predicate = cb(predicate, context);
194
+ var keys = !isArrayLike(obj) && _.keys(obj),
195
+ length = (keys || obj).length;
196
+ for (var index = 0; index < length; index++) {
197
+ var currentKey = keys ? keys[index] : index;
198
+ if (predicate(obj[currentKey], currentKey, obj)) return true;
199
+ }
200
+ return false;
201
+ };
202
+ _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
203
+ if (!isArrayLike(obj)) obj = _.values(obj);
204
+ if (typeof fromIndex != 'number' || guard) fromIndex = 0;
205
+ return _.indexOf(obj, item, fromIndex) >= 0;
206
+ };
207
+ _.invoke = restArguments(function(obj, path, args) {
208
+ var contextPath, func;
209
+ if (_.isFunction(path)) {
210
+ func = path;
211
+ } else if (_.isArray(path)) {
212
+ contextPath = path.slice(0, -1);
213
+ path = path[path.length - 1];
214
+ }
215
+ return _.map(obj, function(context) {
216
+ var method = func;
217
+ if (!method) {
218
+ if (contextPath && contextPath.length) {
219
+ context = deepGet(context, contextPath);
220
+ }
221
+ if (context == null) return void 0;
222
+ method = context[path];
223
+ }
224
+ return method == null ? method : method.apply(context, args);
225
+ });
226
+ });
227
+ _.pluck = function(obj, key) {
228
+ return _.map(obj, _.property(key));
229
+ };
230
+ _.where = function(obj, attrs) {
231
+ return _.filter(obj, _.matcher(attrs));
232
+ };
233
+ _.findWhere = function(obj, attrs) {
234
+ return _.find(obj, _.matcher(attrs));
235
+ };
236
+ _.max = function(obj, iteratee, context) {
237
+ var result = -Infinity, lastComputed = -Infinity,
238
+ value, computed;
239
+ if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
240
+ obj = isArrayLike(obj) ? obj : _.values(obj);
241
+ for (var i = 0, length = obj.length; i < length; i++) {
242
+ value = obj[i];
243
+ if (value != null && value > result) {
244
+ result = value;
245
+ }
246
+ }
247
+ } else {
248
+ iteratee = cb(iteratee, context);
249
+ _.each(obj, function(v, index, list) {
250
+ computed = iteratee(v, index, list);
251
+ if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
252
+ result = v;
253
+ lastComputed = computed;
254
+ }
255
+ });
256
+ }
257
+ return result;
258
+ };
259
+ _.min = function(obj, iteratee, context) {
260
+ var result = Infinity, lastComputed = Infinity,
261
+ value, computed;
262
+ if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
263
+ obj = isArrayLike(obj) ? obj : _.values(obj);
264
+ for (var i = 0, length = obj.length; i < length; i++) {
265
+ value = obj[i];
266
+ if (value != null && value < result) {
267
+ result = value;
268
+ }
269
+ }
270
+ } else {
271
+ iteratee = cb(iteratee, context);
272
+ _.each(obj, function(v, index, list) {
273
+ computed = iteratee(v, index, list);
274
+ if (computed < lastComputed || computed === Infinity && result === Infinity) {
275
+ result = v;
276
+ lastComputed = computed;
277
+ }
278
+ });
279
+ }
280
+ return result;
281
+ };
282
+ _.shuffle = function(obj) {
283
+ return _.sample(obj, Infinity);
284
+ };
285
+ _.sample = function(obj, n, guard) {
286
+ if (n == null || guard) {
287
+ if (!isArrayLike(obj)) obj = _.values(obj);
288
+ return obj[_.random(obj.length - 1)];
289
+ }
290
+ var sample = isArrayLike(obj) ? _.clone(obj) : _.values(obj);
291
+ var length = getLength(sample);
292
+ n = Math.max(Math.min(n, length), 0);
293
+ var last = length - 1;
294
+ for (var index = 0; index < n; index++) {
295
+ var rand = _.random(index, last);
296
+ var temp = sample[index];
297
+ sample[index] = sample[rand];
298
+ sample[rand] = temp;
299
+ }
300
+ return sample.slice(0, n);
301
+ };
302
+ _.sortBy = function(obj, iteratee, context) {
303
+ var index = 0;
304
+ iteratee = cb(iteratee, context);
305
+ return _.pluck(_.map(obj, function(value, key, list) {
306
+ return {
307
+ value: value,
308
+ index: index++,
309
+ criteria: iteratee(value, key, list)
310
+ };
311
+ }).sort(function(left, right) {
312
+ var a = left.criteria;
313
+ var b = right.criteria;
314
+ if (a !== b) {
315
+ if (a > b || a === void 0) return 1;
316
+ if (a < b || b === void 0) return -1;
317
+ }
318
+ return left.index - right.index;
319
+ }), 'value');
320
+ };
321
+ var group = function(behavior, partition) {
322
+ return function(obj, iteratee, context) {
323
+ var result = partition ? [[], []] : {};
324
+ iteratee = cb(iteratee, context);
325
+ _.each(obj, function(value, index) {
326
+ var key = iteratee(value, index, obj);
327
+ behavior(result, value, key);
328
+ });
329
+ return result;
330
+ };
331
+ };
332
+ _.groupBy = group(function(result, value, key) {
333
+ if (has(result, key)) result[key].push(value); else result[key] = [value];
334
+ });
335
+ _.indexBy = group(function(result, value, key) {
336
+ result[key] = value;
337
+ });
338
+ _.countBy = group(function(result, value, key) {
339
+ if (has(result, key)) result[key]++; else result[key] = 1;
340
+ });
341
+
342
+ var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
343
+ _.toArray = function(obj) {
344
+ if (!obj) return [];
345
+ if (_.isArray(obj)) return slice.call(obj);
346
+ if (_.isString(obj)) {
347
+ return obj.match(reStrSymbol);
348
+ }
349
+ if (isArrayLike(obj)) return _.map(obj, _.identity);
350
+ return _.values(obj);
351
+ };
352
+ _.size = function(obj) {
353
+ if (obj == null) return 0;
354
+ return isArrayLike(obj) ? obj.length : _.keys(obj).length;
355
+ };
356
+ _.partition = group(function(result, value, pass) {
357
+ result[pass ? 0 : 1].push(value);
358
+ }, true);
359
+ _.first = _.head = _.take = function(array, n, guard) {
360
+ if (array == null || array.length < 1) return n == null ? void 0 : [];
361
+ if (n == null || guard) return array[0];
362
+ return _.initial(array, array.length - n);
363
+ };
364
+ _.initial = function(array, n, guard) {
365
+ return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
366
+ };
367
+ _.last = function(array, n, guard) {
368
+ if (array == null || array.length < 1) return n == null ? void 0 : [];
369
+ if (n == null || guard) return array[array.length - 1];
370
+ return _.rest(array, Math.max(0, array.length - n));
371
+ };
372
+ _.rest = _.tail = _.drop = function(array, n, guard) {
373
+ return slice.call(array, n == null || guard ? 1 : n);
374
+ };
375
+ _.compact = function(array) {
376
+ return _.filter(array, Boolean);
377
+ };
378
+ var flatten = function(input, shallow, strict, output) {
379
+ output = output || [];
380
+ var idx = output.length;
381
+ for (var i = 0, length = getLength(input); i < length; i++) {
382
+ var value = input[i];
383
+ if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
384
+ if (shallow) {
385
+ var j = 0, len = value.length;
386
+ while (j < len) output[idx++] = value[j++];
387
+ } else {
388
+ flatten(value, shallow, strict, output);
389
+ idx = output.length;
390
+ }
391
+ } else if (!strict) {
392
+ output[idx++] = value;
393
+ }
394
+ }
395
+ return output;
396
+ };
397
+ _.flatten = function(array, shallow) {
398
+ return flatten(array, shallow, false);
399
+ };
400
+ _.without = restArguments(function(array, otherArrays) {
401
+ return _.difference(array, otherArrays);
402
+ });
403
+ _.uniq = _.unique = function(array, isSorted, iteratee, context) {
404
+ if (!_.isBoolean(isSorted)) {
405
+ context = iteratee;
406
+ iteratee = isSorted;
407
+ isSorted = false;
408
+ }
409
+ if (iteratee != null) iteratee = cb(iteratee, context);
410
+ var result = [];
411
+ var seen = [];
412
+ for (var i = 0, length = getLength(array); i < length; i++) {
413
+ var value = array[i],
414
+ computed = iteratee ? iteratee(value, i, array) : value;
415
+ if (isSorted && !iteratee) {
416
+ if (!i || seen !== computed) result.push(value);
417
+ seen = computed;
418
+ } else if (iteratee) {
419
+ if (!_.contains(seen, computed)) {
420
+ seen.push(computed);
421
+ result.push(value);
422
+ }
423
+ } else if (!_.contains(result, value)) {
424
+ result.push(value);
425
+ }
426
+ }
427
+ return result;
428
+ };
429
+ _.union = restArguments(function(arrays) {
430
+ return _.uniq(flatten(arrays, true, true));
431
+ });
432
+ _.intersection = function(array) {
433
+ var result = [];
434
+ var argsLength = arguments.length;
435
+ for (var i = 0, length = getLength(array); i < length; i++) {
436
+ var item = array[i];
437
+ if (_.contains(result, item)) continue;
438
+ var j;
439
+ for (j = 1; j < argsLength; j++) {
440
+ if (!_.contains(arguments[j], item)) break;
441
+ }
442
+ if (j === argsLength) result.push(item);
443
+ }
444
+ return result;
445
+ };
446
+ _.difference = restArguments(function(array, rest) {
447
+ rest = flatten(rest, true, true);
448
+ return _.filter(array, function(value){
449
+ return !_.contains(rest, value);
450
+ });
451
+ });
452
+ _.unzip = function(array) {
453
+ var length = array && _.max(array, getLength).length || 0;
454
+ var result = Array(length);
455
+
456
+ for (var index = 0; index < length; index++) {
457
+ result[index] = _.pluck(array, index);
458
+ }
459
+ return result;
460
+ };
461
+ _.zip = restArguments(_.unzip);
462
+ _.object = function(list, values) {
463
+ var result = {};
464
+ for (var i = 0, length = getLength(list); i < length; i++) {
465
+ if (values) {
466
+ result[list[i]] = values[i];
467
+ } else {
468
+ result[list[i][0]] = list[i][1];
469
+ }
470
+ }
471
+ return result;
472
+ };
473
+ var createPredicateIndexFinder = function(dir) {
474
+ return function(array, predicate, context) {
475
+ predicate = cb(predicate, context);
476
+ var length = getLength(array);
477
+ var index = dir > 0 ? 0 : length - 1;
478
+ for (; index >= 0 && index < length; index += dir) {
479
+ if (predicate(array[index], index, array)) return index;
480
+ }
481
+ return -1;
482
+ };
483
+ };
484
+ _.findIndex = createPredicateIndexFinder(1);
485
+ _.findLastIndex = createPredicateIndexFinder(-1);
486
+ _.sortedIndex = function(array, obj, iteratee, context) {
487
+ iteratee = cb(iteratee, context, 1);
488
+ var value = iteratee(obj);
489
+ var low = 0, high = getLength(array);
490
+ while (low < high) {
491
+ var mid = Math.floor((low + high) / 2);
492
+ if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
493
+ }
494
+ return low;
495
+ };
496
+ var createIndexFinder = function(dir, predicateFind, sortedIndex) {
497
+ return function(array, item, idx) {
498
+ var i = 0, length = getLength(array);
499
+ if (typeof idx == 'number') {
500
+ if (dir > 0) {
501
+ i = idx >= 0 ? idx : Math.max(idx + length, i);
502
+ } else {
503
+ length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
504
+ }
505
+ } else if (sortedIndex && idx && length) {
506
+ idx = sortedIndex(array, item);
507
+ return array[idx] === item ? idx : -1;
508
+ }
509
+ if (item !== item) {
510
+ idx = predicateFind(slice.call(array, i, length), _.isNaN);
511
+ return idx >= 0 ? idx + i : -1;
512
+ }
513
+ for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
514
+ if (array[idx] === item) return idx;
515
+ }
516
+ return -1;
517
+ };
518
+ };
519
+ _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
520
+ _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);
521
+ _.range = function(start, stop, step) {
522
+ if (stop == null) {
523
+ stop = start || 0;
524
+ start = 0;
525
+ }
526
+ if (!step) {
527
+ step = stop < start ? -1 : 1;
528
+ }
529
+
530
+ var length = Math.max(Math.ceil((stop - start) / step), 0);
531
+ var range = Array(length);
532
+
533
+ for (var idx = 0; idx < length; idx++, start += step) {
534
+ range[idx] = start;
535
+ }
536
+
537
+ return range;
538
+ };
539
+ _.chunk = function(array, count) {
540
+ if (count == null || count < 1) return [];
541
+ var result = [];
542
+ var i = 0, length = array.length;
543
+ while (i < length) {
544
+ result.push(slice.call(array, i, i += count));
545
+ }
546
+ return result;
547
+ };
548
+ var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
549
+ if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
550
+ var self = baseCreate(sourceFunc.prototype);
551
+ var result = sourceFunc.apply(self, args);
552
+ if (_.isObject(result)) return result;
553
+ return self;
554
+ };
555
+ _.bind = restArguments(function(func, context, args) {
556
+ if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
557
+ var bound = restArguments(function(callArgs) {
558
+ return executeBound(func, bound, context, this, args.concat(callArgs));
559
+ });
560
+ return bound;
561
+ });
562
+ _.partial = restArguments(function(func, boundArgs) {
563
+ var placeholder = _.partial.placeholder;
564
+ var bound = function() {
565
+ var position = 0, length = boundArgs.length;
566
+ var args = Array(length);
567
+ for (var i = 0; i < length; i++) {
568
+ args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
569
+ }
570
+ while (position < arguments.length) args.push(arguments[position++]);
571
+ return executeBound(func, bound, this, this, args);
572
+ };
573
+ return bound;
574
+ });
575
+
576
+ _.partial.placeholder = _;
577
+ _.bindAll = restArguments(function(obj, keys) {
578
+ keys = flatten(keys, false, false);
579
+ var index = keys.length;
580
+ if (index < 1) throw new Error('bindAll must be passed function names');
581
+ while (index--) {
582
+ var key = keys[index];
583
+ obj[key] = _.bind(obj[key], obj);
584
+ }
585
+ });
586
+ _.memoize = function(func, hasher) {
587
+ var memoize = function(key) {
588
+ var cache = memoize.cache;
589
+ var address = '' + (hasher ? hasher.apply(this, arguments) : key);
590
+ if (!has(cache, address)) cache[address] = func.apply(this, arguments);
591
+ return cache[address];
592
+ };
593
+ memoize.cache = {};
594
+ return memoize;
595
+ };
596
+ _.delay = restArguments(function(func, wait, args) {
597
+ return setTimeout(function() {
598
+ return func.apply(null, args);
599
+ }, wait);
600
+ });
601
+ _.defer = _.partial(_.delay, _, 1);
602
+ _.throttle = function(func, wait, options) {
603
+ var timeout, context, args, result;
604
+ var previous = 0;
605
+ if (!options) options = {};
606
+
607
+ var later = function() {
608
+ previous = options.leading === false ? 0 : _.now();
609
+ timeout = null;
610
+ result = func.apply(context, args);
611
+ if (!timeout) context = args = null;
612
+ };
613
+
614
+ var throttled = function() {
615
+ var now = _.now();
616
+ if (!previous && options.leading === false) previous = now;
617
+ var remaining = wait - (now - previous);
618
+ context = this;
619
+ args = arguments;
620
+ if (remaining <= 0 || remaining > wait) {
621
+ if (timeout) {
622
+ clearTimeout(timeout);
623
+ timeout = null;
624
+ }
625
+ previous = now;
626
+ result = func.apply(context, args);
627
+ if (!timeout) context = args = null;
628
+ } else if (!timeout && options.trailing !== false) {
629
+ timeout = setTimeout(later, remaining);
630
+ }
631
+ return result;
632
+ };
633
+
634
+ throttled.cancel = function() {
635
+ clearTimeout(timeout);
636
+ previous = 0;
637
+ timeout = context = args = null;
638
+ };
639
+
640
+ return throttled;
641
+ };
642
+ _.debounce = function(func, wait, immediate) {
643
+ var timeout, result;
644
+
645
+ var later = function(context, args) {
646
+ timeout = null;
647
+ if (args) result = func.apply(context, args);
648
+ };
649
+
650
+ var debounced = restArguments(function(args) {
651
+ if (timeout) clearTimeout(timeout);
652
+ if (immediate) {
653
+ var callNow = !timeout;
654
+ timeout = setTimeout(later, wait);
655
+ if (callNow) result = func.apply(this, args);
656
+ } else {
657
+ timeout = _.delay(later, wait, this, args);
658
+ }
659
+
660
+ return result;
661
+ });
662
+
663
+ debounced.cancel = function() {
664
+ clearTimeout(timeout);
665
+ timeout = null;
666
+ };
667
+
668
+ return debounced;
669
+ };
670
+ _.wrap = function(func, wrapper) {
671
+ return _.partial(wrapper, func);
672
+ };
673
+ _.negate = function(predicate) {
674
+ return function() {
675
+ return !predicate.apply(this, arguments);
676
+ };
677
+ };
678
+ _.compose = function() {
679
+ var args = arguments;
680
+ var start = args.length - 1;
681
+ return function() {
682
+ var i = start;
683
+ var result = args[start].apply(this, arguments);
684
+ while (i--) result = args[i].call(this, result);
685
+ return result;
686
+ };
687
+ };
688
+ _.after = function(times, func) {
689
+ return function() {
690
+ if (--times < 1) {
691
+ return func.apply(this, arguments);
692
+ }
693
+ };
694
+ };
695
+ _.before = function(times, func) {
696
+ var memo;
697
+ return function() {
698
+ if (--times > 0) {
699
+ memo = func.apply(this, arguments);
700
+ }
701
+ if (times <= 1) func = null;
702
+ return memo;
703
+ };
704
+ };
705
+ _.once = _.partial(_.before, 2);
706
+
707
+ _.restArguments = restArguments;
708
+ var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
709
+ var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
710
+ 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
711
+
712
+ var collectNonEnumProps = function(obj, keys) {
713
+ var nonEnumIdx = nonEnumerableProps.length;
714
+ var constructor = obj.constructor;
715
+ var proto = _.isFunction(constructor) && constructor.prototype || ObjProto;
716
+ var prop = 'constructor';
717
+ if (has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
718
+
719
+ while (nonEnumIdx--) {
720
+ prop = nonEnumerableProps[nonEnumIdx];
721
+ if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
722
+ keys.push(prop);
723
+ }
724
+ }
725
+ };
726
+ _.keys = function(obj) {
727
+ if (!_.isObject(obj)) return [];
728
+ if (nativeKeys) return nativeKeys(obj);
729
+ var keys = [];
730
+ for (var key in obj) if (has(obj, key)) keys.push(key);
731
+ if (hasEnumBug) collectNonEnumProps(obj, keys);
732
+ return keys;
733
+ };
734
+ _.allKeys = function(obj) {
735
+ if (!_.isObject(obj)) return [];
736
+ var keys = [];
737
+ for (var key in obj) keys.push(key);
738
+ if (hasEnumBug) collectNonEnumProps(obj, keys);
739
+ return keys;
740
+ };
741
+ _.values = function(obj) {
742
+ var keys = _.keys(obj);
743
+ var length = keys.length;
744
+ var values = Array(length);
745
+ for (var i = 0; i < length; i++) {
746
+ values[i] = obj[keys[i]];
747
+ }
748
+ return values;
749
+ };
750
+ _.mapObject = function(obj, iteratee, context) {
751
+ iteratee = cb(iteratee, context);
752
+ var keys = _.keys(obj),
753
+ length = keys.length,
754
+ results = {};
755
+ for (var index = 0; index < length; index++) {
756
+ var currentKey = keys[index];
757
+ results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
758
+ }
759
+ return results;
760
+ };
761
+ _.pairs = function(obj) {
762
+ var keys = _.keys(obj);
763
+ var length = keys.length;
764
+ var pairs = Array(length);
765
+ for (var i = 0; i < length; i++) {
766
+ pairs[i] = [keys[i], obj[keys[i]]];
767
+ }
768
+ return pairs;
769
+ };
770
+ _.invert = function(obj) {
771
+ var result = {};
772
+ var keys = _.keys(obj);
773
+ for (var i = 0, length = keys.length; i < length; i++) {
774
+ result[obj[keys[i]]] = keys[i];
775
+ }
776
+ return result;
777
+ };
778
+ _.functions = _.methods = function(obj) {
779
+ var names = [];
780
+ for (var key in obj) {
781
+ if (_.isFunction(obj[key])) names.push(key);
782
+ }
783
+ return names.sort();
784
+ };
785
+ var createAssigner = function(keysFunc, defaults) {
786
+ return function(obj) {
787
+ var length = arguments.length;
788
+ if (defaults) obj = Object(obj);
789
+ if (length < 2 || obj == null) return obj;
790
+ for (var index = 1; index < length; index++) {
791
+ var source = arguments[index],
792
+ keys = keysFunc(source),
793
+ l = keys.length;
794
+ for (var i = 0; i < l; i++) {
795
+ var key = keys[i];
796
+ if (!defaults || obj[key] === void 0) obj[key] = source[key];
797
+ }
798
+ }
799
+ return obj;
800
+ };
801
+ };
802
+ _.extend = createAssigner(_.allKeys);
803
+ _.extendOwn = _.assign = createAssigner(_.keys);
804
+ _.findKey = function(obj, predicate, context) {
805
+ predicate = cb(predicate, context);
806
+ var keys = _.keys(obj), key;
807
+ for (var i = 0, length = keys.length; i < length; i++) {
808
+ key = keys[i];
809
+ if (predicate(obj[key], key, obj)) return key;
810
+ }
811
+ };
812
+ var keyInObj = function(value, key, obj) {
813
+ return key in obj;
814
+ };
815
+ _.pick = restArguments(function(obj, keys) {
816
+ var result = {}, iteratee = keys[0];
817
+ if (obj == null) return result;
818
+ if (_.isFunction(iteratee)) {
819
+ if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
820
+ keys = _.allKeys(obj);
821
+ } else {
822
+ iteratee = keyInObj;
823
+ keys = flatten(keys, false, false);
824
+ obj = Object(obj);
825
+ }
826
+ for (var i = 0, length = keys.length; i < length; i++) {
827
+ var key = keys[i];
828
+ var value = obj[key];
829
+ if (iteratee(value, key, obj)) result[key] = value;
830
+ }
831
+ return result;
832
+ });
833
+ _.omit = restArguments(function(obj, keys) {
834
+ var iteratee = keys[0], context;
835
+ if (_.isFunction(iteratee)) {
836
+ iteratee = _.negate(iteratee);
837
+ if (keys.length > 1) context = keys[1];
838
+ } else {
839
+ keys = _.map(flatten(keys, false, false), String);
840
+ iteratee = function(value, key) {
841
+ return !_.contains(keys, key);
842
+ };
843
+ }
844
+ return _.pick(obj, iteratee, context);
845
+ });
846
+ _.defaults = createAssigner(_.allKeys, true);
847
+ _.create = function(prototype, props) {
848
+ var result = baseCreate(prototype);
849
+ if (props) _.extendOwn(result, props);
850
+ return result;
851
+ };
852
+ _.clone = function(obj) {
853
+ if (!_.isObject(obj)) return obj;
854
+ return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
855
+ };
856
+ _.tap = function(obj, interceptor) {
857
+ interceptor(obj);
858
+ return obj;
859
+ };
860
+ _.isMatch = function(object, attrs) {
861
+ var keys = _.keys(attrs), length = keys.length;
862
+ if (object == null) return !length;
863
+ var obj = Object(object);
864
+ for (var i = 0; i < length; i++) {
865
+ var key = keys[i];
866
+ if (attrs[key] !== obj[key] || !(key in obj)) return false;
867
+ }
868
+ return true;
869
+ };
870
+ var eq, deepEq;
871
+ eq = function(a, b, aStack, bStack) {
872
+ if (a === b) return a !== 0 || 1 / a === 1 / b;
873
+ if (a == null || b == null) return false;
874
+ if (a !== a) return b !== b;
875
+ var type = typeof a;
876
+ if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
877
+ return deepEq(a, b, aStack, bStack);
878
+ };
879
+ deepEq = function(a, b, aStack, bStack) {
880
+ if (a instanceof _) a = a._wrapped;
881
+ if (b instanceof _) b = b._wrapped;
882
+ var className = toString.call(a);
883
+ if (className !== toString.call(b)) return false;
884
+ switch (className) {
885
+ case '[object RegExp]':
886
+ case '[object String]':
887
+ return '' + a === '' + b;
888
+ case '[object Number]':
889
+ if (+a !== +a) return +b !== +b;
890
+ return +a === 0 ? 1 / +a === 1 / b : +a === +b;
891
+ case '[object Date]':
892
+ case '[object Boolean]':
893
+ return +a === +b;
894
+ case '[object Symbol]':
895
+ return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
896
+ }
897
+
898
+ var areArrays = className === '[object Array]';
899
+ if (!areArrays) {
900
+ if (typeof a != 'object' || typeof b != 'object') return false;
901
+ var aCtor = a.constructor, bCtor = b.constructor;
902
+ if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
903
+ _.isFunction(bCtor) && bCtor instanceof bCtor)
904
+ && ('constructor' in a && 'constructor' in b)) {
905
+ return false;
906
+ }
907
+ }
908
+ aStack = aStack || [];
909
+ bStack = bStack || [];
910
+ var length = aStack.length;
911
+ while (length--) {
912
+ if (aStack[length] === a) return bStack[length] === b;
913
+ }
914
+ aStack.push(a);
915
+ bStack.push(b);
916
+ if (areArrays) {
917
+ length = a.length;
918
+ if (length !== b.length) return false;
919
+ while (length--) {
920
+ if (!eq(a[length], b[length], aStack, bStack)) return false;
921
+ }
922
+ } else {
923
+ var keys = _.keys(a), key;
924
+ length = keys.length;
925
+ if (_.keys(b).length !== length) return false;
926
+ while (length--) {
927
+ key = keys[length];
928
+ if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
929
+ }
930
+ }
931
+ aStack.pop();
932
+ bStack.pop();
933
+ return true;
934
+ };
935
+ _.isEqual = function(a, b) {
936
+ return eq(a, b);
937
+ };
938
+ _.isEmpty = function(obj) {
939
+ if (obj == null) return true;
940
+ if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
941
+ return _.keys(obj).length === 0;
942
+ };
943
+ _.isElement = function(obj) {
944
+ return !!(obj && obj.nodeType === 1);
945
+ };
946
+ _.isArray = nativeIsArray || function(obj) {
947
+ return toString.call(obj) === '[object Array]';
948
+ };
949
+ _.isObject = function(obj) {
950
+ var type = typeof obj;
951
+ return type === 'function' || type === 'object' && !!obj;
952
+ };
953
+ _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', 'WeakMap', 'Set', 'WeakSet'], function(name) {
954
+ _['is' + name] = function(obj) {
955
+ return toString.call(obj) === '[object ' + name + ']';
956
+ };
957
+ });
958
+ if (!_.isArguments(arguments)) {
959
+ _.isArguments = function(obj) {
960
+ return has(obj, 'callee');
961
+ };
962
+ }
963
+ var nodelist = root.document && root.document.childNodes;
964
+ if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
965
+ _.isFunction = function(obj) {
966
+ return typeof obj == 'function' || false;
967
+ };
968
+ }
969
+ _.isFinite = function(obj) {
970
+ return !_.isSymbol(obj) && isFinite(obj) && !isNaN(parseFloat(obj));
971
+ };
972
+ _.isNaN = function(obj) {
973
+ return _.isNumber(obj) && isNaN(obj);
974
+ };
975
+ _.isBoolean = function(obj) {
976
+ return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
977
+ };
978
+ _.isNull = function(obj) {
979
+ return obj === null;
980
+ };
981
+ _.isUndefined = function(obj) {
982
+ return obj === void 0;
983
+ };
984
+ _.has = function(obj, path) {
985
+ if (!_.isArray(path)) {
986
+ return has(obj, path);
987
+ }
988
+ var length = path.length;
989
+ for (var i = 0; i < length; i++) {
990
+ var key = path[i];
991
+ if (obj == null || !hasOwnProperty.call(obj, key)) {
992
+ return false;
993
+ }
994
+ obj = obj[key];
995
+ }
996
+ return !!length;
997
+ };
998
+ _.noConflict = function() {
999
+ root._ = previousUnderscore;
1000
+ return this;
1001
+ };
1002
+ _.identity = function(value) {
1003
+ return value;
1004
+ };
1005
+ _.constant = function(value) {
1006
+ return function() {
1007
+ return value;
1008
+ };
1009
+ };
1010
+
1011
+ _.noop = function(){};
1012
+ _.property = function(path) {
1013
+ if (!_.isArray(path)) {
1014
+ return shallowProperty(path);
1015
+ }
1016
+ return function(obj) {
1017
+ return deepGet(obj, path);
1018
+ };
1019
+ };
1020
+ _.propertyOf = function(obj) {
1021
+ if (obj == null) {
1022
+ return function(){};
1023
+ }
1024
+ return function(path) {
1025
+ return !_.isArray(path) ? obj[path] : deepGet(obj, path);
1026
+ };
1027
+ };
1028
+ _.matcher = _.matches = function(attrs) {
1029
+ attrs = _.extendOwn({}, attrs);
1030
+ return function(obj) {
1031
+ return _.isMatch(obj, attrs);
1032
+ };
1033
+ };
1034
+ _.times = function(n, iteratee, context) {
1035
+ var accum = Array(Math.max(0, n));
1036
+ iteratee = optimizeCb(iteratee, context, 1);
1037
+ for (var i = 0; i < n; i++) accum[i] = iteratee(i);
1038
+ return accum;
1039
+ };
1040
+ _.random = function(min, max) {
1041
+ if (max == null) {
1042
+ max = min;
1043
+ min = 0;
1044
+ }
1045
+ return min + Math.floor(Math.random() * (max - min + 1));
1046
+ };
1047
+ _.now = Date.now || function() {
1048
+ return new Date().getTime();
1049
+ };
1050
+ var escapeMap = {
1051
+ '&': '&amp;',
1052
+ '<': '&lt;',
1053
+ '>': '&gt;',
1054
+ '"': '&quot;',
1055
+ "'": '&#x27;',
1056
+ '`': '&#x60;'
1057
+ };
1058
+ var unescapeMap = _.invert(escapeMap);
1059
+ var createEscaper = function(map) {
1060
+ var escaper = function(match) {
1061
+ return map[match];
1062
+ };
1063
+ var source = '(?:' + _.keys(map).join('|') + ')';
1064
+ var testRegexp = RegExp(source);
1065
+ var replaceRegexp = RegExp(source, 'g');
1066
+ return function(string) {
1067
+ string = string == null ? '' : '' + string;
1068
+ return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
1069
+ };
1070
+ };
1071
+ _.escape = createEscaper(escapeMap);
1072
+ _.unescape = createEscaper(unescapeMap);
1073
+ _.result = function(obj, path, fallback) {
1074
+ if (!_.isArray(path)) path = [path];
1075
+ var length = path.length;
1076
+ if (!length) {
1077
+ return _.isFunction(fallback) ? fallback.call(obj) : fallback;
1078
+ }
1079
+ for (var i = 0; i < length; i++) {
1080
+ var prop = obj == null ? void 0 : obj[path[i]];
1081
+ if (prop === void 0) {
1082
+ prop = fallback;
1083
+ i = length; // Ensure we don't continue iterating.
1084
+ }
1085
+ obj = _.isFunction(prop) ? prop.call(obj) : prop;
1086
+ }
1087
+ return obj;
1088
+ };
1089
+ var idCounter = 0;
1090
+ _.uniqueId = function(prefix) {
1091
+ var id = ++idCounter + '';
1092
+ return prefix ? prefix + id : id;
1093
+ };
1094
+ _.templateSettings = {
1095
+ evaluate: /<%([\s\S]+?)%>/g,
1096
+ interpolate: /<%=([\s\S]+?)%>/g,
1097
+ escape: /<%-([\s\S]+?)%>/g
1098
+ };
1099
+ var noMatch = /(.)^/;
1100
+ var escapes = {
1101
+ "'": "'",
1102
+ '\\': '\\',
1103
+ '\r': 'r',
1104
+ '\n': 'n',
1105
+ '\u2028': 'u2028',
1106
+ '\u2029': 'u2029'
1107
+ };
1108
+
1109
+ var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
1110
+
1111
+ var escapeChar = function(match) {
1112
+ return '\\' + escapes[match];
1113
+ };
1114
+ _.template = function(text, settings, oldSettings) {
1115
+ if (!settings && oldSettings) settings = oldSettings;
1116
+ settings = _.defaults({}, settings, _.templateSettings);
1117
+ var matcher = RegExp([
1118
+ (settings.escape || noMatch).source,
1119
+ (settings.interpolate || noMatch).source,
1120
+ (settings.evaluate || noMatch).source
1121
+ ].join('|') + '|$', 'g');
1122
+ var index = 0;
1123
+ var source = "__p+='";
1124
+ text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
1125
+ source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
1126
+ index = offset + match.length;
1127
+
1128
+ if (escape) {
1129
+ source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
1130
+ } else if (interpolate) {
1131
+ source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
1132
+ } else if (evaluate) {
1133
+ source += "';\n" + evaluate + "\n__p+='";
1134
+ }
1135
+ return match;
1136
+ });
1137
+ source += "';\n";
1138
+ if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
1139
+
1140
+ source = "var __t,__p='',__j=Array.prototype.join," +
1141
+ "print=function(){__p+=__j.call(arguments,'');};\n" +
1142
+ source + 'return __p;\n';
1143
+
1144
+ var render;
1145
+ try {
1146
+ render = new Function(settings.variable || 'obj', '_', source);
1147
+ } catch (e) {
1148
+ e.source = source;
1149
+ throw e;
1150
+ }
1151
+
1152
+ var template = function(data) {
1153
+ return render.call(this, data, _);
1154
+ };
1155
+ var argument = settings.variable || 'obj';
1156
+ template.source = 'function(' + argument + '){\n' + source + '}';
1157
+
1158
+ return template;
1159
+ };
1160
+ _.chain = function(obj) {
1161
+ var instance = _(obj);
1162
+ instance._chain = true;
1163
+ return instance;
1164
+ };
1165
+ var chainResult = function(instance, obj) {
1166
+ return instance._chain ? _(obj).chain() : obj;
1167
+ };
1168
+ _.mixin = function(obj) {
1169
+ _.each(_.functions(obj), function(name) {
1170
+ var func = _[name] = obj[name];
1171
+ _.prototype[name] = function() {
1172
+ var args = [this._wrapped];
1173
+ push.apply(args, arguments);
1174
+ return chainResult(this, func.apply(_, args));
1175
+ };
1176
+ });
1177
+ return _;
1178
+ };
1179
+ _.mixin(_);
1180
+ _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
1181
+ var method = ArrayProto[name];
1182
+ _.prototype[name] = function() {
1183
+ var obj = this._wrapped;
1184
+ method.apply(obj, arguments);
1185
+ if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
1186
+ return chainResult(this, obj);
1187
+ };
1188
+ });
1189
+ _.each(['concat', 'join', 'slice'], function(name) {
1190
+ var method = ArrayProto[name];
1191
+ _.prototype[name] = function() {
1192
+ return chainResult(this, method.apply(this._wrapped, arguments));
1193
+ };
1194
+ });
1195
+ _.prototype.value = function() {
1196
+ return this._wrapped;
1197
+ };
1198
+ _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
1199
+
1200
+ _.prototype.toString = function() {
1201
+ return String(this._wrapped);
1202
+ };
1203
+ if (typeof define == 'function' && define.amd) {
1204
+ define('underscore', [], function() {
1205
+ return _;
1206
+ });
1207
+ }
1208
+ }());/*global jQuery */
1209
+ /*!
1210
+ * FitText.js 1.2
1211
+ *
1212
+ * Copyright 2011, Dave Rupert http://daverupert.com
1213
+ * Released under the WTFPL license
1214
+ * http://sam.zoy.org/wtfpl/
1215
+ *
1216
+ * Date: Thu May 05 14:23:00 2011 -0600
1217
+ */
1218
+
1219
+ (function( $ ){
1220
+
1221
+ $.fn.fitText = function( kompressor, options ) {
1222
+ var compressor = kompressor || 1,
1223
+ settings = $.extend({
1224
+ 'minFontSize' : Number.NEGATIVE_INFINITY,
1225
+ 'maxFontSize' : Number.POSITIVE_INFINITY
1226
+ }, options);
1227
+
1228
+ return this.each(function(){
1229
+ var $this = $(this);
1230
+ var resizer = function () {
1231
+ $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
1232
+ };
1233
+ resizer();
1234
+ $(window).on('resize.fittext orientationchange.fittext', resizer);
1235
+
1236
+ });
1237
+ };
1238
+
1239
+ })( jQuery );/* ===================================================
1240
+ * jquerynimbleLazyLoad.js v1.0.0
1241
+ * ===================================================
1242
+ *
1243
+ * Replace all img src placeholder in the $element by the real src on scroll window event
1244
+ * Bind a 'smartload' event on each transformed img
1245
+ *
1246
+ * Note : the data-src (data-srcset) attr has to be pre-processed before the actual page load
1247
+ * Example of regex to pre-process img server side with php :
1248
+ * preg_replace_callback('#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', 'regex_callback' , $_html)
1249
+ *
1250
+ * (c) 2018 Nicolas Guillaume, Nice, France
1251
+ *
1252
+ * Example of gif 1px x 1px placeholder :
1253
+ * 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
1254
+ *
1255
+ * inspired by the work of Luís Almeida
1256
+ * http://luis-almeida.github.com/unveil
1257
+ *
1258
+ * Requires requestAnimationFrame polyfill:
1259
+ * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
1260
+ * =================================================== */
1261
+ (function ( $, window ) {
1262
+ var pluginName = 'nimbleLazyLoad',
1263
+ defaults = {
1264
+ load_all_images_on_first_scroll : false,
1265
+ excludeImg : [],
1266
+ threshold : 200,
1267
+ fadeIn_options : { duration : 400 },
1268
+ delaySmartLoadEvent : 0,
1269
+
1270
+ },
1271
+ skipImgClass = 'smartload-skip';
1272
+
1273
+
1274
+ function Plugin( element, options ) {
1275
+ this.element = element;
1276
+ this.options = $.extend( {}, defaults, options) ;
1277
+ if ( _.isArray( this.options.excludeImg ) ) {
1278
+ this.options.excludeImg.push( '.'+skipImgClass );
1279
+ } else {
1280
+ this.options.excludeImg = [ '.'+skipImgClass ];
1281
+ }
1282
+
1283
+ this._defaults = defaults;
1284
+ this._name = pluginName;
1285
+ this.init();
1286
+ }
1287
+ Plugin.prototype.init = function () {
1288
+ var self = this,
1289
+ $_ImgOrBackgroundElements = $( '[data-sek-src]:not('+ this.options.excludeImg.join() +')' , this.element );
1290
+
1291
+ this.increment = 1;//used to wait a little bit after the first user scroll actions to trigger the timer
1292
+ this.timer = 0;
1293
+
1294
+ $_ImgOrBackgroundElements
1295
+ .addClass( skipImgClass )
1296
+ .bind( 'sek_load_img', {}, function() {
1297
+ self._load_img(this);
1298
+ });
1299
+ $(window).scroll( function( _evt ) { self._better_scroll_event_handler( $_ImgOrBackgroundElements, _evt ); } );
1300
+ $(window).resize( _.debounce( function( _evt ) { self._maybe_trigger_load( $_ImgOrBackgroundElements, _evt ); }, 100 ) );
1301
+ this._maybe_trigger_load( $_ImgOrBackgroundElements );
1302
+ };
1303
+
1304
+
1305
+ /*
1306
+ * @param : array of $img
1307
+ * @param : current event
1308
+ * @return : void
1309
+ * scroll event performance enhancer => avoid browser stack if too much scrolls
1310
+ */
1311
+ Plugin.prototype._better_scroll_event_handler = function( $_ImgOrBackgroundElements , _evt ) {
1312
+ var self = this;
1313
+ if ( ! this.doingAnimation ) {
1314
+ this.doingAnimation = true;
1315
+ window.requestAnimationFrame(function() {
1316
+ self._maybe_trigger_load( $_ImgOrBackgroundElements , _evt );
1317
+ self.doingAnimation = false;
1318
+ });
1319
+ }
1320
+ };
1321
+
1322
+
1323
+ /*
1324
+ * @param : array of $img
1325
+ * @param : current event
1326
+ * @return : void
1327
+ */
1328
+ Plugin.prototype._maybe_trigger_load = function( $_ImgOrBackgroundElements , _evt ) {
1329
+ var self = this,
1330
+ _visible_list = $_ImgOrBackgroundElements.filter( function( ind, _el ) { return self._is_visible( _el , _evt ); } );
1331
+ _visible_list.map( function( ind, _el ) {
1332
+ $(_el).trigger( 'sek_load_img' );
1333
+ });
1334
+ };
1335
+
1336
+
1337
+ /*
1338
+ * @param single $img object
1339
+ * @param : current event
1340
+ * @return bool
1341
+ * helper to check if an image is the visible ( viewport + custom option threshold)
1342
+ */
1343
+ Plugin.prototype._is_visible = function( element, _evt ) {
1344
+ var $element = $(element),
1345
+ wt = $(window).scrollTop(),
1346
+ wb = wt + $(window).height(),
1347
+ it = $element.offset().top,
1348
+ ib = it + $element.height(),
1349
+ th = this.options.threshold;
1350
+ if ( _evt && 'scroll' == _evt.type && this.options.load_all_images_on_first_scroll )
1351
+ return true;
1352
+
1353
+ return ib >= wt - th && it <= wb + th;
1354
+ };
1355
+
1356
+
1357
+ /*
1358
+ * @param single $img object
1359
+ * @return void
1360
+ * replace src place holder by data-src attr val which should include the real src
1361
+ */
1362
+ Plugin.prototype._load_img = function( _el_ ) {
1363
+ var $_el_ = $(_el_),
1364
+ _src = $_el_.attr( 'data-sek-src' ),
1365
+ _src_set = $_el_.attr( 'data-sek-srcset' ),
1366
+ _sizes = $_el_.attr( 'data-sek-sizes' ),
1367
+ self = this,
1368
+ $jQueryImgToLoad = $("<img />", { src : _src } );
1369
+
1370
+ $_el_.addClass('lazy-loading');
1371
+ $_el_.unbind('sek_load_img');
1372
+
1373
+ $jQueryImgToLoad
1374
+ .load( function () {
1375
+ $_el_.removeAttr( [ 'data-sek-src', 'data-sek-srcset', 'data-sek-sizes' ].join(' ') );
1376
+ if( $_el_.data("sek-lazy-bg") ){
1377
+ $_el_.css('backgroundImage', 'url('+_src+')');
1378
+ } else {
1379
+ $_el_.attr("src", _src );
1380
+ if ( _src_set ) {
1381
+ $_el_.attr("srcset", _src_set );
1382
+ }
1383
+ if ( _sizes ) {
1384
+ $_el_.attr("sizes", _sizes );
1385
+ }
1386
+ }
1387
+ if ( ! $_el_.hasClass('sek-lazy-loaded') ) {
1388
+ $_el_.addClass('sek-lazy-loaded');
1389
+ }
1390
+
1391
+ $_el_.trigger('smartload');
1392
+ $_el_.data('sek-lazy-loaded', true );
1393
+ });//<= create a load() fn
1394
+ if ( $jQueryImgToLoad[0].complete ) {
1395
+ $jQueryImgToLoad.load();
1396
+ }
1397
+ $_el_.removeClass('lazy-loading');
1398
+ };
1399
+ $.fn[pluginName] = function ( options ) {
1400
+ return this.each(function () {
1401
+ if (!$.data(this, 'plugin_' + pluginName)) {
1402
+ $.data(this, 'plugin_' + pluginName,
1403
+ new Plugin( this, options ));
1404
+ }
1405
+ });
1406
+ };
1407
+ })( jQuery, window );/* ------------------------------------------------------------------------- *
1408
+ * SMARTLOAD
1409
+ /* ------------------------------------------------------------------------- */
1410
+ jQuery(function($){
1411
+ $('.sektion-wrapper').each( function() {
1412
+ try { $(this).nimbleLazyLoad(); } catch( er ) {
1413
+ if ( typeof window.console.log === 'function' ) {
1414
+ console.log( er );
1415
+ }
1416
+ }
1417
+ });
1418
+ });
1419
+
1420
+ /* ------------------------------------------------------------------------- *
1421
+ * FITTEXT
1422
+ /* ------------------------------------------------------------------------- */
1423
+ jQuery( function($){
1424
+ var doFitText = function() {
1425
+ $(".sek-module-placeholder").each( function() {
1426
+ $(this).fitText( 0.4, { minFontSize: '50px', maxFontSize: '300px' } ).data('sek-fittext-done', true );
1427
+ });
1428
+ $('.sektion-wrapper').on(
1429
+ 'sek-columns-refreshed sek-modules-refreshed sek-section-added sek-refresh-level',
1430
+ 'div[data-sek-level="section"]',
1431
+ function( evt ) {
1432
+ $(this).find(".sek-module-placeholder").fitText( 0.4, { minFontSize: '50px', maxFontSize: '300px' } ).data('sek-fittext-done', true );
1433
+ }
1434
+ );
1435
+
1436
+ };
1437
+ $('body').on( 'click', '.menu .menu-item [href^="#"]', function( evt){
1438
+ evt.preventDefault();
1439
+ var anchorCandidate = $(this).attr('href');
1440
+ anchorCandidate = 'string' === typeof( anchorCandidate ) ? anchorCandidate.replace('#','') : '';
1441
+
1442
+ if ( '' !== anchorCandidate || null !== anchorCandidate ) {
1443
+ var $anchorCandidate = $('[data-sek-level="location"]' ).find( '[id="' + anchorCandidate + '"]');
1444
+ if ( 1 === $anchorCandidate.length ) {
1445
+ $('html, body').animate({
1446
+ scrollTop : $anchorCandidate.offset().top - 150
1447
+ }, 'slow');
1448
+ }
1449
+ }
1450
+ });
1451
+
1452
+ });
assets/front/js/ccat-nimble-front.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){var n="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this||{},t=n._,e=Array.prototype,u=Object.prototype,s="undefined"!=typeof Symbol?Symbol.prototype:null,i=e.push,l=e.slice,p=u.toString,o=u.hasOwnProperty,r=Array.isArray,a=Object.keys,c=Object.create,f=function(){},h=function(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)};"undefined"==typeof exports||exports.nodeType?n._=h:("undefined"!=typeof module&&!module.nodeType&&module.exports&&(exports=module.exports=h),exports._=h),h.VERSION="1.9.1";var d,v=function(i,o,n){if(void 0===o)return i;switch(null==n?3:n){case 1:return function(n){return i.call(o,n)};case 3:return function(n,t,r){return i.call(o,n,t,r)};case 4:return function(n,t,r,e){return i.call(o,n,t,r,e)}}return function(){return i.apply(o,arguments)}},y=function(n,t,r){return h.iteratee!==d?h.iteratee(n,t):null==n?h.identity:h.isFunction(n)?v(n,t,r):h.isObject(n)&&!h.isArray(n)?h.matcher(n):h.property(n)};h.iteratee=d=function(n,t){return y(n,t,1/0)};var g=function(i,o){return o=null==o?i.length-1:+o,function(){for(var n=Math.max(arguments.length-o,0),t=Array(n),r=0;r<n;r++)t[r]=arguments[r+o];switch(o){case 0:return i.call(this,t);case 1:return i.call(this,arguments[0],t);case 2:return i.call(this,arguments[0],arguments[1],t)}var e=Array(o+1);for(r=0;r<o;r++)e[r]=arguments[r];return e[o]=t,i.apply(this,e)}},m=function(n){if(!h.isObject(n))return{};if(c)return c(n);f.prototype=n;var t=new f;return f.prototype=null,t},_=function(t){return function(n){return null==n?void 0:n[t]}},b=function(n,t){return null!=n&&o.call(n,t)},x=function(n,t){for(var r=t.length,e=0;e<r;e++){if(null==n)return;n=n[t[e]]}return r?n:void 0},j=Math.pow(2,53)-1,k=_("length"),w=function(n){var t=k(n);return"number"==typeof t&&0<=t&&t<=j};h.each=h.forEach=function(n,t,r){var e,i;if(t=v(t,r),w(n))for(e=0,i=n.length;e<i;e++)t(n[e],e,n);else{var o=h.keys(n);for(e=0,i=o.length;e<i;e++)t(n[o[e]],o[e],n)}return n},h.map=h.collect=function(n,t,r){t=y(t,r);for(var e=!w(n)&&h.keys(n),i=(e||n).length,o=Array(i),u=0;u<i;u++){var a=e?e[u]:u;o[u]=t(n[a],a,n)}return o};var A=function(l){return function(n,t,r,e){var i=3<=arguments.length;return function(n,t,r,e){var i=!w(n)&&h.keys(n),o=(i||n).length,u=0<l?0:o-1;for(e||(r=n[i?i[u]:u],u+=l);0<=u&&u<o;u+=l){var a=i?i[u]:u;r=t(r,n[a],a,n)}return r}(n,v(t,e,4),r,i)}};h.reduce=h.foldl=h.inject=A(1),h.reduceRight=h.foldr=A(-1),h.find=h.detect=function(n,t,r){var e=(w(n)?h.findIndex:h.findKey)(n,t,r);if(void 0!==e&&-1!==e)return n[e]},h.filter=h.select=function(n,e,t){var i=[];return e=y(e,t),h.each(n,function(n,t,r){e(n,t,r)&&i.push(n)}),i},h.reject=function(n,t,r){return h.filter(n,h.negate(y(t)),r)},h.every=h.all=function(n,t,r){t=y(t,r);for(var e=!w(n)&&h.keys(n),i=(e||n).length,o=0;o<i;o++){var u=e?e[o]:o;if(!t(n[u],u,n))return!1}return!0},h.some=h.any=function(n,t,r){t=y(t,r);for(var e=!w(n)&&h.keys(n),i=(e||n).length,o=0;o<i;o++){var u=e?e[o]:o;if(t(n[u],u,n))return!0}return!1},h.contains=h.includes=h.include=function(n,t,r,e){return w(n)||(n=h.values(n)),("number"!=typeof r||e)&&(r=0),0<=h.indexOf(n,t,r)},h.invoke=g(function(n,r,e){var i,o;return h.isFunction(r)?o=r:h.isArray(r)&&(i=r.slice(0,-1),r=r[r.length-1]),h.map(n,function(n){var t=o;if(!t){if(i&&i.length&&(n=x(n,i)),null==n)return;t=n[r]}return null==t?t:t.apply(n,e)})}),h.pluck=function(n,t){return h.map(n,h.property(t))},h.where=function(n,t){return h.filter(n,h.matcher(t))},h.findWhere=function(n,t){return h.find(n,h.matcher(t))},h.max=function(n,e,t){var r,i,o=-1/0,u=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof n[0]&&null!=n)for(var a=0,l=(n=w(n)?n:h.values(n)).length;a<l;a++)null!=(r=n[a])&&o<r&&(o=r);else e=y(e,t),h.each(n,function(n,t,r){i=e(n,t,r),(u<i||i===-1/0&&o===-1/0)&&(o=n,u=i)});return o},h.min=function(n,e,t){var r,i,o=1/0,u=1/0;if(null==e||"number"==typeof e&&"object"!=typeof n[0]&&null!=n)for(var a=0,l=(n=w(n)?n:h.values(n)).length;a<l;a++)null!=(r=n[a])&&r<o&&(o=r);else e=y(e,t),h.each(n,function(n,t,r){((i=e(n,t,r))<u||i===1/0&&o===1/0)&&(o=n,u=i)});return o},h.shuffle=function(n){return h.sample(n,1/0)},h.sample=function(n,t,r){if(null==t||r)return w(n)||(n=h.values(n)),n[h.random(n.length-1)];var e=w(n)?h.clone(n):h.values(n),i=k(e);t=Math.max(Math.min(t,i),0);for(var o=i-1,u=0;u<t;u++){var a=h.random(u,o),l=e[u];e[u]=e[a],e[a]=l}return e.slice(0,t)},h.sortBy=function(n,e,t){var i=0;return e=y(e,t),h.pluck(h.map(n,function(n,t,r){return{value:n,index:i++,criteria:e(n,t,r)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(e<r||void 0===r)return 1;if(r<e||void 0===e)return-1}return n.index-t.index}),"value")};var S=function(u,t){return function(e,i,n){var o=t?[[],[]]:{};return i=y(i,n),h.each(e,function(n,t){var r=i(n,t,e);u(o,n,r)}),o}};h.groupBy=S(function(n,t,r){b(n,r)?n[r].push(t):n[r]=[t]}),h.indexBy=S(function(n,t,r){n[r]=t}),h.countBy=S(function(n,t,r){b(n,r)?n[r]++:n[r]=1});var O=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;h.toArray=function(n){return n?h.isArray(n)?l.call(n):h.isString(n)?n.match(O):w(n)?h.map(n,h.identity):h.values(n):[]},h.size=function(n){return null==n?0:w(n)?n.length:h.keys(n).length},h.partition=S(function(n,t,r){n[r?0:1].push(t)},!0),h.first=h.head=h.take=function(n,t,r){return null==n||n.length<1?null==t?void 0:[]:null==t||r?n[0]:h.initial(n,n.length-t)},h.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},h.last=function(n,t,r){return null==n||n.length<1?null==t?void 0:[]:null==t||r?n[n.length-1]:h.rest(n,Math.max(0,n.length-t))},h.rest=h.tail=h.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},h.compact=function(n){return h.filter(n,Boolean)};var I=function(n,t,r,e){for(var i=(e=e||[]).length,o=0,u=k(n);o<u;o++){var a=n[o];if(w(a)&&(h.isArray(a)||h.isArguments(a)))if(t)for(var l=0,c=a.length;l<c;)e[i++]=a[l++];else I(a,t,r,e),i=e.length;else r||(e[i++]=a)}return e};h.flatten=function(n,t){return I(n,t,!1)},h.without=g(function(n,t){return h.difference(n,t)}),h.uniq=h.unique=function(n,t,r,e){h.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=y(r,e));for(var i=[],o=[],u=0,a=k(n);u<a;u++){var l=n[u],c=r?r(l,u,n):l;t&&!r?(u&&o===c||i.push(l),o=c):r?h.contains(o,c)||(o.push(c),i.push(l)):h.contains(i,l)||i.push(l)}return i},h.union=g(function(n){return h.uniq(I(n,!0,!0))}),h.intersection=function(n){for(var t=[],r=arguments.length,e=0,i=k(n);e<i;e++){var o=n[e];if(!h.contains(t,o)){var u;for(u=1;u<r&&h.contains(arguments[u],o);u++);u===r&&t.push(o)}}return t},h.difference=g(function(n,t){return t=I(t,!0,!0),h.filter(n,function(n){return!h.contains(t,n)})}),h.unzip=function(n){for(var t=n&&h.max(n,k).length||0,r=Array(t),e=0;e<t;e++)r[e]=h.pluck(n,e);return r},h.zip=g(h.unzip),h.object=function(n,t){for(var r={},e=0,i=k(n);e<i;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r};var F=function(o){return function(n,t,r){t=y(t,r);for(var e=k(n),i=0<o?0:e-1;0<=i&&i<e;i+=o)if(t(n[i],i,n))return i;return-1}};h.findIndex=F(1),h.findLastIndex=F(-1),h.sortedIndex=function(n,t,r,e){for(var i=(r=y(r,e,1))(t),o=0,u=k(n);o<u;){var a=Math.floor((o+u)/2);r(n[a])<i?o=a+1:u=a}return o};var z=function(o,u,a){return function(n,t,r){var e=0,i=k(n);if("number"==typeof r)0<o?e=0<=r?r:Math.max(r+i,e):i=0<=r?Math.min(r+1,i):r+i+1;else if(a&&r&&i)return n[r=a(n,t)]===t?r:-1;if(t!=t)return 0<=(r=u(l.call(n,e,i),h.isNaN))?r+e:-1;for(r=0<o?e:i-1;0<=r&&r<i;r+=o)if(n[r]===t)return r;return-1}};h.indexOf=z(1,h.findIndex,h.sortedIndex),h.lastIndexOf=z(-1,h.findLastIndex),h.range=function(n,t,r){null==t&&(t=n||0,n=0),r||(r=t<n?-1:1);for(var e=Math.max(Math.ceil((t-n)/r),0),i=Array(e),o=0;o<e;o++,n+=r)i[o]=n;return i},h.chunk=function(n,t){if(null==t||t<1)return[];for(var r=[],e=0,i=n.length;e<i;)r.push(l.call(n,e,e+=t));return r};var N=function(n,t,r,e,i){if(!(e instanceof t))return n.apply(r,i);var o=m(n.prototype),u=n.apply(o,i);return h.isObject(u)?u:o};h.bind=g(function(t,r,e){if(!h.isFunction(t))throw new TypeError("Bind must be called on a function");var i=g(function(n){return N(t,i,r,this,e.concat(n))});return i}),h.partial=g(function(i,o){var u=h.partial.placeholder,a=function(){for(var n=0,t=o.length,r=Array(t),e=0;e<t;e++)r[e]=o[e]===u?arguments[n++]:o[e];for(;n<arguments.length;)r.push(arguments[n++]);return N(i,a,this,this,r)};return a}),(h.partial.placeholder=h).bindAll=g(function(n,t){var r=(t=I(t,!1,!1)).length;if(r<1)throw new Error("bindAll must be passed function names");for(;r--;){var e=t[r];n[e]=h.bind(n[e],n)}}),h.memoize=function(e,i){var o=function(n){var t=o.cache,r=""+(i?i.apply(this,arguments):n);return b(t,r)||(t[r]=e.apply(this,arguments)),t[r]};return o.cache={},o},h.delay=g(function(n,t,r){return setTimeout(function(){return n.apply(null,r)},t)}),h.defer=h.partial(h.delay,h,1),h.throttle=function(r,e,i){var o,u,a,l,c=0;i||(i={});var f=function(){c=!1===i.leading?0:h.now(),o=null,l=r.apply(u,a),o||(u=a=null)},n=function(){var n=h.now();c||!1!==i.leading||(c=n);var t=e-(n-c);return u=this,a=arguments,t<=0||e<t?(o&&(clearTimeout(o),o=null),c=n,l=r.apply(u,a),o||(u=a=null)):o||!1===i.trailing||(o=setTimeout(f,t)),l};return n.cancel=function(){clearTimeout(o),c=0,o=u=a=null},n},h.debounce=function(r,e,i){var o,u,a=function(n,t){o=null,t&&(u=r.apply(n,t))},n=g(function(n){if(o&&clearTimeout(o),i){var t=!o;o=setTimeout(a,e),t&&(u=r.apply(this,n))}else o=h.delay(a,e,this,n);return u});return n.cancel=function(){clearTimeout(o),o=null},n},h.wrap=function(n,t){return h.partial(t,n)},h.negate=function(n){return function(){return!n.apply(this,arguments)}},h.compose=function(){var r=arguments,e=r.length-1;return function(){for(var n=e,t=r[e].apply(this,arguments);n--;)t=r[n].call(this,t);return t}},h.after=function(n,t){return function(){if(--n<1)return t.apply(this,arguments)}},h.before=function(n,t){var r;return function(){return 0<--n&&(r=t.apply(this,arguments)),n<=1&&(t=null),r}},h.once=h.partial(h.before,2),h.restArguments=g;var M=!{toString:null}.propertyIsEnumerable("toString"),E=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],T=function(n,t){var r=E.length,e=n.constructor,i=h.isFunction(e)&&e.prototype||u,o="constructor";for(b(n,o)&&!h.contains(t,o)&&t.push(o);r--;)(o=E[r])in n&&n[o]!==i[o]&&!h.contains(t,o)&&t.push(o)};h.keys=function(n){if(!h.isObject(n))return[];if(a)return a(n);var t=[];for(var r in n)b(n,r)&&t.push(r);return M&&T(n,t),t},h.allKeys=function(n){if(!h.isObject(n))return[];var t=[];for(var r in n)t.push(r);return M&&T(n,t),t},h.values=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),i=0;i<r;i++)e[i]=n[t[i]];return e},h.mapObject=function(n,t,r){t=y(t,r);for(var e=h.keys(n),i=e.length,o={},u=0;u<i;u++){var a=e[u];o[a]=t(n[a],a,n)}return o},h.pairs=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),i=0;i<r;i++)e[i]=[t[i],n[t[i]]];return e},h.invert=function(n){for(var t={},r=h.keys(n),e=0,i=r.length;e<i;e++)t[n[r[e]]]=r[e];return t},h.functions=h.methods=function(n){var t=[];for(var r in n)h.isFunction(n[r])&&t.push(r);return t.sort()};var B=function(l,c){return function(n){var t=arguments.length;if(c&&(n=Object(n)),t<2||null==n)return n;for(var r=1;r<t;r++)for(var e=arguments[r],i=l(e),o=i.length,u=0;u<o;u++){var a=i[u];c&&void 0!==n[a]||(n[a]=e[a])}return n}};h.extend=B(h.allKeys),h.extendOwn=h.assign=B(h.keys),h.findKey=function(n,t,r){t=y(t,r);for(var e,i=h.keys(n),o=0,u=i.length;o<u;o++)if(t(n[e=i[o]],e,n))return e};var L,q,R=function(n,t,r){return t in r};h.pick=g(function(n,t){var r={},e=t[0];if(null==n)return r;h.isFunction(e)?(1<t.length&&(e=v(e,t[1])),t=h.allKeys(n)):(e=R,t=I(t,!1,!1),n=Object(n));for(var i=0,o=t.length;i<o;i++){var u=t[i],a=n[u];e(a,u,n)&&(r[u]=a)}return r}),h.omit=g(function(n,r){var t,e=r[0];return h.isFunction(e)?(e=h.negate(e),1<r.length&&(t=r[1])):(r=h.map(I(r,!1,!1),String),e=function(n,t){return!h.contains(r,t)}),h.pick(n,e,t)}),h.defaults=B(h.allKeys,!0),h.create=function(n,t){var r=m(n);return t&&h.extendOwn(r,t),r},h.clone=function(n){return h.isObject(n)?h.isArray(n)?n.slice():h.extend({},n):n},h.tap=function(n,t){return t(n),n},h.isMatch=function(n,t){var r=h.keys(t),e=r.length;if(null==n)return!e;for(var i=Object(n),o=0;o<e;o++){var u=r[o];if(t[u]!==i[u]||!(u in i))return!1}return!0},L=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return!1;if(n!=n)return t!=t;var i=typeof n;return("function"===i||"object"===i||"object"==typeof t)&&q(n,t,r,e)},q=function(n,t,r,e){n instanceof h&&(n=n._wrapped),t instanceof h&&(t=t._wrapped);var i=p.call(n);if(i!==p.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!=+n?+t!=+t:0==+n?1/+n==1/t:+n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object Symbol]":return s.valueOf.call(n)===s.valueOf.call(t)}var o="[object Array]"===i;if(!o){if("object"!=typeof n||"object"!=typeof t)return!1;var u=n.constructor,a=t.constructor;if(u!==a&&!(h.isFunction(u)&&u instanceof u&&h.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}e=e||[];for(var l=(r=r||[]).length;l--;)if(r[l]===n)return e[l]===t;if(r.push(n),e.push(t),o){if((l=n.length)!==t.length)return!1;for(;l--;)if(!L(n[l],t[l],r,e))return!1}else{var c,f=h.keys(n);if(l=f.length,h.keys(t).length!==l)return!1;for(;l--;)if(c=f[l],!b(t,c)||!L(n[c],t[c],r,e))return!1}return r.pop(),e.pop(),!0},h.isEqual=function(n,t){return L(n,t)},h.isEmpty=function(n){return null==n||(w(n)&&(h.isArray(n)||h.isString(n)||h.isArguments(n))?0===n.length:0===h.keys(n).length)},h.isElement=function(n){return!(!n||1!==n.nodeType)},h.isArray=r||function(n){return"[object Array]"===p.call(n)},h.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},h.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol","Map","WeakMap","Set","WeakSet"],function(t){h["is"+t]=function(n){return p.call(n)==="[object "+t+"]"}}),h.isArguments(arguments)||(h.isArguments=function(n){return b(n,"callee")});var C=n.document&&n.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof C&&(h.isFunction=function(n){return"function"==typeof n||!1}),h.isFinite=function(n){return!h.isSymbol(n)&&isFinite(n)&&!isNaN(parseFloat(n))},h.isNaN=function(n){return h.isNumber(n)&&isNaN(n)},h.isBoolean=function(n){return!0===n||!1===n||"[object Boolean]"===p.call(n)},h.isNull=function(n){return null===n},h.isUndefined=function(n){return void 0===n},h.has=function(n,t){if(!h.isArray(t))return b(n,t);for(var r=t.length,e=0;e<r;e++){var i=t[e];if(null==n||!o.call(n,i))return!1;n=n[i]}return!!r},h.noConflict=function(){return n._=t,this},h.identity=function(n){return n},h.constant=function(n){return function(){return n}},h.noop=function(){},h.property=function(t){return h.isArray(t)?function(n){return x(n,t)}:_(t)},h.propertyOf=function(t){return null==t?function(){}:function(n){return h.isArray(n)?x(t,n):t[n]}},h.matcher=h.matches=function(t){return t=h.extendOwn({},t),function(n){return h.isMatch(n,t)}},h.times=function(n,t,r){var e=Array(Math.max(0,n));t=v(t,r,1);for(var i=0;i<n;i++)e[i]=t(i);return e},h.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},h.now=Date.now||function(){return(new Date).getTime()};var K={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},D=h.invert(K),P=function(t){var r=function(n){return t[n]},n="(?:"+h.keys(t).join("|")+")",e=RegExp(n),i=RegExp(n,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(i,r):n}};h.escape=P(K),h.unescape=P(D),h.result=function(n,t,r){h.isArray(t)||(t=[t]);var e=t.length;if(!e)return h.isFunction(r)?r.call(n):r;for(var i=0;i<e;i++){var o=null==n?void 0:n[t[i]];void 0===o&&(o=r,i=e),n=h.isFunction(o)?o.call(n):o}return n};var Q=0;h.uniqueId=function(n){var t=++Q+"";return n?n+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var V=/(.)^/,W={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Y=/\\|'|\r|\n|\u2028|\u2029/g,G=function(n){return"\\"+W[n]};h.template=function(o,n,t){!n&&t&&(n=t),n=h.defaults({},n,h.templateSettings);var r,e=RegExp([(n.escape||V).source,(n.interpolate||V).source,(n.evaluate||V).source].join("|")+"|$","g"),u=0,a="__p+='";o.replace(e,function(n,t,r,e,i){return a+=o.slice(u,i).replace(Y,G),u=i+n.length,t?a+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?a+="'+\n((__t=("+r+"))==null?'':__t)+\n'":e&&(a+="';\n"+e+"\n__p+='"),n}),a+="';\n",n.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{r=new Function(n.variable||"obj","_",a)}catch(n){throw n.source=a,n}var i=function(n){return r.call(this,n,h)},l=n.variable||"obj";return i.source="function("+l+"){\n"+a+"}",i},h.chain=function(n){var t=h(n);return t._chain=!0,t};var J=function(n,t){return n._chain?h(t).chain():t};h.mixin=function(r){return h.each(h.functions(r),function(n){var t=h[n]=r[n];h.prototype[n]=function(){var n=[this._wrapped];return i.apply(n,arguments),J(this,t.apply(h,n))}}),h},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=e[t];h.prototype[t]=function(){var n=this._wrapped;return r.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],J(this,n)}}),h.each(["concat","join","slice"],function(n){var t=e[n];h.prototype[n]=function(){return J(this,t.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},h.prototype.valueOf=h.prototype.toJSON=h.prototype.value,h.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}(),function(i){i.fn.fitText=function(n,t){var r=n||1,e=i.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},t);return this.each(function(){var n=i(this),t=function(){n.css("font-size",Math.max(Math.min(n.width()/(10*r),parseFloat(e.maxFontSize)),parseFloat(e.minFontSize)))};t(),i(window).on("resize.fittext orientationchange.fittext",t)})}}(jQuery),function(l,c){var r="nimbleLazyLoad",e={load_all_images_on_first_scroll:!1,excludeImg:[],threshold:200,fadeIn_options:{duration:400},delaySmartLoadEvent:0},i="smartload-skip";function t(n,t){this.element=n,this.options=l.extend({},e,t),_.isArray(this.options.excludeImg)?this.options.excludeImg.push("."+i):this.options.excludeImg=["."+i],this._defaults=e,this._name=r,this.init()}t.prototype.init=function(){var t=this,r=l("[data-sek-src]:not("+this.options.excludeImg.join()+")",this.element);this.increment=1,this.timer=0,r.addClass(i).bind("sek_load_img",{},function(){t._load_img(this)}),l(c).scroll(function(n){t._better_scroll_event_handler(r,n)}),l(c).resize(_.debounce(function(n){t._maybe_trigger_load(r,n)},100)),this._maybe_trigger_load(r)},t.prototype._better_scroll_event_handler=function(n,t){var r=this;this.doingAnimation||(this.doingAnimation=!0,c.requestAnimationFrame(function(){r._maybe_trigger_load(n,t),r.doingAnimation=!1}))},t.prototype._maybe_trigger_load=function(n,r){var e=this;n.filter(function(n,t){return e._is_visible(t,r)}).map(function(n,t){l(t).trigger("sek_load_img")})},t.prototype._is_visible=function(n,t){var r=l(n),e=l(c).scrollTop(),i=e+l(c).height(),o=r.offset().top,u=o+r.height(),a=this.options.threshold;return!(!t||"scroll"!=t.type||!this.options.load_all_images_on_first_scroll)||e-a<=u&&o<=i+a},t.prototype._load_img=function(n){var t=l(n),r=t.attr("data-sek-src"),e=t.attr("data-sek-srcset"),i=t.attr("data-sek-sizes"),o=l("<img />",{src:r});t.addClass("lazy-loading"),t.unbind("sek_load_img"),o.load(function(){t.removeAttr(["data-sek-src","data-sek-srcset","data-sek-sizes"].join(" ")),t.data("sek-lazy-bg")?t.css("backgroundImage","url("+r+")"):(t.attr("src",r),e&&t.attr("srcset",e),i&&t.attr("sizes",i)),t.hasClass("sek-lazy-loaded")||t.addClass("sek-lazy-loaded"),t.trigger("smartload"),t.data("sek-lazy-loaded",!0)}),o[0].complete&&o.load(),t.removeClass("lazy-loading")},l.fn[r]=function(n){return this.each(function(){l.data(this,"plugin_"+r)||l.data(this,"plugin_"+r,new t(this,n))})}}(jQuery,window),jQuery(function(n){n(".sektion-wrapper").each(function(){try{n(this).nimbleLazyLoad()}catch(n){"function"==typeof window.console.log&&console.log(n)}})}),jQuery(function(e){e("body").on("click",'.menu .menu-item [href^="#"]',function(n){n.preventDefault();var t=e(this).attr("href");if(""!==(t="string"==typeof t?t.replace("#",""):"")||null!==t){var r=e('[data-sek-level="location"]').find('[id="'+t+'"]');1===r.length&&e("html, body").animate({scrollTop:r.offset().top-150},"slow")}})});
assets/front/js/sek-main.js DELETED
@@ -1,83 +0,0 @@
1
- /*global jQuery */
2
- /*!
3
- * FitText.js 1.2
4
- *
5
- * Copyright 2011, Dave Rupert http://daverupert.com
6
- * Released under the WTFPL license
7
- * http://sam.zoy.org/wtfpl/
8
- *
9
- * Date: Thu May 05 14:23:00 2011 -0600
10
- */
11
-
12
- (function( $ ){
13
-
14
- $.fn.fitText = function( kompressor, options ) {
15
-
16
- // Setup options
17
- var compressor = kompressor || 1,
18
- settings = $.extend({
19
- 'minFontSize' : Number.NEGATIVE_INFINITY,
20
- 'maxFontSize' : Number.POSITIVE_INFINITY
21
- }, options);
22
-
23
- return this.each(function(){
24
-
25
- // Store the object
26
- var $this = $(this);
27
-
28
- // Resizer() resizes items based on the object width divided by the compressor * 10
29
- var resizer = function () {
30
- $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
31
- };
32
-
33
- // Call once to set.
34
- resizer();
35
-
36
- // Call on resize. Opera debounces their resize by default.
37
- $(window).on('resize.fittext orientationchange.fittext', resizer);
38
-
39
- });
40
- };
41
-
42
- })( jQuery );
43
-
44
-
45
- jQuery( function($){
46
- var doFitText = function() {
47
- $(".sek-module-placeholder").each( function() {
48
- $(this).fitText( 0.4, { minFontSize: '50px', maxFontSize: '300px' } ).data('sek-fittext-done', true );
49
- });
50
- // Delegate instantiation
51
- $('.sektion-wrapper').on(
52
- 'sek-columns-refreshed sek-modules-refreshed sek-section-added sek-refresh-level',
53
- 'div[data-sek-level="section"]',
54
- function( evt ) {
55
- $(this).find(".sek-module-placeholder").fitText( 0.4, { minFontSize: '50px', maxFontSize: '300px' } ).data('sek-fittext-done', true );
56
- }
57
- );
58
-
59
- };
60
- //doFitText();
61
- // if ( 'function' == typeof(_) && ! _.isUndefined( wp.customize ) ) {
62
- // wp.customize.selectiveRefresh.bind('partial-content-rendered' , function() {
63
- // doFitText();
64
- // });
65
- // }
66
-
67
- // animate menu item to Nimble anchors
68
- $('body').on( 'click', '.menu .menu-item [href^="#"]', function( evt){
69
- evt.preventDefault();
70
- var anchorCandidate = $(this).attr('href');
71
- anchorCandidate = _.isString( anchorCandidate ) ? anchorCandidate.replace('#','') : '';
72
-
73
- if ( !_.isEmpty( anchorCandidate ) ) {
74
- var $anchorCandidate = $('[data-sek-level="location"]' ).find( '[id="' + anchorCandidate + '"]');
75
- if ( 1 === $anchorCandidate.length ) {
76
- $('html, body').animate({
77
- scrollTop : $anchorCandidate.offset().top - 150
78
- }, 'slow');
79
- }
80
- }
81
- });
82
-
83
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/admin/nimble-admin.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Nimble;
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+ add_action( 'plugins_loaded', '\Nimble\sek_versionning');
5
+ function sek_versionning() {
6
+ $current_version = get_option( 'nimble_version' );
7
+ if ( $current_version != NIMBLE_VERSION ) {
8
+ update_option( 'nimble_version_upgraded_from', $current_version );
9
+ update_option( 'nimble_version', NIMBLE_VERSION );
10
+ }
11
+ $started_with = get_option( 'nimble_started_with_version' );
12
+ if ( empty( $started_with ) ) {
13
+ update_option( 'nimble_started_with_version', $current_version );
14
+ }
15
+ $start_date = get_option( 'nimble_start_date' );
16
+ if ( empty( $start_date ) ) {
17
+ update_option( 'nimble_start_date', date("Y-m-d H:i:s") );
18
+ }
19
+ }
20
+ add_action('admin_menu', '\Nimble\sek_plugin_menu');
21
+ function sek_plugin_menu() {
22
+ add_plugins_page(__( 'System infos', 'nimble-builder' ), __( 'System infos', 'nimble-builder' ), 'read', 'nimble-builder', '\Nimble\sek_plugin_page');
23
+ }
24
+
25
+ function sek_plugin_page() {
26
+ ?>
27
+ <div class="wrap">
28
+ <h3><?php _e( 'System Informations', 'nimble-builder' ); ?></h3>
29
+ <h4 style="text-align: left"><?php _e( 'Please include your system informations when posting support requests.' , 'nimble-builder' ) ?></h4>
30
+ <textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="tc-sysinfo" title="<?php _e( 'To copy the system infos, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'nimble-builder' ); ?>" style="width: 800px;min-height: 800px;font-family: Menlo,Monaco,monospace;background: 0 0;white-space: pre;overflow: auto;display:block;"><?php echo sek_config_infos(); ?></textarea>
31
+ </div>
32
+ <?php
33
+ }
34
+
35
+
36
+
37
+
38
+
39
+ /**
40
+ * Get system info
41
+ * Inspired by the system infos page for Easy Digital Download plugin
42
+ * @return string $return A string containing the info to output
43
+ */
44
+ function sek_config_infos() {
45
+ global $wpdb;
46
+
47
+ if ( !class_exists( 'Browser' ) ) {
48
+ require_once( NIMBLE_BASE_PATH . '/inc/libs/browser.php' );
49
+ }
50
+
51
+ $browser = new \Browser();
52
+ $theme_data = wp_get_theme();
53
+ $theme = $theme_data->Name . ' ' . $theme_data->Version;
54
+ $parent_theme = $theme_data->Template;
55
+ if ( ! empty( $parent_theme ) ) {
56
+ $parent_theme_data = wp_get_theme( $parent_theme );
57
+ $parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version;
58
+ }
59
+
60
+ $return = '### Begin System Infos (Generated ' . date( 'Y-m-d H:i:s' ) . ') ###' . "";
61
+ $return .= "\n" .'------------ SITE INFO' . "\n";
62
+ $return .= 'Site URL: ' . site_url() . "\n";
63
+ $return .= 'Home URL: ' . home_url() . "\n";
64
+ $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
65
+ $return .= "\n\n" . '------------ USER BROWSER' . "\n";
66
+ $return .= $browser;
67
+
68
+ $locale = get_locale();
69
+ $return .= "\n\n" . '------------ WORDPRESS CONFIG' . "\n";
70
+ $return .= 'WP Version: ' . get_bloginfo( 'version' ) . "\n";
71
+ $return .= 'Language: ' . ( !empty( $locale ) ? $locale : 'en_US' ) . "\n";
72
+ $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n";
73
+ $return .= 'Active Theme: ' . $theme . "\n";
74
+ if ( $parent_theme !== $theme ) {
75
+ $return .= 'Parent Theme: ' . $parent_theme . "\n";
76
+ }
77
+ $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n";
78
+ if( get_option( 'show_on_front' ) == 'page' ) {
79
+ $front_page_id = get_option( 'page_on_front' );
80
+ $blog_page_id = get_option( 'page_for_posts' );
81
+
82
+ $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n";
83
+ $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n";
84
+ }
85
+
86
+ $return .= 'ABSPATH: ' . ABSPATH . "\n";
87
+
88
+ $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
89
+ $return .= 'WP Memory Limit: ' . ( sek_let_to_num( WP_MEMORY_LIMIT )/( 1024 ) ) ."MB" . "\n";
90
+ $return .= "\n\n" . '------------ NIMBLE CONFIGURATION' . "\n";
91
+ $return .= 'Version: ' . NIMBLE_VERSION . "\n";
92
+ $return .= 'Upgraded From: ' . get_option( 'nimble_version_upgraded_from', 'None' ) . "\n";
93
+ $return .= 'Started With: ' . get_option( 'nimble_started_with_version', 'None' ) . "\n";
94
+ $updates = get_plugin_updates();
95
+ $muplugins = get_mu_plugins();
96
+ if( count( $muplugins ) > 0 ) {
97
+ $return .= "\n\n" . '------------ MU PLUGINS' . "\n";
98
+
99
+ foreach( $muplugins as $plugin => $plugin_data ) {
100
+ $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
101
+ }
102
+ }
103
+ $return .= "\n\n" . '------------ WP ACTIVE PLUGINS' . "\n";
104
+
105
+ $plugins = get_plugins();
106
+ $active_plugins = get_option( 'active_plugins', array() );
107
+
108
+ foreach( $plugins as $plugin_path => $plugin ) {
109
+ if( !in_array( $plugin_path, $active_plugins ) )
110
+ continue;
111
+
112
+ $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
113
+ $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
114
+ }
115
+ $return .= "\n\n" . '------------ WP INACTIVE PLUGINS' . "\n";
116
+
117
+ foreach( $plugins as $plugin_path => $plugin ) {
118
+ if( in_array( $plugin_path, $active_plugins ) )
119
+ continue;
120
+
121
+ $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
122
+ $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
123
+ }
124
+
125
+ if( is_multisite() ) {
126
+ $return .= "\n\n" . '------------ NETWORK ACTIVE PLUGINS' . "\n";
127
+
128
+ $plugins = wp_get_active_network_plugins();
129
+ $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
130
+
131
+ foreach( $plugins as $plugin_path ) {
132
+ $plugin_base = plugin_basename( $plugin_path );
133
+
134
+ if( !array_key_exists( $plugin_base, $active_plugins ) )
135
+ continue;
136
+
137
+ $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
138
+ $plugin = get_plugin_data( $plugin_path );
139
+ $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
140
+ }
141
+ }
142
+ $return .= "\n\n" . '------------ WEBSERVER CONFIG' . "\n";
143
+ $return .= 'PHP Version: ' . PHP_VERSION . "\n";
144
+ $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
145
+ $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
146
+ $return .= "\n\n" . '------------ PHP CONFIG' . "\n";
147
+ $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n";
148
+ $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n";
149
+ $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n";
150
+ $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n";
151
+ $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n";
152
+ $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n";
153
+ $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n";
154
+ $return .= 'PHP Arg Separator: ' . ini_get( 'arg_separator.output' ) . "\n";
155
+ $return .= 'PHP Allow URL File Open: ' . ini_get( 'allow_url_fopen' ) . "\n";
156
+
157
+ $return .= "\n\n" . '### End System Infos ###';
158
+
159
+ return $return;
160
+ }
161
+
162
+
163
+ /**
164
+ * Does Size Conversions
165
+ */
166
+ function sek_let_to_num( $v ) {
167
+ $l = substr( $v, -1 );
168
+ $ret = substr( $v, 0, -1 );
169
+
170
+ switch ( strtoupper( $l ) ) {
171
+ case 'P': // fall-through
172
+ case 'T': // fall-through
173
+ case 'G': // fall-through
174
+ case 'M': // fall-through
175
+ case 'K': // fall-through
176
+ $ret *= 1024;
177
+ break;
178
+ default:
179
+ break;
180
+ }
181
+ return $ret;
182
+ }
183
+ add_action( 'admin_init' , '\Nimble\sek_admin_style' );
184
+ function sek_admin_style() {
185
+ wp_enqueue_style(
186
+ 'nimble-admin-css',
187
+ sprintf(
188
+ '%1$s/assets/admin/css/%2$s' ,
189
+ NIMBLE_BASE_URL,
190
+ 'nimble-admin.css'
191
+ ),
192
+ array(),
193
+ NIMBLE_ASSETS_VERSION,
194
+ 'all'
195
+ );
196
+ }
197
+ if( ! defined( 'DISPLAY_UPDATE_NOTIFICATION' ) ) { define( 'DISPLAY_UPDATE_NOTIFICATION', true ); }
198
+ add_action( 'admin_notices' , '\Nimble\sek_may_be_display_update_notice');
199
+ add_action( 'wp_ajax_dismiss_nimble_update_notice' , '\Nimble\sek_dismiss_update_notice_action' );
200
+ add_action( 'admin_footer' , '\Nimble\sek_write_ajax_dismis_script' );
201
+ foreach ( array( 'wptexturize', 'convert_smilies', 'wpautop') as $callback ) {
202
+ if ( function_exists( $callback ) )
203
+ add_filter( 'sek_update_notice', $callback );
204
+ }
205
+
206
+
207
+ /**
208
+ * @hook : admin_notices
209
+ */
210
+ function sek_may_be_display_update_notice() {
211
+ if ( ! defined('DISPLAY_UPDATE_NOTIFICATION') || ! DISPLAY_UPDATE_NOTIFICATION )
212
+ return;
213
+ $last_update_notice_values = get_option( 'nimble_last_update_notice' );
214
+ $show_new_notice = false;
215
+ $display_ct = 5;
216
+
217
+ if ( ! $last_update_notice_values || ! is_array($last_update_notice_values) ) {
218
+ $last_update_notice_values = array( "version" => NIMBLE_VERSION, "display_count" => 0 );
219
+ update_option( 'nimble_last_update_notice', $last_update_notice_values );
220
+ if ( sek_user_started_before_version( NIMBLE_VERSION ) ) {
221
+ $show_new_notice = true;
222
+ }
223
+ }
224
+
225
+ $_db_version = $last_update_notice_values["version"];
226
+ $_db_displayed_count = $last_update_notice_values["display_count"];
227
+ if ( version_compare( NIMBLE_VERSION, $_db_version , '>' ) ) {
228
+ if ( $_db_displayed_count < $display_ct ) {
229
+ $show_new_notice = true;
230
+ (int) $_db_displayed_count++;
231
+ $last_update_notice_values["display_count"] = $_db_displayed_count;
232
+ update_option( 'nimble_last_update_notice', $last_update_notice_values );
233
+ }
234
+ else {
235
+ $new_val = array( "version" => NIMBLE_VERSION, "display_count" => 0 );
236
+ update_option('nimble_last_update_notice', $new_val );
237
+ }//end else
238
+ }//end if
239
+
240
+ if ( ! $show_new_notice )
241
+ return;
242
+
243
+ ob_start();
244
+ ?>
245
+ <div class="updated czr-update-notice" style="position:relative;">
246
+ <?php
247
+ printf('<h3>%1$s %2$s %3$s %4$s :D</h3>',
248
+ __( "Thanks, you successfully upgraded", 'nimble-builder'),
249
+ 'Nimble Builder',
250
+ __( "to version", 'nimble-builder'),
251
+ NIMBLE_VERSION
252
+ );
253
+ ?>
254
+ <?php
255
+ printf( '<h4>%1$s <a class="" href="%2$s" title="%3$s" target="_blank">%3$s &raquo;</a></h4>',
256
+ __( "We'd like to introduce the new features we've been working on.", 'nimble-builder'),
257
+ "https://presscustomizr.com/category/nimble-releases/",
258
+ __( "Read the latest release notes" , 'nimble-builder' )
259
+ );
260
+ ?>
261
+ <p style="text-align:right;position: absolute;font-size: 1.1em;<?php echo is_rtl()? 'left' : 'right';?>: 7px;bottom: -6px;">
262
+ <?php printf('<a href="#" title="%1$s" class="nimble-dismiss-update-notice"> ( %1$s <strong>X</strong> ) </a>',
263
+ __('close' , 'nimble-builder')
264
+ );
265
+ ?>
266
+ </p>
267
+ <p>
268
+ <?php
269
+ printf(
270
+ __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'nimble-builder' ),
271
+ sprintf( '<strong>%s</strong>', esc_html__( 'the Nimble Builder', 'nimble-builder' ) ),
272
+ sprintf( '<a href="%1$s" target="_blank" class="czr-rating-link">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', esc_url( 'wordpress.org/support/plugin/nimble-builder/reviews/?filter=5#new-post') )
273
+ );
274
+ ?>
275
+ </p>
276
+ </div>
277
+ <?php
278
+ $_html = ob_get_contents();
279
+ if ($_html) ob_end_clean();
280
+ echo apply_filters( 'sek_update_notice', $_html );
281
+ }
282
+
283
+
284
+ /**
285
+ * hook : wp_ajax_dismiss_nimble_update_notice
286
+ * => sets the last_update_notice to the current Hueman version when user click on dismiss notice link
287
+ */
288
+ function sek_dismiss_update_notice_action() {
289
+ check_ajax_referer( 'dismiss-update-notice-nonce', 'dismissUpdateNoticeNonce' );
290
+ $new_val = array( "version" => NIMBLE_VERSION, "display_count" => 0 );
291
+ update_option( 'nimble_last_update_notice', $new_val );
292
+ wp_die();
293
+ }
294
+
295
+
296
+
297
+ /**
298
+ * hook : admin_footer
299
+ */
300
+ function sek_write_ajax_dismis_script() {
301
+ ?>
302
+ <script type="text/javascript" id="nimble-dismiss-update-notice">
303
+ ( function($){
304
+ var _ajax_action = function( $_el ) {
305
+ var AjaxUrl = "<?php echo admin_url( 'admin-ajax.php' ); ?>",
306
+ _query = {
307
+ action : 'dismiss_nimble_update_notice',
308
+ dismissUpdateNoticeNonce : "<?php echo wp_create_nonce( 'dismiss-update-notice-nonce' ); ?>"
309
+ },
310
+ $ = jQuery,
311
+ request = $.post( AjaxUrl, _query );
312
+
313
+ request.fail( function ( response ) {
314
+ console.log('response when failed : ', response);
315
+ });
316
+ request.done( function( response ) {
317
+ console.log('RESPONSE DONE', $_el, response);
318
+ if ( '0' === response )
319
+ return;
320
+ if ( '-1' === response )
321
+ return;
322
+
323
+ $_el.closest('.updated').slideToggle('fast');
324
+ });
325
+ };//end of fn
326
+ $( function($) {
327
+ $('.nimble-dismiss-update-notice').click( function( e ) {
328
+ e.preventDefault();
329
+ _ajax_action( $(this) );
330
+ } );
331
+ } );
332
+
333
+ } )( jQuery );
334
+
335
+
336
+ </script>
337
+ <?php
338
+ }
inc/czr-base-fmk/czr-base-fmk.php CHANGED
@@ -7,14 +7,10 @@ if ( did_action('nimble_base_fmk_loaded') ) {
7
  }
8
  return;
9
  }
10
-
11
- // Set the namsepace as a global so we can use it when fired from another theme/plugin using the fmk
12
  global $czr_base_fmk_namespace;
13
  $czr_base_fmk_namespace = __NAMESPACE__ . '\\';
14
 
15
  do_action( 'nimble_base_fmk_loaded' );
16
- ////////////////////////////////////////////////////////////////
17
- // CZR_Fmk_Base
18
  if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
19
  class CZR_Fmk_Base_Construct {
20
  static $instance;
@@ -33,10 +29,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
33
  }
34
  return self::$instance;
35
  }
36
-
37
- //@param $params = array(
38
- // 'base_url' => '' <= path to root class folder
39
- //)
40
  function __construct( $params = array() ) {
41
  if ( ! is_array( $params ) || empty( $params ) ) {
42
  error_log( 'CZR_Fmk_Base => constructor => missing params');
@@ -46,34 +38,17 @@ if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
46
  error_log( 'CZR_Fmk_Base => constructor => wrong params');
47
  return;
48
  }
49
-
50
- // DEFINITIONS
51
  if ( ! defined( 'NIMBLE_FMK_BASE_URL' ) ) { define( 'NIMBLE_FMK_BASE_URL' , $params['base_url'] ); }
52
  if ( ! defined( 'NIMBLE_FMK_BASE_VERSION' ) ) { define( 'NIMBLE_FMK_BASE_VERSION' , isset( $params['version'] ) ? $params['version'] : '1.0.0' ); }
53
-
54
- // Cache the css attr used in the tmpl builder and in the localized params
55
  $this -> czr_css_attr = $this -> czr_fmk_get_customizer_controls_css_attr();
56
-
57
- // Cache the default dynamic params
58
  $this -> default_dynamic_setting_params = $this -> czr_fmk_get_default_dynamic_setting_params();
59
  $this -> default_dynamic_module_params = $this -> czr_fmk_get_default_dynamic_module_params();
60
-
61
- // Enqueue the fmk control js + a module tmpl
62
  $this -> czr_enqueue_fmk_resources();
63
-
64
- // ajax filters + template generator
65
  $this -> czr_setup_ajax_tmpl();
66
-
67
- // Dynamic Module Registration
68
  $this -> czr_setup_dynamic_settings_registration();
69
  $this -> czr_setup_dynamic_modules_registration();
70
-
71
- // Content picker
72
  $this -> czr_setup_content_picker_ajax_actions();
73
  }//__construct
74
-
75
-
76
- // fired in the constructor to cache the params in a property
77
  private function czr_fmk_get_default_dynamic_setting_params() {
78
  return array(
79
  'setting_id' => '',
@@ -105,8 +80,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
105
  )
106
  );
107
  }
108
-
109
- // fired in the constructor to cache the params in a property
110
  private function czr_fmk_get_default_dynamic_module_params() {
111
  return array(
112
  'dynamic_registration' => true,
@@ -122,8 +95,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
122
  'tmpl' => array()
123
  );
124
  }
125
-
126
- // Copy of czr_fn_get_controls_css_attr() and the equivalent in Hueman Pro
127
  public function czr_fmk_get_customizer_controls_css_attr() {
128
  return apply_filters('czr_fmk_controls_css_attr',
129
  array(
@@ -144,15 +115,12 @@ if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
144
  'item_title' => 'czr-item-title',
145
  'item_btns' => 'czr-item-btns',
146
  'item_sort_handle' => 'czr-item-sort-handle',
147
-
148
- //remove dialog
149
  'display_alert_btn' => 'czr-display-alert',
150
  'remove_alert_wrapper' => 'czr-remove-alert-wrapper',
151
  'cancel_alert_btn' => 'czr-cancel-button',
152
  'remove_view_btn' => 'czr-remove-button',
153
 
154
  'edit_view_btn' => 'czr-edit-view',
155
- //pre add dialog
156
  'open_pre_add_btn' => 'czr-open-pre-add-new',
157
  'adding_new' => 'czr-adding-new',
158
  'pre_add_wrapper' => 'czr-pre-add-wrapper',
@@ -167,37 +135,19 @@ if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
167
  endif;
168
 
169
  ?><?php
170
- ////////////////////////////////////////////////////////////////
171
- // CZR_Fmk_Base
172
  if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
173
  class CZR_Fmk_Base_Load_Resources extends CZR_Fmk_Base_Construct {
174
-
175
- // fired in the constructor
176
  function czr_enqueue_fmk_resources() {
177
- // Enqueue the fmk control js
178
  add_action ( 'customize_controls_enqueue_scripts' , array( $this, 'ac_load_additional_controls_js' ) );
179
  add_action ( 'customize_controls_enqueue_scripts' , array( $this, 'ac_load_additional_controls_css' ) );
180
-
181
- // Enqueue the base preview js
182
- //hook : customize_preview_init
183
  add_action ( 'customize_preview_init' , array( $this, 'ac_customize_load_preview_js' ) );
184
-
185
- // adds specific js templates for the czr_module control
186
  add_action( 'customize_controls_print_footer_scripts', array( $this, 'ac_print_module_control_templates' ) , 1 );
187
  }
188
-
189
-
190
- // hook : 'customize_controls_enqueue_scripts'
191
  function ac_load_additional_controls_js() {
192
- // Enqueue scripts/styles for the color picker.
193
- // Probably already enqueued by the theme controls, but let's make sure they are.
194
  wp_enqueue_script( 'wp-color-picker' );
195
  wp_enqueue_style( 'wp-color-picker' );
196
-
197
- //'czr-customizer-fmk' will be enqueued as a dependency of 'font-customizer-control' only in plugin mode
198
  wp_enqueue_script(
199
  'czr-customizer-fmk',
200
- //dev / debug mode mode?
201
  sprintf(
202
  '%1$s/assets/js/%2$s',
203
  NIMBLE_FMK_BASE_URL,
@@ -207,12 +157,9 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
207
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : NIMBLE_FMK_BASE_VERSION,
208
  $in_footer = true
209
  );
210
-
211
- // When used with Customizr or Hueman, free and pro, we also need to load the theme js part
212
  if ( false !== strpos( czr_get_parent_theme_slug(), 'customizr' ) || false !== strpos( czr_get_parent_theme_slug(), 'hueman' ) ) {
213
  wp_enqueue_script(
214
  'czr-theme-customizer-fmk',
215
- //dev / debug mode mode?
216
  sprintf(
217
  '%1$s/assets/js/%2$s',
218
  NIMBLE_FMK_BASE_URL,
@@ -223,9 +170,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
223
  $in_footer = true
224
  );
225
  }
226
-
227
-
228
- //additional localized param when standalone plugin mode
229
  wp_localize_script(
230
  'czr-customizer-fmk',
231
  'serverControlParams',
@@ -243,8 +187,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
243
  'readDocumentation' => __('Learn more about this in the documentation', 'nimble-builder'),
244
  'Settings' => __('Settings', 'nimble-builder'),
245
  'Options for' => __('Options for', 'nimble-builder'),
246
-
247
- // img upload translation
248
  'select_image' => __( 'Select Image', 'nimble-builder' ),
249
  'change_image' => __( 'Change Image', 'nimble-builder' ),
250
  'remove_image' => __( 'Remove', 'nimble-builder' ),
@@ -260,11 +202,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
260
  )
261
  );
262
  }
263
-
264
-
265
-
266
- // Enqueue the fmk css when standalone plugin
267
- // hook : 'customize_controls_enqueue_scripts'
268
  function ac_load_additional_controls_css() {
269
  wp_enqueue_style(
270
  'czr-fmk-controls-style',
@@ -273,9 +210,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
273
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : NIMBLE_FMK_BASE_VERSION,
274
  $media = 'all'
275
  );
276
-
277
- //select2 stylesheet
278
- //overriden by some specific style in czr-control-base.css
279
  wp_enqueue_style(
280
  'select2-css',
281
  sprintf('%1$s/assets/css/lib/select2.min.css', NIMBLE_FMK_BASE_URL, ( defined('WP_DEBUG') && true === WP_DEBUG ) ? '' : '.min'),
@@ -292,9 +226,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
292
  $media = 'all'
293
  );
294
  }
295
-
296
-
297
- //hook : customize_preview_init
298
  function ac_customize_load_preview_js() {
299
  global $wp_version;
300
 
@@ -309,15 +240,12 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
309
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : NIMBLE_FMK_BASE_VERSION,
310
  true
311
  );
312
-
313
- //localizes
314
  wp_localize_script(
315
  'czr-customizer-preview',
316
  'serverPreviewParams',
317
  apply_filters('czr_base_fmk_customizer_preview_params' ,
318
  array(
319
  'themeFolder' => get_template_directory_uri(),
320
- //patch for old wp versions which don't trigger preview-ready signal => since WP 4.1
321
  'preview_ready_event_exists' => version_compare( $wp_version, '4.1' , '>=' ),
322
  'blogname' => get_bloginfo('name'),
323
  'isRTL' => is_rtl()
@@ -325,17 +253,7 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
325
  )
326
  );
327
  }
328
-
329
- // DO WE STILL NEED TO PRINT THIS TMPL ?
330
- /////////////////////////////////////////////////////
331
- /// WHEN EMBEDDED IN A CONTROL //////////////////////
332
- /////////////////////////////////////////////////////
333
- //add specific js templates for the czr_module control
334
- //this is usually called in the manager for "registered" controls that need to be rendered with js
335
- //for this control, we'll do it another way because we need several js templates
336
- //=> that's why this control has not been "registered" and js templates are printed with the following action
337
  function ac_print_module_control_templates() {
338
- //Render the control wrapper for the CRUD types modules
339
  ?>
340
  <?php //Render the control wrapper for the CRUD types modules ?>
341
  <script type="text/html" id="tmpl-customize-control-czr_module-content">
@@ -355,23 +273,12 @@ if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
355
  endif;
356
 
357
  ?><?php
358
- ////////////////////////////////////////////////////////////////
359
- // CZR_Fmk_Base
360
  if ( ! class_exists( 'CZR_Fmk_Base_Ajax_Filter' ) ) :
361
  class CZR_Fmk_Base_Ajax_Filter extends CZR_Fmk_Base_Load_Resources {
362
-
363
- // fired in the constructor
364
  function czr_setup_ajax_tmpl() {
365
- // this dynamic filter is declared on wp_ajax_ac_get_template
366
- // It allows us to populate the server response with the relevant module html template
367
- // $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl );
368
  add_filter( "ac_set_ajax_czr_tmpl___all_modules", array( $this, 'ac_get_all_modules_tmpl' ), 10, 3 );
369
-
370
- // fetch templates
371
  add_action( 'wp_ajax_ac_get_template', array( $this, 'ac_set_ajax_czr_tmpl' ) );
372
  }
373
-
374
- // hook : 'wp_ajax_ac_get_template'
375
  function ac_set_ajax_czr_tmpl() {
376
  if ( ! is_user_logged_in() ) {
377
  wp_send_json_error( 'ac_set_ajax_czr_tmpl => unauthenticated' );
@@ -410,17 +317,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Ajax_Filter' ) ) :
410
  wp_send_json_success( apply_filters( 'tmpl_results', $html, $tmpl ) );
411
  }
412
  }
413
-
414
-
415
- // hook : ac_set_ajax_czr_tmpl___all_modules
416
- // this dynamic filter is declared on wp_ajax_ac_get_template
417
- // It allows us to populate the server response with the relevant module html template
418
- // $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl );
419
- //
420
- // For all modules, there are 3 types of templates :
421
- // 1) the pre-item, rendered when adding an item
422
- // 2) the module meta options, or mod-opt
423
- // 3) the item input options
424
  function ac_get_all_modules_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
425
  $css_attr = $this -> czr_css_attr;
426
  if ( empty( $requested_tmpl ) ) {
@@ -461,8 +357,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Ajax_Filter' ) ) :
461
  <span class="<?php echo $css_attr['remove_view_btn']; ?> button"><?php _e('Yes', 'nimble-builder'); ?></span> <span class="<?php echo $css_attr['cancel_alert_btn']; ?> button"><?php _e('No', 'nimble-builder'); ?></span>
462
  <?php
463
  break;
464
-
465
- // this template is used in setupImageUploaderSaveAsId and setupImageUploaderSaveAsUrl
466
  case 'img-uploader' :
467
  ?>
468
  <?php // case when a regular attachement object is provided, fetched from an id with wp.media.attachment( id ) ?>
@@ -526,16 +420,11 @@ if ( ! class_exists( 'CZR_Fmk_Base_Ajax_Filter' ) ) :
526
  endif;
527
 
528
  ?><?php
529
- ////////////////////////////////////////////////////////////////
530
- // CZR_Fmk_Base
531
  if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
532
  class CZR_Fmk_Base_Tmpl_Builder extends CZR_Fmk_Base_Ajax_Filter {
533
  /*********************************************************
534
  ** TMPL BUILDER
535
  *********************************************************/
536
- // This is the standard method to be used in a module to generate the item input template
537
- // for pre-item, mod-opts and item-inputs
538
- // fired in self::ac_get_ajax_module_tmpl
539
  function ac_generate_czr_tmpl_from_map( $tmpl_map ) {
540
  $html = '';
541
  $default_input_entries = array(
@@ -546,8 +435,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
546
  'notice_before' => '',
547
  'notice_after' => '',
548
  'placeholder' => '',
549
-
550
- // typically used for the number and range inputs
551
  'step' => '',
552
  'min' => '',
553
  'max' => '',
@@ -592,21 +479,15 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
592
  wp_send_json_error( __FUNCTION__ . ' => wrong var type for the input_data of input id : ' . $input_id );
593
  break;
594
  }
595
- // check that we have no unknown entries in the provided input_data
596
  $maybe_diff = array_diff_key( $input_data, $default_input_entries );
597
  if ( ! empty( $maybe_diff ) ) {
598
  error_log('<' . __FUNCTION__ . '>');
599
  error_log( '=> at least one unknown param in the registered input params for input id : ' . $input_id );
600
  error_log( print_r( $maybe_diff, true ) );
601
  error_log('</' . __FUNCTION__ . '>');
602
- //wp_send_json_error( 'ac_generate_czr_tmpl_from_map => at least one unknow entry in the input data for input id : ' . $input_id );
603
  break;
604
  }
605
-
606
- // we're clear, let's go
607
  $input_data = wp_parse_args( $input_data, $default_input_entries );
608
-
609
- // Do we have a specific template provided ?
610
  if ( ! empty( $input_data[ 'tmpl_callback' ] ) && function_exists( $input_data[ 'tmpl_callback' ] ) ) {
611
  $html .= call_user_func_array( $input_data[ 'tmpl_callback' ], array( $input_data ) );
612
  } else {
@@ -616,17 +497,11 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
616
  }
617
  return $html;////will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
618
  }
619
-
620
-
621
-
622
- // Fired in ac_generate_czr_tmpl_from_map
623
  function ac_get_default_input_tmpl( $input_id, $input_data ) {
624
  if ( ! array_key_exists( 'input_type', $input_data ) || empty( $input_data[ 'input_type' ] ) ) {
625
  wp_send_json_error( 'ac_get_input_tmpl => missing input type for input id : ' . $input_id );
626
  }
627
  $input_type = $input_data[ 'input_type' ];
628
-
629
- // some inputs have a width of 100% even if not specified in the input_data
630
  $is_width_100 = true === $input_data[ 'width-100' ];
631
  if ( in_array( $input_type, array( 'color', 'radio', 'textarea' ) ) ) {
632
  $is_width_100 = true;
@@ -635,7 +510,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
635
  $css_attr = $this -> czr_css_attr;
636
 
637
  ob_start();
638
- // <INPUT WRAPPER>
639
  printf( '<div class="%1$s %2$s %3$s" data-input-type="%4$s" %5$s>',
640
  $css_attr['sub_set_wrapper'],
641
  $is_width_100 ? 'width-100' : '',
@@ -643,7 +517,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
643
  $input_type,
644
  ! empty( $input_data['transport'] ) ? 'data-transport="'. $input_data['transport'] .'"' : ''
645
  );
646
- // no need to print a title for an hidden input
647
  if ( $input_type !== 'hidden' ) {
648
  printf( '<div class="customize-control-title %1$s">%2$s</div>', ! empty( $input_data['title_width'] ) ? $input_data['title_width'] : '', $input_data['title'] );
649
  }
@@ -658,7 +531,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
658
  if ( ! empty( $input_data['input_template'] ) && is_string( $input_data['input_template'] ) ) {
659
  echo $input_data['input_template'];
660
  } else {
661
- // THIS IS WHERE THE ACTUAL INPUT CONTENT IS SET
662
  $this -> ac_set_input_tmpl_content( $input_type, $input_id, $input_data );
663
  }
664
  ?>
@@ -668,29 +540,16 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
668
  <?php endif; ?>
669
  </div> <?php //class="$css_attr['sub_set_wrapper']" ?>
670
  <?php
671
- // </INPUT WRAPPER>
672
 
673
  $tmpl_html = apply_filters( "czr_set_input_tmpl___{$input_type}", ob_get_clean(), $input_id, $input_data );
674
- //error_log( print_r($tmpl_html, true ) );
675
  if ( empty( $tmpl_html ) ) {
676
  wp_send_json_error( 'ac_get_input_tmpl => no html returned for input ' . $input_id );
677
  }
678
  return $tmpl_html;
679
  }//ac_get_input_tmpl()
680
-
681
-
682
-
683
-
684
-
685
-
686
-
687
- // fired in ::ac_get_default_input_tmpl();
688
  private function ac_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
689
  $css_attr = $this -> czr_css_attr;
690
  $input_tmpl_content = null;
691
-
692
- // First fires a hook to allow the input content to be remotely set
693
- // For example the module_picker, the spacing, h_text_alignment... are printed this way
694
  ob_start();
695
  do_action( 'czr_set_input_tmpl_content', $input_type, $input_id, $input_data );
696
  $input_tmpl_content = ob_get_clean();
@@ -698,7 +557,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
698
  if ( ! empty( $input_tmpl_content ) ) {
699
  echo $input_tmpl_content;
700
  } else {
701
- // Then, if we have no content yet, let's go thought the default input cases
702
  switch ( $input_type ) {
703
  /* ------------------------------------------------------------------------- *
704
  * HIDDEN
@@ -848,7 +706,6 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
848
  * - no default input template is defined for the requested input type
849
  /* ------------------------------------------------------------------------- */
850
  default :
851
- // this input type has no template, this is a problem
852
  wp_send_json_error( 'ERROR => ' . __CLASS__ . '::' . __FUNCTION__ . ' this input type has no template : ' . $input_type );
853
  break;
854
  }//switch ( $input_type ) {
@@ -859,57 +716,12 @@ if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
859
  endif;
860
 
861
  ?><?php
862
- ////////////////////////////////////////////////////////////////
863
- // CZR_Fmk_Base
864
  if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
865
  class CZR_Fmk_Dyn_Setting_Registration extends CZR_Fmk_Base_Tmpl_Builder {
866
-
867
- //fired in the constructor
868
  function czr_setup_dynamic_settings_registration() {
869
  add_action( 'customize_register', array( $this, 'czr_setup_dynamic_setting_registration' ), 10 );
870
-
871
- // if we have dynamic setting params, let's add a filter to serverControlParams
872
- // filter declared when localizing 'serverControlParams' @see resources
873
  add_filter( 'czr_fmk_dynamic_setting_js_params', array( $this, 'czr_setup_localized_params_for_dynamic_js_registration' ), 20 );
874
-
875
- // when not dynamically registered
876
- // TO DEPRECATE ?
877
- //add_action( 'customize_register', array( $this, 'czr_register_not_dynamic_settings' ), 20 );
878
  }
879
-
880
-
881
- ////////////////////////////////////////////////////////////////
882
- // PRE REGISTRATION FOR SETTINGS
883
- // Default params
884
- // array(
885
- // 'setting_id' => '',
886
- // 'dynamic_registration' => true,
887
- // 'module_type' => '',
888
- // 'option_value' => array(),
889
-
890
- // 'setting' => array(
891
- // 'type' => 'option',
892
- // 'default' => array(),
893
- // 'transport' => 'refresh',
894
- // 'setting_class' => '',//array( 'path' => '', 'name' => '' )
895
- // 'sanitize_callback' => '',
896
- // 'validate_callback' => '',
897
- // ),
898
-
899
- // 'section' => array(
900
- // 'id' => '',
901
- // 'title' => '',
902
- // 'panel' => '',
903
- // 'priority' => 10
904
- // ),
905
-
906
- // 'control' => array(
907
- // 'label' => '',
908
- // 'type' => 'czr_module',
909
- // 'priority' => 10,
910
- // 'control_class' => ''//array( 'path' => '', 'name' => '' )
911
- // )
912
- // )
913
  function czr_pre_register_dynamic_setting( $setting_params ) {
914
  if ( ! is_array( $setting_params ) || empty( $setting_params ) ) {
915
  error_log( 'czr_pre_register_dynamic_setting => empty $setting_params submitted' );
@@ -919,15 +731,10 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
919
  error_log( 'czr_pre_register_dynamic_setting => missing setting id' );
920
  return;
921
  }
922
-
923
- // normalize
924
  $setting_params = wp_parse_args( $setting_params, $this -> default_dynamic_setting_params );
925
 
926
  $registered = $this->registered_settings;
927
  $setting_id_candidate = $setting_params['setting_id'];
928
-
929
- // A setting id can be registered only once.
930
- // Already registered ?
931
  if ( array_key_exists( $setting_id_candidate, $registered ) ) {
932
  error_log( 'czr_pre_register_dynamic_setting => setting id already registered => ' . $setting_id_candidate );
933
  return;
@@ -935,30 +742,15 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
935
  $registered[ $setting_id_candidate ] = $setting_params;
936
  $this->registered_settings = $registered;
937
  }
938
-
939
-
940
-
941
- ////////////////////////////////////////////////////////////////
942
- // FILTER DYNAMIC SETTING AND CLASS ARGS
943
- // hook : customize_register
944
- // Those filters are declared by WP core in class-wp-customize-manager.php
945
- // in => add_action( 'customize_register', array( $this, 'register_dynamic_settings' ), 11 );
946
  function czr_setup_dynamic_setting_registration( $wp_customize ) {
947
  add_filter( 'customize_dynamic_setting_args', array( $this, 'czr_setup_customizer_dynamic_setting_args' ), 10, 2 );
948
  add_filter( 'customize_dynamic_setting_class', array( $this, 'czr_setup_customizer_dynamic_setting_class' ), 10, 3 );
949
  }
950
-
951
- // hook : 'customize_dynamic_setting_args'
952
  function czr_setup_customizer_dynamic_setting_args( $setting_args, $setting_id ) {
953
- //sek_error_log( __CLASS__ . '::' . __FUNCTION__ , $this->registered_settings );
954
 
955
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
956
  return $setting_args;
957
-
958
- // let's initialize the args to the provided param
959
  $registered_setting_args = $setting_args;
960
-
961
- // loop on each registered modules
962
  foreach ( $this->registered_settings as $registerered_setting_id => $params ) {
963
 
964
  if ( array_key_exists('dynamic_registration', $params) && true !== $params['dynamic_registration'] ) {
@@ -978,8 +770,6 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
978
  'sanitize_callback' => '',
979
  'validate_callback' => ''
980
  ) );
981
-
982
- // Provide new setting args
983
  $registered_setting_args = array(
984
  'type' => empty( $setting_args[ 'type' ] ) ? 'option' : $setting_args[ 'type' ],
985
  'default' => array(),
@@ -987,10 +777,6 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
987
  'sanitize_callback' => ( ! empty( $setting_args[ 'sanitize_callback' ] ) && function_exists( $setting_args[ 'sanitize_callback' ] ) ) ? $setting_args[ 'sanitize_callback' ] : '',
988
  'validate_callback' => ( ! empty( $setting_args[ 'validate_callback' ] ) && function_exists( $setting_args[ 'validate_callback' ] ) ) ? $setting_args[ 'validate_callback' ] : ''
989
  );
990
-
991
- // if this is a module setting, it can have specific sanitize and validate callback set for the module
992
- // Let's check if the module_type is registered, and if there are any callback set.
993
- // If a match is found, we'll use those callback
994
  $module_params = $this -> czr_get_registered_dynamic_module( $params[ 'module_type' ] );
995
  if ( false !== $module_params && is_array( $module_params ) ) {
996
  if ( array_key_exists( 'validate_callback', $module_params ) && function_exists( $module_params[ 'validate_callback' ] ) ) {
@@ -1000,22 +786,13 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
1000
  $registered_setting_args[ 'sanitize_callback' ] = $module_params[ 'sanitize_callback' ];
1001
  }
1002
  }
1003
- //error_log( 'REGISTERING DYNAMICALLY for setting =>'. $setting_id );
1004
  }
1005
  return $registered_setting_args;
1006
  }
1007
-
1008
-
1009
- // hook : 'customize_dynamic_setting_class'
1010
  function czr_setup_customizer_dynamic_setting_class( $class, $setting_id, $args ) {
1011
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
1012
  return $class;
1013
-
1014
-
1015
- // let's initialize the args to the provided class
1016
  $registered_setting_class = $class;//'WP_Customize_Setting' by default
1017
-
1018
- // loop on each registered modules
1019
  foreach ( $this->registered_settings as $registerered_setting_id => $params ) {
1020
  $params = wp_parse_args( $params, $this -> default_dynamic_setting_params );
1021
  if ( true !== $params['dynamic_registration'] ) {
@@ -1027,7 +804,6 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
1027
  $setting_args = $params['setting'];
1028
 
1029
  if ( is_array( $setting_args ) && array_key_exists( 'setting_class', $setting_args ) ) {
1030
- // provide new setting class if exists and not yet loaded
1031
  if ( is_array( $setting_args[ 'setting_class' ] ) && array_key_exists( 'name', $setting_args[ 'setting_class' ] ) && array_key_exists( 'path', $setting_args[ 'setting_class' ] ) ) {
1032
  if ( ! class_exists( $setting_args[ 'setting_class' ][ 'name' ] ) && file_exists( $setting_args[ 'setting_class' ]['path'] ) ) {
1033
  require_once( $setting_args[ 'setting_class' ]['path'] );
@@ -1037,47 +813,18 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
1037
  }
1038
  }
1039
  }
1040
- //error_log( 'REGISTERING CLASS DYNAMICALLY for setting =>'. $setting_id );
1041
  }
1042
 
1043
  return $registered_setting_class;
1044
  }
1045
-
1046
-
1047
- ////////////////////////////////////////////////////////////////
1048
- // Print js params for dynamic control and section registration
1049
- // hook : czr_fmk_dynamic_setting_js_params'
1050
- // @param js_param = array()
1051
  function czr_setup_localized_params_for_dynamic_js_registration( $js_params ) {
1052
- // error_log( '<REGISTERED SETTINGS>' );
1053
- // error_log( print_r( $this->registered_settings, true ) );
1054
- // error_log( '</REGISTERED SETTINGS>' );
1055
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
1056
  return $js_params;
1057
  $js_params = ! is_array( $js_params ) ? array() : $js_params;
1058
-
1059
- // 'localized_control_js' => array(
1060
- // 'deps' => 'czr-customizer-fmk',
1061
- // 'global_var_name' => 'socialLocalized',
1062
- // 'params' => array(
1063
- // //Social Module
1064
- // 'defaultSocialColor' => 'rgb(90,90,90)',
1065
- // 'defaultSocialSize' => 14,
1066
- // //option value for dynamic registration
1067
- //
1068
- // )
1069
- // 'dynamic_setting_registration' => array(
1070
- // 'values' => $args['option_value'],
1071
- // 'section' => $args['section']
1072
- // )
1073
- // )
1074
- // loop on each registered modules
1075
  foreach ( $this->registered_settings as $registerered_setting_id => $params ) {
1076
  $params = wp_parse_args( $params, $this -> default_dynamic_setting_params );
1077
- // We need the 'option_value' entry, even if empty
1078
  if ( ! array_key_exists( 'option_value', $params ) || ! is_array( $params['option_value'] ) )
1079
  continue;
1080
- // Check if not already setup
1081
  if ( array_key_exists( $registerered_setting_id, $params ) ) {
1082
  error_log( 'czr_setup_localized_params_for_dynamic_js_registration => js_params already setup for setting : ' . $registerered_setting_id );
1083
  }
@@ -1087,74 +834,24 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
1087
  'module_type' => $params[ 'module_type' ],
1088
  'module_registration_params' => $this -> czr_get_registered_dynamic_module( $params[ 'module_type' ] ),
1089
  'option_value' => $params['option_value'],
1090
-
1091
- // 'setting' => array(
1092
- // 'type' => 'option',
1093
- // 'default' => array(),
1094
- // 'transport' => 'refresh',
1095
- // 'setting_class' => '',//array( 'path' => '', 'name' => '' )
1096
- // 'sanitize_callback' => '',
1097
- // 'validate_callback' => '',
1098
- // ),
1099
  'setting' => array_key_exists( 'setting', $params ) ? $params[ 'setting' ] : array(),
1100
-
1101
- // 'section' => array(
1102
- // 'id' => '',
1103
- // 'title' => '',
1104
- // 'panel' => '',
1105
- // 'priority' => 10
1106
- // ),
1107
  'section' => array_key_exists( 'section', $params ) ? $params[ 'section' ] : array(),
1108
-
1109
- // 'control' => array(
1110
- // 'label' => '',
1111
- // 'type' => 'czr_module',
1112
- // 'priority' => 10,
1113
- // 'control_class' => ''//array( 'path' => '', 'name' => '' )
1114
- // ),
1115
  'control' => array_key_exists( 'control', $params ) ? $params[ 'control' ] : array(),
1116
  );
1117
  }
1118
  return $js_params;
1119
  }
1120
-
1121
-
1122
-
1123
-
1124
-
1125
-
1126
-
1127
-
1128
-
1129
-
1130
-
1131
-
1132
-
1133
-
1134
- ////////////////////////////////////////////////////////////////
1135
- // TO DEPRECATE ?
1136
- // REGISTER IF NOT DYNAMIC
1137
- // hook : customize_register
1138
  function czr_register_not_dynamic_settings( $wp_customize ) {
1139
- // error_log('<MODULE REGISTRATION>');
1140
- // error_log(print_r( $this->registered_settings, true ));
1141
- // error_log('</MODULE REGISTRATION>');
1142
 
1143
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
1144
  return;
1145
-
1146
- // loop on each registered modules
1147
  foreach ( $this->registered_settings as $setting_id => $params ) {
1148
  $params = wp_parse_args( $params, $this -> default_dynamic_setting_params );
1149
  if ( true === $params['dynamic_registration'] )
1150
  continue;
1151
-
1152
-
1153
- // SETTING
1154
  $setting_args = $params['setting'];
1155
  $registered_setting_class = 'WP_Customize_Setting';
1156
  if ( is_array( $setting_args ) && array_key_exists( 'setting_class', $setting_args ) ) {
1157
- // provide new setting class if exists and not yet loaded
1158
  if ( is_array( $setting_args[ 'setting_class' ] ) && array_key_exists( 'name', $setting_args[ 'setting_class' ] ) && array_key_exists( 'path', $setting_args[ 'setting_class' ] ) ) {
1159
  if ( ! class_exists( $setting_args[ 'setting_class' ][ 'name' ] ) && file_exists( $setting_args[ 'setting_class' ]['path'] ) ) {
1160
  require_once( $setting_args[ 'setting_class' ]['path'] );
@@ -1170,13 +867,9 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
1170
  'type' => $setting_args[ 'type' ],
1171
  'sanitize_callback' => isset( $settings_args[ 'sanitize_callback' ] ) ? $settings_args[ 'sanitize_callback' ] : ''
1172
  ) ) );
1173
-
1174
-
1175
- // CONTROL
1176
  $control_args = $params['control'];
1177
  $registered_control_class = 'WP_Customize_Control';
1178
  if ( is_array( $control_args ) && array_key_exists( 'control_class', $control_args ) ) {
1179
- // provide new setting class if exists and not yet loaded
1180
  if ( is_array( $control_args[ 'control_class' ] ) && array_key_exists( 'name', $control_args[ 'control_class' ] ) && array_key_exists( 'path', $control_args[ 'control_class' ] ) ) {
1181
  if ( ! class_exists( $control_args[ 'control_class' ][ 'name' ] ) && file_exists( $control_args[ 'control_class' ]['path'] ) ) {
1182
  require_once( $control_args[ 'control_class' ]['path'] );
@@ -1201,39 +894,13 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
1201
  endif;
1202
 
1203
  ?><?php
1204
- ////////////////////////////////////////////////////////////////
1205
- // CZR_Fmk_Base
1206
  if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1207
  class CZR_Fmk_Dyn_Module_Registration extends CZR_Fmk_Dyn_Setting_Registration {
1208
-
1209
- //fired in the constructor
1210
  function czr_setup_dynamic_modules_registration() {
1211
- // Dynamic Module Registration
1212
  add_action( 'init', array( $this, 'czr_schedule_ajax_tmpl' ) );
1213
- // Enqueue the module customizer control assets
1214
  add_action( 'customize_controls_enqueue_scripts' , array( $this, 'czr_register_dynamic_modules_customizer_control_assets' ) );
1215
  }
1216
-
1217
-
1218
-
1219
-
1220
-
1221
-
1222
- ////////////////////////////////////////////////////////////////
1223
- // PRE REGISTRATION FOR MODULES
1224
- // Default params
1225
- // array(
1226
- // 'module_type' => '',
1227
- // 'customizer_assets' => array(
1228
- // 'control_js' => array(),
1229
- // 'localized_control_js' => array()
1230
- // ),
1231
- // 'tmpl' => array()
1232
- // )
1233
  function czr_pre_register_dynamic_module( $module_params ) {
1234
- // error_log( '<czr_pre_register_dynamic_module>' );
1235
- // error_log( print_r( $module_params, true ) );
1236
- // error_log( '</czr_pre_register_dynamic_module>' );
1237
 
1238
  if ( ! is_array( $module_params ) || empty( $module_params ) ) {
1239
  error_log( 'czr_pre_register_dynamic_module => empty $module_params submitted' );
@@ -1243,15 +910,10 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1243
  error_log( 'czr_pre_register_dynamic_module => missing module_type' );
1244
  return;
1245
  }
1246
-
1247
- // normalize
1248
  $module_params = wp_parse_args( $module_params, $this -> default_dynamic_module_params );
1249
 
1250
  $registered = $this->registered_modules;
1251
  $module_type_candidate = $module_params['module_type'];
1252
-
1253
- // A module type can be registered only once.
1254
- // Already registered ?
1255
  if ( array_key_exists( $module_type_candidate, $registered ) ) {
1256
  error_log( 'czr_pre_register_dynamic_module => module type already registered => ' . $module_type_candidate );
1257
  return;
@@ -1259,62 +921,20 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1259
  $registered[ $module_type_candidate ] = $module_params;
1260
  $this->registered_modules = $registered;
1261
  }
1262
-
1263
-
1264
-
1265
- // HELPER
1266
- // @return boolean or array of module params
1267
  function czr_get_registered_dynamic_module( $module_type = '' ) {
1268
  $registered = $this->registered_modules;
1269
  if ( empty( $module_type ) || ! is_array( $registered ) || empty( $registered ) )
1270
  return;
1271
  return array_key_exists( $module_type , $registered ) ? $registered[ $module_type ] : false;
1272
  }
1273
-
1274
-
1275
-
1276
- ////////////////////////////////////////////////////////////////
1277
- // ENQUEUE ASSETS
1278
- // hook : customize_controls_enqueue_scripts
1279
- //
1280
- // 'customizer_assets' => array(
1281
- // 'control_js' => array(
1282
- // // handle + params for wp_enqueue_script()
1283
- // // @see https://developer.wordpress.org/reference/functions/wp_enqueue_script/
1284
- // 'czr-social-links-module' => array(
1285
- // 'src' => sprintf(
1286
- // '%1$s/assets/js/%2$s',
1287
- // $args['base_url_path'],
1288
- // '_2_7_socials_module.js'
1289
- // ),
1290
- // 'deps' => array('customize-controls' , 'jquery', 'underscore'),
1291
- // 'ver' => ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : $args['version'],
1292
- // 'in_footer' => true
1293
- // )
1294
- // ),
1295
- // 'localized_control_js' => array(
1296
- // 'deps' => 'czr-customizer-fmk',
1297
- // 'global_var_name' => 'socialLocalized',
1298
- // 'params' => array(
1299
- // //Social Module
1300
- // 'defaultSocialColor' => 'rgb(90,90,90)',
1301
- // 'defaultSocialSize' => 14,
1302
- // //option value for dynamic registration
1303
- // )
1304
- // )
1305
- // ),
1306
  function czr_register_dynamic_modules_customizer_control_assets() {
1307
  if ( ! is_array( $this->registered_modules ) || empty( $this->registered_modules ) )
1308
  return;
1309
 
1310
  $wp_scripts = wp_scripts();
1311
-
1312
- // loop on each registered modules
1313
  foreach ( $this->registered_modules as $module_type => $params ) {
1314
  $params = wp_parse_args( $params, $this -> default_dynamic_module_params );
1315
- //error_log( print_r( $params, true ) );
1316
  $control_js_params = $params[ 'customizer_assets' ][ 'control_js' ];
1317
- // Enqueue the list of registered scripts
1318
  if ( ! empty( $control_js_params ) ) {
1319
  foreach ( $control_js_params as $handle => $script_args ) {
1320
  if ( ! isset( $wp_scripts->registered[$handle] ) ) {
@@ -1331,18 +951,6 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1331
  }
1332
 
1333
  }
1334
-
1335
- // 'localized_control_js' => array(
1336
- // 'deps' => 'czr-customizer-fmk',
1337
- // 'global_var_name' => 'socialLocalized',
1338
- // 'params' => array(
1339
- // //Social Module
1340
- // 'defaultSocialColor' => 'rgb(90,90,90)',
1341
- // 'defaultSocialSize' => 14,
1342
- // //option value for dynamic registration
1343
- // )
1344
- // )
1345
- // Print localized params if any
1346
  if ( array_key_exists( 'localized_control_js', $params[ 'customizer_assets' ] ) ) {
1347
  $localized_control_js_params = is_array( $params[ 'customizer_assets' ][ 'localized_control_js' ] ) ? $params[ 'customizer_assets' ][ 'localized_control_js' ] : array();
1348
 
@@ -1356,12 +964,6 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1356
  }
1357
  }//foreach
1358
  }
1359
-
1360
-
1361
-
1362
- ////////////////////////////////////////////////////////////////
1363
- // AJAX TEMPLATE FILTERS
1364
- // hook : init
1365
  function czr_schedule_ajax_tmpl() {
1366
  if ( ! is_array( $this->registered_modules ) || empty( $this->registered_modules ) )
1367
  return;
@@ -1370,45 +972,17 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1370
  $params = wp_parse_args( $params, $this -> default_dynamic_module_params );
1371
  if ( ! empty( $params['tmpl'] ) ) {
1372
  $module_type = $params['module_type'];
1373
- // filter declared with $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl, $_POST );
1374
  add_filter( "ac_set_ajax_czr_tmpl___{$module_type}", array( $this, 'ac_get_ajax_module_tmpl'), 10, 3 );
1375
  }
1376
  }//foreach
1377
  }
1378
-
1379
-
1380
- // AJAX TMPL FILTERS
1381
- // this dynamic filter is declared on wp_ajax_ac_get_template
1382
- // It allows us to populate the server response with the relevant module html template
1383
- // $html = apply_filters( "ac_set_ajax_czr_tmpl___{$module_type}", '', $tmpl );
1384
- //
1385
- // Each template is built from a map, each input type having its own unique piece of tmpl
1386
- //
1387
- // 3 types of templates :
1388
- // 1) the pre-item, rendered when adding an item
1389
- // 2) the module meta options, or mod-opt
1390
- // 3) the item input options
1391
- // @param $posted_params is the $_POST
1392
- // hook : ac_set_ajax_czr_tmpl___{$module_type}
1393
  function ac_get_ajax_module_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
1394
- // error_log( '<REGISTERED MODULES>' );
1395
- // error_log( print_r( $this->registered_modules, true ) );
1396
- // error_log( '</REGISTERED MODULES>' );
1397
- // error_log( '<GET AJAX MODULE TMPL>' );
1398
- // error_log( print_r( $posted_params, true ) );
1399
- // error_log( '</GET AJAX MODULE TMPL>' );
1400
- // the module type is sent in the $posted_params
1401
  if ( ! is_array( $posted_params ) || empty( $posted_params ) ) {
1402
  wp_send_json_error( 'ac_get_ajax_module_tmpl => empty posted_params' );
1403
  }
1404
  if ( ! array_key_exists( 'module_type', $posted_params ) || empty( $posted_params['module_type'] ) ) {
1405
  wp_send_json_error( 'ac_get_ajax_module_tmpl => missing module_type' );
1406
  }
1407
- // if ( ! array_key_exists( 'control_id', $posted_params ) || empty( $posted_params['control_id'] ) ) {
1408
- // wp_send_json_error( 'ac_get_ajax_module_tmpl => missing control_id' );
1409
- // }
1410
-
1411
- // find the requested module_id in the list of registered modules
1412
  $registered_modules = $this->registered_modules;
1413
  $module_type = $posted_params['module_type'];
1414
  if ( ! array_key_exists( $module_type, $registered_modules ) || empty( $registered_modules[ $module_type ] ) ) {
@@ -1417,43 +991,13 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1417
 
1418
  $module_params = $registered_modules[ $module_type ];
1419
  $tmpl_params = $module_params[ 'tmpl' ];
1420
- // Enqueue the list of registered scripts
1421
  if ( empty( $tmpl_params ) ) {
1422
  return;
1423
  }
1424
- // the requested_tmpl can be pre-item, mod-opt or item-inputs
1425
  $tmpl_map = array_key_exists( $requested_tmpl, $tmpl_params ) ? $tmpl_params[ $requested_tmpl ] : array();
1426
  if ( empty( $tmpl_map ) ) {
1427
  return;
1428
  }
1429
- // Do we have tabs ?
1430
- // With tabs
1431
- // 'tabs' => array(
1432
- // array(
1433
- // 'title' => __('Spacing', 'text_domain_to_be_replaced'),
1434
- // 'inputs' => array(
1435
- // 'padding' => array(
1436
- // 'input_type' => 'number',
1437
- // 'title' => __('Padding', 'text_domain_to_be_replaced')
1438
- // ),
1439
- // 'margin' => array(
1440
- // 'input_type' => 'number',
1441
- // 'title' => __('Margin', 'text_domain_to_be_replaced')
1442
- // )
1443
- // )
1444
- // ),
1445
- // array( ... )
1446
- //
1447
- //
1448
- // Without tabs :
1449
- // 'padding' => array(
1450
- // 'input_type' => 'number',
1451
- // 'title' => __('Padding', 'text_domain_to_be_replaced')
1452
- // ),
1453
- // 'margin' => array(
1454
- // 'input_type' => 'number',
1455
- // 'title' => __('Margin', 'text_domain_to_be_replaced')
1456
- // )
1457
  if ( array_key_exists( 'tabs', $tmpl_map ) ) {
1458
  ob_start();
1459
  ?>
@@ -1461,7 +1005,6 @@ if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
1461
  <nav>
1462
  <ul>
1463
  <?php
1464
- // print the tabs nav
1465
  foreach ( $tmpl_map['tabs'] as $_key => $tab ) {
1466
  printf( '<li data-tab-id="section-topline-%1$s" %2$s><a href="#"><span>%3$s</span></a></li>',
1467
  $_key + 1,
@@ -1499,23 +1042,14 @@ endif;
1499
  * Customizer ajax content picker actions
1500
  *
1501
  */
1502
- // CZR_Fmk_Base
1503
  if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1504
  class CZR_Fmk_Base extends CZR_Fmk_Dyn_Module_Registration {
1505
-
1506
- //fired in the constructor
1507
  public function czr_setup_content_picker_ajax_actions() {
1508
  if ( current_user_can( 'edit_theme_options' ) ) {
1509
  add_action( 'wp_ajax_load-available-content-items-customizer' , array( $this, 'ajax_load_available_items' ) );
1510
  add_action( 'wp_ajax_search-available-content-items-customizer' , array( $this, 'ajax_search_available_items' ) );
1511
  }
1512
-
1513
- // CONTENT PICKER INPUT
1514
- //add the _custom_ item to the content picker retrieved in ajax
1515
- //add_filter( 'content_picker_ajax_items', array( $this, 'czr_add_custom_item_to_ajax_results' ), 10, 3 );
1516
  }
1517
-
1518
- // hook : 'content_picker_ajax_items'
1519
  function czr_add_custom_item_to_ajax_results( $items, $page, $context ) {
1520
  if ( is_numeric( $page ) && $page < 1 ) {
1521
  return array_merge(
@@ -1535,9 +1069,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1535
  return $items;
1536
  }
1537
  }
1538
-
1539
-
1540
- //hook : 'pre_post_link'
1541
  function dont_use_fancy_permalinks() {
1542
  return '';
1543
  }
@@ -1570,31 +1101,11 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1570
  wp_send_json_error( 'czr_ajax_content_picker_missing_pagination_param' );
1571
  }
1572
 
1573
- //error_log( print_r($_POST, true ) );
1574
-
1575
  $wp_object_types = json_decode( wp_unslash( $_POST['wp_object_types'] ), true );
1576
-
1577
- //$wp_object_types should look like :
1578
- //array(
1579
- // post : '',//<= all post types
1580
- // taxonomy : ''//<= all taxonomy types
1581
- //) OR
1582
- //array(
1583
- // post : [ 'page', 'cpt1', ...]
1584
- // taxonomy : [ 'category', 'tag', 'Custom_Tax_1', ... ]
1585
- //) OR
1586
- //array(
1587
- // post : [ 'page', 'cpt1', ...]
1588
- // taxonomy : '_none_'//<= don't load or search taxonomies
1589
- //)
1590
  if ( ! is_array( $wp_object_types ) || empty( $wp_object_types ) ) {
1591
  wp_send_json_error( 'czr_ajax_content_picker_missing_object_types' );
1592
  }
1593
  $page = empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] );
1594
- //do we need that ?
1595
- // if ( $page < 1 ) {
1596
- // $page = 1;
1597
- // }
1598
 
1599
  $items = array();
1600
 
@@ -1641,7 +1152,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1641
  * @return WP_Error|array Returns either a WP_Error object or an array of menu items.
1642
  */
1643
  public function load_available_items_query( $args ) {
1644
- //normalize args
1645
  $args = wp_parse_args( $args, array(
1646
  'type' => 'post',
1647
  'object_types' => '_all_',//could be page, post, or any CPT
@@ -1654,7 +1164,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1654
 
1655
  $items = array();
1656
  if ( 'post' === $type ) {
1657
- //What are the post types we need to fetch ?
1658
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1659
  $post_types = get_post_types( array( 'public' => true ) );
1660
  } else {
@@ -1675,7 +1184,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1675
  foreach ( $posts as $post ) {
1676
  $post_title = $post->post_title;
1677
  if ( '' === $post_title ) {
1678
- // translators: %d: ID of a post
1679
  $post_title = sprintf( __( '#%d (no title)', 'nimble-builder' ), $post->ID );
1680
  }
1681
  $items[] = array(
@@ -1689,7 +1197,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1689
  }
1690
 
1691
  } elseif ( 'taxonomy' === $type ) {
1692
- //What are the taxonomy types we need to fetch ?
1693
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1694
  $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
1695
  } else {
@@ -1776,20 +1283,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1776
  $s = sanitize_text_field( wp_unslash( $_POST['search'] ) );
1777
 
1778
  $wp_object_types = json_decode( wp_unslash( $_POST['wp_object_types'] ), true );
1779
-
1780
- //$wp_object_types should look like :
1781
- //array(
1782
- // post : '',//<= all post types
1783
- // taxonomy : ''//<= all taxonomy types
1784
- //) OR
1785
- //array(
1786
- // post : [ 'page', 'cpt1', ...]
1787
- // taxonomy : [ 'category', 'tag', 'Custom_Tax_1', ... ]
1788
- //) OR
1789
- //array(
1790
- // post : [ 'page', 'cpt1', ...]
1791
- // taxonomy : '_none_'//<= don't load or search taxonomies
1792
- //)
1793
  if ( ! is_array( $wp_object_types ) || empty( $wp_object_types ) ) {
1794
  wp_send_json_error( 'czr_ajax_content_picker_missing_object_types' );
1795
  }
@@ -1840,7 +1333,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1840
  * @return array Menu items.
1841
  */
1842
  public function search_available_items_query( $args = array() ) {
1843
- //normalize args
1844
  $args = wp_parse_args( $args, array(
1845
  'pagenum' => 1,
1846
  's' => '',
@@ -1848,11 +1340,8 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1848
  'object_types' => '_all_'//could be page, post, or any CPT
1849
  ) );
1850
  $object_types = $args['object_types'];
1851
-
1852
- //TODO: need a search only on the allowed types
1853
  $items = array();
1854
  if ( 'post' === $args['type'] ) {
1855
- //What are the post types we need to fetch ?
1856
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1857
  $post_types = get_post_types( array( 'public' => true ) );
1858
  } else {
@@ -1876,10 +1365,7 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1876
  if ( isset( $args['s'] ) ) {
1877
  $query['s'] = $args['s'];
1878
  }
1879
-
1880
- // Query posts.
1881
  $get_posts = new WP_Query( $query );
1882
- // Check if any posts were found.
1883
  if ( $get_posts->post_count ) {
1884
  foreach ( $get_posts->posts as $post ) {
1885
  $post_title = $post->post_title;
@@ -1898,7 +1384,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1898
  }
1899
  }
1900
  } elseif ( 'taxonomy' === $args['type'] ) {
1901
- //What are the taxonomy types we need to fetch ?
1902
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1903
  $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
1904
  } else {
@@ -1912,8 +1397,6 @@ if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1912
  'number' => 10,
1913
  'offset' => 10 * ( $args['pagenum'] - 1 )
1914
  ) );
1915
-
1916
- // Check if any taxonomies were found.
1917
  if ( ! empty( $terms ) ) {
1918
  foreach ( $terms as $term ) {
1919
  $items[] = array(
@@ -1947,11 +1430,8 @@ endif;
1947
  */
1948
  function czr_get_parent_theme_slug() {
1949
  $theme_slug = get_option( 'stylesheet' );
1950
- // $_REQUEST['theme'] is set both in live preview and when we're customizing a non active theme
1951
  $theme_slug = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : $theme_slug; //old wp versions
1952
  $theme_slug = isset($_REQUEST['customize_theme']) ? $_REQUEST['customize_theme'] : $theme_slug;
1953
-
1954
- //gets the theme name (or parent if child)
1955
  $theme_data = wp_get_theme( $theme_slug );
1956
  if ( $theme_data -> parent() ) {
1957
  $theme_slug = $theme_data -> parent() -> Name;
@@ -1959,9 +1439,6 @@ function czr_get_parent_theme_slug() {
1959
 
1960
  return sanitize_file_name( strtolower( $theme_slug ) );
1961
  }
1962
-
1963
-
1964
- //@return boolean
1965
  function czr_is_multi_item_module( $module_type ) {
1966
  $is_multi_item = false;
1967
  $module_params = CZR_Fmk_Base() -> czr_get_registered_dynamic_module( $module_type );
@@ -1975,15 +1452,6 @@ function czr_is_multi_item_module( $module_type ) {
1975
  }
1976
  return $is_multi_item;
1977
  }
1978
-
1979
-
1980
-
1981
-
1982
- //Creates a new instance
1983
- //@params ex :
1984
- //array(
1985
- // 'base_url' => NIMBLE_BASE_URL . '/inc/czr-base-fmk'
1986
- // )
1987
  function CZR_Fmk_Base( $params = array() ) {
1988
  return CZR_Fmk_Base::czr_fmk_get_instance( $params );
1989
  }
7
  }
8
  return;
9
  }
 
 
10
  global $czr_base_fmk_namespace;
11
  $czr_base_fmk_namespace = __NAMESPACE__ . '\\';
12
 
13
  do_action( 'nimble_base_fmk_loaded' );
 
 
14
  if ( ! class_exists( 'CZR_Fmk_Base_Construct' ) ) :
15
  class CZR_Fmk_Base_Construct {
16
  static $instance;
29
  }
30
  return self::$instance;
31
  }
 
 
 
 
32
  function __construct( $params = array() ) {
33
  if ( ! is_array( $params ) || empty( $params ) ) {
34
  error_log( 'CZR_Fmk_Base => constructor => missing params');
38
  error_log( 'CZR_Fmk_Base => constructor => wrong params');
39
  return;
40
  }
 
 
41
  if ( ! defined( 'NIMBLE_FMK_BASE_URL' ) ) { define( 'NIMBLE_FMK_BASE_URL' , $params['base_url'] ); }
42
  if ( ! defined( 'NIMBLE_FMK_BASE_VERSION' ) ) { define( 'NIMBLE_FMK_BASE_VERSION' , isset( $params['version'] ) ? $params['version'] : '1.0.0' ); }
 
 
43
  $this -> czr_css_attr = $this -> czr_fmk_get_customizer_controls_css_attr();
 
 
44
  $this -> default_dynamic_setting_params = $this -> czr_fmk_get_default_dynamic_setting_params();
45
  $this -> default_dynamic_module_params = $this -> czr_fmk_get_default_dynamic_module_params();
 
 
46
  $this -> czr_enqueue_fmk_resources();
 
 
47
  $this -> czr_setup_ajax_tmpl();
 
 
48
  $this -> czr_setup_dynamic_settings_registration();
49
  $this -> czr_setup_dynamic_modules_registration();
 
 
50
  $this -> czr_setup_content_picker_ajax_actions();
51
  }//__construct
 
 
 
52
  private function czr_fmk_get_default_dynamic_setting_params() {
53
  return array(
54
  'setting_id' => '',
80
  )
81
  );
82
  }
 
 
83
  private function czr_fmk_get_default_dynamic_module_params() {
84
  return array(
85
  'dynamic_registration' => true,
95
  'tmpl' => array()
96
  );
97
  }
 
 
98
  public function czr_fmk_get_customizer_controls_css_attr() {
99
  return apply_filters('czr_fmk_controls_css_attr',
100
  array(
115
  'item_title' => 'czr-item-title',
116
  'item_btns' => 'czr-item-btns',
117
  'item_sort_handle' => 'czr-item-sort-handle',
 
 
118
  'display_alert_btn' => 'czr-display-alert',
119
  'remove_alert_wrapper' => 'czr-remove-alert-wrapper',
120
  'cancel_alert_btn' => 'czr-cancel-button',
121
  'remove_view_btn' => 'czr-remove-button',
122
 
123
  'edit_view_btn' => 'czr-edit-view',
 
124
  'open_pre_add_btn' => 'czr-open-pre-add-new',
125
  'adding_new' => 'czr-adding-new',
126
  'pre_add_wrapper' => 'czr-pre-add-wrapper',
135
  endif;
136
 
137
  ?><?php
 
 
138
  if ( ! class_exists( 'CZR_Fmk_Base_Load_Resources' ) ) :
139
  class CZR_Fmk_Base_Load_Resources extends CZR_Fmk_Base_Construct {
 
 
140
  function czr_enqueue_fmk_resources() {
 
141
  add_action ( 'customize_controls_enqueue_scripts' , array( $this, 'ac_load_additional_controls_js' ) );
142
  add_action ( 'customize_controls_enqueue_scripts' , array( $this, 'ac_load_additional_controls_css' ) );
 
 
 
143
  add_action ( 'customize_preview_init' , array( $this, 'ac_customize_load_preview_js' ) );
 
 
144
  add_action( 'customize_controls_print_footer_scripts', array( $this, 'ac_print_module_control_templates' ) , 1 );
145
  }
 
 
 
146
  function ac_load_additional_controls_js() {
 
 
147
  wp_enqueue_script( 'wp-color-picker' );
148
  wp_enqueue_style( 'wp-color-picker' );
 
 
149
  wp_enqueue_script(
150
  'czr-customizer-fmk',
 
151
  sprintf(
152
  '%1$s/assets/js/%2$s',
153
  NIMBLE_FMK_BASE_URL,
157
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : NIMBLE_FMK_BASE_VERSION,
158
  $in_footer = true
159
  );
 
 
160
  if ( false !== strpos( czr_get_parent_theme_slug(), 'customizr' ) || false !== strpos( czr_get_parent_theme_slug(), 'hueman' ) ) {
161
  wp_enqueue_script(
162
  'czr-theme-customizer-fmk',
 
163
  sprintf(
164
  '%1$s/assets/js/%2$s',
165
  NIMBLE_FMK_BASE_URL,
170
  $in_footer = true
171
  );
172
  }
 
 
 
173
  wp_localize_script(
174
  'czr-customizer-fmk',
175
  'serverControlParams',
187
  'readDocumentation' => __('Learn more about this in the documentation', 'nimble-builder'),
188
  'Settings' => __('Settings', 'nimble-builder'),
189
  'Options for' => __('Options for', 'nimble-builder'),
 
 
190
  'select_image' => __( 'Select Image', 'nimble-builder' ),
191
  'change_image' => __( 'Change Image', 'nimble-builder' ),
192
  'remove_image' => __( 'Remove', 'nimble-builder' ),
202
  )
203
  );
204
  }
 
 
 
 
 
205
  function ac_load_additional_controls_css() {
206
  wp_enqueue_style(
207
  'czr-fmk-controls-style',
210
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : NIMBLE_FMK_BASE_VERSION,
211
  $media = 'all'
212
  );
 
 
 
213
  wp_enqueue_style(
214
  'select2-css',
215
  sprintf('%1$s/assets/css/lib/select2.min.css', NIMBLE_FMK_BASE_URL, ( defined('WP_DEBUG') && true === WP_DEBUG ) ? '' : '.min'),
226
  $media = 'all'
227
  );
228
  }
 
 
 
229
  function ac_customize_load_preview_js() {
230
  global $wp_version;
231
 
240
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : NIMBLE_FMK_BASE_VERSION,
241
  true
242
  );
 
 
243
  wp_localize_script(
244
  'czr-customizer-preview',
245
  'serverPreviewParams',
246
  apply_filters('czr_base_fmk_customizer_preview_params' ,
247
  array(
248
  'themeFolder' => get_template_directory_uri(),
 
249
  'preview_ready_event_exists' => version_compare( $wp_version, '4.1' , '>=' ),
250
  'blogname' => get_bloginfo('name'),
251
  'isRTL' => is_rtl()
253
  )
254
  );
255
  }
 
 
 
 
 
 
 
 
 
256
  function ac_print_module_control_templates() {
 
257
  ?>
258
  <?php //Render the control wrapper for the CRUD types modules ?>
259
  <script type="text/html" id="tmpl-customize-control-czr_module-content">
273
  endif;
274
 
275
  ?><?php
 
 
276
  if ( ! class_exists( 'CZR_Fmk_Base_Ajax_Filter' ) ) :
277
  class CZR_Fmk_Base_Ajax_Filter extends CZR_Fmk_Base_Load_Resources {
 
 
278
  function czr_setup_ajax_tmpl() {
 
 
 
279
  add_filter( "ac_set_ajax_czr_tmpl___all_modules", array( $this, 'ac_get_all_modules_tmpl' ), 10, 3 );
 
 
280
  add_action( 'wp_ajax_ac_get_template', array( $this, 'ac_set_ajax_czr_tmpl' ) );
281
  }
 
 
282
  function ac_set_ajax_czr_tmpl() {
283
  if ( ! is_user_logged_in() ) {
284
  wp_send_json_error( 'ac_set_ajax_czr_tmpl => unauthenticated' );
317
  wp_send_json_success( apply_filters( 'tmpl_results', $html, $tmpl ) );
318
  }
319
  }
 
 
 
 
 
 
 
 
 
 
 
320
  function ac_get_all_modules_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
321
  $css_attr = $this -> czr_css_attr;
322
  if ( empty( $requested_tmpl ) ) {
357
  <span class="<?php echo $css_attr['remove_view_btn']; ?> button"><?php _e('Yes', 'nimble-builder'); ?></span> <span class="<?php echo $css_attr['cancel_alert_btn']; ?> button"><?php _e('No', 'nimble-builder'); ?></span>
358
  <?php
359
  break;
 
 
360
  case 'img-uploader' :
361
  ?>
362
  <?php // case when a regular attachement object is provided, fetched from an id with wp.media.attachment( id ) ?>
420
  endif;
421
 
422
  ?><?php
 
 
423
  if ( ! class_exists( 'CZR_Fmk_Base_Tmpl_Builder' ) ) :
424
  class CZR_Fmk_Base_Tmpl_Builder extends CZR_Fmk_Base_Ajax_Filter {
425
  /*********************************************************
426
  ** TMPL BUILDER
427
  *********************************************************/
 
 
 
428
  function ac_generate_czr_tmpl_from_map( $tmpl_map ) {
429
  $html = '';
430
  $default_input_entries = array(
435
  'notice_before' => '',
436
  'notice_after' => '',
437
  'placeholder' => '',
 
 
438
  'step' => '',
439
  'min' => '',
440
  'max' => '',
479
  wp_send_json_error( __FUNCTION__ . ' => wrong var type for the input_data of input id : ' . $input_id );
480
  break;
481
  }
 
482
  $maybe_diff = array_diff_key( $input_data, $default_input_entries );
483
  if ( ! empty( $maybe_diff ) ) {
484
  error_log('<' . __FUNCTION__ . '>');
485
  error_log( '=> at least one unknown param in the registered input params for input id : ' . $input_id );
486
  error_log( print_r( $maybe_diff, true ) );
487
  error_log('</' . __FUNCTION__ . '>');
 
488
  break;
489
  }
 
 
490
  $input_data = wp_parse_args( $input_data, $default_input_entries );
 
 
491
  if ( ! empty( $input_data[ 'tmpl_callback' ] ) && function_exists( $input_data[ 'tmpl_callback' ] ) ) {
492
  $html .= call_user_func_array( $input_data[ 'tmpl_callback' ], array( $input_data ) );
493
  } else {
497
  }
498
  return $html;////will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
499
  }
 
 
 
 
500
  function ac_get_default_input_tmpl( $input_id, $input_data ) {
501
  if ( ! array_key_exists( 'input_type', $input_data ) || empty( $input_data[ 'input_type' ] ) ) {
502
  wp_send_json_error( 'ac_get_input_tmpl => missing input type for input id : ' . $input_id );
503
  }
504
  $input_type = $input_data[ 'input_type' ];
 
 
505
  $is_width_100 = true === $input_data[ 'width-100' ];
506
  if ( in_array( $input_type, array( 'color', 'radio', 'textarea' ) ) ) {
507
  $is_width_100 = true;
510
  $css_attr = $this -> czr_css_attr;
511
 
512
  ob_start();
 
513
  printf( '<div class="%1$s %2$s %3$s" data-input-type="%4$s" %5$s>',
514
  $css_attr['sub_set_wrapper'],
515
  $is_width_100 ? 'width-100' : '',
517
  $input_type,
518
  ! empty( $input_data['transport'] ) ? 'data-transport="'. $input_data['transport'] .'"' : ''
519
  );
 
520
  if ( $input_type !== 'hidden' ) {
521
  printf( '<div class="customize-control-title %1$s">%2$s</div>', ! empty( $input_data['title_width'] ) ? $input_data['title_width'] : '', $input_data['title'] );
522
  }
531
  if ( ! empty( $input_data['input_template'] ) && is_string( $input_data['input_template'] ) ) {
532
  echo $input_data['input_template'];
533
  } else {
 
534
  $this -> ac_set_input_tmpl_content( $input_type, $input_id, $input_data );
535
  }
536
  ?>
540
  <?php endif; ?>
541
  </div> <?php //class="$css_attr['sub_set_wrapper']" ?>
542
  <?php
 
543
 
544
  $tmpl_html = apply_filters( "czr_set_input_tmpl___{$input_type}", ob_get_clean(), $input_id, $input_data );
 
545
  if ( empty( $tmpl_html ) ) {
546
  wp_send_json_error( 'ac_get_input_tmpl => no html returned for input ' . $input_id );
547
  }
548
  return $tmpl_html;
549
  }//ac_get_input_tmpl()
 
 
 
 
 
 
 
 
550
  private function ac_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
551
  $css_attr = $this -> czr_css_attr;
552
  $input_tmpl_content = null;
 
 
 
553
  ob_start();
554
  do_action( 'czr_set_input_tmpl_content', $input_type, $input_id, $input_data );
555
  $input_tmpl_content = ob_get_clean();
557
  if ( ! empty( $input_tmpl_content ) ) {
558
  echo $input_tmpl_content;
559
  } else {
 
560
  switch ( $input_type ) {
561
  /* ------------------------------------------------------------------------- *
562
  * HIDDEN
706
  * - no default input template is defined for the requested input type
707
  /* ------------------------------------------------------------------------- */
708
  default :
 
709
  wp_send_json_error( 'ERROR => ' . __CLASS__ . '::' . __FUNCTION__ . ' this input type has no template : ' . $input_type );
710
  break;
711
  }//switch ( $input_type ) {
716
  endif;
717
 
718
  ?><?php
 
 
719
  if ( ! class_exists( 'CZR_Fmk_Dyn_Setting_Registration' ) ) :
720
  class CZR_Fmk_Dyn_Setting_Registration extends CZR_Fmk_Base_Tmpl_Builder {
 
 
721
  function czr_setup_dynamic_settings_registration() {
722
  add_action( 'customize_register', array( $this, 'czr_setup_dynamic_setting_registration' ), 10 );
 
 
 
723
  add_filter( 'czr_fmk_dynamic_setting_js_params', array( $this, 'czr_setup_localized_params_for_dynamic_js_registration' ), 20 );
 
 
 
 
724
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
725
  function czr_pre_register_dynamic_setting( $setting_params ) {
726
  if ( ! is_array( $setting_params ) || empty( $setting_params ) ) {
727
  error_log( 'czr_pre_register_dynamic_setting => empty $setting_params submitted' );
731
  error_log( 'czr_pre_register_dynamic_setting => missing setting id' );
732
  return;
733
  }
 
 
734
  $setting_params = wp_parse_args( $setting_params, $this -> default_dynamic_setting_params );
735
 
736
  $registered = $this->registered_settings;
737
  $setting_id_candidate = $setting_params['setting_id'];
 
 
 
738
  if ( array_key_exists( $setting_id_candidate, $registered ) ) {
739
  error_log( 'czr_pre_register_dynamic_setting => setting id already registered => ' . $setting_id_candidate );
740
  return;
742
  $registered[ $setting_id_candidate ] = $setting_params;
743
  $this->registered_settings = $registered;
744
  }
 
 
 
 
 
 
 
 
745
  function czr_setup_dynamic_setting_registration( $wp_customize ) {
746
  add_filter( 'customize_dynamic_setting_args', array( $this, 'czr_setup_customizer_dynamic_setting_args' ), 10, 2 );
747
  add_filter( 'customize_dynamic_setting_class', array( $this, 'czr_setup_customizer_dynamic_setting_class' ), 10, 3 );
748
  }
 
 
749
  function czr_setup_customizer_dynamic_setting_args( $setting_args, $setting_id ) {
 
750
 
751
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
752
  return $setting_args;
 
 
753
  $registered_setting_args = $setting_args;
 
 
754
  foreach ( $this->registered_settings as $registerered_setting_id => $params ) {
755
 
756
  if ( array_key_exists('dynamic_registration', $params) && true !== $params['dynamic_registration'] ) {
770
  'sanitize_callback' => '',
771
  'validate_callback' => ''
772
  ) );
 
 
773
  $registered_setting_args = array(
774
  'type' => empty( $setting_args[ 'type' ] ) ? 'option' : $setting_args[ 'type' ],
775
  'default' => array(),
777
  'sanitize_callback' => ( ! empty( $setting_args[ 'sanitize_callback' ] ) && function_exists( $setting_args[ 'sanitize_callback' ] ) ) ? $setting_args[ 'sanitize_callback' ] : '',
778
  'validate_callback' => ( ! empty( $setting_args[ 'validate_callback' ] ) && function_exists( $setting_args[ 'validate_callback' ] ) ) ? $setting_args[ 'validate_callback' ] : ''
779
  );
 
 
 
 
780
  $module_params = $this -> czr_get_registered_dynamic_module( $params[ 'module_type' ] );
781
  if ( false !== $module_params && is_array( $module_params ) ) {
782
  if ( array_key_exists( 'validate_callback', $module_params ) && function_exists( $module_params[ 'validate_callback' ] ) ) {
786
  $registered_setting_args[ 'sanitize_callback' ] = $module_params[ 'sanitize_callback' ];
787
  }
788
  }
 
789
  }
790
  return $registered_setting_args;
791
  }
 
 
 
792
  function czr_setup_customizer_dynamic_setting_class( $class, $setting_id, $args ) {
793
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
794
  return $class;
 
 
 
795
  $registered_setting_class = $class;//'WP_Customize_Setting' by default
 
 
796
  foreach ( $this->registered_settings as $registerered_setting_id => $params ) {
797
  $params = wp_parse_args( $params, $this -> default_dynamic_setting_params );
798
  if ( true !== $params['dynamic_registration'] ) {
804
  $setting_args = $params['setting'];
805
 
806
  if ( is_array( $setting_args ) && array_key_exists( 'setting_class', $setting_args ) ) {
 
807
  if ( is_array( $setting_args[ 'setting_class' ] ) && array_key_exists( 'name', $setting_args[ 'setting_class' ] ) && array_key_exists( 'path', $setting_args[ 'setting_class' ] ) ) {
808
  if ( ! class_exists( $setting_args[ 'setting_class' ][ 'name' ] ) && file_exists( $setting_args[ 'setting_class' ]['path'] ) ) {
809
  require_once( $setting_args[ 'setting_class' ]['path'] );
813
  }
814
  }
815
  }
 
816
  }
817
 
818
  return $registered_setting_class;
819
  }
 
 
 
 
 
 
820
  function czr_setup_localized_params_for_dynamic_js_registration( $js_params ) {
 
 
 
821
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
822
  return $js_params;
823
  $js_params = ! is_array( $js_params ) ? array() : $js_params;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  foreach ( $this->registered_settings as $registerered_setting_id => $params ) {
825
  $params = wp_parse_args( $params, $this -> default_dynamic_setting_params );
 
826
  if ( ! array_key_exists( 'option_value', $params ) || ! is_array( $params['option_value'] ) )
827
  continue;
 
828
  if ( array_key_exists( $registerered_setting_id, $params ) ) {
829
  error_log( 'czr_setup_localized_params_for_dynamic_js_registration => js_params already setup for setting : ' . $registerered_setting_id );
830
  }
834
  'module_type' => $params[ 'module_type' ],
835
  'module_registration_params' => $this -> czr_get_registered_dynamic_module( $params[ 'module_type' ] ),
836
  'option_value' => $params['option_value'],
 
 
 
 
 
 
 
 
 
837
  'setting' => array_key_exists( 'setting', $params ) ? $params[ 'setting' ] : array(),
 
 
 
 
 
 
 
838
  'section' => array_key_exists( 'section', $params ) ? $params[ 'section' ] : array(),
 
 
 
 
 
 
 
839
  'control' => array_key_exists( 'control', $params ) ? $params[ 'control' ] : array(),
840
  );
841
  }
842
  return $js_params;
843
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
844
  function czr_register_not_dynamic_settings( $wp_customize ) {
 
 
 
845
 
846
  if ( ! is_array( $this->registered_settings ) || empty( $this->registered_settings ) )
847
  return;
 
 
848
  foreach ( $this->registered_settings as $setting_id => $params ) {
849
  $params = wp_parse_args( $params, $this -> default_dynamic_setting_params );
850
  if ( true === $params['dynamic_registration'] )
851
  continue;
 
 
 
852
  $setting_args = $params['setting'];
853
  $registered_setting_class = 'WP_Customize_Setting';
854
  if ( is_array( $setting_args ) && array_key_exists( 'setting_class', $setting_args ) ) {
 
855
  if ( is_array( $setting_args[ 'setting_class' ] ) && array_key_exists( 'name', $setting_args[ 'setting_class' ] ) && array_key_exists( 'path', $setting_args[ 'setting_class' ] ) ) {
856
  if ( ! class_exists( $setting_args[ 'setting_class' ][ 'name' ] ) && file_exists( $setting_args[ 'setting_class' ]['path'] ) ) {
857
  require_once( $setting_args[ 'setting_class' ]['path'] );
867
  'type' => $setting_args[ 'type' ],
868
  'sanitize_callback' => isset( $settings_args[ 'sanitize_callback' ] ) ? $settings_args[ 'sanitize_callback' ] : ''
869
  ) ) );
 
 
 
870
  $control_args = $params['control'];
871
  $registered_control_class = 'WP_Customize_Control';
872
  if ( is_array( $control_args ) && array_key_exists( 'control_class', $control_args ) ) {
 
873
  if ( is_array( $control_args[ 'control_class' ] ) && array_key_exists( 'name', $control_args[ 'control_class' ] ) && array_key_exists( 'path', $control_args[ 'control_class' ] ) ) {
874
  if ( ! class_exists( $control_args[ 'control_class' ][ 'name' ] ) && file_exists( $control_args[ 'control_class' ]['path'] ) ) {
875
  require_once( $control_args[ 'control_class' ]['path'] );
894
  endif;
895
 
896
  ?><?php
 
 
897
  if ( ! class_exists( 'CZR_Fmk_Dyn_Module_Registration' ) ) :
898
  class CZR_Fmk_Dyn_Module_Registration extends CZR_Fmk_Dyn_Setting_Registration {
 
 
899
  function czr_setup_dynamic_modules_registration() {
 
900
  add_action( 'init', array( $this, 'czr_schedule_ajax_tmpl' ) );
 
901
  add_action( 'customize_controls_enqueue_scripts' , array( $this, 'czr_register_dynamic_modules_customizer_control_assets' ) );
902
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
903
  function czr_pre_register_dynamic_module( $module_params ) {
 
 
 
904
 
905
  if ( ! is_array( $module_params ) || empty( $module_params ) ) {
906
  error_log( 'czr_pre_register_dynamic_module => empty $module_params submitted' );
910
  error_log( 'czr_pre_register_dynamic_module => missing module_type' );
911
  return;
912
  }
 
 
913
  $module_params = wp_parse_args( $module_params, $this -> default_dynamic_module_params );
914
 
915
  $registered = $this->registered_modules;
916
  $module_type_candidate = $module_params['module_type'];
 
 
 
917
  if ( array_key_exists( $module_type_candidate, $registered ) ) {
918
  error_log( 'czr_pre_register_dynamic_module => module type already registered => ' . $module_type_candidate );
919
  return;
921
  $registered[ $module_type_candidate ] = $module_params;
922
  $this->registered_modules = $registered;
923
  }
 
 
 
 
 
924
  function czr_get_registered_dynamic_module( $module_type = '' ) {
925
  $registered = $this->registered_modules;
926
  if ( empty( $module_type ) || ! is_array( $registered ) || empty( $registered ) )
927
  return;
928
  return array_key_exists( $module_type , $registered ) ? $registered[ $module_type ] : false;
929
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
  function czr_register_dynamic_modules_customizer_control_assets() {
931
  if ( ! is_array( $this->registered_modules ) || empty( $this->registered_modules ) )
932
  return;
933
 
934
  $wp_scripts = wp_scripts();
 
 
935
  foreach ( $this->registered_modules as $module_type => $params ) {
936
  $params = wp_parse_args( $params, $this -> default_dynamic_module_params );
 
937
  $control_js_params = $params[ 'customizer_assets' ][ 'control_js' ];
 
938
  if ( ! empty( $control_js_params ) ) {
939
  foreach ( $control_js_params as $handle => $script_args ) {
940
  if ( ! isset( $wp_scripts->registered[$handle] ) ) {
951
  }
952
 
953
  }
 
 
 
 
 
 
 
 
 
 
 
 
954
  if ( array_key_exists( 'localized_control_js', $params[ 'customizer_assets' ] ) ) {
955
  $localized_control_js_params = is_array( $params[ 'customizer_assets' ][ 'localized_control_js' ] ) ? $params[ 'customizer_assets' ][ 'localized_control_js' ] : array();
956
 
964
  }
965
  }//foreach
966
  }
 
 
 
 
 
 
967
  function czr_schedule_ajax_tmpl() {
968
  if ( ! is_array( $this->registered_modules ) || empty( $this->registered_modules ) )
969
  return;
972
  $params = wp_parse_args( $params, $this -> default_dynamic_module_params );
973
  if ( ! empty( $params['tmpl'] ) ) {
974
  $module_type = $params['module_type'];
 
975
  add_filter( "ac_set_ajax_czr_tmpl___{$module_type}", array( $this, 'ac_get_ajax_module_tmpl'), 10, 3 );
976
  }
977
  }//foreach
978
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
  function ac_get_ajax_module_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
 
 
 
 
 
 
 
980
  if ( ! is_array( $posted_params ) || empty( $posted_params ) ) {
981
  wp_send_json_error( 'ac_get_ajax_module_tmpl => empty posted_params' );
982
  }
983
  if ( ! array_key_exists( 'module_type', $posted_params ) || empty( $posted_params['module_type'] ) ) {
984
  wp_send_json_error( 'ac_get_ajax_module_tmpl => missing module_type' );
985
  }
 
 
 
 
 
986
  $registered_modules = $this->registered_modules;
987
  $module_type = $posted_params['module_type'];
988
  if ( ! array_key_exists( $module_type, $registered_modules ) || empty( $registered_modules[ $module_type ] ) ) {
991
 
992
  $module_params = $registered_modules[ $module_type ];
993
  $tmpl_params = $module_params[ 'tmpl' ];
 
994
  if ( empty( $tmpl_params ) ) {
995
  return;
996
  }
 
997
  $tmpl_map = array_key_exists( $requested_tmpl, $tmpl_params ) ? $tmpl_params[ $requested_tmpl ] : array();
998
  if ( empty( $tmpl_map ) ) {
999
  return;
1000
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1001
  if ( array_key_exists( 'tabs', $tmpl_map ) ) {
1002
  ob_start();
1003
  ?>
1005
  <nav>
1006
  <ul>
1007
  <?php
 
1008
  foreach ( $tmpl_map['tabs'] as $_key => $tab ) {
1009
  printf( '<li data-tab-id="section-topline-%1$s" %2$s><a href="#"><span>%3$s</span></a></li>',
1010
  $_key + 1,
1042
  * Customizer ajax content picker actions
1043
  *
1044
  */
 
1045
  if ( ! class_exists( 'CZR_Fmk_Base' ) ) :
1046
  class CZR_Fmk_Base extends CZR_Fmk_Dyn_Module_Registration {
 
 
1047
  public function czr_setup_content_picker_ajax_actions() {
1048
  if ( current_user_can( 'edit_theme_options' ) ) {
1049
  add_action( 'wp_ajax_load-available-content-items-customizer' , array( $this, 'ajax_load_available_items' ) );
1050
  add_action( 'wp_ajax_search-available-content-items-customizer' , array( $this, 'ajax_search_available_items' ) );
1051
  }
 
 
 
 
1052
  }
 
 
1053
  function czr_add_custom_item_to_ajax_results( $items, $page, $context ) {
1054
  if ( is_numeric( $page ) && $page < 1 ) {
1055
  return array_merge(
1069
  return $items;
1070
  }
1071
  }
 
 
 
1072
  function dont_use_fancy_permalinks() {
1073
  return '';
1074
  }
1101
  wp_send_json_error( 'czr_ajax_content_picker_missing_pagination_param' );
1102
  }
1103
 
 
 
1104
  $wp_object_types = json_decode( wp_unslash( $_POST['wp_object_types'] ), true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1105
  if ( ! is_array( $wp_object_types ) || empty( $wp_object_types ) ) {
1106
  wp_send_json_error( 'czr_ajax_content_picker_missing_object_types' );
1107
  }
1108
  $page = empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] );
 
 
 
 
1109
 
1110
  $items = array();
1111
 
1152
  * @return WP_Error|array Returns either a WP_Error object or an array of menu items.
1153
  */
1154
  public function load_available_items_query( $args ) {
 
1155
  $args = wp_parse_args( $args, array(
1156
  'type' => 'post',
1157
  'object_types' => '_all_',//could be page, post, or any CPT
1164
 
1165
  $items = array();
1166
  if ( 'post' === $type ) {
 
1167
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1168
  $post_types = get_post_types( array( 'public' => true ) );
1169
  } else {
1184
  foreach ( $posts as $post ) {
1185
  $post_title = $post->post_title;
1186
  if ( '' === $post_title ) {
 
1187
  $post_title = sprintf( __( '#%d (no title)', 'nimble-builder' ), $post->ID );
1188
  }
1189
  $items[] = array(
1197
  }
1198
 
1199
  } elseif ( 'taxonomy' === $type ) {
 
1200
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1201
  $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
1202
  } else {
1283
  $s = sanitize_text_field( wp_unslash( $_POST['search'] ) );
1284
 
1285
  $wp_object_types = json_decode( wp_unslash( $_POST['wp_object_types'] ), true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1286
  if ( ! is_array( $wp_object_types ) || empty( $wp_object_types ) ) {
1287
  wp_send_json_error( 'czr_ajax_content_picker_missing_object_types' );
1288
  }
1333
  * @return array Menu items.
1334
  */
1335
  public function search_available_items_query( $args = array() ) {
 
1336
  $args = wp_parse_args( $args, array(
1337
  'pagenum' => 1,
1338
  's' => '',
1340
  'object_types' => '_all_'//could be page, post, or any CPT
1341
  ) );
1342
  $object_types = $args['object_types'];
 
 
1343
  $items = array();
1344
  if ( 'post' === $args['type'] ) {
 
1345
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1346
  $post_types = get_post_types( array( 'public' => true ) );
1347
  } else {
1365
  if ( isset( $args['s'] ) ) {
1366
  $query['s'] = $args['s'];
1367
  }
 
 
1368
  $get_posts = new WP_Query( $query );
 
1369
  if ( $get_posts->post_count ) {
1370
  foreach ( $get_posts->posts as $post ) {
1371
  $post_title = $post->post_title;
1384
  }
1385
  }
1386
  } elseif ( 'taxonomy' === $args['type'] ) {
 
1387
  if ( '_all_' == $object_types || ! is_array( $object_types ) || ( is_array( $object_types ) && empty( $object_types ) ) ) {
1388
  $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
1389
  } else {
1397
  'number' => 10,
1398
  'offset' => 10 * ( $args['pagenum'] - 1 )
1399
  ) );
 
 
1400
  if ( ! empty( $terms ) ) {
1401
  foreach ( $terms as $term ) {
1402
  $items[] = array(
1430
  */
1431
  function czr_get_parent_theme_slug() {
1432
  $theme_slug = get_option( 'stylesheet' );
 
1433
  $theme_slug = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : $theme_slug; //old wp versions
1434
  $theme_slug = isset($_REQUEST['customize_theme']) ? $_REQUEST['customize_theme'] : $theme_slug;
 
 
1435
  $theme_data = wp_get_theme( $theme_slug );
1436
  if ( $theme_data -> parent() ) {
1437
  $theme_slug = $theme_data -> parent() -> Name;
1439
 
1440
  return sanitize_file_name( strtolower( $theme_slug ) );
1441
  }
 
 
 
1442
  function czr_is_multi_item_module( $module_type ) {
1443
  $is_multi_item = false;
1444
  $module_params = CZR_Fmk_Base() -> czr_get_registered_dynamic_module( $module_type );
1452
  }
1453
  return $is_multi_item;
1454
  }
 
 
 
 
 
 
 
 
 
1455
  function CZR_Fmk_Base( $params = array() ) {
1456
  return CZR_Fmk_Base::czr_fmk_get_instance( $params );
1457
  }
inc/czr-skope/index.php CHANGED
@@ -6,21 +6,13 @@ if ( did_action('nimble_skope_loaded') ) {
6
  }
7
  return;
8
  }
9
-
10
- // Set the namsepace as a global so we can use it when fired from another theme/plugin using the fmk
11
  global $czr_skope_namespace;
12
  $czr_skope_namespace = __NAMESPACE__ . '\\';
13
 
14
  do_action( 'nimble_skope_loaded' );
15
-
16
- //Creates a new instance
17
  function Flat_Skop_Base( $params = array() ) {
18
  return Flat_Skop_Base::skp_get_instance( $params );
19
  }
20
-
21
- /////////////////////////////////////////////////////////////////
22
- // <DEFINITIONS>
23
- // THE SKOPE MODEL
24
  function skp_get_default_skope_model() {
25
  return array(
26
  'title' => '',
@@ -28,26 +20,15 @@ function skp_get_default_skope_model() {
28
  'ctx_title' => '',
29
  'id' => '',
30
  'skope' => '',
31
- //'level' => '',
32
  'obj_id' => '',
33
  'skope_id' => '',
34
  'values' => ''
35
  );
36
  }
37
-
38
-
39
- // those contexts have no group
40
  function skp_get_no_group_skope_list() {
41
  return array( 'home', 'search', '404', 'date' );
42
  }
43
 
44
- /////////////////////////////////////////////////////////////////
45
- // </DEFINITIONS>
46
-
47
-
48
- /////////////////////////////////////////////////////////////////
49
- // HELPERS
50
-
51
  function skp_trim_text( $text, $text_length, $more ) {
52
  if ( ! $text )
53
  return '';
@@ -66,15 +47,6 @@ function skp_trim_text( $text, $text_length, $more ) {
66
  }
67
  return ( ( $end_substr < $text_length ) && $more ) ? $text : $text . ' ' .$more ;
68
  }
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
- /////////////////////////////////////////////////////////////////
77
- // SKOPE HELPERS
78
  /**
79
  * Return the current skope
80
  * Front / Back agnostic.
@@ -91,19 +63,7 @@ function skp_trim_text( $text, $text_length, $more ) {
91
  * @return a string of all concatenated ctx parts (default) 0R an array of the ctx parts
92
  */
93
  function skp_get_skope( $_requesting_wot = null, $_return_string = true, $requested_parts = array() ) {
94
- //skope builder from the wp $query
95
- //=> returns :
96
- // the meta_type : post, tax, user
97
- // the type : post_type, taxonomy name, author
98
- // the id : post id, term id, user id
99
-
100
- // if $parts are provided, use them.
101
  $parts = ( is_array( $requested_parts ) && ! empty( $requested_parts ) ) ? $requested_parts : skp_get_query_skope();
102
- // if ( is_array( $requested_parts ) && ! empty( $requested_parts ) ) {
103
- // error_log( '<SKOPE PARTS>' );
104
- // error_log( print_r( $parts, true ) );
105
- // error_log( '</SKOPE PARTS>' );
106
- // }
107
  $_return = array();
108
  $meta_type = $type = $obj_id = '';
109
 
@@ -133,40 +93,26 @@ function skp_get_skope( $_requesting_wot = null, $_return_string = true, $reques
133
  break;
134
 
135
  default:
136
- //LOCAL
137
- //here we don't check if there's a type this is the case where there must be one when a meta type (post, tax, user) is defined.
138
- //typically the skope will look like post_page_25
139
  if ( false !== $meta_type && false !== $obj_id ) {
140
  $_return = array( "meta_type" => "{$meta_type}" , "type" => "{$type}", "id" => "{$obj_id}" );
141
  }
142
- //GROUP
143
  else if ( false !== $meta_type && ! $obj_id ) {
144
  $_return = array( "meta_type" => "{$meta_type}", "type" => "{$type}" );
145
  }
146
- //LOCAL WITH NO GROUP : home, 404, search, date, post type archive
147
  else if ( false !== $obj_id ) {
148
  $_return = array( "id" => "{$obj_id}" );
149
  }
150
  break;
151
  }
152
-
153
- //return the parts array if not a string requested
154
  if ( ! $_return_string ) {
155
  return $_return;
156
  }
157
-
158
- //don't go further if not an array or empty
159
  if ( ! is_array( $_return ) || ( is_array( $_return ) && empty( $_return ) ) ) {
160
  return '';
161
  }
162
-
163
- //if a specific part of the ctx is requested, don't concatenate
164
- //return the part if exists
165
  if ( ! is_null( $_requesting_wot ) ) {
166
  return isset( $_return[ $_requesting_wot ] ) ? $_return[ $_requesting_wot ] : '';
167
  }
168
-
169
- //generate the ctx string from the array of ctx_parts
170
  $_concat = "";
171
  foreach ( $_return as $_key => $_part ) {
172
  if ( empty( $_concat) ) {
@@ -186,7 +132,6 @@ function skp_get_skope( $_requesting_wot = null, $_return_string = true, $reques
186
  * @return array of ctx parts
187
  */
188
  function skp_get_query_skope() {
189
- //don't call get_queried_object if the $query is not defined yet
190
  global $wp_the_query;
191
  if ( ! isset( $wp_the_query ) || empty( $wp_the_query ) )
192
  return array();
@@ -198,30 +143,22 @@ function skp_get_query_skope() {
198
 
199
 
200
  if ( is_object( $current_obj ) ) {
201
- //post, custom post types, page
202
  if ( isset($current_obj -> post_type) ) {
203
  $meta_type = 'post';
204
  $type = $current_obj -> post_type;
205
  $obj_id = $current_obj -> ID;
206
  }
207
-
208
- //taxinomies : tags, categories, custom tax type
209
  if ( isset($current_obj -> taxonomy) && isset($current_obj -> term_id) ) {
210
  $meta_type = 'tax';
211
  $type = $current_obj -> taxonomy;
212
  $obj_id = $current_obj -> term_id;
213
  }
214
  }
215
-
216
- //author archive page
217
  if ( is_author() ) {
218
  $meta_type = 'user';
219
  $type = 'author';
220
  $obj_id = $wp_the_query ->get( 'author' );
221
  }
222
-
223
- //SKOPES WITH NO GROUPS
224
- //post type archive object
225
  if ( is_post_type_archive() ) {
226
  $obj_id = 'post_type_archive' . '_'. $wp_the_query ->get( 'post_type' );
227
  }
@@ -236,13 +173,7 @@ function skp_get_query_skope() {
236
 
237
  return apply_filters( 'skp_get_query_skope' , array( 'meta_type' => $meta_type , 'type' => $type , 'obj_id' => $obj_id ) , $current_obj );
238
  }
239
-
240
-
241
- //@return the skope prefix used both when customizing and on front
242
  function skp_get_skope_id( $level = 'local' ) {
243
- // CACHE THE SKOPE WHEN 'wp' DONE
244
- // the skope id is used when filtering the options, called hundreds of times.
245
- // We'll get hight performances with a cached value instead of using the skp_get_skope_id() function on each call.
246
  $new_skope_ids = array( 'local' => '_skope_not_set_', 'group' => '_skope_not_set_' );
247
  if ( did_action( 'wp' ) ) {
248
  if ( empty( Flat_Skop_Base() -> current_skope_ids ) ) {
@@ -252,9 +183,6 @@ function skp_get_skope_id( $level = 'local' ) {
252
  Flat_Skop_Base() -> current_skope_ids = $new_skope_ids;
253
 
254
  $skope_id_to_return = $new_skope_ids[ $level ];
255
- // error_log('<SKOPE ID cached in skp_get_skope_id>');
256
- // error_log( print_r( $new_skope_ids, true ) );
257
- // error_log('</SKOPE ID cached in skp_get_skope_id>');
258
  } else {
259
  $new_skope_ids = Flat_Skop_Base() -> current_skope_ids;
260
  $skope_id_to_return = $new_skope_ids[ $level ];
@@ -262,33 +190,18 @@ function skp_get_skope_id( $level = 'local' ) {
262
  } else {
263
  $skope_id_to_return = array_key_exists( $level, $new_skope_ids ) ? $new_skope_ids[ $level ] : '_skope_not_set_';
264
  }
265
- // error_log('$skope_id_to_return => ' . $level . ' ' . $skope_id_to_return );
266
- // error_log( print_r( Flat_Skop_Base() -> current_skope_ids , true ) );
267
  return $skope_id_to_return;
268
  }
269
-
270
- //@param args = array(
271
- // 'skope_string' => skp_get_skope(),
272
- // 'skope_type' => $skp_type,
273
- // 'skope_level' => 'local'
274
- //)
275
- //@return string
276
  function skp_build_skope_id( $args = array() ) {
277
  $skope_id = '_skope_not_set_';
278
-
279
- // normalizes
280
  $args = is_array( $args ) ? $args : array();
281
  $args = wp_parse_args(
282
  $args,
283
  array( 'skope_string' => '', 'skope_type' => '', 'skope_level' => '' )
284
  );
285
-
286
- // set params if not provided
287
  $args['skope_level'] = empty( $args['skope_level'] ) ? 'local' : $args['skope_level'];
288
  $args['skope_string'] = ( 'local' == $args['skope_level'] && empty( $args['skope_string'] ) ) ? skp_get_skope() : $args['skope_string'];
289
  $args['skope_type'] = ( 'group' == $args['skope_level'] && empty( $args['skope_type'] ) ) ? skp_get_skope( 'type' ) : $args['skope_type'];
290
-
291
- // generate skope_id for two cases : local or group
292
  switch( $args[ 'skope_level'] ) {
293
  case 'local' :
294
  $skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . $args[ 'skope_string' ] );
@@ -391,26 +304,18 @@ function skp_get_skope_title( $args = array() ) {
391
  $title = ucfirst( $title );
392
  return skp_trim_text( $title, $long ? 45 : 28, '...');
393
  }
394
-
395
- //@return bool
396
- //=> tells if the current skope is part of the ones without group
397
  function skp_skope_has_no_group( $meta_type ) {
398
  return in_array(
399
  $meta_type,
400
  skp_get_no_group_skope_list()
401
  ) || is_post_type_archive();
402
  }
403
-
404
- //@return bool
405
- //Tells if the current skope has a group level
406
  function skp_skope_has_a_group( $meta_type ) {
407
  return in_array(
408
  $meta_type,
409
  array('post', 'tax', 'user')
410
  );
411
  }
412
-
413
- //@return bool
414
  function skp_is_real_home() {
415
  return ( is_home() && ( 'posts' == get_option( 'show_on_front' ) || '__nothing__' == get_option( 'show_on_front' ) ) )
416
  || ( 0 == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) )//<= this is the case when the user want to display a page on home but did not pick a page yet
@@ -422,20 +327,14 @@ function skp_is_real_home() {
422
  * Returns a boolean
423
  */
424
  function skp_is_customizing() {
425
- //checks if is customizing : two contexts, admin and front (preview frame)
426
  global $pagenow;
427
  $_is_ajaxing_from_customizer = isset( $_POST['customized'] ) || isset( $_POST['wp_customize'] );
428
 
429
  $is_customizing = false;
430
- //hu_is_customize_left_panel() ?
431
  if ( is_admin() && isset( $pagenow ) && 'customize.php' == $pagenow ) {
432
  $is_customizing = true;
433
- //hu_is_customize_preview_frame() ?
434
- // Note : is_customize_preview() is not able to differentiate when previewing in the customizer and when previewing a changeset draft.
435
- // @todo => change this
436
  } else if ( is_customize_preview() || ( ! is_admin() && isset($_REQUEST['customize_messenger_channel']) ) ) {
437
  $is_customizing = true;
438
- // hu_doing_customizer_ajax()
439
  } else if ( $_is_ajaxing_from_customizer && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
440
  $is_customizing = true;
441
  }
@@ -457,9 +356,6 @@ function skp_is_previewing_live_changeset() {
457
  return ! isset( $_POST['customize_messenger_channel']) && is_customize_preview();
458
  }
459
  ?><?php
460
-
461
- ////////////////////////////////////////////////////////////////
462
- // FLAT SKOPE BASE
463
  if ( ! class_exists( 'Flat_Skop_Base' ) ) :
464
  class Flat_Skop_Base {
465
  static $instance;
@@ -485,11 +381,8 @@ if ( ! class_exists( 'Flat_Skop_Base' ) ) :
485
  }
486
  endif;
487
  ?><?php
488
- /////////////////////////////////////////////////////////////////
489
- // PRINT CUSTOMIZER JAVASCRIPT + LOCALIZED DATA
490
  if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
491
  class Flat_Skop_Register_And_Load_Control_Assets extends Flat_Skop_Base {
492
- // Fired in Flat_Skop_Base::__construct()
493
  public function skp_register_and_load_control_assets() {
494
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'skp_enqueue_controls_js_css' ), 20 );
495
  }
@@ -497,7 +390,6 @@ if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
497
  public function skp_enqueue_controls_js_css() {
498
  $_use_unminified = defined('CZR_DEV')
499
  && true === CZR_DEV
500
- // && false === strpos( dirname( dirname( dirname (__FILE__) ) ) , 'inc/wfc' )
501
  && file_exists( sprintf( '%s/assets/czr/js/czr-skope-base.js' , dirname( __FILE__ ) ) );
502
 
503
  $_prod_script_path = sprintf(
@@ -508,7 +400,6 @@ if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
508
 
509
  wp_enqueue_script(
510
  'czr-skope-base',
511
- //dev / debug mode mode?
512
  $_prod_script_path,
513
  array('customize-controls' , 'jquery', 'underscore'),
514
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : wp_get_theme() -> version,
@@ -534,21 +425,15 @@ endif;
534
  /* ------------------------------------------------------------------------- */
535
  if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
536
  class Flat_Export_Skope_Data_And_Send_To_Panel extends Flat_Skop_Register_And_Load_Control_Assets {
537
- // Fired in Flat_Skop_Base::__construct()
538
  public function skp_export_skope_data_and_schedule_sending_to_panel() {
539
  add_action( 'wp_footer', array( $this, 'skp_print_server_skope_data') , 30 );
540
  }
541
-
542
-
543
- //hook : 'wp_footer'
544
  public function skp_print_server_skope_data() {
545
  if ( ! skp_is_customize_preview_frame() )
546
  return;
547
 
548
  global $wp_query, $wp_customize;
549
  $_meta_type = skp_get_skope( 'meta_type', true );
550
-
551
- // $_czr_scopes = array( );
552
  $_czr_skopes = $this->_skp_get_json_export_ready_skopes();
553
  ?>
554
  <script type="text/javascript" id="czr-print-skop">
@@ -576,30 +461,10 @@ if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
576
  /* ------------------------------------------------------------------------- *
577
  * CUSTOMIZE PREVIEW : BUILD SKOPES JSON
578
  /* ------------------------------------------------------------------------- */
579
- //generates the array of available scopes for a given context
580
- //ex for a single post tagged #tag1 and #tag2 and categroized #cat1 :
581
- //global
582
- //all posts
583
- //local
584
- //posts tagged #tag1
585
- //posts tagged #tag2
586
- //posts categorized #cat1
587
- //@return array()
588
- //
589
- //skp_get_skope_title() takes the following default args
590
- //array(
591
- // 'level' => '',
592
- // 'meta_type' => null,
593
- // 'long' => false,
594
- // 'is_prefixed' => true
595
- //)
596
  private function _skp_get_json_export_ready_skopes() {
597
  $skopes = array();
598
  $_meta_type = skp_get_skope( 'meta_type', true );
599
-
600
- //default properties of the scope object
601
  $defaults = skp_get_default_skope_model();
602
- //global and local and always sent
603
  $skopes[] = wp_parse_args(
604
  array(
605
  'title' => skp_get_skope_title( array( 'level' => 'global' ) ),
@@ -610,14 +475,6 @@ if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
610
  ),
611
  $defaults
612
  );
613
-
614
-
615
- //SPECIAL GROUPS
616
- //@todo
617
-
618
-
619
- //GROUP
620
- //Do we have a group ? => if yes, then there must be a meta type
621
  if ( skp_get_skope('meta_type') ) {
622
  $skopes[] = wp_parse_args(
623
  array(
@@ -631,9 +488,6 @@ if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
631
  $defaults
632
  );
633
  }
634
-
635
-
636
- //LOCAL
637
  $skopes[] = wp_parse_args(
638
  array(
639
  'title' => skp_get_skope_title( array( 'level' => 'local', 'meta_type' => $_meta_type ) ),
@@ -655,101 +509,56 @@ endif;
655
 
656
  if ( ! class_exists( 'Flat_Skope_Clean_Final' ) ) :
657
  final class Flat_Skope_Clean_Final extends Flat_Export_Skope_Data_And_Send_To_Panel {
658
- // Fired in Flat_Skop_Base::__construct()
659
  public function skp_schedule_cleaning_on_object_delete() {
660
  add_action( 'delete_post', array( $this, 'skp_clean_skopified_posts' ) );
661
  add_action( 'delete_term_taxonomy', array( $this, 'skp_clean_skopified_taxonomies' ) );
662
  add_action( 'delete_user', array( $this, 'skp_clean_skopified_users' ) );
663
  }
664
-
665
-
666
- // Clean any associated skope post for all public post types : post, page, public cpt
667
- // 'delete_post' Fires immediately before a post is deleted from the database.
668
- // @see wp-includes/post.php
669
- // don't have to return anything
670
  public function skp_clean_skopified_posts( $postid ) {
671
  $deletion_candidate = get_post( $postid );
672
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
673
  return;
674
-
675
- // Stop here if the post type is not considered "viewable".
676
- // For built-in post types such as posts and pages, the 'public' value will be evaluated.
677
- // For all others, the 'publicly_queryable' value will be used.
678
- // For example, the 'revision' post type, which is purely internal and not skopable, won't pass this test.
679
  if ( ! is_post_type_viewable( $deletion_candidate -> post_type ) )
680
  return;
681
-
682
- // Force the skope parts normally retrieved with skp_get_query_skope()
683
  $skope_string = skp_get_skope( null, true, array(
684
  'meta_type' => 'post',
685
  'type' => $deletion_candidate -> post_type,
686
  'obj_id' => $postid
687
  ) );
688
-
689
- // build a skope_id with the normalized function
690
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
691
-
692
- // fetch the skope post id which, if exists, is set as a theme mod
693
  $skope_post_id_candidate = get_theme_mod( $skope_id );
694
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
695
- // permanently delete the skope post from db
696
  wp_delete_post( $skope_post_id_candidate );
697
- // remove the theme_mod
698
  remove_theme_mod( $skope_id );
699
  }
700
  }
701
-
702
-
703
- // 'delete_term_taxonomy' Fires immediately before a term taxonomy ID is deleted.
704
  public function skp_clean_skopified_taxonomies( $term_id ) {
705
  $deletion_candidate = get_term( $term_id );
706
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
707
  return;
708
-
709
- //error_log( print_r( $deletion_candidate, true ) );
710
-
711
- // Force the skope parts normally retrieved with skp_get_query_skope()
712
  $skope_string = skp_get_skope( null, true, array(
713
  'meta_type' => 'tax',
714
  'type' => $deletion_candidate -> taxonomy,
715
  'obj_id' => $term_id
716
  ) );
717
-
718
- // build a skope_id with the normalized function
719
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
720
-
721
- // fetch the skope post id which, if exists, is set as a theme mod
722
  $skope_post_id_candidate = get_theme_mod( $skope_id );
723
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
724
- // permanently delete the skope post from db
725
  wp_delete_post( $skope_post_id_candidate );
726
- // remove the theme_mod
727
  remove_theme_mod( $skope_id );
728
- //error_log( 'SUCCESSFULLY REMOVED SKOPE POST ID ' . $skope_post_id_candidate . ' AND THEME MOD ' . $skope_id );
729
  }
730
  }
731
-
732
-
733
- // 'delete_user' Fires immediately before a user is deleted from the database.
734
  public function skp_clean_skopified_users( $user_id ) {
735
- // Force the skope parts normally retrieved with skp_get_query_skope()
736
  $skope_string = skp_get_skope( null, true, array(
737
  'meta_type' => 'user',
738
  'type' => 'author',
739
  'obj_id' => $user_id
740
  ) );
741
-
742
- // build a skope_id with the normalized function
743
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
744
-
745
- // fetch the skope post id which, if exists, is set as a theme mod
746
  $skope_post_id_candidate = get_theme_mod( $skope_id );
747
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
748
- // permanently delete the skope post from db
749
  wp_delete_post( $skope_post_id_candidate );
750
- // remove the theme_mod
751
  remove_theme_mod( $skope_id );
752
- //error_log( 'SUCCESSFULLY REMOVED SKOPE POST ID ' . $skope_post_id_candidate . ' AND THEME MOD ' . $skope_id );
753
  }
754
  }
755
  }//class
6
  }
7
  return;
8
  }
 
 
9
  global $czr_skope_namespace;
10
  $czr_skope_namespace = __NAMESPACE__ . '\\';
11
 
12
  do_action( 'nimble_skope_loaded' );
 
 
13
  function Flat_Skop_Base( $params = array() ) {
14
  return Flat_Skop_Base::skp_get_instance( $params );
15
  }
 
 
 
 
16
  function skp_get_default_skope_model() {
17
  return array(
18
  'title' => '',
20
  'ctx_title' => '',
21
  'id' => '',
22
  'skope' => '',
 
23
  'obj_id' => '',
24
  'skope_id' => '',
25
  'values' => ''
26
  );
27
  }
 
 
 
28
  function skp_get_no_group_skope_list() {
29
  return array( 'home', 'search', '404', 'date' );
30
  }
31
 
 
 
 
 
 
 
 
32
  function skp_trim_text( $text, $text_length, $more ) {
33
  if ( ! $text )
34
  return '';
47
  }
48
  return ( ( $end_substr < $text_length ) && $more ) ? $text : $text . ' ' .$more ;
49
  }
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Return the current skope
52
  * Front / Back agnostic.
63
  * @return a string of all concatenated ctx parts (default) 0R an array of the ctx parts
64
  */
65
  function skp_get_skope( $_requesting_wot = null, $_return_string = true, $requested_parts = array() ) {
 
 
 
 
 
 
 
66
  $parts = ( is_array( $requested_parts ) && ! empty( $requested_parts ) ) ? $requested_parts : skp_get_query_skope();
 
 
 
 
 
67
  $_return = array();
68
  $meta_type = $type = $obj_id = '';
69
 
93
  break;
94
 
95
  default:
 
 
 
96
  if ( false !== $meta_type && false !== $obj_id ) {
97
  $_return = array( "meta_type" => "{$meta_type}" , "type" => "{$type}", "id" => "{$obj_id}" );
98
  }
 
99
  else if ( false !== $meta_type && ! $obj_id ) {
100
  $_return = array( "meta_type" => "{$meta_type}", "type" => "{$type}" );
101
  }
 
102
  else if ( false !== $obj_id ) {
103
  $_return = array( "id" => "{$obj_id}" );
104
  }
105
  break;
106
  }
 
 
107
  if ( ! $_return_string ) {
108
  return $_return;
109
  }
 
 
110
  if ( ! is_array( $_return ) || ( is_array( $_return ) && empty( $_return ) ) ) {
111
  return '';
112
  }
 
 
 
113
  if ( ! is_null( $_requesting_wot ) ) {
114
  return isset( $_return[ $_requesting_wot ] ) ? $_return[ $_requesting_wot ] : '';
115
  }
 
 
116
  $_concat = "";
117
  foreach ( $_return as $_key => $_part ) {
118
  if ( empty( $_concat) ) {
132
  * @return array of ctx parts
133
  */
134
  function skp_get_query_skope() {
 
135
  global $wp_the_query;
136
  if ( ! isset( $wp_the_query ) || empty( $wp_the_query ) )
137
  return array();
143
 
144
 
145
  if ( is_object( $current_obj ) ) {
 
146
  if ( isset($current_obj -> post_type) ) {
147
  $meta_type = 'post';
148
  $type = $current_obj -> post_type;
149
  $obj_id = $current_obj -> ID;
150
  }
 
 
151
  if ( isset($current_obj -> taxonomy) && isset($current_obj -> term_id) ) {
152
  $meta_type = 'tax';
153
  $type = $current_obj -> taxonomy;
154
  $obj_id = $current_obj -> term_id;
155
  }
156
  }
 
 
157
  if ( is_author() ) {
158
  $meta_type = 'user';
159
  $type = 'author';
160
  $obj_id = $wp_the_query ->get( 'author' );
161
  }
 
 
 
162
  if ( is_post_type_archive() ) {
163
  $obj_id = 'post_type_archive' . '_'. $wp_the_query ->get( 'post_type' );
164
  }
173
 
174
  return apply_filters( 'skp_get_query_skope' , array( 'meta_type' => $meta_type , 'type' => $type , 'obj_id' => $obj_id ) , $current_obj );
175
  }
 
 
 
176
  function skp_get_skope_id( $level = 'local' ) {
 
 
 
177
  $new_skope_ids = array( 'local' => '_skope_not_set_', 'group' => '_skope_not_set_' );
178
  if ( did_action( 'wp' ) ) {
179
  if ( empty( Flat_Skop_Base() -> current_skope_ids ) ) {
183
  Flat_Skop_Base() -> current_skope_ids = $new_skope_ids;
184
 
185
  $skope_id_to_return = $new_skope_ids[ $level ];
 
 
 
186
  } else {
187
  $new_skope_ids = Flat_Skop_Base() -> current_skope_ids;
188
  $skope_id_to_return = $new_skope_ids[ $level ];
190
  } else {
191
  $skope_id_to_return = array_key_exists( $level, $new_skope_ids ) ? $new_skope_ids[ $level ] : '_skope_not_set_';
192
  }
 
 
193
  return $skope_id_to_return;
194
  }
 
 
 
 
 
 
 
195
  function skp_build_skope_id( $args = array() ) {
196
  $skope_id = '_skope_not_set_';
 
 
197
  $args = is_array( $args ) ? $args : array();
198
  $args = wp_parse_args(
199
  $args,
200
  array( 'skope_string' => '', 'skope_type' => '', 'skope_level' => '' )
201
  );
 
 
202
  $args['skope_level'] = empty( $args['skope_level'] ) ? 'local' : $args['skope_level'];
203
  $args['skope_string'] = ( 'local' == $args['skope_level'] && empty( $args['skope_string'] ) ) ? skp_get_skope() : $args['skope_string'];
204
  $args['skope_type'] = ( 'group' == $args['skope_level'] && empty( $args['skope_type'] ) ) ? skp_get_skope( 'type' ) : $args['skope_type'];
 
 
205
  switch( $args[ 'skope_level'] ) {
206
  case 'local' :
207
  $skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . $args[ 'skope_string' ] );
304
  $title = ucfirst( $title );
305
  return skp_trim_text( $title, $long ? 45 : 28, '...');
306
  }
 
 
 
307
  function skp_skope_has_no_group( $meta_type ) {
308
  return in_array(
309
  $meta_type,
310
  skp_get_no_group_skope_list()
311
  ) || is_post_type_archive();
312
  }
 
 
 
313
  function skp_skope_has_a_group( $meta_type ) {
314
  return in_array(
315
  $meta_type,
316
  array('post', 'tax', 'user')
317
  );
318
  }
 
 
319
  function skp_is_real_home() {
320
  return ( is_home() && ( 'posts' == get_option( 'show_on_front' ) || '__nothing__' == get_option( 'show_on_front' ) ) )
321
  || ( 0 == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) )//<= this is the case when the user want to display a page on home but did not pick a page yet
327
  * Returns a boolean
328
  */
329
  function skp_is_customizing() {
 
330
  global $pagenow;
331
  $_is_ajaxing_from_customizer = isset( $_POST['customized'] ) || isset( $_POST['wp_customize'] );
332
 
333
  $is_customizing = false;
 
334
  if ( is_admin() && isset( $pagenow ) && 'customize.php' == $pagenow ) {
335
  $is_customizing = true;
 
 
 
336
  } else if ( is_customize_preview() || ( ! is_admin() && isset($_REQUEST['customize_messenger_channel']) ) ) {
337
  $is_customizing = true;
 
338
  } else if ( $_is_ajaxing_from_customizer && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
339
  $is_customizing = true;
340
  }
356
  return ! isset( $_POST['customize_messenger_channel']) && is_customize_preview();
357
  }
358
  ?><?php
 
 
 
359
  if ( ! class_exists( 'Flat_Skop_Base' ) ) :
360
  class Flat_Skop_Base {
361
  static $instance;
381
  }
382
  endif;
383
  ?><?php
 
 
384
  if ( ! class_exists( 'Flat_Skop_Register_And_Load_Control_Assets' ) ) :
385
  class Flat_Skop_Register_And_Load_Control_Assets extends Flat_Skop_Base {
 
386
  public function skp_register_and_load_control_assets() {
387
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'skp_enqueue_controls_js_css' ), 20 );
388
  }
390
  public function skp_enqueue_controls_js_css() {
391
  $_use_unminified = defined('CZR_DEV')
392
  && true === CZR_DEV
 
393
  && file_exists( sprintf( '%s/assets/czr/js/czr-skope-base.js' , dirname( __FILE__ ) ) );
394
 
395
  $_prod_script_path = sprintf(
400
 
401
  wp_enqueue_script(
402
  'czr-skope-base',
 
403
  $_prod_script_path,
404
  array('customize-controls' , 'jquery', 'underscore'),
405
  ( defined('WP_DEBUG') && true === WP_DEBUG ) ? time() : wp_get_theme() -> version,
425
  /* ------------------------------------------------------------------------- */
426
  if ( ! class_exists( 'Flat_Export_Skope_Data_And_Send_To_Panel' ) ) :
427
  class Flat_Export_Skope_Data_And_Send_To_Panel extends Flat_Skop_Register_And_Load_Control_Assets {
 
428
  public function skp_export_skope_data_and_schedule_sending_to_panel() {
429
  add_action( 'wp_footer', array( $this, 'skp_print_server_skope_data') , 30 );
430
  }
 
 
 
431
  public function skp_print_server_skope_data() {
432
  if ( ! skp_is_customize_preview_frame() )
433
  return;
434
 
435
  global $wp_query, $wp_customize;
436
  $_meta_type = skp_get_skope( 'meta_type', true );
 
 
437
  $_czr_skopes = $this->_skp_get_json_export_ready_skopes();
438
  ?>
439
  <script type="text/javascript" id="czr-print-skop">
461
  /* ------------------------------------------------------------------------- *
462
  * CUSTOMIZE PREVIEW : BUILD SKOPES JSON
463
  /* ------------------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  private function _skp_get_json_export_ready_skopes() {
465
  $skopes = array();
466
  $_meta_type = skp_get_skope( 'meta_type', true );
 
 
467
  $defaults = skp_get_default_skope_model();
 
468
  $skopes[] = wp_parse_args(
469
  array(
470
  'title' => skp_get_skope_title( array( 'level' => 'global' ) ),
475
  ),
476
  $defaults
477
  );
 
 
 
 
 
 
 
 
478
  if ( skp_get_skope('meta_type') ) {
479
  $skopes[] = wp_parse_args(
480
  array(
488
  $defaults
489
  );
490
  }
 
 
 
491
  $skopes[] = wp_parse_args(
492
  array(
493
  'title' => skp_get_skope_title( array( 'level' => 'local', 'meta_type' => $_meta_type ) ),
509
 
510
  if ( ! class_exists( 'Flat_Skope_Clean_Final' ) ) :
511
  final class Flat_Skope_Clean_Final extends Flat_Export_Skope_Data_And_Send_To_Panel {
 
512
  public function skp_schedule_cleaning_on_object_delete() {
513
  add_action( 'delete_post', array( $this, 'skp_clean_skopified_posts' ) );
514
  add_action( 'delete_term_taxonomy', array( $this, 'skp_clean_skopified_taxonomies' ) );
515
  add_action( 'delete_user', array( $this, 'skp_clean_skopified_users' ) );
516
  }
 
 
 
 
 
 
517
  public function skp_clean_skopified_posts( $postid ) {
518
  $deletion_candidate = get_post( $postid );
519
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
520
  return;
 
 
 
 
 
521
  if ( ! is_post_type_viewable( $deletion_candidate -> post_type ) )
522
  return;
 
 
523
  $skope_string = skp_get_skope( null, true, array(
524
  'meta_type' => 'post',
525
  'type' => $deletion_candidate -> post_type,
526
  'obj_id' => $postid
527
  ) );
 
 
528
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
 
 
529
  $skope_post_id_candidate = get_theme_mod( $skope_id );
530
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
 
531
  wp_delete_post( $skope_post_id_candidate );
 
532
  remove_theme_mod( $skope_id );
533
  }
534
  }
 
 
 
535
  public function skp_clean_skopified_taxonomies( $term_id ) {
536
  $deletion_candidate = get_term( $term_id );
537
  if ( ! $deletion_candidate || ! is_object( $deletion_candidate ) )
538
  return;
 
 
 
 
539
  $skope_string = skp_get_skope( null, true, array(
540
  'meta_type' => 'tax',
541
  'type' => $deletion_candidate -> taxonomy,
542
  'obj_id' => $term_id
543
  ) );
 
 
544
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
 
 
545
  $skope_post_id_candidate = get_theme_mod( $skope_id );
546
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
 
547
  wp_delete_post( $skope_post_id_candidate );
 
548
  remove_theme_mod( $skope_id );
 
549
  }
550
  }
 
 
 
551
  public function skp_clean_skopified_users( $user_id ) {
 
552
  $skope_string = skp_get_skope( null, true, array(
553
  'meta_type' => 'user',
554
  'type' => 'author',
555
  'obj_id' => $user_id
556
  ) );
 
 
557
  $skope_id = skp_build_skope_id( array( 'skope_string' => $skope_string, 'skope_level' => 'local' ) );
 
 
558
  $skope_post_id_candidate = get_theme_mod( $skope_id );
559
  if ( $skope_post_id_candidate > 0 && get_post( $skope_post_id_candidate ) ) {
 
560
  wp_delete_post( $skope_post_id_candidate );
 
561
  remove_theme_mod( $skope_id );
 
562
  }
563
  }
564
  }//class
inc/libs/browser.php ADDED
@@ -0,0 +1,1106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Modified to comment the user agent string for Nimble
8
+ * Nicolas Guillaume on 10/18/2018
9
+ *
10
+ * Modified to remove var
11
+ * Chris Christoff on 12/26/2012
12
+ * Changes: Changes vars to publics
13
+ *
14
+ * Modified to work for EDD by
15
+ * Chris Christoff on 12/23/2012
16
+ * Changes: Removed the browser string return and added spacing. Also removed return HTML formatting.
17
+ *
18
+ * Modified to add formatted User Agent string for EDD System Info by
19
+ * Chris Christoff on 12/23/2012
20
+ * Changes: Split user string and add formatting so we can print a nicely
21
+ * formatted user agent string on the EDD System Info
22
+ *
23
+ * File: Browser.php
24
+ * Author: Chris Schuld (http://chrisschuld.com/)
25
+ * Last Modified: August 20th, 2010
26
+ *
27
+ * @version 1.9
28
+ * @package PegasusPHP
29
+ *
30
+ * Copyright (C) 2008-2010 Chris Schuld (chris@chrisschuld.com)
31
+ *
32
+ * This program is free software; you can redistribute it and/or
33
+ * modify it under the terms of the GNU General Public License as
34
+ * published by the Free Software Foundation; either version 2 of
35
+ * the License, or (at your option) any later version.
36
+ *
37
+ * This program is distributed in the hope that it will be useful,
38
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
39
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40
+ * GNU General Public License for more details at:
41
+ * http://www.gnu.org/copyleft/gpl.html
42
+ *
43
+ *
44
+ * Typical Usage:
45
+ *
46
+ * $browser = new Browser();
47
+ * if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
48
+ * echo 'You have FireFox version 2 or greater';
49
+ * }
50
+ *
51
+ * User Agents Sampled from: http://www.useragentstring.com/
52
+ *
53
+ * This implementation is based on the original work from Gary White
54
+ * http://apptools.com/phptools/browser/
55
+ *
56
+ * UPDATES:
57
+ *
58
+ * 2010-08-20 (v1.9):
59
+ * + Added MSN Explorer Browser (legacy)
60
+ * + Added Bing/MSN Robot (Thanks Rob MacDonald)
61
+ * + Added the Android Platform (PLATFORM_ANDROID)
62
+ * + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima)
63
+ *
64
+ * 2010-04-27 (v1.8):
65
+ * + Added iPad Support
66
+ *
67
+ * 2010-03-07 (v1.7):
68
+ * + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s))
69
+ * + Almost allof Gary's original code has been replaced
70
+ * + Large PHPUNIT testing environment created to validate new releases and additions
71
+ * + Added FreeBSD Platform
72
+ * + Added OpenBSD Platform
73
+ * + Added NetBSD Platform
74
+ * + Added SunOS Platform
75
+ * + Added OpenSolaris Platform
76
+ * + Added support of the Iceweazel Browser
77
+ * + Added isChromeFrame() call to check if chromeframe is in use
78
+ * + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents
79
+ * + Added the __toString() method (Thanks Deano)
80
+ *
81
+ * 2009-11-15:
82
+ * + Updated the checkes for Firefox
83
+ * + Added the NOKIA platform
84
+ * + Added Checks for the NOKIA brower(s)
85
+ *
86
+ * 2009-11-08:
87
+ * + PHP 5.3 Support
88
+ * + Added support for BlackBerry OS and BlackBerry browser
89
+ * + Added support for the Opera Mini browser
90
+ * + Added additional documenation
91
+ * + Added support for isRobot() and isMobile()
92
+ * + Added support for Opera version 10
93
+ * + Added support for deprecated Netscape Navigator version 9
94
+ * + Added support for IceCat
95
+ * + Added support for Shiretoko
96
+ *
97
+ * 2010-04-27 (v1.8):
98
+ * + Added iPad Support
99
+ *
100
+ * 2009-08-18:
101
+ * + Updated to support PHP 5.3 - removed all deprecated function calls
102
+ * + Updated to remove all double quotes (") -- converted to single quotes (')
103
+ *
104
+ * 2009-04-27:
105
+ * + Updated the IE check to remove a typo and bug (thanks John)
106
+ *
107
+ * 2009-04-22:
108
+ * + Added detection for GoogleBot
109
+ * + Added detection for the W3C Validator.
110
+ * + Added detection for Yahoo! Slurp
111
+ *
112
+ * 2009-03-14:
113
+ * + Added detection for iPods.
114
+ * + Added Platform detection for iPhones
115
+ * + Added Platform detection for iPods
116
+ *
117
+ * 2009-02-16: (Rick Hale)
118
+ * + Added version detection for Android phones.
119
+ *
120
+ * 2008-12-09:
121
+ * + Removed unused constant
122
+ *
123
+ * 2008-11-07:
124
+ * + Added Google's Chrome to the detection list
125
+ * + Added isBrowser(string) to the list of functions special thanks to
126
+ * Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au)
127
+ *
128
+ *
129
+ * Gary White noted: "Since browser detection is so unreliable, I am
130
+ * no longer maintaining this script. You are free to use and or
131
+ * modify/update it as you want, however the author assumes no
132
+ * responsibility for the accuracy of the detected values."
133
+ *
134
+ * Anyone experienced with Gary's script might be interested in these notes:
135
+ *
136
+ * Added class constants
137
+ * Added detection and version detection for Google's Chrome
138
+ * Updated the version detection for Amaya
139
+ * Updated the version detection for Firefox
140
+ * Updated the version detection for Lynx
141
+ * Updated the version detection for WebTV
142
+ * Updated the version detection for NetPositive
143
+ * Updated the version detection for IE
144
+ * Updated the version detection for OmniWeb
145
+ * Updated the version detection for iCab
146
+ * Updated the version detection for Safari
147
+ * Updated Safari to remove mobile devices (iPhone)
148
+ * Added detection for iPhone
149
+ * Added detection for robots
150
+ * Added detection for mobile devices
151
+ * Added detection for BlackBerry
152
+ * Removed Netscape checks (matches heavily with firefox & mozilla)
153
+ *
154
+ */
155
+
156
+ class Browser {
157
+ public $_agent = '';
158
+ public $_browser_name = '';
159
+ public $_version = '';
160
+ public $_platform = '';
161
+ public $_os = '';
162
+ public $_is_aol = false;
163
+ public $_is_mobile = false;
164
+ public $_is_robot = false;
165
+ public $_aol_version = '';
166
+
167
+ public $BROWSER_UNKNOWN = 'unknown';
168
+ public $VERSION_UNKNOWN = 'unknown';
169
+
170
+ public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/
171
+ public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/
172
+ public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/
173
+ public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/
174
+ public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile
175
+ public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/
176
+ public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/
177
+ public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/
178
+ public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/
179
+ public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html
180
+ public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/
181
+ public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko
182
+ public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/
183
+ public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/
184
+ public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx
185
+ public $BROWSER_SAFARI = 'Safari'; // Http://apple.com
186
+ public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com
187
+ public $BROWSER_IPOD = 'iPod'; // Http://apple.com
188
+ public $BROWSER_IPAD = 'iPad'; // Http://apple.com
189
+ public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome
190
+ public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/
191
+ public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot
192
+ public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp
193
+ public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/
194
+ public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/
195
+ public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat
196
+ public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60
197
+ public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform
198
+ public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/
199
+ public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm
200
+ // Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well)
201
+
202
+ public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED)
203
+ public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED)
204
+ public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
205
+ public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
206
+
207
+ public $PLATFORM_UNKNOWN = 'unknown';
208
+ public $PLATFORM_WINDOWS = 'Windows';
209
+ public $PLATFORM_WINDOWS_CE = 'Windows CE';
210
+ public $PLATFORM_APPLE = 'Apple';
211
+ public $PLATFORM_LINUX = 'Linux';
212
+ public $PLATFORM_OS2 = 'OS/2';
213
+ public $PLATFORM_BEOS = 'BeOS';
214
+ public $PLATFORM_IPHONE = 'iPhone';
215
+ public $PLATFORM_IPOD = 'iPod';
216
+ public $PLATFORM_IPAD = 'iPad';
217
+ public $PLATFORM_BLACKBERRY = 'BlackBerry';
218
+ public $PLATFORM_NOKIA = 'Nokia';
219
+ public $PLATFORM_FREEBSD = 'FreeBSD';
220
+ public $PLATFORM_OPENBSD = 'OpenBSD';
221
+ public $PLATFORM_NETBSD = 'NetBSD';
222
+ public $PLATFORM_SUNOS = 'SunOS';
223
+ public $PLATFORM_OPENSOLARIS = 'OpenSolaris';
224
+ public $PLATFORM_ANDROID = 'Android';
225
+
226
+ public $OPERATING_SYSTEM_UNKNOWN = 'unknown';
227
+
228
+ function __construct( $useragent="" ) {
229
+ $this->reset();
230
+ if ( $useragent != "" ) {
231
+ $this->setUserAgent( $useragent );
232
+ } else {
233
+ $this->determine();
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Reset all properties
239
+ */
240
+ function reset() {
241
+ $this->_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : "";
242
+ $this->_browser_name = $this->BROWSER_UNKNOWN;
243
+ $this->_version = $this->VERSION_UNKNOWN;
244
+ $this->_platform = $this->PLATFORM_UNKNOWN;
245
+ $this->_os = $this->OPERATING_SYSTEM_UNKNOWN;
246
+ $this->_is_aol = false;
247
+ $this->_is_mobile = false;
248
+ $this->_is_robot = false;
249
+ $this->_aol_version = $this->VERSION_UNKNOWN;
250
+ }
251
+
252
+ /**
253
+ * Check to see if the specific browser is valid
254
+ *
255
+ * @param string $browserName
256
+ * @return True if the browser is the specified browser
257
+ */
258
+ function isBrowser( $browserName ) { return 0 == strcasecmp( $this->_browser_name, trim( $browserName ) ); }
259
+
260
+ /**
261
+ * The name of the browser. All return types are from the class contants
262
+ *
263
+ * @return string Name of the browser
264
+ */
265
+ function getBrowser() { return $this->_browser_name; }
266
+ /**
267
+ * Set the name of the browser
268
+ *
269
+ * @param unknown $browser The name of the Browser
270
+ */
271
+ function setBrowser( $browser ) { return $this->_browser_name = $browser; }
272
+ /**
273
+ * The name of the platform. All return types are from the class contants
274
+ *
275
+ * @return string Name of the browser
276
+ */
277
+ function getPlatform() { return $this->_platform; }
278
+ /**
279
+ * Set the name of the platform
280
+ *
281
+ * @param unknown $platform The name of the Platform
282
+ */
283
+ function setPlatform( $platform ) { return $this->_platform = $platform; }
284
+ /**
285
+ * The version of the browser.
286
+ *
287
+ * @return string Version of the browser (will only contain alpha-numeric characters and a period)
288
+ */
289
+ function getVersion() { return $this->_version; }
290
+ /**
291
+ * Set the version of the browser
292
+ *
293
+ * @param unknown $version The version of the Browser
294
+ */
295
+ function setVersion( $version ) { $this->_version = preg_replace( '/[^0-9,.,a-z,A-Z-]/', '', $version ); }
296
+ /**
297
+ * The version of AOL.
298
+ *
299
+ * @return string Version of AOL (will only contain alpha-numeric characters and a period)
300
+ */
301
+ function getAolVersion() { return $this->_aol_version; }
302
+ /**
303
+ * Set the version of AOL
304
+ *
305
+ * @param unknown $version The version of AOL
306
+ */
307
+ function setAolVersion( $version ) { $this->_aol_version = preg_replace( '/[^0-9,.,a-z,A-Z]/', '', $version ); }
308
+ /**
309
+ * Is the browser from AOL?
310
+ *
311
+ * @return boolean True if the browser is from AOL otherwise false
312
+ */
313
+ function isAol() { return $this->_is_aol; }
314
+ /**
315
+ * Is the browser from a mobile device?
316
+ *
317
+ * @return boolean True if the browser is from a mobile device otherwise false
318
+ */
319
+ function isMobile() { return $this->_is_mobile; }
320
+ /**
321
+ * Is the browser from a robot (ex Slurp,GoogleBot)?
322
+ *
323
+ * @return boolean True if the browser is from a robot otherwise false
324
+ */
325
+ function isRobot() { return $this->_is_robot; }
326
+ /**
327
+ * Set the browser to be from AOL
328
+ *
329
+ * @param unknown $isAol
330
+ */
331
+ function setAol( $isAol ) { $this->_is_aol = $isAol; }
332
+ /**
333
+ * Set the Browser to be mobile
334
+ *
335
+ * @param boolean $value is the browser a mobile brower or not
336
+ */
337
+ function setMobile( $value=true ) { $this->_is_mobile = $value; }
338
+ /**
339
+ * Set the Browser to be a robot
340
+ *
341
+ * @param boolean $value is the browser a robot or not
342
+ */
343
+ function setRobot( $value=true ) { $this->_is_robot = $value; }
344
+ /**
345
+ * Get the user agent value in use to determine the browser
346
+ *
347
+ * @return string The user agent from the HTTP header
348
+ */
349
+ function getUserAgent() { return $this->_agent; }
350
+ /**
351
+ * Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
352
+ *
353
+ * @param unknown $agent_string The value for the User Agent
354
+ */
355
+ function setUserAgent( $agent_string ) {
356
+ $this->reset();
357
+ $this->_agent = $agent_string;
358
+ $this->determine();
359
+ }
360
+ /**
361
+ * Used to determine if the browser is actually "chromeframe"
362
+ *
363
+ * @since 1.7
364
+ * @return boolean True if the browser is using chromeframe
365
+ */
366
+ function isChromeFrame() {
367
+ return strpos( $this->_agent, "chromeframe" ) !== false;
368
+ }
369
+ /**
370
+ * Returns a formatted string with a summary of the details of the browser.
371
+ *
372
+ * @return string formatted string with a summary of the browser
373
+ */
374
+ function __toString() {
375
+ $text1 = $this->getUserAgent(); //grabs the UA (user agent) string
376
+ $UAline1 = substr( $text1, 0, 32 ); //the first line we print should only be the first 32 characters of the UA string
377
+ $text2 = $this->getUserAgent();//now we grab it again and save it to a string
378
+ $towrapUA = str_replace( $UAline1, '', $text2 );//the rest of the printoff (other than first line) is equivolent
379
+ // To the whole string minus the part we printed off. IE
380
+ // User Agent: thefirst32charactersfromUAline1
381
+ // the rest of it is now stored in
382
+ // $text2 to be printed off
383
+ // But we need to add spaces before each line that is split other than line 1
384
+ $space = '';
385
+ for ( $i = 0; $i < 25; $i++ ) {
386
+ $space .= ' ';
387
+ }
388
+ // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting
389
+ $wordwrapped = chunk_split( $towrapUA, 32, "\n $space" );
390
+ return "Platform: {$this->getPlatform()} \n".
391
+ "Browser Name: {$this->getBrowser()} \n" .
392
+ "Browser Version: {$this->getVersion()} \n";
393
+ // "User Agent String: $UAline1 \n\t\t\t " .
394
+ // "$wordwrapped";
395
+ }
396
+ /**
397
+ * Protected routine to calculate and determine what the browser is in use (including platform)
398
+ */
399
+ function determine() {
400
+ $this->checkPlatform();
401
+ $this->checkBrowsers();
402
+ $this->checkForAol();
403
+ }
404
+ /**
405
+ * Protected routine to determine the browser type
406
+ *
407
+ * @return boolean True if the browser was detected otherwise false
408
+ */
409
+ function checkBrowsers() {
410
+ return (
411
+ // Well-known, well-used
412
+ // Special Notes:
413
+ // (1) Opera must be checked before FireFox due to the odd
414
+ // user agents used in some older versions of Opera
415
+ // (2) WebTV is strapped onto Internet Explorer so we must
416
+ // check for WebTV before IE
417
+ // (3) (deprecated) Galeon is based on Firefox and needs to be
418
+ // tested before Firefox is tested
419
+ // (4) OmniWeb is based on Safari so OmniWeb check must occur
420
+ // before Safari
421
+ // (5) Netscape 9+ is based on Firefox so Netscape checks
422
+ // before FireFox are necessary
423
+ $this->checkBrowserWebTv() ||
424
+ $this->checkBrowserInternetExplorer() ||
425
+ $this->checkBrowserOpera() ||
426
+ $this->checkBrowserGaleon() ||
427
+ $this->checkBrowserNetscapeNavigator9Plus() ||
428
+ $this->checkBrowserFirefox() ||
429
+ $this->checkBrowserChrome() ||
430
+ $this->checkBrowserOmniWeb() ||
431
+
432
+ // Common mobile
433
+ $this->checkBrowserAndroid() ||
434
+ $this->checkBrowseriPad() ||
435
+ $this->checkBrowseriPod() ||
436
+ $this->checkBrowseriPhone() ||
437
+ $this->checkBrowserBlackBerry() ||
438
+ $this->checkBrowserNokia() ||
439
+
440
+ // Common bots
441
+ $this->checkBrowserGoogleBot() ||
442
+ $this->checkBrowserMSNBot() ||
443
+ $this->checkBrowserSlurp() ||
444
+
445
+ // WebKit base check (post mobile and others)
446
+ $this->checkBrowserSafari() ||
447
+
448
+ // Everyone else
449
+ $this->checkBrowserNetPositive() ||
450
+ $this->checkBrowserFirebird() ||
451
+ $this->checkBrowserKonqueror() ||
452
+ $this->checkBrowserIcab() ||
453
+ $this->checkBrowserPhoenix() ||
454
+ $this->checkBrowserAmaya() ||
455
+ $this->checkBrowserLynx() ||
456
+
457
+ $this->checkBrowserShiretoko() ||
458
+ $this->checkBrowserIceCat() ||
459
+ $this->checkBrowserW3CValidator() ||
460
+ $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
461
+ );
462
+ }
463
+
464
+ /**
465
+ * Determine if the user is using a BlackBerry (last updated 1.7)
466
+ *
467
+ * @return boolean True if the browser is the BlackBerry browser otherwise false
468
+ */
469
+ function checkBrowserBlackBerry() {
470
+ if ( stripos( $this->_agent, 'blackberry' ) !== false ) {
471
+ $aresult = explode( "/", stristr( $this->_agent, "BlackBerry" ) );
472
+ $aversion = explode( ' ', $aresult[1] );
473
+ $this->setVersion( $aversion[0] );
474
+ $this->_browser_name = $this->BROWSER_BLACKBERRY;
475
+ $this->setMobile( true );
476
+ return true;
477
+ }
478
+ return false;
479
+ }
480
+
481
+ /**
482
+ * Determine if the user is using an AOL User Agent (last updated 1.7)
483
+ *
484
+ * @return boolean True if the browser is from AOL otherwise false
485
+ */
486
+ function checkForAol() {
487
+ $this->setAol( false );
488
+ $this->setAolVersion( $this->VERSION_UNKNOWN );
489
+
490
+ if ( stripos( $this->_agent, 'aol' ) !== false ) {
491
+ $aversion = explode( ' ', stristr( $this->_agent, 'AOL' ) );
492
+ $this->setAol( true );
493
+ $this->setAolVersion( preg_replace( '/[^0-9\.a-z]/i', '', $aversion[1] ) );
494
+ return true;
495
+ }
496
+ return false;
497
+ }
498
+
499
+ /**
500
+ * Determine if the browser is the GoogleBot or not (last updated 1.7)
501
+ *
502
+ * @return boolean True if the browser is the GoogletBot otherwise false
503
+ */
504
+ function checkBrowserGoogleBot() {
505
+ if ( stripos( $this->_agent, 'googlebot' ) !== false ) {
506
+ $aresult = explode( '/', stristr( $this->_agent, 'googlebot' ) );
507
+ $aversion = explode( ' ', $aresult[1] );
508
+ $this->setVersion( str_replace( ';', '', $aversion[0] ) );
509
+ $this->_browser_name = $this->BROWSER_GOOGLEBOT;
510
+ $this->setRobot( true );
511
+ return true;
512
+ }
513
+ return false;
514
+ }
515
+
516
+ /**
517
+ * Determine if the browser is the MSNBot or not (last updated 1.9)
518
+ *
519
+ * @return boolean True if the browser is the MSNBot otherwise false
520
+ */
521
+ function checkBrowserMSNBot() {
522
+ if ( stripos( $this->_agent, "msnbot" ) !== false ) {
523
+ $aresult = explode( "/", stristr( $this->_agent, "msnbot" ) );
524
+ $aversion = explode( " ", $aresult[1] );
525
+ $this->setVersion( str_replace( ";", "", $aversion[0] ) );
526
+ $this->_browser_name = $this->BROWSER_MSNBOT;
527
+ $this->setRobot( true );
528
+ return true;
529
+ }
530
+ return false;
531
+ }
532
+
533
+ /**
534
+ * Determine if the browser is the W3C Validator or not (last updated 1.7)
535
+ *
536
+ * @return boolean True if the browser is the W3C Validator otherwise false
537
+ */
538
+ function checkBrowserW3CValidator() {
539
+ if ( stripos( $this->_agent, 'W3C-checklink' ) !== false ) {
540
+ $aresult = explode( '/', stristr( $this->_agent, 'W3C-checklink' ) );
541
+ $aversion = explode( ' ', $aresult[1] );
542
+ $this->setVersion( $aversion[0] );
543
+ $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
544
+ return true;
545
+ } else if ( stripos( $this->_agent, 'W3C_Validator' ) !== false ) {
546
+ // Some of the Validator versions do not delineate w/ a slash - add it back in
547
+ $ua = str_replace( "W3C_Validator ", "W3C_Validator/", $this->_agent );
548
+ $aresult = explode( '/', stristr( $ua, 'W3C_Validator' ) );
549
+ $aversion = explode( ' ', $aresult[1] );
550
+ $this->setVersion( $aversion[0] );
551
+ $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
552
+ return true;
553
+ }
554
+ return false;
555
+ }
556
+
557
+ /**
558
+ * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
559
+ *
560
+ * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false
561
+ */
562
+ function checkBrowserSlurp() {
563
+ if ( stripos( $this->_agent, 'slurp' ) !== false ) {
564
+ $aresult = explode( '/', stristr( $this->_agent, 'Slurp' ) );
565
+ $aversion = explode( ' ', $aresult[1] );
566
+ $this->setVersion( $aversion[0] );
567
+ $this->_browser_name = $this->BROWSER_SLURP;
568
+ $this->setRobot( true );
569
+ $this->setMobile( false );
570
+ return true;
571
+ }
572
+ return false;
573
+ }
574
+
575
+ /**
576
+ * Determine if the browser is Internet Explorer or not (last updated 1.7)
577
+ *
578
+ * @return boolean True if the browser is Internet Explorer otherwise false
579
+ */
580
+ function checkBrowserInternetExplorer() {
581
+
582
+ // Test for v1 - v1.5 IE
583
+ if ( stripos( $this->_agent, 'microsoft internet explorer' ) !== false ) {
584
+ $this->setBrowser( $this->BROWSER_IE );
585
+ $this->setVersion( '1.0' );
586
+ $aresult = stristr( $this->_agent, '/' );
587
+ if ( preg_match( '/308|425|426|474|0b1/i', $aresult ) ) {
588
+ $this->setVersion( '1.5' );
589
+ }
590
+ return true;
591
+ }
592
+ // Test for versions > 1.5
593
+ else if ( stripos( $this->_agent, 'msie' ) !== false && stripos( $this->_agent, 'opera' ) === false ) {
594
+ // See if the browser is the odd MSN Explorer
595
+ if ( stripos( $this->_agent, 'msnb' ) !== false ) {
596
+ $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'MSN' ) );
597
+ $this->setBrowser( $this->BROWSER_MSN );
598
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) );
599
+ return true;
600
+ }
601
+ $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'msie' ) );
602
+ $this->setBrowser( $this->BROWSER_IE );
603
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) );
604
+ return true;
605
+ }
606
+ // Test for Pocket IE
607
+ else if ( stripos( $this->_agent, 'mspie' ) !== false || stripos( $this->_agent, 'pocket' ) !== false ) {
608
+ $aresult = explode( ' ', stristr( $this->_agent, 'mspie' ) );
609
+ $this->setPlatform( $this->PLATFORM_WINDOWS_CE );
610
+ $this->setBrowser( $this->BROWSER_POCKET_IE );
611
+ $this->setMobile( true );
612
+
613
+ if ( stripos( $this->_agent, 'mspie' ) !== false ) {
614
+ $this->setVersion( $aresult[1] );
615
+ } else {
616
+ $aversion = explode( '/', $this->_agent );
617
+ $this->setVersion( $aversion[1] );
618
+ }
619
+ return true;
620
+ }
621
+ return false;
622
+ }
623
+
624
+ /**
625
+ * Determine if the browser is Opera or not (last updated 1.7)
626
+ *
627
+ * @return boolean True if the browser is Opera otherwise false
628
+ */
629
+ function checkBrowserOpera() {
630
+ if ( stripos( $this->_agent, 'opera mini' ) !== false ) {
631
+ $resultant = stristr( $this->_agent, 'opera mini' );
632
+ if ( preg_match( '/\//', $resultant ) ) {
633
+ $aresult = explode( '/', $resultant );
634
+ $aversion = explode( ' ', $aresult[1] );
635
+ $this->setVersion( $aversion[0] );
636
+ } else {
637
+ $aversion = explode( ' ', stristr( $resultant, 'opera mini' ) );
638
+ $this->setVersion( $aversion[1] );
639
+ }
640
+ $this->_browser_name = $this->BROWSER_OPERA_MINI;
641
+ $this->setMobile( true );
642
+ return true;
643
+ } else if ( stripos( $this->_agent, 'opera' ) !== false ) {
644
+ $resultant = stristr( $this->_agent, 'opera' );
645
+ if ( preg_match( '/Version\/(10.*)$/', $resultant, $matches ) ) {
646
+ $this->setVersion( $matches[1] );
647
+ } else if ( preg_match( '/\//', $resultant ) ) {
648
+ $aresult = explode( '/', str_replace( "(", " ", $resultant ) );
649
+ $aversion = explode( ' ', $aresult[1] );
650
+ $this->setVersion( $aversion[0] );
651
+ } else {
652
+ $aversion = explode( ' ', stristr( $resultant, 'opera' ) );
653
+ $this->setVersion( isset( $aversion[1] )?$aversion[1]:"" );
654
+ }
655
+ $this->_browser_name = $this->BROWSER_OPERA;
656
+ return true;
657
+ }
658
+ return false;
659
+ }
660
+
661
+ /**
662
+ * Determine if the browser is Chrome or not (last updated 1.7)
663
+ *
664
+ * @return boolean True if the browser is Chrome otherwise false
665
+ */
666
+ function checkBrowserChrome() {
667
+ if ( stripos( $this->_agent, 'Chrome' ) !== false ) {
668
+ $aresult = explode( '/', stristr( $this->_agent, 'Chrome' ) );
669
+ $aversion = explode( ' ', $aresult[1] );
670
+ $this->setVersion( $aversion[0] );
671
+ $this->setBrowser( $this->BROWSER_CHROME );
672
+ return true;
673
+ }
674
+ return false;
675
+ }
676
+
677
+
678
+ /**
679
+ * Determine if the browser is WebTv or not (last updated 1.7)
680
+ *
681
+ * @return boolean True if the browser is WebTv otherwise false
682
+ */
683
+ function checkBrowserWebTv() {
684
+ if ( stripos( $this->_agent, 'webtv' ) !== false ) {
685
+ $aresult = explode( '/', stristr( $this->_agent, 'webtv' ) );
686
+ $aversion = explode( ' ', $aresult[1] );
687
+ $this->setVersion( $aversion[0] );
688
+ $this->setBrowser( $this->BROWSER_WEBTV );
689
+ return true;
690
+ }
691
+ return false;
692
+ }
693
+
694
+ /**
695
+ * Determine if the browser is NetPositive or not (last updated 1.7)
696
+ *
697
+ * @return boolean True if the browser is NetPositive otherwise false
698
+ */
699
+ function checkBrowserNetPositive() {
700
+ if ( stripos( $this->_agent, 'NetPositive' ) !== false ) {
701
+ $aresult = explode( '/', stristr( $this->_agent, 'NetPositive' ) );
702
+ $aversion = explode( ' ', $aresult[1] );
703
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aversion[0] ) );
704
+ $this->setBrowser( $this->BROWSER_NETPOSITIVE );
705
+ return true;
706
+ }
707
+ return false;
708
+ }
709
+
710
+ /**
711
+ * Determine if the browser is Galeon or not (last updated 1.7)
712
+ *
713
+ * @return boolean True if the browser is Galeon otherwise false
714
+ */
715
+ function checkBrowserGaleon() {
716
+ if ( stripos( $this->_agent, 'galeon' ) !== false ) {
717
+ $aresult = explode( ' ', stristr( $this->_agent, 'galeon' ) );
718
+ $aversion = explode( '/', $aresult[0] );
719
+ $this->setVersion( $aversion[1] );
720
+ $this->setBrowser( $this->BROWSER_GALEON );
721
+ return true;
722
+ }
723
+ return false;
724
+ }
725
+
726
+ /**
727
+ * Determine if the browser is Konqueror or not (last updated 1.7)
728
+ *
729
+ * @return boolean True if the browser is Konqueror otherwise false
730
+ */
731
+ function checkBrowserKonqueror() {
732
+ if ( stripos( $this->_agent, 'Konqueror' ) !== false ) {
733
+ $aresult = explode( ' ', stristr( $this->_agent, 'Konqueror' ) );
734
+ $aversion = explode( '/', $aresult[0] );
735
+ $this->setVersion( $aversion[1] );
736
+ $this->setBrowser( $this->BROWSER_KONQUEROR );
737
+ return true;
738
+ }
739
+ return false;
740
+ }
741
+
742
+ /**
743
+ * Determine if the browser is iCab or not (last updated 1.7)
744
+ *
745
+ * @return boolean True if the browser is iCab otherwise false
746
+ */
747
+ function checkBrowserIcab() {
748
+ if ( stripos( $this->_agent, 'icab' ) !== false ) {
749
+ $aversion = explode( ' ', stristr( str_replace( '/', ' ', $this->_agent ), 'icab' ) );
750
+ $this->setVersion( $aversion[1] );
751
+ $this->setBrowser( $this->BROWSER_ICAB );
752
+ return true;
753
+ }
754
+ return false;
755
+ }
756
+
757
+ /**
758
+ * Determine if the browser is OmniWeb or not (last updated 1.7)
759
+ *
760
+ * @return boolean True if the browser is OmniWeb otherwise false
761
+ */
762
+ function checkBrowserOmniWeb() {
763
+ if ( stripos( $this->_agent, 'omniweb' ) !== false ) {
764
+ $aresult = explode( '/', stristr( $this->_agent, 'omniweb' ) );
765
+ $aversion = explode( ' ', isset( $aresult[1] )?$aresult[1]:"" );
766
+ $this->setVersion( $aversion[0] );
767
+ $this->setBrowser( $this->BROWSER_OMNIWEB );
768
+ return true;
769
+ }
770
+ return false;
771
+ }
772
+
773
+ /**
774
+ * Determine if the browser is Phoenix or not (last updated 1.7)
775
+ *
776
+ * @return boolean True if the browser is Phoenix otherwise false
777
+ */
778
+ function checkBrowserPhoenix() {
779
+ if ( stripos( $this->_agent, 'Phoenix' ) !== false ) {
780
+ $aversion = explode( '/', stristr( $this->_agent, 'Phoenix' ) );
781
+ $this->setVersion( $aversion[1] );
782
+ $this->setBrowser( $this->BROWSER_PHOENIX );
783
+ return true;
784
+ }
785
+ return false;
786
+ }
787
+
788
+ /**
789
+ * Determine if the browser is Firebird or not (last updated 1.7)
790
+ *
791
+ * @return boolean True if the browser is Firebird otherwise false
792
+ */
793
+ function checkBrowserFirebird() {
794
+ if ( stripos( $this->_agent, 'Firebird' ) !== false ) {
795
+ $aversion = explode( '/', stristr( $this->_agent, 'Firebird' ) );
796
+ $this->setVersion( $aversion[1] );
797
+ $this->setBrowser( $this->BROWSER_FIREBIRD );
798
+ return true;
799
+ }
800
+ return false;
801
+ }
802
+
803
+ /**
804
+ * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7)
805
+ * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
806
+ *
807
+ * @return boolean True if the browser is Netscape Navigator 9+ otherwise false
808
+ */
809
+ function checkBrowserNetscapeNavigator9Plus() {
810
+ if ( stripos( $this->_agent, 'Firefox' ) !== false && preg_match( '/Navigator\/([^ ]*)/i', $this->_agent, $matches ) ) {
811
+ $this->setVersion( $matches[1] );
812
+ $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR );
813
+ return true;
814
+ } else if ( stripos( $this->_agent, 'Firefox' ) === false && preg_match( '/Netscape6?\/([^ ]*)/i', $this->_agent, $matches ) ) {
815
+ $this->setVersion( $matches[1] );
816
+ $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR );
817
+ return true;
818
+ }
819
+ return false;
820
+ }
821
+
822
+ /**
823
+ * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
824
+ *
825
+ * @return boolean True if the browser is Shiretoko otherwise false
826
+ */
827
+ function checkBrowserShiretoko() {
828
+ if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/Shiretoko\/([^ ]*)/i', $this->_agent, $matches ) ) {
829
+ $this->setVersion( $matches[1] );
830
+ $this->setBrowser( $this->BROWSER_SHIRETOKO );
831
+ return true;
832
+ }
833
+ return false;
834
+ }
835
+
836
+ /**
837
+ * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
838
+ *
839
+ * @return boolean True if the browser is Ice Cat otherwise false
840
+ */
841
+ function checkBrowserIceCat() {
842
+ if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/IceCat\/([^ ]*)/i', $this->_agent, $matches ) ) {
843
+ $this->setVersion( $matches[1] );
844
+ $this->setBrowser( $this->BROWSER_ICECAT );
845
+ return true;
846
+ }
847
+ return false;
848
+ }
849
+
850
+ /**
851
+ * Determine if the browser is Nokia or not (last updated 1.7)
852
+ *
853
+ * @return boolean True if the browser is Nokia otherwise false
854
+ */
855
+ function checkBrowserNokia() {
856
+ if ( preg_match( "/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches ) ) {
857
+ $this->setVersion( $matches[2] );
858
+ if ( stripos( $this->_agent, 'Series60' ) !== false || strpos( $this->_agent, 'S60' ) !== false ) {
859
+ $this->setBrowser( $this->BROWSER_NOKIA_S60 );
860
+ } else {
861
+ $this->setBrowser( $this->BROWSER_NOKIA );
862
+ }
863
+ $this->setMobile( true );
864
+ return true;
865
+ }
866
+ return false;
867
+ }
868
+
869
+ /**
870
+ * Determine if the browser is Firefox or not (last updated 1.7)
871
+ *
872
+ * @return boolean True if the browser is Firefox otherwise false
873
+ */
874
+ function checkBrowserFirefox() {
875
+ if ( stripos( $this->_agent, 'safari' ) === false ) {
876
+ if ( preg_match( "/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches ) ) {
877
+ $this->setVersion( $matches[1] );
878
+ $this->setBrowser( $this->BROWSER_FIREFOX );
879
+ return true;
880
+ } else if ( preg_match( "/Firefox$/i", $this->_agent, $matches ) ) {
881
+ $this->setVersion( "" );
882
+ $this->setBrowser( $this->BROWSER_FIREFOX );
883
+ return true;
884
+ }
885
+ }
886
+ return false;
887
+ }
888
+
889
+ /**
890
+ * Determine if the browser is Firefox or not (last updated 1.7)
891
+ *
892
+ * @return boolean True if the browser is Firefox otherwise false
893
+ */
894
+ function checkBrowserIceweasel() {
895
+ if ( stripos( $this->_agent, 'Iceweasel' ) !== false ) {
896
+ $aresult = explode( '/', stristr( $this->_agent, 'Iceweasel' ) );
897
+ $aversion = explode( ' ', $aresult[1] );
898
+ $this->setVersion( $aversion[0] );
899
+ $this->setBrowser( $this->BROWSER_ICEWEASEL );
900
+ return true;
901
+ }
902
+ return false;
903
+ }
904
+ /**
905
+ * Determine if the browser is Mozilla or not (last updated 1.7)
906
+ *
907
+ * @return boolean True if the browser is Mozilla otherwise false
908
+ */
909
+ function checkBrowserMozilla() {
910
+ if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) {
911
+ $aversion = explode( ' ', stristr( $this->_agent, 'rv:' ) );
912
+ preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion );
913
+ $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) );
914
+ $this->setBrowser( $this->BROWSER_MOZILLA );
915
+ return true;
916
+ } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9]\.[0-9]/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) {
917
+ $aversion = explode( '', stristr( $this->_agent, 'rv:' ) );
918
+ $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) );
919
+ $this->setBrowser( $this->BROWSER_MOZILLA );
920
+ return true;
921
+ } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/mozilla\/([^ ]*)/i', $this->_agent, $matches ) && stripos( $this->_agent, 'netscape' ) === false ) {
922
+ $this->setVersion( $matches[1] );
923
+ $this->setBrowser( $this->BROWSER_MOZILLA );
924
+ return true;
925
+ }
926
+ return false;
927
+ }
928
+
929
+ /**
930
+ * Determine if the browser is Lynx or not (last updated 1.7)
931
+ *
932
+ * @return boolean True if the browser is Lynx otherwise false
933
+ */
934
+ function checkBrowserLynx() {
935
+ if ( stripos( $this->_agent, 'lynx' ) !== false ) {
936
+ $aresult = explode( '/', stristr( $this->_agent, 'Lynx' ) );
937
+ $aversion = explode( ' ', ( isset( $aresult[1] )?$aresult[1]:"" ) );
938
+ $this->setVersion( $aversion[0] );
939
+ $this->setBrowser( $this->BROWSER_LYNX );
940
+ return true;
941
+ }
942
+ return false;
943
+ }
944
+
945
+ /**
946
+ * Determine if the browser is Amaya or not (last updated 1.7)
947
+ *
948
+ * @return boolean True if the browser is Amaya otherwise false
949
+ */
950
+ function checkBrowserAmaya() {
951
+ if ( stripos( $this->_agent, 'amaya' ) !== false ) {
952
+ $aresult = explode( '/', stristr( $this->_agent, 'Amaya' ) );
953
+ $aversion = explode( ' ', $aresult[1] );
954
+ $this->setVersion( $aversion[0] );
955
+ $this->setBrowser( $this->BROWSER_AMAYA );
956
+ return true;
957
+ }
958
+ return false;
959
+ }
960
+
961
+ /**
962
+ * Determine if the browser is Safari or not (last updated 1.7)
963
+ *
964
+ * @return boolean True if the browser is Safari otherwise false
965
+ */
966
+ function checkBrowserSafari() {
967
+ if ( stripos( $this->_agent, 'Safari' ) !== false && stripos( $this->_agent, 'iPhone' ) === false && stripos( $this->_agent, 'iPod' ) === false ) {
968
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
969
+ if ( isset( $aresult[1] ) ) {
970
+ $aversion = explode( ' ', $aresult[1] );
971
+ $this->setVersion( $aversion[0] );
972
+ } else {
973
+ $this->setVersion( $this->VERSION_UNKNOWN );
974
+ }
975
+ $this->setBrowser( $this->BROWSER_SAFARI );
976
+ return true;
977
+ }
978
+ return false;
979
+ }
980
+
981
+ /**
982
+ * Determine if the browser is iPhone or not (last updated 1.7)
983
+ *
984
+ * @return boolean True if the browser is iPhone otherwise false
985
+ */
986
+ function checkBrowseriPhone() {
987
+ if ( stripos( $this->_agent, 'iPhone' ) !== false ) {
988
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
989
+ if ( isset( $aresult[1] ) ) {
990
+ $aversion = explode( ' ', $aresult[1] );
991
+ $this->setVersion( $aversion[0] );
992
+ } else {
993
+ $this->setVersion( $this->VERSION_UNKNOWN );
994
+ }
995
+ $this->setMobile( true );
996
+ $this->setBrowser( $this->BROWSER_IPHONE );
997
+ return true;
998
+ }
999
+ return false;
1000
+ }
1001
+
1002
+ /**
1003
+ * Determine if the browser is iPod or not (last updated 1.7)
1004
+ *
1005
+ * @return boolean True if the browser is iPod otherwise false
1006
+ */
1007
+ function checkBrowseriPad() {
1008
+ if ( stripos( $this->_agent, 'iPad' ) !== false ) {
1009
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
1010
+ if ( isset( $aresult[1] ) ) {
1011
+ $aversion = explode( ' ', $aresult[1] );
1012
+ $this->setVersion( $aversion[0] );
1013
+ } else {
1014
+ $this->setVersion( $this->VERSION_UNKNOWN );
1015
+ }
1016
+ $this->setMobile( true );
1017
+ $this->setBrowser( $this->BROWSER_IPAD );
1018
+ return true;
1019
+ }
1020
+ return false;
1021
+ }
1022
+
1023
+ /**
1024
+ * Determine if the browser is iPod or not (last updated 1.7)
1025
+ *
1026
+ * @return boolean True if the browser is iPod otherwise false
1027
+ */
1028
+ function checkBrowseriPod() {
1029
+ if ( stripos( $this->_agent, 'iPod' ) !== false ) {
1030
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
1031
+ if ( isset( $aresult[1] ) ) {
1032
+ $aversion = explode( ' ', $aresult[1] );
1033
+ $this->setVersion( $aversion[0] );
1034
+ } else {
1035
+ $this->setVersion( $this->VERSION_UNKNOWN );
1036
+ }
1037
+ $this->setMobile( true );
1038
+ $this->setBrowser( $this->BROWSER_IPOD );
1039
+ return true;
1040
+ }
1041
+ return false;
1042
+ }
1043
+
1044
+ /**
1045
+ * Determine if the browser is Android or not (last updated 1.7)
1046
+ *
1047
+ * @return boolean True if the browser is Android otherwise false
1048
+ */
1049
+ function checkBrowserAndroid() {
1050
+ if ( stripos( $this->_agent, 'Android' ) !== false ) {
1051
+ $aresult = explode( ' ', stristr( $this->_agent, 'Android' ) );
1052
+ if ( isset( $aresult[1] ) ) {
1053
+ $aversion = explode( ' ', $aresult[1] );
1054
+ $this->setVersion( $aversion[0] );
1055
+ } else {
1056
+ $this->setVersion( $this->VERSION_UNKNOWN );
1057
+ }
1058
+ $this->setMobile( true );
1059
+ $this->setBrowser( $this->BROWSER_ANDROID );
1060
+ return true;
1061
+ }
1062
+ return false;
1063
+ }
1064
+
1065
+ /**
1066
+ * Determine the user's platform (last updated 1.7)
1067
+ */
1068
+ function checkPlatform() {
1069
+ if ( stripos( $this->_agent, 'windows' ) !== false ) {
1070
+ $this->_platform = $this->PLATFORM_WINDOWS;
1071
+ } else if ( stripos( $this->_agent, 'iPad' ) !== false ) {
1072
+ $this->_platform = $this->PLATFORM_IPAD;
1073
+ } else if ( stripos( $this->_agent, 'iPod' ) !== false ) {
1074
+ $this->_platform = $this->PLATFORM_IPOD;
1075
+ } else if ( stripos( $this->_agent, 'iPhone' ) !== false ) {
1076
+ $this->_platform = $this->PLATFORM_IPHONE;
1077
+ } elseif ( stripos( $this->_agent, 'mac' ) !== false ) {
1078
+ $this->_platform = $this->PLATFORM_APPLE;
1079
+ } elseif ( stripos( $this->_agent, 'android' ) !== false ) {
1080
+ $this->_platform = $this->PLATFORM_ANDROID;
1081
+ } elseif ( stripos( $this->_agent, 'linux' ) !== false ) {
1082
+ $this->_platform = $this->PLATFORM_LINUX;
1083
+ } else if ( stripos( $this->_agent, 'Nokia' ) !== false ) {
1084
+ $this->_platform = $this->PLATFORM_NOKIA;
1085
+ } else if ( stripos( $this->_agent, 'BlackBerry' ) !== false ) {
1086
+ $this->_platform = $this->PLATFORM_BLACKBERRY;
1087
+ } elseif ( stripos( $this->_agent, 'FreeBSD' ) !== false ) {
1088
+ $this->_platform = $this->PLATFORM_FREEBSD;
1089
+ } elseif ( stripos( $this->_agent, 'OpenBSD' ) !== false ) {
1090
+ $this->_platform = $this->PLATFORM_OPENBSD;
1091
+ } elseif ( stripos( $this->_agent, 'NetBSD' ) !== false ) {
1092
+ $this->_platform = $this->PLATFORM_NETBSD;
1093
+ } elseif ( stripos( $this->_agent, 'OpenSolaris' ) !== false ) {
1094
+ $this->_platform = $this->PLATFORM_OPENSOLARIS;
1095
+ } elseif ( stripos( $this->_agent, 'SunOS' ) !== false ) {
1096
+ $this->_platform = $this->PLATFORM_SUNOS;
1097
+ } elseif ( stripos( $this->_agent, 'OS\/2' ) !== false ) {
1098
+ $this->_platform = $this->PLATFORM_OS2;
1099
+ } elseif ( stripos( $this->_agent, 'BeOS' ) !== false ) {
1100
+ $this->_platform = $this->PLATFORM_BEOS;
1101
+ } elseif ( stripos( $this->_agent, 'win' ) !== false ) {
1102
+ $this->_platform = $this->PLATFORM_WINDOWS;
1103
+ }
1104
+
1105
+ }
1106
+ }
inc/sektions/ccat-czr-sektions.php ADDED
@@ -0,0 +1,1601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Nimble;
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+ add_action ( 'customize_controls_enqueue_scripts', '\Nimble\sek_enqueue_controls_js_css', 20 );
7
+ function sek_enqueue_controls_js_css() {
8
+ wp_enqueue_style(
9
+ 'sek-control',
10
+ sprintf(
11
+ '%1$s/assets/czr/sek/css/%2$s' ,
12
+ NIMBLE_BASE_URL,
13
+ sek_is_dev_mode() ? 'sek-control.css' : 'sek-control.min.css'
14
+ ),
15
+ array(),
16
+ NIMBLE_ASSETS_VERSION,
17
+ 'all'
18
+ );
19
+
20
+
21
+ wp_enqueue_script(
22
+ 'czr-sektions',
23
+ sprintf(
24
+ '%1$s/assets/czr/sek/js/%2$s' ,
25
+ NIMBLE_BASE_URL,
26
+ sek_is_dev_mode() ? 'ccat-sek-control.js' : 'ccat-sek-control.min.js'
27
+ ),
28
+ array( 'czr-skope-base' , 'jquery', 'underscore' ),
29
+ NIMBLE_ASSETS_VERSION,
30
+ $in_footer = true
31
+ );
32
+
33
+ wp_enqueue_script(
34
+ 'czr-color-picker',
35
+ sprintf(
36
+ '%1$s/assets/czr/sek/js/libs/%2$s' ,
37
+ NIMBLE_BASE_URL,
38
+ sek_is_dev_mode() ? 'czr-color-picker.js' : 'czr-color-picker.min.js'
39
+ ),
40
+ array( 'jquery' ),
41
+ NIMBLE_ASSETS_VERSION,
42
+ $in_footer = true
43
+ );
44
+
45
+ wp_localize_script(
46
+ 'czr-sektions',
47
+ 'sektionsLocalizedData',
48
+ apply_filters( 'nimble-sek-localized-customizer-control-params',
49
+ array(
50
+ 'nimbleVersion' => NIMBLE_VERSION,
51
+ 'isDevMode' => sek_is_dev_mode(),
52
+ 'baseUrl' => NIMBLE_BASE_URL,
53
+ 'sektionsPanelId' => '__sektions__',
54
+ 'addNewSektionId' => 'sek_add_new_sektion',
55
+ 'addNewColumnId' => 'sek_add_new_column',
56
+ 'addNewModuleId' => 'sek_add_new_module',
57
+
58
+ 'optPrefixForSektionSetting' => NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION,//'nimble___'
59
+ 'optNameForGlobalOptions' => NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS,//'nimble___'
60
+ 'optPrefixForSektionsNotSaved' => NIMBLE_OPT_PREFIX_FOR_LEVEL_UI,//"__nimble__"
61
+
62
+ 'globalOptionDBValues' => get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS ),// '__nimble_options__'
63
+
64
+ 'defaultSektionSettingValue' => sek_get_default_sektions_value(),
65
+
66
+ 'registeredModules' => CZR_Fmk_Base() -> registered_modules,
67
+ 'preDropElementClass' => 'sortable-placeholder',
68
+ 'dropSelectors' => implode(',', [
69
+ '.sek-drop-zone', //This is the selector for all eligible drop zones printed statically or dynamically on dragstart
70
+ 'body',// body will not be eligible for drop, but setting the body as drop zone allows us to fire dragenter / dragover actions, like toggling the "approaching" or "close" css class to real drop zone
71
+ '.sek-content-preset_section-drop-zone'//between sections
72
+ ])
73
+ )
74
+ )
75
+ );//wp_localize_script()
76
+
77
+ nimble_enqueue_code_editor();
78
+ }//sek_enqueue_controls_js_css()
79
+
80
+
81
+
82
+
83
+
84
+ /**
85
+ * Enqueue all code editor assets
86
+ */
87
+ function nimble_enqueue_code_editor() {
88
+ wp_enqueue_script( 'code-editor' );
89
+ wp_enqueue_style( 'code-editor' );
90
+
91
+ wp_enqueue_script( 'csslint' );
92
+ wp_enqueue_script( 'htmlhint' );
93
+ wp_enqueue_script( 'csslint' );
94
+ wp_enqueue_script( 'jshint' );
95
+ wp_enqueue_script( 'htmlhint-kses' );
96
+ wp_enqueue_script( 'jshint' );
97
+ wp_enqueue_script( 'jsonlint' );
98
+ }
99
+
100
+
101
+
102
+ /**
103
+ * Enqueue assets needed by the code editor for the given settings.
104
+ *
105
+ * @param array $args {
106
+ * Args.
107
+ *
108
+ * @type string $type The MIME type of the file to be edited.
109
+ * @type array $codemirror Additional CodeMirror setting overrides.
110
+ * @type array $csslint CSSLint rule overrides.
111
+ * @type array $jshint JSHint rule overrides.
112
+ * @type array $htmlhint JSHint rule overrides.
113
+ * @returns array Settings for the enqueued code editor.
114
+ * }
115
+ */
116
+ function nimble_get_code_editor_settings( $args ) {
117
+ $settings = array(
118
+ 'codemirror' => array(
119
+ 'indentUnit' => 2,
120
+ 'tabSize' => 2,
121
+ 'indentWithTabs' => true,
122
+ 'inputStyle' => 'contenteditable',
123
+ 'lineNumbers' => true,
124
+ 'lineWrapping' => true,
125
+ 'styleActiveLine' => true,
126
+ 'continueComments' => true,
127
+ 'extraKeys' => array(
128
+ 'Ctrl-Space' => 'autocomplete',
129
+ 'Ctrl-/' => 'toggleComment',
130
+ 'Cmd-/' => 'toggleComment',
131
+ 'Alt-F' => 'findPersistent',
132
+ 'Ctrl-F' => 'findPersistent',
133
+ 'Cmd-F' => 'findPersistent',
134
+ ),
135
+ 'direction' => 'ltr', // Code is shown in LTR even in RTL languages.
136
+ 'gutters' => array(),
137
+ ),
138
+ 'csslint' => array(
139
+ 'errors' => true, // Parsing errors.
140
+ 'box-model' => true,
141
+ 'display-property-grouping' => true,
142
+ 'duplicate-properties' => true,
143
+ 'known-properties' => true,
144
+ 'outline-none' => true,
145
+ ),
146
+ 'jshint' => array(
147
+ 'boss' => true,
148
+ 'curly' => true,
149
+ 'eqeqeq' => true,
150
+ 'eqnull' => true,
151
+ 'es3' => true,
152
+ 'expr' => true,
153
+ 'immed' => true,
154
+ 'noarg' => true,
155
+ 'nonbsp' => true,
156
+ 'onevar' => true,
157
+ 'quotmark' => 'single',
158
+ 'trailing' => true,
159
+ 'undef' => true,
160
+ 'unused' => true,
161
+
162
+ 'browser' => true,
163
+
164
+ 'globals' => array(
165
+ '_' => false,
166
+ 'Backbone' => false,
167
+ 'jQuery' => false,
168
+ 'JSON' => false,
169
+ 'wp' => false,
170
+ ),
171
+ ),
172
+ 'htmlhint' => array(
173
+ 'tagname-lowercase' => true,
174
+ 'attr-lowercase' => true,
175
+ 'attr-value-double-quotes' => false,
176
+ 'doctype-first' => false,
177
+ 'tag-pair' => true,
178
+ 'spec-char-escape' => true,
179
+ 'id-unique' => true,
180
+ 'src-not-empty' => true,
181
+ 'attr-no-duplication' => true,
182
+ 'alt-require' => true,
183
+ 'space-tab-mixed-disabled' => 'tab',
184
+ 'attr-unsafe-chars' => true,
185
+ ),
186
+ );
187
+
188
+ $type = '';
189
+
190
+ if ( isset( $args['type'] ) ) {
191
+ $type = $args['type'];
192
+ if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
193
+ $type = 'text/x-diff';
194
+ }
195
+ } //we do not treat the "file" case
196
+
197
+
198
+ if ( 'text/css' === $type ) {
199
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
200
+ 'mode' => 'css',
201
+ 'lint' => true,
202
+ 'autoCloseBrackets' => true,
203
+ 'matchBrackets' => true,
204
+ ) );
205
+ } elseif ( 'text/x-scss' === $type || 'text/x-less' === $type || 'text/x-sass' === $type ) {
206
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
207
+ 'mode' => $type,
208
+ 'lint' => false,
209
+ 'autoCloseBrackets' => true,
210
+ 'matchBrackets' => true,
211
+ ) );
212
+ } elseif ( 'text/x-diff' === $type ) {
213
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
214
+ 'mode' => 'diff',
215
+ ) );
216
+ } elseif ( 'text/html' === $type ) {
217
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
218
+ 'mode' => 'htmlmixed',
219
+ 'lint' => true,
220
+ 'autoCloseBrackets' => true,
221
+ 'autoCloseTags' => true,
222
+ 'matchTags' => array(
223
+ 'bothTags' => true,
224
+ ),
225
+ ) );
226
+
227
+ if ( ! current_user_can( 'unfiltered_html' ) ) {
228
+ $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' );
229
+ }
230
+ } elseif ( 'text/x-gfm' === $type ) {
231
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
232
+ 'mode' => 'gfm',
233
+ 'highlightFormatting' => true,
234
+ ) );
235
+ } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) {
236
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
237
+ 'mode' => 'javascript',
238
+ 'lint' => true,
239
+ 'autoCloseBrackets' => true,
240
+ 'matchBrackets' => true,
241
+ ) );
242
+ } elseif ( false !== strpos( $type, 'json' ) ) {
243
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
244
+ 'mode' => array(
245
+ 'name' => 'javascript',
246
+ ),
247
+ 'lint' => true,
248
+ 'autoCloseBrackets' => true,
249
+ 'matchBrackets' => true,
250
+ ) );
251
+ if ( 'application/ld+json' === $type ) {
252
+ $settings['codemirror']['mode']['jsonld'] = true;
253
+ } else {
254
+ $settings['codemirror']['mode']['json'] = true;
255
+ }
256
+ } elseif ( false !== strpos( $type, 'jsx' ) ) {
257
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
258
+ 'mode' => 'jsx',
259
+ 'autoCloseBrackets' => true,
260
+ 'matchBrackets' => true,
261
+ ) );
262
+ } elseif ( 'text/x-markdown' === $type ) {
263
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
264
+ 'mode' => 'markdown',
265
+ 'highlightFormatting' => true,
266
+ ) );
267
+ } elseif ( 'text/nginx' === $type ) {
268
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
269
+ 'mode' => 'nginx',
270
+ ) );
271
+ } elseif ( 'application/x-httpd-php' === $type ) {
272
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
273
+ 'mode' => 'php',
274
+ 'autoCloseBrackets' => true,
275
+ 'autoCloseTags' => true,
276
+ 'matchBrackets' => true,
277
+ 'matchTags' => array(
278
+ 'bothTags' => true,
279
+ ),
280
+ ) );
281
+ } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) {
282
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
283
+ 'mode' => 'sql',
284
+ 'autoCloseBrackets' => true,
285
+ 'matchBrackets' => true,
286
+ ) );
287
+ } elseif ( false !== strpos( $type, 'xml' ) ) {
288
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
289
+ 'mode' => 'xml',
290
+ 'autoCloseBrackets' => true,
291
+ 'autoCloseTags' => true,
292
+ 'matchTags' => array(
293
+ 'bothTags' => true,
294
+ ),
295
+ ) );
296
+ } elseif ( 'text/x-yaml' === $type ) {
297
+ $settings['codemirror'] = array_merge( $settings['codemirror'], array(
298
+ 'mode' => 'yaml',
299
+ ) );
300
+ } else {
301
+ $settings['codemirror']['mode'] = $type;
302
+ }
303
+
304
+ if ( ! empty( $settings['codemirror']['lint'] ) ) {
305
+ $settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers';
306
+ }
307
+ foreach ( wp_array_slice_assoc( $args, array( 'codemirror', 'csslint', 'jshint', 'htmlhint' ) ) as $key => $value ) {
308
+ $settings[ $key ] = array_merge(
309
+ $settings[ $key ],
310
+ $value
311
+ );
312
+ }
313
+
314
+ $settings = apply_filters( 'nimble_code_editor_settings', $settings, $args );
315
+
316
+ if ( empty( $settings ) || empty( $settings['codemirror'] ) ) {
317
+ return false;
318
+ }
319
+
320
+ if ( isset( $settings['codemirror']['mode'] ) ) {
321
+ $mode = $settings['codemirror']['mode'];
322
+ if ( is_string( $mode ) ) {
323
+ $mode = array(
324
+ 'name' => $mode,
325
+ );
326
+ }
327
+ }
328
+
329
+ return $settings;
330
+ }
331
+
332
+
333
+
334
+
335
+ /* ------------------------------------------------------------------------- *
336
+ * LOCALIZED PARAMS I18N
337
+ /* ------------------------------------------------------------------------- */
338
+ add_filter( 'nimble-sek-localized-customizer-control-params', '\Nimble\nimble_add_i18n_localized_control_params' );
339
+ function nimble_add_i18n_localized_control_params( $params ) {
340
+ return array_merge( $params, array(
341
+ 'i18n' => array(
342
+ 'Sections' => __( 'Sections', 'nimble-builder'),
343
+
344
+ 'Nimble Builder' => __('Nimble Builder', 'nimble-builder'),
345
+
346
+ "You've reached the maximum number of allowed nested sections." => __("You've reached the maximum number of allowed nested sections.", 'nimble-builder'),
347
+ "You've reached the maximum number of columns allowed in this section." => __( "You've reached the maximum number of columns allowed in this section.", 'nimble-builder'),
348
+ "A section must have at least one column." => __( "A section must have at least one column.", 'nimble-builder'),
349
+
350
+ 'If this problem locks the Nimble builder, you might try to reset the sections for this page.' => __('If this problem locks the Nimble builder, you might try to reset the sections for this page.', 'nimble-builder'),
351
+ 'Reset' => __('Reset', 'nimble-builder'),
352
+ 'Reset complete' => __('Reset complete', 'nimble-builder'),
353
+ 'Drag and drop content' => __('Drag and drop content', 'nimble-builder'),
354
+ 'Content Picker' => __('Content Picker', 'nimble-builder'),
355
+ 'Pick a module' => __('Pick a module', 'nimble-builder'),
356
+ 'Pick a pre-designed section' => __('Pick a pre-designed section', 'nimble-builder'),
357
+ 'Select a content type' => __('Select a content type', 'nimble-builder'),
358
+
359
+ 'Sections for an introduction' => __('Sections for an introduction', 'nimble-builder'),
360
+ 'Sections for services and features' => __('Sections for services and features', 'nimble-builder'),
361
+ 'Contact-us sections' => __('Contact-us sections', 'nimble-builder'),
362
+ 'Empty sections with columns layout' => __('Empty sections with columns layout', 'nimble-builder'),
363
+
364
+ 'Drag and drop a module in one of the possible locations of the previewed page.' => __( 'Drag and drop a module in one of the possible locations of the previewed page.', 'nimble-builder' ),
365
+
366
+ 'Module' => __('Module', 'nimble-builder'),
367
+ 'Content for' => __('Content for', 'nimble-builder'),
368
+ 'Customize the options for module :' => __('Customize the options for module :', 'nimble-builder'),
369
+
370
+ 'Layout settings for the' => __('Layout settings for the', 'nimble-builder'),
371
+ 'Background settings for the' => __('Background settings for the', 'nimble-builder'),
372
+ 'Borders settings for the' => __('Borders settings for the', 'nimble-builder'),
373
+ 'Padding and margin settings for the' => __('Padding and margin settings for the', 'nimble-builder'),
374
+ 'Height settings for the' => __('Height settings for the', 'nimble-builder'),
375
+ 'Width settings for the' => __('Width settings for the', 'nimble-builder'),
376
+ 'Set a custom anchor for the' => __('Set a custom anchor for the', 'nimble-builder'),
377
+ 'Device visibility settings for the' => __('Device visibility settings for the', 'nimble-builder'),
378
+ 'Responsive settings : breakpoint, column direction' => __('Responsive settings : breakpoint, column direction', 'nimble-builder'),
379
+
380
+ 'Settings for the' => __('Settings for the', 'nimble-builder'),//section / column / module
381
+ 'Current page options' => __( 'Current page options', 'nimble-builder'),
382
+ 'Page template' => __( 'Page template', 'nimble-builder'),
383
+ 'Inner and outer widths' => __( 'Inner and outer widths', 'nimble-builder'),
384
+ 'Custom CSS' => __( 'Custom CSS', 'nimble-builder'),
385
+ 'Remove the sections in this page' => __( 'Remove the sections in this page', 'nimble-builder'),
386
+ 'Page speed optimizations' => __( 'Page speed optimizations', 'nimble-builder'),
387
+
388
+ 'Site wide breakpoint for Nimble sections' => __( 'Site wide breakpoint for Nimble sections', 'nimble-builder'),
389
+ 'Site wide inner and outer sections widths' => __( 'Site wide inner and outer sections widths', 'nimble-builder'),
390
+
391
+ 'Site wide page speed optimizations' => __( 'Site wide page speed optimizations', 'nimble-builder'),
392
+ 'Options for the sections of the current page' => __( 'Options for the sections of the current page', 'nimble-builder'),
393
+ 'General options applied for the sections site wide' => __( 'General options applied for the sections site wide', 'nimble-builder'),
394
+
395
+ 'Site wide options' => __( 'Site wide options', 'nimble-builder'),
396
+ 'location' => __('location', 'nimble-builder'),
397
+ 'section' => __('section', 'nimble-builder'),
398
+ 'column' => __('column', 'nimble-builder'),
399
+ 'module' => __('module', 'nimble-builder'),
400
+
401
+ 'This browser does not support drag and drop. You might need to update your browser or use another one.' => __('This browser does not support drag and drop. You might need to update your browser or use another one.', 'nimble-builder'),
402
+ 'Insert here' => __('Insert here', 'nimble-builder'),
403
+ 'Insert in a new section' => __('Insert in a new section', 'nimble-builder'),
404
+ 'Insert a new section here' => __('Insert a new section here', 'nimble-builder'),
405
+ 'Select a font family' => __('Select a font family', 'nimble-builder'),
406
+ 'Web Safe Fonts' => __('Web Safe Fonts', 'nimble-builder'),
407
+ 'Google Fonts' => __('Google Fonts', 'nimble-builder'),
408
+
409
+ 'Set a custom url' => __('Set a custom url', 'nimble-builder'),
410
+
411
+ 'Something went wrong, please refresh this page.' => __('Something went wrong, please refresh this page.', 'nimble-builder'),
412
+
413
+ 'Select an icon' => __( 'Select an icon', 'nimble-builder' ),
414
+ 'codeEditorSingular' => __( 'There is %d error in your %s code which might break your site. Please fix it before saving.', 'nimble-builder' ),
415
+ 'codeEditorPlural' => __( 'There are %d errors in your %s code which might break your site. Please fix them before saving.', 'nimble-builder' ),
416
+ 'Settings on desktops' => __('Settings on desktops', 'nimble-builder'),
417
+ 'Settings on tablets' => __('Settings on tablets', 'nimble-builder'),
418
+ 'Settings on mobiles' => __('Settings on mobiles', 'nimble-builder')
419
+
420
+ )//array()
421
+ )//array()
422
+ );//array_merge
423
+ }//'nimble_add_i18n_localized_control_params'
424
+ add_filter( 'skp_json_export_ready_skopes', '\Nimble\add_sektion_values_to_skope_export' );
425
+ function add_sektion_values_to_skope_export( $skopes ) {
426
+ if ( ! is_array( $skopes ) ) {
427
+ error_log( 'skp_json_export_ready_skopes filter => the filtered skopes must be an array.' );
428
+ }
429
+ $new_skopes = array();
430
+ foreach ( $skopes as $skp_data ) {
431
+ if ( 'global' == $skp_data['skope'] || 'group' == $skp_data['skope'] ) {
432
+ $new_skopes[] = $skp_data;
433
+ continue;
434
+ }
435
+ if ( ! is_array( $skp_data ) ) {
436
+ error_log( 'skp_json_export_ready_skopes filter => the skope data must be an array.' );
437
+ continue;
438
+ }
439
+ $skope_id = skp_get_skope_id( $skp_data['skope'] );
440
+ $skp_data[ 'sektions' ] = array(
441
+ 'db_values' => sek_get_skoped_seks( $skope_id ),
442
+ 'setting_id' => sek_get_seks_setting_id( $skope_id )//nimble___loop_start[skp__post_page_home]
443
+ );
444
+ $new_skopes[] = $skp_data;
445
+ }
446
+
447
+ return $new_skopes;
448
+ }
449
+ function sek_get_preset_sektions() {
450
+ $transient_name = 'nimble_preset_sections_' . NIMBLE_VERSION;
451
+ $transient_data = get_transient( $transient_name );
452
+ if ( false == $transient_data || empty( $transient_data ) || sek_is_dev_mode() ) {
453
+ $preset_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/preset_sections.json" );
454
+ if ( $preset_raw === false ) {
455
+ $preset_raw = wp_remote_fopen( NIMBLE_BASE_PATH ."/assets/preset_sections.json" );
456
+ }
457
+
458
+ $presets_decoded = json_decode( $preset_raw, true );
459
+ set_transient( $transient_name , $presets_decoded , 60*60*24*30 );
460
+ }
461
+ else {
462
+ $presets_decoded = $transient_data;
463
+ }
464
+ return $presets_decoded;
465
+ }
466
+
467
+
468
+ add_action( 'customize_controls_print_footer_scripts', '\Nimble\sek_print_nimble_customizer_tmpl' );
469
+ function sek_print_nimble_customizer_tmpl() {
470
+ ?>
471
+ <script type="text/html" id="tmpl-nimble-top-bar">
472
+ <div id="nimble-top-bar" class="czr-preview-notification">
473
+ <div class="sek-add-content">
474
+ <button type="button" class="material-icons" title="<?php _e('Add content', 'nimble-builder'); ?>" data-nimble-state="enabled">
475
+ add_circle_outline<span class="screen-reader-text"><?php _e('Add content', 'nimble-builder'); ?></span>
476
+ </button>
477
+ </div>
478
+ <div class="sek-do-undo">
479
+ <button type="button" class="icon undo" title="<?php _e('Undo', 'nimble-builder'); ?>" data-nimble-history="undo" data-nimble-state="disabled">
480
+ <span class="screen-reader-text"><?php _e('Undo', 'nimble-builder'); ?></span>
481
+ </button>
482
+ <button type="button" class="icon do" title="<?php _e('Redo', 'nimble-builder'); ?>" data-nimble-history="redo" data-nimble-state="disabled">
483
+ <span class="screen-reader-text"><?php _e('Redo', 'nimble-builder'); ?></span>
484
+ </button>
485
+ </div>
486
+ <div class="sek-settings">
487
+ <button type="button" class="fas fa-sliders-h" title="<?php _e('Global settings', 'nimble-builder'); ?>" data-nimble-state="enabled">
488
+ <span class="screen-reader-text"><?php _e('Global settings', 'nimble-builder'); ?></span>
489
+ </button>
490
+ </div>
491
+ <div class="sek-nimble-doc" data-doc-href="https://docs.presscustomizr.com/collection/334-nimble-builder">
492
+ <span class="sek-pointer" title="<?php _e('Nimble online documentation', 'nimble-builder'); ?>"><?php _e('Nimble online documentation', 'nimble-builder'); ?></span>
493
+ <button class="far fa-question-circle" type="button" title="<?php _e('Nimble online documentation', 'nimble-builder'); ?>" data-nimble-state="enabled">
494
+ <span class="screen-reader-text"><?php _e('Nimble online documentation', 'nimble-builder'); ?></span>
495
+ </button>
496
+ </div>
497
+ </div>
498
+ </script>
499
+ <?php
500
+ }
501
+
502
+ ?><?php
503
+ /* ------------------------------------------------------------------------- *
504
+ * SETUP DYNAMIC SERVER REGISTRATION FOR SETTING
505
+ /* ------------------------------------------------------------------------- */
506
+ if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
507
+ class SEK_CZR_Dyn_Register {
508
+ static $instance;
509
+ public $sanitize_callbacks = array();// <= will be populated to cache the callbacks when invoking sek_get_module_sanitize_callbacks().
510
+
511
+ public static function get_instance( $params ) {
512
+ if ( ! isset( self::$instance ) && ! ( self::$instance instanceof SEK_CZR_Dyn_Register ) )
513
+ self::$instance = new SEK_CZR_Dyn_Register( $params );
514
+ return self::$instance;
515
+ }
516
+
517
+ function __construct( $params = array() ) {
518
+ add_action( 'customize_register', array( $this, 'load_nimble_setting_class' ) );
519
+
520
+ add_filter( 'customize_dynamic_setting_args', array( $this, 'set_dyn_setting_args' ), 10, 2 );
521
+ add_filter( 'customize_dynamic_setting_class', array( $this, 'set_dyn_setting_class') , 10, 3 );
522
+ }//__construct
523
+ function load_nimble_setting_class() {
524
+ require_once( NIMBLE_BASE_PATH . '/inc/sektions/seks_setting_class.php' );
525
+ }
526
+ function set_dyn_setting_args( $setting_args, $setting_id ) {
527
+ if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) || 0 === strpos( $setting_id, NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS ) ) {
528
+ return array(
529
+ 'transport' => 'refresh',
530
+ 'type' => 'option',
531
+ 'default' => array(),
532
+ );
533
+ } else if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_LEVEL_UI ) ) {
534
+ return array(
535
+ 'transport' => 'refresh',
536
+ 'type' => '_nimble_ui_',//won't be saved as is,
537
+ 'default' => array(),
538
+ 'sanitize_callback' => array( $this, 'sanitize_callback' ),
539
+ 'validate_callback' => array( $this, 'validate_callback' )
540
+ );
541
+ }
542
+ return $setting_args;
543
+ }
544
+ function set_dyn_setting_class( $class, $setting_id, $args ) {
545
+ if ( 0 !== strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) )
546
+ return $class;
547
+ return '\Nimble\Nimble_Customizer_Setting';
548
+ }
549
+ function sanitize_callback( $setting_data, $setting_instance ) {
550
+ if ( isset( $_POST['skope_id'] ) ) {
551
+ $sektionSettingValue = sek_get_skoped_seks( $_POST['skope_id'] );
552
+ if ( is_array( $sektionSettingValue ) ) {
553
+ $sektion_collection = array_key_exists('collection', $sektionSettingValue) ? $sektionSettingValue['collection'] : array();
554
+ if ( is_array( $sektion_collection ) ) {
555
+ $model = sek_get_level_model( $setting_instance->id, $sektion_collection );
556
+ if ( is_array( $model ) && ! empty( $model['module_type'] ) ) {
557
+ $sanitize_callback = sek_get_registered_module_type_property( $model['module_type'], 'sanitize_callback' );
558
+ if ( ! empty( $sanitize_callback ) && is_string( $sanitize_callback ) && function_exists( $sanitize_callback ) ) {
559
+ $setting_data = $sanitize_callback( $setting_data );
560
+ }
561
+ }
562
+ }
563
+ }
564
+ }
565
+ return $setting_data;
566
+ }
567
+ function validate_callback( $validity, $setting_data, $setting_instance ) {
568
+ $validated = true;
569
+ if ( isset( $_POST['skope_id'] ) ) {
570
+ $sektionSettingValue = sek_get_skoped_seks( $_POST['skope_id'] );
571
+ if ( is_array( $sektionSettingValue ) ) {
572
+ $sektion_collection = array_key_exists('collection', $sektionSettingValue) ? $sektionSettingValue['collection'] : array();
573
+ if ( is_array( $sektion_collection ) ) {
574
+ $model = sek_get_level_model( $setting_instance->id, $sektion_collection );
575
+ if ( is_array( $model ) && ! empty( $model['module_type'] ) ) {
576
+ $validate_callback = sek_get_registered_module_type_property( $model['module_type'], 'validate_callback' );
577
+ if ( ! empty( $validate_callback ) && is_string( $validate_callback ) && function_exists( $validate_callback ) ) {
578
+ $validated = $validate_callback( $setting_data );
579
+ }
580
+ }
581
+ }
582
+ }
583
+ }
584
+ if ( true !== $validated ) {
585
+ if ( is_wp_error( $validated ) ) {
586
+ $validation_msg = $validation_msg->get_error_message();
587
+ $validity->add(
588
+ 'nimble_validation_error_in_' . $setting_instance->id ,
589
+ $validation_msg
590
+ );
591
+ }
592
+
593
+ }
594
+ return $validity;
595
+ }
596
+
597
+
598
+ }//class
599
+ endif;
600
+
601
+ ?><?php
602
+ /*
603
+ * This approach has been inspired by the excellent https://github.com/xwp/wp-customize-posts
604
+ */
605
+ add_action( 'customize_controls_print_footer_scripts', '\Nimble\sek_print_tiny_mce_editor_template', 0 );
606
+ function sek_print_tiny_mce_editor_template() {
607
+ ?>
608
+ <div id="czr-customize-content_editor-pane">
609
+ <div data-czr-action="close-tinymce-editor" class="czr-close-editor"><i class="fas fa-arrow-circle-down" title="<?php _e( 'Hide Editor', 'nimble-builder' ); ?>"></i>&nbsp;<span><?php _e( 'Hide Editor', 'nimble-builder');?></span></div>
610
+ <div id="czr-customize-content_editor-dragbar" title="<?php _e('Resize the editor', 'nimble-builder'); ?>">
611
+ <span class="screen-reader-text"><?php _e( 'Resize the editor', 'nimble-builder' ); ?></span>
612
+ <i class="czr-resize-handle fas fa-arrows-alt-v"></i>
613
+ </div>
614
+
615
+ <?php
616
+ wp_editor( '', 'czr-customize-content_editor', array(
617
+ '_content_editor_dfw' => false,
618
+ 'drag_drop_upload' => true,
619
+ 'tabfocus_elements' => 'content-html,save-post',
620
+ 'editor_height' => 200,
621
+ 'default_editor' => 'tinymce',
622
+ 'tinymce' => array(
623
+ 'resize' => false,
624
+ 'wp_autoresize_on' => false,
625
+ 'add_unload_trigger' => false,
626
+ ),
627
+ ) );
628
+ ?>
629
+ </div>
630
+ <?php
631
+ }
632
+
633
+ /**
634
+ * Enqueue a WP Editor instance we can use for rich text editing.
635
+ */
636
+ add_action( 'customize_controls_init', '\Nimble\sek_enqueue_tiny_mce_editor' );
637
+ function sek_enqueue_tiny_mce_editor() {
638
+ if ( false === has_action( 'customize_controls_print_footer_scripts', array( '_WP_Editors', 'enqueue_scripts' ) ) ) {
639
+ add_action( 'customize_controls_print_footer_scripts', array( '_WP_Editors', 'enqueue_scripts' ) );
640
+ }
641
+ }
642
+
643
+ ?><?php
644
+ add_action( 'czr_set_input_tmpl_content', '\Nimble\sek_set_input_tmpl_content', 10, 3 );
645
+ function sek_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
646
+ if ( ! array_key_exists( 'input_type', $input_data ) || empty( $input_data[ 'input_type' ] ) ) {
647
+ wp_send_json_error( 'sek_set_input_tmpl_content => missing input type for input id : ' . $input_id );
648
+ }
649
+ switch( $input_type ) {
650
+ case 'content_type_switcher' :
651
+ sek_set_input_tmpl___content_type_switcher( $input_id, $input_data );
652
+ break;
653
+ case 'module_picker' :
654
+ sek_set_input_tmpl___module_picker( $input_id, $input_data );
655
+ break;
656
+ case 'section_picker' :
657
+ sek_set_input_tmpl___section_picker( $input_id, $input_data );
658
+ break;
659
+
660
+ case 'spacing' :
661
+ case 'spacingWithDeviceSwitcher' :
662
+ sek_set_input_tmpl___spacing( $input_id, $input_data );
663
+ break;
664
+ case 'bg_position' :
665
+ case 'bgPositionWithDeviceSwitcher' :
666
+ sek_set_input_tmpl___bg_position( $input_id, $input_data );
667
+ break;
668
+ case 'h_alignment' :
669
+ case 'horizAlignmentWithDeviceSwitcher' :
670
+ sek_set_input_tmpl___h_alignment( $input_id, $input_data );
671
+ break;
672
+ case 'h_text_alignment' :
673
+ case 'horizTextAlignmentWithDeviceSwitcher' :
674
+ sek_set_input_tmpl___h_text_alignment( $input_id, $input_data );
675
+ break;
676
+ case 'verticalAlignWithDeviceSwitcher' :
677
+ sek_set_input_tmpl___v_alignment( $input_id, $input_data );
678
+ break;
679
+ case 'font_picker' :
680
+ sek_set_input_tmpl___font_picker( $input_id, $input_data );
681
+ break;
682
+ case 'fa_icon_picker' :
683
+ sek_set_input_tmpl___fa_icon_picker( $input_id, $input_data );
684
+ break;
685
+ case 'font_size' :
686
+ case 'line_height' :
687
+ sek_set_input_tmpl___font_size_line_height( $input_id, $input_data );
688
+ break;
689
+ case 'code_editor' :
690
+ sek_set_input_tmpl___code_editor( $input_id, $input_data );
691
+ break;
692
+ case 'range_with_unit_picker' :
693
+ sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data );
694
+ break;
695
+ case 'range_with_unit_picker_device_switcher' :
696
+ sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id, $input_data );
697
+ break;
698
+ case 'range_simple' :
699
+ sek_set_input_tmpl___range_simple( $input_id, $input_data );
700
+ break;
701
+ case 'borders' :
702
+ sek_set_input_tmpl___borders( $input_id, $input_data );
703
+ break;
704
+ case 'border_radius' :
705
+ sek_set_input_tmpl___border_radius( $input_id, $input_data );
706
+ break;
707
+ case 'buttons_choice' :
708
+ sek_set_input_tmpl___buttons_choice( $input_id, $input_data );
709
+ break;
710
+ case 'reset_button' :
711
+ sek_set_input_tmpl___reset_button( $input_id, $input_data );
712
+ break;
713
+ }
714
+ }
715
+ ?><?php
716
+
717
+ /* ------------------------------------------------------------------------- *
718
+ * CONTENT TYPE SWITCHER INPUT
719
+ /* ------------------------------------------------------------------------- */
720
+ function sek_set_input_tmpl___content_type_switcher( $input_id, $input_data ) {
721
+ ?>
722
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
723
+ <div class="sek-content-type-wrapper">
724
+ <div aria-label="<?php _e( 'Content type', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
725
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Pick a section', 'nimble-builder');?>" data-sek-content-type="section"><?php _e('Pick a section', 'nimble-builder');?></button>
726
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Pick a module', 'nimble-builder');?>" data-sek-content-type="module"><?php _e('Pick a module', 'nimble-builder');?></button>
727
+ </div>
728
+ </div>
729
+ <?php
730
+ }
731
+
732
+
733
+ /* ------------------------------------------------------------------------- *
734
+ * MODULE PICKER INPUT
735
+ /* ------------------------------------------------------------------------- */
736
+ function sek_set_input_tmpl___module_picker( $input_id, $input_data ) {
737
+ ?>
738
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
739
+ <div class="sek-content-type-wrapper">
740
+ <?php
741
+ $content_collection = array(
742
+ array(
743
+ 'content-type' => 'module',
744
+ 'content-id' => 'czr_tiny_mce_editor_module',
745
+ 'title' => __( 'WordPress Editor', 'nimble-builder' ),
746
+ 'icon' => 'Nimble_rich-text-editor_icon.svg'
747
+ ),
748
+ array(
749
+ 'content-type' => 'module',
750
+ 'content-id' => 'czr_image_module',
751
+ 'title' => __( 'Image', 'nimble-builder' ),
752
+ 'icon' => 'Nimble__image_icon.svg'
753
+ ),
754
+ array(
755
+ 'content-type' => 'module',
756
+ 'content-id' => 'czr_heading_module',
757
+ 'title' => __( 'Heading', 'nimble-builder' ),
758
+ 'icon' => 'Nimble__heading_icon.svg'
759
+ ),
760
+
761
+ array(
762
+ 'content-type' => 'module',
763
+ 'content-id' => 'czr_icon_module',
764
+ 'title' => __( 'Icon', 'nimble-builder' ),
765
+ 'icon' => 'Nimble__icon_icon.svg'
766
+ ),
767
+ array(
768
+ 'content-type' => 'module',
769
+ 'content-id' => 'czr_button_module',
770
+ 'title' => __( 'Button', 'nimble-builder' ),
771
+ 'icon' => 'Nimble_button_icon.svg'
772
+ ),
773
+ array(
774
+ 'content-type' => 'module',
775
+ 'content-id' => 'czr_map_module',
776
+ 'title' => __( 'Map', 'nimble-builder' ),
777
+ 'icon' => 'Nimble_map_icon.svg'
778
+ ),
779
+
780
+ array(
781
+ 'content-type' => 'preset_section',
782
+ 'content-id' => 'two_columns',
783
+ 'title' => __( 'Two Columns', 'nimble-builder' ),
784
+ 'icon' => 'Nimble_2-columns_icon.svg'
785
+ ),
786
+ array(
787
+ 'content-type' => 'preset_section',
788
+ 'content-id' => 'three_columns',
789
+ 'title' => __( 'Three Columns', 'nimble-builder' ),
790
+ 'icon' => 'Nimble_3-columns_icon.svg'
791
+ ),
792
+ array(
793
+ 'content-type' => 'preset_section',
794
+ 'content-id' => 'four_columns',
795
+ 'title' => __( 'Four Columns', 'nimble-builder' ),
796
+ 'icon' => 'Nimble_4-columns_icon.svg'
797
+ ),
798
+
799
+ array(
800
+ 'content-type' => 'module',
801
+ 'content-id' => 'czr_simple_html_module',
802
+ 'title' => __( 'Html Content', 'nimble-builder' ),
803
+ 'icon' => 'Nimble_html_icon.svg'
804
+ ),
805
+ array(
806
+ 'content-type' => 'module',
807
+ 'content-id' => 'czr_quote_module',
808
+ 'title' => __( 'Quote', 'nimble-builder' ),
809
+ 'icon' => 'Nimble_quote_icon.svg'
810
+ ),
811
+ array(
812
+ 'content-type' => 'module',
813
+ 'content-id' => 'czr_spacer_module',
814
+ 'title' => __( 'Spacer', 'nimble-builder' ),
815
+ 'icon' => 'Nimble__spacer_icon.svg'
816
+ ),
817
+ array(
818
+ 'content-type' => 'module',
819
+ 'content-id' => 'czr_divider_module',
820
+ 'title' => __( 'Divider', 'nimble-builder' ),
821
+ 'icon' => 'Nimble__divider_icon.svg'
822
+ ),
823
+ array(
824
+ 'content-type' => 'module',
825
+ 'content-id' => 'czr_simple_form_module',
826
+ 'title' => __( 'Simple Contact Form', 'nimble-builder' ),
827
+ 'icon' => 'Nimble_contact-form_icon.svg'
828
+ ),
829
+
830
+
831
+ );
832
+ $i = 0;
833
+ foreach( $content_collection as $_params) {
834
+ $icon_img_src = '';
835
+ if ( !empty( $_params['icon'] ) ) {
836
+ $icon_img_src = NIMBLE_BASE_URL . '/assets/czr/sek/icons/modules/' . $_params['icon'];
837
+ }
838
+
839
+ printf('<div draggable="true" data-sek-content-type="%1$s" data-sek-content-id="%2$s" title="%5$s"><div class="sek-module-icon">%3$s</div><div class="sek-module-title"><div class="sek-centered-module-title">%4$s</div></div></div>',
840
+ $_params['content-type'],
841
+ $_params['content-id'],
842
+ empty( $icon_img_src ) ? '<i style="color:red">Missing Icon</i>' : '<img draggable="false" title="'. $_params['title'] . '" alt="'. $_params['title'] . '" class="nimble-module-icons" src="' . $icon_img_src .'"/>',
843
+ $_params['title'],
844
+ __('Drag and drop the module in the previewed page.', 'nimble-builder' )
845
+ );
846
+ }
847
+ ?>
848
+ </div>
849
+ <?php
850
+ }
851
+
852
+
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+ /* ------------------------------------------------------------------------- *
861
+ * SECTION PICKER INPUT
862
+ /* ------------------------------------------------------------------------- */
863
+ function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
864
+ ?>
865
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
866
+ <div class="sek-content-type-wrapper">
867
+ <?php
868
+ switch( $input_id ) {
869
+ case 'intro_sections' :
870
+ $content_collection = array(
871
+ array(
872
+ 'content-type' => 'preset_section',
873
+ 'content-id' => 'intro_three',
874
+ 'title' => __('1 columns, call to action, full-width background', 'nimble-builder' ),
875
+ 'thumb' => 'intro_three.jpg'
876
+ ),
877
+ array(
878
+ 'content-type' => 'preset_section',
879
+ 'content-id' => 'intro_one',
880
+ 'title' => __('1 column, full-width background', 'nimble-builder' ),
881
+ 'thumb' => 'intro_one.jpg'
882
+ ),
883
+ array(
884
+ 'content-type' => 'preset_section',
885
+ 'content-id' => 'intro_two',
886
+ 'title' => __('2 columns, call to action, full-width background', 'nimble-builder' ),
887
+ 'thumb' => 'intro_two.jpg'
888
+ )
889
+ );
890
+ break;
891
+ case 'features_sections' :
892
+ $content_collection = array(
893
+ array(
894
+ 'content-type' => 'preset_section',
895
+ 'content-id' => 'features_one',
896
+ 'title' => __('3 columns with icon and call to action', 'nimble-builder' ),
897
+ 'thumb' => 'features_one.jpg',
898
+ ),
899
+ array(
900
+ 'content-type' => 'preset_section',
901
+ 'content-id' => 'features_two',
902
+ 'title' => __('3 columns with icon', 'nimble-builder' ),
903
+ 'thumb' => 'features_two.jpg',
904
+ )
905
+ );
906
+ break;
907
+ case 'contact_sections' :
908
+ $content_collection = array(
909
+ array(
910
+ 'content-type' => 'preset_section',
911
+ 'content-id' => 'contact_one',
912
+ 'title' => __('A contact form and a Google map', 'nimble-builder' ),
913
+ 'thumb' => 'contact_one.jpg',
914
+ ),
915
+ array(
916
+ 'content-type' => 'preset_section',
917
+ 'content-id' => 'contact_two',
918
+ 'title' => __('A contact form with an image background', 'nimble-builder' ),
919
+ 'thumb' => 'contact_two.jpg',
920
+ )
921
+ );
922
+ break;
923
+ case 'layout_sections' :
924
+ $content_collection = array(
925
+ array(
926
+ 'content-type' => 'preset_section',
927
+ 'content-id' => 'two_columns',
928
+ 'title' => __('two columns layout', 'nimble-builder' ),
929
+ 'thumb' => 'two_columns.jpg'
930
+ ),
931
+ array(
932
+ 'content-type' => 'preset_section',
933
+ 'content-id' => 'three_columns',
934
+ 'title' => __('three columns layout', 'nimble-builder' ),
935
+ 'thumb' => 'three_columns.jpg'
936
+ ),
937
+ array(
938
+ 'content-type' => 'preset_section',
939
+ 'content-id' => 'four_columns',
940
+ 'title' => __('four columns layout', 'nimble-builder' ),
941
+ 'thumb' => 'four_columns.jpg'
942
+ ),
943
+ );
944
+ break;
945
+ }
946
+ foreach( $content_collection as $_params) {
947
+ printf('<div draggable="true" data-sek-content-type="%1$s" data-sek-content-id="%2$s" style="%3$s" title="%4$s"><div class="sek-overlay"></div></div>',
948
+ $_params['content-type'],
949
+ $_params['content-id'],
950
+ sprintf( 'background: url(%1$s) 50% 50% / cover no-repeat;%2$s',
951
+ NIMBLE_BASE_URL . '/assets/img/section_assets/thumbs/' . $_params['thumb'],
952
+ isset( $_params['height'] ) ? 'height:'.$_params['height'] : ''
953
+ ),
954
+ $_params['title']
955
+ );
956
+ }
957
+ ?>
958
+ </div>
959
+ <?php
960
+ }
961
+
962
+ ?><?php
963
+
964
+ /* ------------------------------------------------------------------------- *
965
+ * SPACING INPUT
966
+ /* ------------------------------------------------------------------------- */
967
+ function sek_set_input_tmpl___spacing( $input_id, $input_data ) {
968
+ ?>
969
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
970
+ <div class="sek-spacing-wrapper">
971
+ <div class="sek-pad-marg-inner">
972
+ <div class="sek-pm-top-bottom-wrap sek-flex-justify-center">
973
+ <div class="sek-flex-center-stretch" data-sek-spacing="margin-top" title="<?php _e('Margin top', 'nimble-builder'); ?>">
974
+ <div class="sek-pm-input-parent">
975
+ <input class="sek-pm-input" value="" type="number" >
976
+ </div>
977
+ </div>
978
+ </div>
979
+ <div class="sek-pm-middle-wrap sek-flex-justify-center">
980
+ <div class="sek-flex-center-stretch sek-pm-margin-left" data-sek-spacing="margin-left" title="<?php _e('Margin left', 'nimble-builder'); ?>">
981
+ <div class="sek-pm-input-parent">
982
+ <input class="sek-pm-input" value="" type="number" >
983
+ </div>
984
+ </div>
985
+
986
+ <div class="sek-pm-padding-wrapper">
987
+ <div class="sek-flex-justify-center">
988
+ <div class="sek-flex-center-stretch" data-sek-spacing="padding-top" title="<?php _e('Padding top', 'nimble-builder'); ?>">
989
+ <div class="sek-pm-input-parent">
990
+ <input class="sek-pm-input" value="" type="number" >
991
+ </div>
992
+ </div>
993
+ </div>
994
+ <div class="sek-flex-justify-center sek-flex-space-between">
995
+ <div class="sek-flex-center-stretch" data-sek-spacing="padding-left" title="<?php _e('Padding left', 'nimble-builder'); ?>">
996
+ <div class="sek-pm-input-parent">
997
+ <input class="sek-pm-input" value="" type="number" >
998
+ </div>
999
+ </div>
1000
+ <div class="sek-flex-center-stretch" data-sek-spacing="padding-right" title="<?php _e('Padding right', 'nimble-builder'); ?>">
1001
+ <div class="sek-pm-input-parent">
1002
+ <input class="sek-pm-input" value="" type="number" >
1003
+ </div>
1004
+ </div>
1005
+ </div>
1006
+ <div class="sek-flex-justify-center">
1007
+ <div class="sek-flex-center-stretch" data-sek-spacing="padding-bottom" title="<?php _e('Padding bottom', 'nimble-builder'); ?>">
1008
+ <div class="sek-pm-input-parent">
1009
+ <input class="sek-pm-input" value="" type="number" >
1010
+ </div>
1011
+ </div>
1012
+ </div>
1013
+ </div>
1014
+
1015
+ <div class="sek-flex-center-stretch sek-pm-margin-right" data-sek-spacing="margin-right" title="<?php _e('Margin right', 'nimble-builder'); ?>">
1016
+ <div class="sek-pm-input-parent">
1017
+ <input class="sek-pm-input" value="" type="number" >
1018
+ </div>
1019
+ </div>
1020
+ </div>
1021
+
1022
+ <div class="sek-pm-top-bottom-wrap sek-flex-justify-center">
1023
+ <div class="sek-flex-center-stretch" data-sek-spacing="margin-bottom" title="<?php _e('Margin bottom', 'nimble-builder'); ?>">
1024
+ <div class="sek-pm-input-parent">
1025
+ <input class="sek-pm-input" value="" type="number" >
1026
+ </div>
1027
+ </div>
1028
+ </div>
1029
+ </div><?php //sek-pad-marg-inner ?>
1030
+ <div class="sek-unit-wrapper">
1031
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1032
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
1033
+ </div>
1034
+ <div class="reset-spacing-wrap"><span class="sek-do-reset"><?php _e('Reset all spacing', 'nimble-builder' ); ?></span></div>
1035
+
1036
+ </div><?php // sek-spacing-wrapper ?>
1037
+ <?php
1038
+ }
1039
+
1040
+ ?><?php
1041
+
1042
+ /* ------------------------------------------------------------------------- *
1043
+ * BACKGROUND POSITION INPUT
1044
+ /* ------------------------------------------------------------------------- */
1045
+ function sek_set_input_tmpl___bg_position( $input_id, $input_data ) {
1046
+ ?>
1047
+ <div class="sek-bg-pos-wrapper">
1048
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1049
+ <label class="sek-bg-pos">
1050
+ <input type="radio" name="sek-bg-pos" value="top_left">
1051
+ <span>
1052
+ <svg width="24" height="24">
1053
+ <path id="sek-pth" fill-rule="evenodd" d="M14.96 16v-1h-1v-1h-1v-1h-1v-1h-1v-1.001h-1V14h-1v-4-1h5v1h-3v.938h1v.999h1v1h1v1.001h1v1h1V16h-1z" class="sek-svg-bg-pos">
1054
+ </path>
1055
+ </svg>
1056
+ </span>
1057
+ </label>
1058
+ <label class="sek-bg-pos">
1059
+ <input type="radio" name="sek-bg-pos" value="top">
1060
+ <span>
1061
+ <svg width="24" height="24">
1062
+ <path id="sek-pth" fill-rule="evenodd" d="M14.969 12v-1h-1v-1h-1v7h-1v-7h-1v1h-1v1h-1v-1.062h1V9.937h1v-1h1V8h1v.937h1v1h1v1.001h1V12h-1z" class="sek-svg-bg-pos">
1063
+ </path>
1064
+ </svg>
1065
+ </span>
1066
+ </label>
1067
+ <label class="sek-bg-pos">
1068
+ <input type="radio" name="sek-bg-pos" value="top_right">
1069
+ <span>
1070
+ <svg width="24" height="24">
1071
+ <path id="sek-pth" fill-rule="evenodd" d="M9.969 16v-1h1v-1h1v-1h1v-1h1v-1.001h1V14h1v-4-1h-1-4v1h3v.938h-1v.999h-1v1h-1v1.001h-1v1h-1V16h1z" class="sek-svg-bg-pos">
1072
+ </path>
1073
+ </svg>
1074
+ </span>
1075
+ </label>
1076
+ <label class="sek-bg-pos">
1077
+ <input type="radio" name="sek-bg-pos" value="left">
1078
+ <span>
1079
+ <svg width="24" height="24">
1080
+ <path id="sek-pth" fill-rule="evenodd" d="M11.469 9.5h-1v1h-1v1h7v1h-7v1h1v1h1v1h-1.063v-1h-1v-1h-1v-1h-.937v-1h.937v-1h1v-1h1v-1h1.063v1z" class="sek-svg-bg-pos">
1081
+ </path>
1082
+ </svg>
1083
+ </span>
1084
+ </label>
1085
+ <label class="sek-bg-pos">
1086
+ <input type="radio" name="sek-bg-pos" value="center">
1087
+ <span>
1088
+ <svg width="24" height="24">
1089
+ <path id="sek-pth" fill-rule="evenodd" d="M12 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z" class="sek-svg-bg-pos">
1090
+ </path>
1091
+ </svg>
1092
+ </span>
1093
+ </label>
1094
+ <label class="sek-bg-pos">
1095
+ <input type="radio" name="sek-bg-pos" value="right">
1096
+ <span>
1097
+ <svg width="24" height="24">
1098
+ <path id="sek-pth" fill-rule="evenodd" d="M12.469 14.5h1v-1h1v-1h-7v-1h7v-1h-1v-1h-1v-1h1.062v1h1v1h1v1h.938v1h-.938v1h-1v1h-1v1h-1.062v-1z" class="sek-svg-bg-pos">
1099
+ </path>
1100
+ </svg>
1101
+ </span>
1102
+ </label>
1103
+ <label class="sek-bg-pos">
1104
+ <input type="radio" name="sek-bg-pos" value="bottom_left">
1105
+ <span>
1106
+ <svg width="24" height="24">
1107
+ <path id="sek-pth" fill-rule="evenodd" d="M14.969 9v1h-1v1h-1v1h-1v1h-1v1.001h-1V11h-1v5h5v-1h-3v-.938h1v-.999h1v-1h1v-1.001h1v-1h1V9h-1z" class="sek-svg-bg-pos">
1108
+ </path>
1109
+ </svg>
1110
+ </span>
1111
+ </label>
1112
+ <label class="sek-bg-pos">
1113
+ <input type="radio" name="sek-bg-pos" value="bottom">
1114
+ <span>
1115
+ <svg width="24" height="24">
1116
+ <path id="sek-pth" fill-rule="evenodd" d="M9.969 13v1h1v1h1V8h1v7h1v-1h1v-1h1v1.063h-1v.999h-1v1.001h-1V17h-1v-.937h-1v-1.001h-1v-.999h-1V13h1z" class="sek-svg-bg-pos">
1117
+ </path>
1118
+ </svg>
1119
+ </span>
1120
+ </label>
1121
+ <label class="sek-bg-pos">
1122
+ <input type="radio" name="sek-bg-pos" value="bottom_right">
1123
+ <span>
1124
+ <svg width="24" height="24">
1125
+ <path id="sek-pth" fill-rule="evenodd" d="M9.969 9v1h1v1h1v1h1v1h1v1.001h1V11h1v5h-1-4v-1h3v-.938h-1v-.999h-1v-1h-1v-1.001h-1v-1h-1V9h1z" class="sek-svg-bg-pos">
1126
+ </path>
1127
+ </svg>
1128
+ </span>
1129
+ </label>
1130
+ </div><?php // sek-bg-pos-wrapper ?>
1131
+ <?php
1132
+ }
1133
+
1134
+ ?><?php
1135
+
1136
+ /* ------------------------------------------------------------------------- *
1137
+ * HORIZONTAL ALIGNMENT INPUT
1138
+ /* ------------------------------------------------------------------------- */
1139
+ /* ------------------------------------------------------------------------- *
1140
+ * HORIZONTAL ALIGNMENT INPUT FOR TEXT => includes the 'justify' icon
1141
+ /* ------------------------------------------------------------------------- */
1142
+ function sek_set_input_tmpl___h_alignment( $input_id, $input_data ) {
1143
+ ?>
1144
+ <div class="sek-h-align-wrapper">
1145
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1146
+ <div class="sek-align-icons">
1147
+ <div data-sek-align="left" title="<?php _e('Align left','nimble-builder'); ?>"><i class="material-icons">format_align_left</i></div>
1148
+ <div data-sek-align="center" title="<?php _e('Align center','nimble-builder'); ?>"><i class="material-icons">format_align_center</i></div>
1149
+ <div data-sek-align="right" title="<?php _e('Align right','nimble-builder'); ?>"><i class="material-icons">format_align_right</i></div>
1150
+ </div>
1151
+ </div><?php // sek-h-align-wrapper ?>
1152
+ <?php
1153
+ }
1154
+
1155
+ function sek_set_input_tmpl___h_text_alignment( $input_id, $input_data ) {
1156
+ ?>
1157
+ <div class="sek-h-align-wrapper">
1158
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1159
+ <div class="sek-align-icons">
1160
+ <div data-sek-align="left" title="<?php _e('Align left','nimble-builder'); ?>"><i class="material-icons">format_align_left</i></div>
1161
+ <div data-sek-align="center" title="<?php _e('Align center','nimble-builder'); ?>"><i class="material-icons">format_align_center</i></div>
1162
+ <div data-sek-align="right" title="<?php _e('Align right','nimble-builder'); ?>"><i class="material-icons">format_align_right</i></div>
1163
+ <div data-sek-align="justify" title="<?php _e('Justified','nimble-builder'); ?>"><i class="material-icons">format_align_justify</i></div>
1164
+ </div>
1165
+ </div><?php // sek-h-align-wrapper ?>
1166
+ <?php
1167
+ }
1168
+ ?><?php
1169
+ /* ------------------------------------------------------------------------- *
1170
+ * VERTICAL ALIGNMENT INPUT
1171
+ /* ------------------------------------------------------------------------- */
1172
+ function sek_set_input_tmpl___v_alignment( $input_id, $input_data ) {
1173
+ ?>
1174
+ <div class="sek-v-align-wrapper">
1175
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1176
+ <div class="sek-align-icons">
1177
+ <div data-sek-align="top" title="<?php _e('Align top','nimble-builder'); ?>"><i class="material-icons">vertical_align_top</i></div>
1178
+ <div data-sek-align="center" title="<?php _e('Align center','nimble-builder'); ?>"><i class="material-icons">vertical_align_center</i></div>
1179
+ <div data-sek-align="bottom" title="<?php _e('Align bottom','nimble-builder'); ?>"><i class="material-icons">vertical_align_bottom</i></div>
1180
+ </div>
1181
+ </div><?php // sek-h-align-wrapper ?>
1182
+ <?php
1183
+ }
1184
+
1185
+ ?><?php
1186
+ /* ------------------------------------------------------------------------- *
1187
+ * FONT AWESOME ICON PICKER INPUT
1188
+ /* ------------------------------------------------------------------------- */
1189
+ function sek_set_input_tmpl___fa_icon_picker( $input_id, $input_data ) {
1190
+ ?>
1191
+ <select data-czrtype="<?php echo $input_id; ?>"></select>
1192
+ <?php
1193
+ }
1194
+ add_filter( "ac_set_ajax_czr_tmpl___fa_icon_picker_input", '\Nimble\sek_get_fa_icon_list_tmpl', 10, 3 );
1195
+ function sek_get_fa_icon_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
1196
+ if ( empty( $requested_tmpl ) ) {
1197
+ wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
1198
+ }
1199
+
1200
+ return wp_json_encode(
1201
+ sek_retrieve_decoded_font_awesome_icons()
1202
+ );//will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
1203
+ }
1204
+ function sek_retrieve_decoded_font_awesome_icons() {
1205
+ $faicons_json_path = NIMBLE_BASE_PATH . '/assets/faicons.json';
1206
+ $faicons_transient_name = 'sek_font_awesome_october_2018';
1207
+ if ( false == get_transient( $faicons_transient_name ) ) {
1208
+ if ( file_exists( $faicons_json_path ) ) {
1209
+ $faicons_raw = @file_get_contents( $faicons_json_path );
1210
+
1211
+ if ( false === $faicons_raw ) {
1212
+ $faicons_raw = wp_remote_fopen( $faicons_json_path );
1213
+ }
1214
+
1215
+ $faicons_decoded = json_decode( $faicons_raw, true );
1216
+ set_transient( $faicons_transient_name , $faicons_decoded , 60*60*24*3000 );
1217
+ } else {
1218
+ wp_send_json_error( __FUNCTION__ . ' => the file faicons.json is missing' );
1219
+ }
1220
+ }
1221
+ else {
1222
+ $faicons_decoded = get_transient( $faicons_transient_name );
1223
+ }
1224
+
1225
+ return $faicons_decoded;
1226
+ }
1227
+
1228
+ ?>
1229
+ <?php
1230
+ /* ------------------------------------------------------------------------- *
1231
+ * FONT PICKER INPUT
1232
+ /* ------------------------------------------------------------------------- */
1233
+ function sek_set_input_tmpl___font_picker( $input_id, $input_data ) {
1234
+ ?>
1235
+ <select data-czrtype="<?php echo $input_id; ?>"></select>
1236
+ <?php
1237
+ }
1238
+ add_filter( "ac_set_ajax_czr_tmpl___font_picker_input", '\Nimble\sek_get_font_list_tmpl', 10, 3 );
1239
+ function sek_get_font_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
1240
+ if ( empty( $requested_tmpl ) ) {
1241
+ wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
1242
+ }
1243
+
1244
+ return wp_json_encode( array(
1245
+ 'cfonts' => sek_get_cfonts(),
1246
+ 'gfonts' => sek_get_gfonts(),
1247
+ ) );//will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
1248
+ }
1249
+
1250
+
1251
+ function sek_get_cfonts() {
1252
+ $cfonts = array();
1253
+ $raw_cfonts = array(
1254
+ 'Arial Black,Arial Black,Gadget,sans-serif',
1255
+ 'Century Gothic',
1256
+ 'Comic Sans MS,Comic Sans MS,cursive',
1257
+ 'Courier New,Courier New,Courier,monospace',
1258
+ 'Georgia,Georgia,serif',
1259
+ 'Helvetica Neue, Helvetica, Arial, sans-serif',
1260
+ 'Impact,Charcoal,sans-serif',
1261
+ 'Lucida Console,Monaco,monospace',
1262
+ 'Lucida Sans Unicode,Lucida Grande,sans-serif',
1263
+ 'Palatino Linotype,Book Antiqua,Palatino,serif',
1264
+ 'Tahoma,Geneva,sans-serif',
1265
+ 'Times New Roman,Times,serif',
1266
+ 'Trebuchet MS,Helvetica,sans-serif',
1267
+ 'Verdana,Geneva,sans-serif',
1268
+ );
1269
+ foreach ( $raw_cfonts as $font ) {
1270
+ $cfonts[] = array(
1271
+ 'name' => $font ,
1272
+ 'subsets' => array()
1273
+ );
1274
+ }
1275
+ return apply_filters( 'sek_font_picker_cfonts', $cfonts );
1276
+ }
1277
+ function sek_retrieve_decoded_gfonts() {
1278
+ if ( false == get_transient( 'sek_gfonts_may_2018' ) ) {
1279
+ $gfont_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/webfonts.json" );
1280
+
1281
+ if ( $gfont_raw === false ) {
1282
+ $gfont_raw = wp_remote_fopen( NIMBLE_BASE_PATH ."/assets/webfonts.json" );
1283
+ }
1284
+
1285
+ $gfonts_decoded = json_decode( $gfont_raw, true );
1286
+ set_transient( 'sek_gfonts_may_2018' , $gfonts_decoded , 60*60*24*3000 );
1287
+ }
1288
+ else {
1289
+ $gfonts_decoded = get_transient( 'sek_gfonts_may_2018' );
1290
+ }
1291
+
1292
+ return $gfonts_decoded;
1293
+ }
1294
+ function sek_get_gfonts( $what = null ) {
1295
+
1296
+ $gfonts_decoded = sek_retrieve_decoded_gfonts();
1297
+ $gfonts = array();
1298
+
1299
+ foreach ( $gfonts_decoded['items'] as $font ) {
1300
+ foreach ( $font['variants'] as $variant ) {
1301
+ $name = str_replace( ' ', '+', $font['family'] );
1302
+ $gfonts[] = array(
1303
+ 'name' => $name . ':' .$variant
1304
+ );
1305
+ }
1306
+ }
1307
+
1308
+ return ('subsets' == $what) ? apply_filters( 'sek_font_picker_gfonts_subsets ', $subsets ) : apply_filters( 'sek_font_picker_gfonts', $gfonts ) ;
1309
+ }
1310
+
1311
+ ?><?php
1312
+
1313
+ /* ------------------------------------------------------------------------- *
1314
+ * FONT SIZE
1315
+ /* ------------------------------------------------------------------------- */
1316
+ /* ------------------------------------------------------------------------- *
1317
+ * LINE HEIGHT INPUT TMPLS
1318
+ /* ------------------------------------------------------------------------- */
1319
+ function sek_set_input_tmpl___font_size_line_height( $input_id, $input_data ) {
1320
+ ?>
1321
+ <?php
1322
+ ?>
1323
+ <#
1324
+ var value = data['<?php echo $input_id; ?>'],
1325
+ unit = data['<?php echo $input_id; ?>'];
1326
+ value = _.isString( value ) ? value.replace(/px|em|%/g,'') : '';
1327
+ unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
1328
+ unit = _.isEmpty( unit ) ? 'px' : unit;
1329
+ #>
1330
+ <div class="sek-font-size-line-height-wrapper">
1331
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
1332
+
1333
+ <?php
1334
+ printf( '<input type="number" %1$s %2$s %3$s value="{{ value }}" />',
1335
+ ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
1336
+ ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : '',
1337
+ ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
1338
+ );
1339
+ ?>
1340
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group sek-float-right" role="group">
1341
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
1342
+ </div><?php // sek-font-size-wrapper ?>
1343
+ <?php
1344
+ }
1345
+ ?><?php
1346
+ /* ------------------------------------------------------------------------- *
1347
+ * CODE EDITOR INPUT TEMPLATE
1348
+ /* ------------------------------------------------------------------------- */
1349
+ function sek_set_input_tmpl___code_editor( $input_id, $input_data ) {
1350
+ /*
1351
+ * Needed to form the correct params to pass to the code mirror editor, based on the code type
1352
+ */
1353
+ $code_editor_params = nimble_get_code_editor_settings( array(
1354
+ 'type' => ! empty( $input_data[ 'code_type' ] ) ? $input_data[ 'code_type' ] : 'text/html',
1355
+ ));
1356
+ ?>
1357
+ <textarea data-czrtype="<?php echo $input_id; ?>" class="width-100" name="textarea" rows="10" cols="" data-editor-params="<?php echo htmlspecialchars( json_encode( $code_editor_params ) ); ?>">{{ data.value }}</textarea>
1358
+ <?php
1359
+ }
1360
+ ?>
1361
+ <?php
1362
+ /* ------------------------------------------------------------------------- *
1363
+ * CODE EDITOR INPUT TEMPLATE
1364
+ /* ------------------------------------------------------------------------- */
1365
+ function sek_set_input_tmpl___range_simple( $input_id, $input_data ) {
1366
+ ?>
1367
+ <?php
1368
+ ?>
1369
+ <#
1370
+ var value = data['<?php echo $input_id; ?>'],
1371
+ unit = data['<?php echo $input_id; ?>'];
1372
+ value = _.isString( value ) ? value.replace(/px|em|%/g,'') : value;
1373
+ unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
1374
+ unit = _.isEmpty( unit ) ? 'px' : unit;
1375
+ #>
1376
+ <div class="sek-range-with-unit-picker-wrapper sek-no-unit-picker">
1377
+ <# //console.log( 'IN php::sek_set_input_tmpl___range_simple() => data range_slide => ', data ); #>
1378
+ <div class="sek-range-wrapper">
1379
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
1380
+ <?php
1381
+ printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
1382
+ ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
1383
+ ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
1384
+ ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
1385
+ ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
1386
+ );
1387
+ ?>
1388
+ </div>
1389
+ <div class="sek-number-wrapper">
1390
+ <input class="sek-pm-input" value="{{ value }}" type="number" >
1391
+ </div>
1392
+ </div><?php // sek-spacing-wrapper ?>
1393
+ <?php
1394
+ }
1395
+ ?>
1396
+ <?php
1397
+ /* ------------------------------------------------------------------------- *
1398
+ * CODE EDITOR INPUT TEMPLATE
1399
+ /* ------------------------------------------------------------------------- */
1400
+ function sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data ) {
1401
+ ?>
1402
+ <?php
1403
+ ?>
1404
+ <#
1405
+ var value = data['<?php echo $input_id; ?>'],
1406
+ unit = data['<?php echo $input_id; ?>'];
1407
+ value = _.isString( value ) ? value.replace(/px|em|%/g,'') : value;
1408
+ unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
1409
+ unit = _.isEmpty( unit ) ? 'px' : unit;
1410
+ #>
1411
+ <div class="sek-range-with-unit-picker-wrapper">
1412
+ <# //console.log( 'IN php::sek_set_input_tmpl___range_with_unit_picker() => data range_slide => ', data ); #>
1413
+ <div class="sek-range-wrapper">
1414
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
1415
+ <?php
1416
+ printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
1417
+ ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
1418
+ ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
1419
+ ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
1420
+ ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
1421
+ );
1422
+ ?>
1423
+ </div>
1424
+ <div class="sek-number-wrapper">
1425
+ <input class="sek-pm-input" value="{{ value }}" type="number" >
1426
+ </div>
1427
+ <div class="sek-unit-wrapper">
1428
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1429
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
1430
+ </div>
1431
+ </div><?php // sek-spacing-wrapper ?>
1432
+ <?php
1433
+ }
1434
+ ?>
1435
+ <?php
1436
+ /* ------------------------------------------------------------------------- *
1437
+ * CODE EDITOR INPUT TEMPLATE
1438
+ /* ------------------------------------------------------------------------- */
1439
+ function sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id, $input_data ) {
1440
+ ?>
1441
+ <?php
1442
+ ?>
1443
+ <#
1444
+ var value = data['<?php echo $input_id; ?>'],
1445
+ unit = data['<?php echo $input_id; ?>'];
1446
+ value = _.isString( value ) ? value.replace(/px|em|%/g,'') : value;
1447
+ unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
1448
+ unit = _.isEmpty( unit ) ? 'px' : unit;
1449
+ #>
1450
+ <div class="sek-range-with-unit-picker-wrapper">
1451
+ <# //console.log( 'IN php::sek_set_input_tmpl___range_with_unit_picker_device_switcher() => data range_slide => ', data ); #>
1452
+ <div class="sek-range-wrapper">
1453
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
1454
+ <?php
1455
+ printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
1456
+ ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
1457
+ ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
1458
+ ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
1459
+ ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
1460
+ );
1461
+ ?>
1462
+ </div>
1463
+ <div class="sek-number-wrapper">
1464
+ <input class="sek-pm-input" value="{{ value }}" type="number" >
1465
+ </div>
1466
+ <div class="sek-unit-wrapper">
1467
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1468
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
1469
+ </div>
1470
+ </div><?php // sek-spacing-wrapper ?>
1471
+ <?php
1472
+ }
1473
+ ?>
1474
+ <?php
1475
+ /* ------------------------------------------------------------------------- *
1476
+ * BORDERS INPUT TEMPLATE
1477
+ /* ------------------------------------------------------------------------- */
1478
+ function sek_set_input_tmpl___borders( $input_id, $input_data ) {
1479
+ ?>
1480
+ <?php
1481
+ ?>
1482
+ <div class="sek-borders">
1483
+ <# //console.log( 'IN php::sek_set_input_tmpl___borders() => data range_slide => ', data ); #>
1484
+ <div class="sek-border-type-wrapper">
1485
+ <div aria-label="unit" class="sek-ui-button-group" role="group"><button type="button" aria-pressed="true" class="sek-ui-button is-selected" title="<?php _e('All', 'nimble-builder');?>" data-sek-border-type="_all_"><?php _e('All', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Left', 'nimble-builder');?>" data-sek-border-type="left"><?php _e('Left', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Top', 'nimble-builder');?>" data-sek-border-type="top"><?php _e('Top', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Right', 'nimble-builder');?>" data-sek-border-type="right"><?php _e('Right', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Bottom', 'nimble-builder');?>" data-sek-border-type="bottom"><?php _e('Bottom', 'nimble-builder');?></button></div>
1486
+ </div>
1487
+ <div class="sek-range-unit-wrapper">
1488
+ <div class="sek-range-wrapper">
1489
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1490
+ <?php
1491
+ printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
1492
+ ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
1493
+ ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
1494
+ ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
1495
+ ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
1496
+ );
1497
+ ?>
1498
+ </div>
1499
+ <div class="sek-number-wrapper">
1500
+ <input class="sek-pm-input" value="{{ value }}" type="number" >
1501
+ </div>
1502
+ <div class="sek-unit-wrapper">
1503
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1504
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button></div>
1505
+ </div>
1506
+ </div>
1507
+ <div class="sek-color-wrapper">
1508
+ <div class="sek-color-picker"><input class="sek-alpha-color-input" data-alpha="true" type="text" value=""/></div>
1509
+ <div class="sek-reset-button"><button type="button" class="button sek-reset-button sek-float-right"><?php _e( 'Reset', 'nimble-builder'); ?></button></div>
1510
+ </div>
1511
+ </div><?php // sek-borders ?>
1512
+ <?php
1513
+ }
1514
+ ?>
1515
+ <?php
1516
+ /* ------------------------------------------------------------------------- *
1517
+ * BORDER RADIUS INPUT TEMPLATE
1518
+ /* ------------------------------------------------------------------------- */
1519
+ function sek_set_input_tmpl___border_radius( $input_id, $input_data ) {
1520
+ ?>
1521
+ <?php
1522
+ ?>
1523
+ <div class="sek-borders">
1524
+ <# //console.log( 'IN php::sek_set_input_tmpl___border_radius() => data range_slide => ', data ); #>
1525
+ <div class="sek-border-type-wrapper">
1526
+ <div aria-label="unit" class="sek-ui-button-group sek-float-left" role="group"><button type="button" aria-pressed="true" class="sek-ui-button is-selected" title="<?php _e('All', 'nimble-builder');?>" data-sek-radius-type="_all_"><?php _e('All', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Top left', 'nimble-builder');?>" data-sek-radius-type="top_left"><i class="material-icons">border_style</i></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Top right', 'nimble-builder');?>" data-sek-radius-type="top_right"><i class="material-icons">border_style</i></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Bottom right', 'nimble-builder');?>" data-sek-radius-type="bottom_right"><i class="material-icons">border_style</i></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Bottom left', 'nimble-builder');?>" data-sek-radius-type="bottom_left"><i class="material-icons">border_style</i></button></div>
1527
+ <div class="sek-reset-button"><button type="button" class="button sek-reset-button sek-float-right"><?php _e( 'Reset', 'nimble-builder'); ?></button></div>
1528
+ </div>
1529
+ <div class="sek-range-unit-wrapper">
1530
+ <div class="sek-range-wrapper">
1531
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1532
+ <?php
1533
+ printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
1534
+ ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
1535
+ ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
1536
+ ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
1537
+ ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
1538
+ );
1539
+ ?>
1540
+ </div>
1541
+ <div class="sek-number-wrapper">
1542
+ <input class="sek-pm-input" value="{{ value }}" type="number" >
1543
+ </div>
1544
+ <div class="sek-unit-wrapper">
1545
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1546
+ <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
1547
+ </div>
1548
+ </div>
1549
+ </div><?php // sek-borders ?>
1550
+ <?php
1551
+ }
1552
+ ?>
1553
+ <?php
1554
+ /* ------------------------------------------------------------------------- *
1555
+ * MULTIPLE BUTTON CHOICES INPUT TEMPLATE
1556
+ /* ------------------------------------------------------------------------- */
1557
+ function sek_set_input_tmpl___buttons_choice( $input_id, $input_data ) {
1558
+ ?>
1559
+ <# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #>
1560
+ <?php
1561
+ if ( ! is_array( $input_data ) || empty( $input_data['choices'] ) || ! is_array( $input_data['choices'] ) ) {
1562
+ sek_error_log( __FUNCTION__ . ' error => missing choices property' );
1563
+ return;
1564
+ }
1565
+ ?>
1566
+ <div class="sek-button-choice-wrapper">
1567
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1568
+ <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group sek-float-right" role="group">
1569
+ <?php
1570
+ foreach( $input_data['choices'] as $choice => $label ) {
1571
+ printf('<button type="button" aria-pressed="false" class="sek-ui-button" title="%1$s" data-sek-choice="%2$s">%1$s</button>',
1572
+ $label,
1573
+ $choice
1574
+ );
1575
+ }
1576
+ ?>
1577
+ </div>
1578
+ </div>
1579
+ <?php
1580
+ }
1581
+ ?>
1582
+ <?php
1583
+ /* ------------------------------------------------------------------------- *
1584
+ * RESET BUTTON INPUT TEMPLATE
1585
+ /* ------------------------------------------------------------------------- */
1586
+ function sek_set_input_tmpl___reset_button( $input_id, $input_data ) {
1587
+ ?>
1588
+ <# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #>
1589
+ <?php
1590
+ if ( ! is_array( $input_data ) || empty( $input_data['scope'] ) ) {
1591
+ sek_error_log( __FUNCTION__ . ' error => missing scope property' );
1592
+ return;
1593
+ }
1594
+ ?>
1595
+ <div class="sek-button-choice-wrapper">
1596
+ <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1597
+ <button type="button" aria-pressed="false" class="sek-ui-button sek-float-right" title="%1$s" data-sek-reset-scope="<?php echo $input_data['scope']; ?>"><?php _e('Reset', 'nimble-builder'); ?></button>
1598
+ </div>
1599
+ <?php
1600
+ }
1601
+ ?>
inc/sektions/ccat-sektions.php CHANGED
@@ -512,6 +512,124 @@ function sek_front_needs_font_awesome( $bool = false, $recursive_data = null ) {
512
  }
513
  return $bool;
514
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  ?><?php
516
  function sek_maybe_do_version_mapping() {
517
  if ( ! is_user_logged_in() || ! current_user_can( 'edit_theme_options' ) )
@@ -772,1707 +890,121 @@ function sek_get_seks_post( $skope_id = '', $skope_level = 'local' ) {
772
  return $post;
773
  }
774
 
775
- /**
776
- * Fetch the saved collection of sektion for a given skope_id / location
777
- *
778
- * @since 4.7.0
779
- *
780
- * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme.
781
- * @return array => the skope setting items
782
- */
783
- function sek_get_skoped_seks( $skope_id = '', $location_id = '', $skope_level = 'local' ) {
784
- if ( empty( $skope_id ) ) {
785
- $skope_id = skp_get_skope_id( $skope_level );
786
- }
787
- if ( did_action('wp') && 'not_cached' != SEK_Fire()->local_seks ) {
788
- $seks_data = SEK_Fire()->local_seks;
789
- } else {
790
-
791
- $seks_data = array();
792
- $post = sek_get_seks_post( $skope_id );
793
- if ( $post ) {
794
- $seks_data = maybe_unserialize( $post->post_content );
795
- }
796
- $seks_data = is_array( $seks_data ) ? $seks_data : array();
797
- $default_collection = sek_get_default_sektions_value();
798
- $seks_data = wp_parse_args( $seks_data, $default_collection );
799
- $maybe_incomplete_locations = [];
800
- foreach( $seks_data['collection'] as $location_data ) {
801
- if ( !empty( $location_data['id'] ) ) {
802
- $maybe_incomplete_locations[] = $location_data['id'];
803
- }
804
- }
805
-
806
- foreach( SEK_Fire()->registered_locations as $loc_id => $params ) {
807
- if ( !in_array( $loc_id, $maybe_incomplete_locations ) ) {
808
- $seks_data['collection'][] = wp_parse_args( [ 'id' => $loc_id ], SEK_Fire()->default_location_model );
809
- }
810
- }
811
- SEK_Fire()->local_seks = $seks_data;
812
- }//end if
813
- $seks_data = apply_filters(
814
- 'sek_get_skoped_seks',
815
- $seks_data,
816
- $skope_id,
817
- $location_id
818
- );
819
- if ( array_key_exists( 'collection', $seks_data ) && ! empty( $location_id ) ) {
820
- if ( ! array_key_exists( $location_id, sek_get_locations() ) ) {
821
- error_log( __FUNCTION__ . ' Error => location ' . $location_id . ' is not registered in the available locations' );
822
- } else {
823
- $seks_data = sek_get_level_model( $location_id, $seks_data['collection'] );
824
- }
825
- }
826
-
827
- return 'no_match' === $seks_data ? SEK_Fire()->default_location_model : $seks_data;
828
- }
829
-
830
-
831
-
832
- /**
833
- * Update the `nimble_post_type` post for a given "{$skope_id}"
834
- * Inserts a `nimble_post_type` post when one doesn't yet exist.
835
- *
836
- * @since 4.7.0
837
- *
838
- * }
839
- * @return WP_Post|WP_Error Post on success, error on failure.
840
- */
841
- function sek_update_sek_post( $seks_data, $args = array() ) {
842
- $args = wp_parse_args( $args, array(
843
- 'skope_id' => ''
844
- ) );
845
-
846
- if ( ! is_array( $seks_data ) ) {
847
- error_log( 'sek_update_sek_post => $seks_data is not an array' );
848
- return new WP_Error( 'sek_update_sek_post => $seks_data is not an array');
849
- }
850
-
851
- $skope_id = $args['skope_id'];
852
- if ( empty( $skope_id ) ) {
853
- error_log( 'sek_update_sek_post => empty skope_id' );
854
- return new WP_Error( 'sek_update_sek_post => empty skope_id');
855
- }
856
-
857
- $post_title = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id;
858
-
859
- $post_data = array(
860
- 'post_title' => $post_title,
861
- 'post_name' => sanitize_title( $post_title ),
862
- 'post_type' => NIMBLE_CPT,
863
- 'post_status' => 'publish',
864
- 'post_content' => maybe_serialize( $seks_data )
865
- );
866
- $post = sek_get_seks_post( $skope_id );
867
-
868
- if ( $post ) {
869
- $post_data['ID'] = $post->ID;
870
- $r = wp_update_post( wp_slash( $post_data ), true );
871
- } else {
872
- $r = wp_insert_post( wp_slash( $post_data ), true );
873
- if ( ! is_wp_error( $r ) ) {
874
- $option_name = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id;
875
- $post_id = $r;//$r is the post ID
876
-
877
- update_option( $option_name, (int)$post_id );
878
- if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
879
- wp_save_post_revision( $r );
880
- }
881
- }
882
- }
883
-
884
- if ( is_wp_error( $r ) ) {
885
- return $r;
886
- }
887
- return get_post( $r );
888
- }
889
- ?><?php
890
- require_once( dirname( __FILE__ ) . '/customizer/seks_tiny_mce_editor_actions.php' );
891
- add_action ( 'customize_controls_enqueue_scripts', '\Nimble\sek_enqueue_controls_js_css', 20 );
892
- function sek_enqueue_controls_js_css() {
893
- wp_enqueue_style(
894
- 'sek-control',
895
- sprintf(
896
- '%1$s/assets/czr/sek/css/%2$s' ,
897
- NIMBLE_BASE_URL,
898
- sek_is_dev_mode() ? 'sek-control.css' : 'sek-control.min.css'
899
- ),
900
- array(),
901
- NIMBLE_ASSETS_VERSION,
902
- 'all'
903
- );
904
-
905
-
906
- wp_enqueue_script(
907
- 'czr-sektions',
908
- sprintf(
909
- '%1$s/assets/czr/sek/js/%2$s' ,
910
- NIMBLE_BASE_URL,
911
- sek_is_dev_mode() ? 'ccat-sek-control.js' : 'ccat-sek-control.min.js'
912
- ),
913
- array( 'czr-skope-base' , 'jquery', 'underscore' ),
914
- NIMBLE_ASSETS_VERSION,
915
- $in_footer = true
916
- );
917
-
918
- wp_enqueue_script(
919
- 'czr-color-picker',
920
- sprintf(
921
- '%1$s/assets/czr/sek/js/libs/%2$s' ,
922
- NIMBLE_BASE_URL,
923
- sek_is_dev_mode() ? 'czr-color-picker.js' : 'czr-color-picker.min.js'
924
- ),
925
- array( 'jquery' ),
926
- NIMBLE_ASSETS_VERSION,
927
- $in_footer = true
928
- );
929
-
930
- wp_localize_script(
931
- 'czr-sektions',
932
- 'sektionsLocalizedData',
933
- apply_filters( 'nimble-sek-localized-customizer-control-params',
934
- array(
935
- 'nimbleVersion' => NIMBLE_VERSION,
936
- 'isDevMode' => sek_is_dev_mode(),
937
- 'baseUrl' => NIMBLE_BASE_URL,
938
- 'sektionsPanelId' => '__sektions__',
939
- 'addNewSektionId' => 'sek_add_new_sektion',
940
- 'addNewColumnId' => 'sek_add_new_column',
941
- 'addNewModuleId' => 'sek_add_new_module',
942
-
943
- 'optPrefixForSektionSetting' => NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION,//'nimble___'
944
- 'optNameForGlobalOptions' => NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS,//'nimble___'
945
- 'optPrefixForSektionsNotSaved' => NIMBLE_OPT_PREFIX_FOR_LEVEL_UI,//"__nimble__"
946
-
947
- 'globalOptionDBValues' => get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS ),// '__nimble_options__'
948
-
949
- 'defaultSektionSettingValue' => sek_get_default_sektions_value(),
950
-
951
- 'registeredModules' => CZR_Fmk_Base() -> registered_modules,
952
- 'preDropElementClass' => 'sortable-placeholder',
953
- 'dropSelectors' => implode(',', [
954
- '.sek-drop-zone', //This is the selector for all eligible drop zones printed statically or dynamically on dragstart
955
- 'body',// body will not be eligible for drop, but setting the body as drop zone allows us to fire dragenter / dragover actions, like toggling the "approaching" or "close" css class to real drop zone
956
- '.sek-content-preset_section-drop-zone'//between sections
957
- ])
958
- )
959
- )
960
- );//wp_localize_script()
961
-
962
- nimble_enqueue_code_editor();
963
- }//sek_enqueue_controls_js_css()
964
-
965
-
966
-
967
-
968
-
969
- /**
970
- * Enqueue all code editor assets
971
- */
972
- function nimble_enqueue_code_editor() {
973
- wp_enqueue_script( 'code-editor' );
974
- wp_enqueue_style( 'code-editor' );
975
-
976
- wp_enqueue_script( 'csslint' );
977
- wp_enqueue_script( 'htmlhint' );
978
- wp_enqueue_script( 'csslint' );
979
- wp_enqueue_script( 'jshint' );
980
- wp_enqueue_script( 'htmlhint-kses' );
981
- wp_enqueue_script( 'jshint' );
982
- wp_enqueue_script( 'jsonlint' );
983
- }
984
-
985
-
986
-
987
- /**
988
- * Enqueue assets needed by the code editor for the given settings.
989
- *
990
- * @param array $args {
991
- * Args.
992
- *
993
- * @type string $type The MIME type of the file to be edited.
994
- * @type array $codemirror Additional CodeMirror setting overrides.
995
- * @type array $csslint CSSLint rule overrides.
996
- * @type array $jshint JSHint rule overrides.
997
- * @type array $htmlhint JSHint rule overrides.
998
- * @returns array Settings for the enqueued code editor.
999
- * }
1000
- */
1001
- function nimble_get_code_editor_settings( $args ) {
1002
- $settings = array(
1003
- 'codemirror' => array(
1004
- 'indentUnit' => 2,
1005
- 'tabSize' => 2,
1006
- 'indentWithTabs' => true,
1007
- 'inputStyle' => 'contenteditable',
1008
- 'lineNumbers' => true,
1009
- 'lineWrapping' => true,
1010
- 'styleActiveLine' => true,
1011
- 'continueComments' => true,
1012
- 'extraKeys' => array(
1013
- 'Ctrl-Space' => 'autocomplete',
1014
- 'Ctrl-/' => 'toggleComment',
1015
- 'Cmd-/' => 'toggleComment',
1016
- 'Alt-F' => 'findPersistent',
1017
- 'Ctrl-F' => 'findPersistent',
1018
- 'Cmd-F' => 'findPersistent',
1019
- ),
1020
- 'direction' => 'ltr', // Code is shown in LTR even in RTL languages.
1021
- 'gutters' => array(),
1022
- ),
1023
- 'csslint' => array(
1024
- 'errors' => true, // Parsing errors.
1025
- 'box-model' => true,
1026
- 'display-property-grouping' => true,
1027
- 'duplicate-properties' => true,
1028
- 'known-properties' => true,
1029
- 'outline-none' => true,
1030
- ),
1031
- 'jshint' => array(
1032
- 'boss' => true,
1033
- 'curly' => true,
1034
- 'eqeqeq' => true,
1035
- 'eqnull' => true,
1036
- 'es3' => true,
1037
- 'expr' => true,
1038
- 'immed' => true,
1039
- 'noarg' => true,
1040
- 'nonbsp' => true,
1041
- 'onevar' => true,
1042
- 'quotmark' => 'single',
1043
- 'trailing' => true,
1044
- 'undef' => true,
1045
- 'unused' => true,
1046
-
1047
- 'browser' => true,
1048
-
1049
- 'globals' => array(
1050
- '_' => false,
1051
- 'Backbone' => false,
1052
- 'jQuery' => false,
1053
- 'JSON' => false,
1054
- 'wp' => false,
1055
- ),
1056
- ),
1057
- 'htmlhint' => array(
1058
- 'tagname-lowercase' => true,
1059
- 'attr-lowercase' => true,
1060
- 'attr-value-double-quotes' => false,
1061
- 'doctype-first' => false,
1062
- 'tag-pair' => true,
1063
- 'spec-char-escape' => true,
1064
- 'id-unique' => true,
1065
- 'src-not-empty' => true,
1066
- 'attr-no-duplication' => true,
1067
- 'alt-require' => true,
1068
- 'space-tab-mixed-disabled' => 'tab',
1069
- 'attr-unsafe-chars' => true,
1070
- ),
1071
- );
1072
-
1073
- $type = '';
1074
-
1075
- if ( isset( $args['type'] ) ) {
1076
- $type = $args['type'];
1077
- if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
1078
- $type = 'text/x-diff';
1079
- }
1080
- } //we do not treat the "file" case
1081
-
1082
-
1083
- if ( 'text/css' === $type ) {
1084
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1085
- 'mode' => 'css',
1086
- 'lint' => true,
1087
- 'autoCloseBrackets' => true,
1088
- 'matchBrackets' => true,
1089
- ) );
1090
- } elseif ( 'text/x-scss' === $type || 'text/x-less' === $type || 'text/x-sass' === $type ) {
1091
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1092
- 'mode' => $type,
1093
- 'lint' => false,
1094
- 'autoCloseBrackets' => true,
1095
- 'matchBrackets' => true,
1096
- ) );
1097
- } elseif ( 'text/x-diff' === $type ) {
1098
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1099
- 'mode' => 'diff',
1100
- ) );
1101
- } elseif ( 'text/html' === $type ) {
1102
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1103
- 'mode' => 'htmlmixed',
1104
- 'lint' => true,
1105
- 'autoCloseBrackets' => true,
1106
- 'autoCloseTags' => true,
1107
- 'matchTags' => array(
1108
- 'bothTags' => true,
1109
- ),
1110
- ) );
1111
-
1112
- if ( ! current_user_can( 'unfiltered_html' ) ) {
1113
- $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' );
1114
- }
1115
- } elseif ( 'text/x-gfm' === $type ) {
1116
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1117
- 'mode' => 'gfm',
1118
- 'highlightFormatting' => true,
1119
- ) );
1120
- } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) {
1121
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1122
- 'mode' => 'javascript',
1123
- 'lint' => true,
1124
- 'autoCloseBrackets' => true,
1125
- 'matchBrackets' => true,
1126
- ) );
1127
- } elseif ( false !== strpos( $type, 'json' ) ) {
1128
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1129
- 'mode' => array(
1130
- 'name' => 'javascript',
1131
- ),
1132
- 'lint' => true,
1133
- 'autoCloseBrackets' => true,
1134
- 'matchBrackets' => true,
1135
- ) );
1136
- if ( 'application/ld+json' === $type ) {
1137
- $settings['codemirror']['mode']['jsonld'] = true;
1138
- } else {
1139
- $settings['codemirror']['mode']['json'] = true;
1140
- }
1141
- } elseif ( false !== strpos( $type, 'jsx' ) ) {
1142
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1143
- 'mode' => 'jsx',
1144
- 'autoCloseBrackets' => true,
1145
- 'matchBrackets' => true,
1146
- ) );
1147
- } elseif ( 'text/x-markdown' === $type ) {
1148
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1149
- 'mode' => 'markdown',
1150
- 'highlightFormatting' => true,
1151
- ) );
1152
- } elseif ( 'text/nginx' === $type ) {
1153
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1154
- 'mode' => 'nginx',
1155
- ) );
1156
- } elseif ( 'application/x-httpd-php' === $type ) {
1157
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1158
- 'mode' => 'php',
1159
- 'autoCloseBrackets' => true,
1160
- 'autoCloseTags' => true,
1161
- 'matchBrackets' => true,
1162
- 'matchTags' => array(
1163
- 'bothTags' => true,
1164
- ),
1165
- ) );
1166
- } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) {
1167
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1168
- 'mode' => 'sql',
1169
- 'autoCloseBrackets' => true,
1170
- 'matchBrackets' => true,
1171
- ) );
1172
- } elseif ( false !== strpos( $type, 'xml' ) ) {
1173
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1174
- 'mode' => 'xml',
1175
- 'autoCloseBrackets' => true,
1176
- 'autoCloseTags' => true,
1177
- 'matchTags' => array(
1178
- 'bothTags' => true,
1179
- ),
1180
- ) );
1181
- } elseif ( 'text/x-yaml' === $type ) {
1182
- $settings['codemirror'] = array_merge( $settings['codemirror'], array(
1183
- 'mode' => 'yaml',
1184
- ) );
1185
- } else {
1186
- $settings['codemirror']['mode'] = $type;
1187
- }
1188
-
1189
- if ( ! empty( $settings['codemirror']['lint'] ) ) {
1190
- $settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers';
1191
- }
1192
- foreach ( wp_array_slice_assoc( $args, array( 'codemirror', 'csslint', 'jshint', 'htmlhint' ) ) as $key => $value ) {
1193
- $settings[ $key ] = array_merge(
1194
- $settings[ $key ],
1195
- $value
1196
- );
1197
- }
1198
-
1199
- $settings = apply_filters( 'nimble_code_editor_settings', $settings, $args );
1200
-
1201
- if ( empty( $settings ) || empty( $settings['codemirror'] ) ) {
1202
- return false;
1203
- }
1204
-
1205
- if ( isset( $settings['codemirror']['mode'] ) ) {
1206
- $mode = $settings['codemirror']['mode'];
1207
- if ( is_string( $mode ) ) {
1208
- $mode = array(
1209
- 'name' => $mode,
1210
- );
1211
- }
1212
- }
1213
-
1214
- return $settings;
1215
- }
1216
-
1217
-
1218
-
1219
-
1220
- /* ------------------------------------------------------------------------- *
1221
- * LOCALIZED PARAMS I18N
1222
- /* ------------------------------------------------------------------------- */
1223
- add_filter( 'nimble-sek-localized-customizer-control-params', '\Nimble\nimble_add_i18n_localized_control_params' );
1224
- function nimble_add_i18n_localized_control_params( $params ) {
1225
- return array_merge( $params, array(
1226
- 'i18n' => array(
1227
- 'Sections' => __( 'Sections', 'nimble-builder'),
1228
-
1229
- 'Nimble Builder' => __('Nimble Builder', 'nimble-builder'),
1230
-
1231
- "You've reached the maximum number of allowed nested sections." => __("You've reached the maximum number of allowed nested sections.", 'nimble-builder'),
1232
- "You've reached the maximum number of columns allowed in this section." => __( "You've reached the maximum number of columns allowed in this section.", 'nimble-builder'),
1233
- "A section must have at least one column." => __( "A section must have at least one column.", 'nimble-builder'),
1234
-
1235
- 'If this problem locks the Nimble builder, you might try to reset the sections for this page.' => __('If this problem locks the Nimble builder, you might try to reset the sections for this page.', 'nimble-builder'),
1236
- 'Reset' => __('Reset', 'nimble-builder'),
1237
- 'Reset complete' => __('Reset complete', 'nimble-builder'),
1238
- 'Drag and drop content' => __('Drag and drop content', 'nimble-builder'),
1239
- 'Content Picker' => __('Content Picker', 'nimble-builder'),
1240
- 'Pick a module' => __('Pick a module', 'nimble-builder'),
1241
- 'Pick a pre-designed section' => __('Pick a pre-designed section', 'nimble-builder'),
1242
- 'Select a content type' => __('Select a content type', 'nimble-builder'),
1243
-
1244
- 'Sections for an introduction' => __('Sections for an introduction', 'nimble-builder'),
1245
- 'Sections for services and features' => __('Sections for services and features', 'nimble-builder'),
1246
- 'Contact-us sections' => __('Contact-us sections', 'nimble-builder'),
1247
- 'Empty sections with columns layout' => __('Empty sections with columns layout', 'nimble-builder'),
1248
-
1249
- 'Drag and drop a module in one of the possible locations of the previewed page.' => __( 'Drag and drop a module in one of the possible locations of the previewed page.', 'nimble-builder' ),
1250
-
1251
- 'Module' => __('Module', 'nimble-builder'),
1252
- 'Content for' => __('Content for', 'nimble-builder'),
1253
- 'Customize the options for module :' => __('Customize the options for module :', 'nimble-builder'),
1254
-
1255
- 'Layout settings for the' => __('Layout settings for the', 'nimble-builder'),
1256
- 'Background settings for the' => __('Background settings for the', 'nimble-builder'),
1257
- 'Borders settings for the' => __('Borders settings for the', 'nimble-builder'),
1258
- 'Padding and margin settings for the' => __('Padding and margin settings for the', 'nimble-builder'),
1259
- 'Height settings for the' => __('Height settings for the', 'nimble-builder'),
1260
- 'Width settings for the' => __('Width settings for the', 'nimble-builder'),
1261
- 'Set a custom anchor for the' => __('Set a custom anchor for the', 'nimble-builder'),
1262
- 'Device visibility settings for the' => __('Device visibility settings for the', 'nimble-builder'),
1263
- 'Responsive settings : breakpoint, column direction' => __('Responsive settings : breakpoint, column direction', 'nimble-builder'),
1264
-
1265
- 'Settings for the' => __('Settings for the', 'nimble-builder'),//section / column / module
1266
- 'Current page options' => __( 'Current page options', 'nimble-builder'),
1267
- 'Page template' => __( 'Page template', 'nimble-builder'),
1268
- 'Inner and outer widths' => __( 'Inner and outer widths', 'nimble-builder'),
1269
- 'Custom CSS' => __( 'Custom CSS', 'nimble-builder'),
1270
- 'Remove the sections in this page' => __( 'Remove the sections in this page', 'nimble-builder'),
1271
-
1272
- 'Site wide breakpoint for Nimble sections' => __( 'Site wide breakpoint for Nimble sections', 'nimble-builder'),
1273
- 'Site wide inner and outer sections widths' => __( 'Site wide inner and outer sections widths', 'nimble-builder'),
1274
- 'Options for the sections of the current page' => __( 'Options for the sections of the current page', 'nimble-builder'),
1275
- 'General options applied for the sections site wide' => __( 'General options applied for the sections site wide', 'nimble-builder'),
1276
-
1277
- 'Site wide options' => __( 'Site wide options', 'nimble-builder'),
1278
- 'location' => __('location', 'nimble-builder'),
1279
- 'section' => __('section', 'nimble-builder'),
1280
- 'column' => __('column', 'nimble-builder'),
1281
- 'module' => __('module', 'nimble-builder'),
1282
-
1283
- 'This browser does not support drag and drop. You might need to update your browser or use another one.' => __('This browser does not support drag and drop. You might need to update your browser or use another one.', 'nimble-builder'),
1284
- 'Insert here' => __('Insert here', 'nimble-builder'),
1285
- 'Insert in a new section' => __('Insert in a new section', 'nimble-builder'),
1286
- 'Insert a new section here' => __('Insert a new section here', 'nimble-builder'),
1287
- 'Select a font family' => __('Select a font family', 'nimble-builder'),
1288
- 'Web Safe Fonts' => __('Web Safe Fonts', 'nimble-builder'),
1289
- 'Google Fonts' => __('Google Fonts', 'nimble-builder'),
1290
-
1291
- 'Set a custom url' => __('Set a custom url', 'nimble-builder'),
1292
-
1293
- 'Something went wrong, please refresh this page.' => __('Something went wrong, please refresh this page.', 'nimble-builder'),
1294
-
1295
- 'Select an icon' => __( 'Select an icon', 'nimble-builder' ),
1296
- 'codeEditorSingular' => __( 'There is %d error in your %s code which might break your site. Please fix it before saving.', 'nimble-builder' ),
1297
- 'codeEditorPlural' => __( 'There are %d errors in your %s code which might break your site. Please fix them before saving.', 'nimble-builder' ),
1298
- 'Settings on desktops' => __('Settings on desktops', 'nimble-builder'),
1299
- 'Settings on tablets' => __('Settings on tablets', 'nimble-builder'),
1300
- 'Settings on mobiles' => __('Settings on mobiles', 'nimble-builder')
1301
-
1302
- )//array()
1303
- )//array()
1304
- );//array_merge
1305
- }//'nimble_add_i18n_localized_control_params'
1306
- add_filter( 'skp_json_export_ready_skopes', '\Nimble\add_sektion_values_to_skope_export' );
1307
- function add_sektion_values_to_skope_export( $skopes ) {
1308
- if ( ! is_array( $skopes ) ) {
1309
- error_log( 'skp_json_export_ready_skopes filter => the filtered skopes must be an array.' );
1310
- }
1311
- $new_skopes = array();
1312
- foreach ( $skopes as $skp_data ) {
1313
- if ( 'global' == $skp_data['skope'] || 'group' == $skp_data['skope'] ) {
1314
- $new_skopes[] = $skp_data;
1315
- continue;
1316
- }
1317
- if ( ! is_array( $skp_data ) ) {
1318
- error_log( 'skp_json_export_ready_skopes filter => the skope data must be an array.' );
1319
- continue;
1320
- }
1321
- $skope_id = skp_get_skope_id( $skp_data['skope'] );
1322
- $skp_data[ 'sektions' ] = array(
1323
- 'db_values' => sek_get_skoped_seks( $skope_id ),
1324
- 'setting_id' => sek_get_seks_setting_id( $skope_id )//nimble___loop_start[skp__post_page_home]
1325
- );
1326
- $new_skopes[] = $skp_data;
1327
- }
1328
-
1329
- return $new_skopes;
1330
- }
1331
- function sek_get_preset_sektions() {
1332
- $transient_name = 'nimble_preset_sections_' . NIMBLE_VERSION;
1333
- $transient_data = get_transient( $transient_name );
1334
- if ( false == $transient_data || empty( $transient_data ) || sek_is_dev_mode() ) {
1335
- $preset_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/preset_sections.json" );
1336
- if ( $preset_raw === false ) {
1337
- $preset_raw = wp_remote_fopen( NIMBLE_BASE_PATH ."/assets/preset_sections.json" );
1338
- }
1339
-
1340
- $presets_decoded = json_decode( $preset_raw, true );
1341
- set_transient( $transient_name , $presets_decoded , 60*60*24*30 );
1342
- }
1343
- else {
1344
- $presets_decoded = $transient_data;
1345
- }
1346
- return $presets_decoded;
1347
- }
1348
- function sek_get_img_sizes() {
1349
- global $_wp_additional_image_sizes;
1350
-
1351
- $sizes = array();
1352
- $to_return = array(
1353
- 'original' => __('Original image dimensions', 'nimble-builder')
1354
- );
1355
-
1356
- foreach ( get_intermediate_image_sizes() as $_size ) {
1357
-
1358
- $first_to_upper_size = ucfirst(strtolower($_size));
1359
- $first_to_upper_size = preg_replace_callback( '/[.!?].*?\w/', '\Nimble\sek_img_sizes_preg_replace_callback', $first_to_upper_size );
1360
-
1361
- if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
1362
- $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
1363
- $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
1364
- $sizes[ $_size ]['title'] = $first_to_upper_size;
1365
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1366
- $sizes[ $_size ] = array(
1367
- 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
1368
- 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
1369
- 'title' => $first_to_upper_size
1370
- );
1371
- }
1372
- }
1373
- foreach ( $sizes as $_size => $data ) {
1374
- $to_return[ $_size ] = $data['title'] . ' - ' . $data['width'] . ' x ' . $data['height'];
1375
- }
1376
-
1377
- return $to_return;
1378
- }
1379
-
1380
- function sek_img_sizes_preg_replace_callback( $matches ) {
1381
- return strtoupper( $matches[0] );
1382
- }
1383
-
1384
- add_action( 'customize_controls_print_footer_scripts', '\Nimble\sek_print_nimble_customizer_tmpl' );
1385
- function sek_print_nimble_customizer_tmpl() {
1386
- ?>
1387
- <script type="text/html" id="tmpl-nimble-top-bar">
1388
- <div id="nimble-top-bar" class="czr-preview-notification">
1389
- <div class="sek-add-content">
1390
- <button type="button" class="material-icons" title="<?php _e('Add content', 'nimble-builder'); ?>" data-nimble-state="enabled">
1391
- add_circle_outline<span class="screen-reader-text"><?php _e('Add content', 'nimble-builder'); ?></span>
1392
- </button>
1393
- </div>
1394
- <div class="sek-do-undo">
1395
- <button type="button" class="icon undo" title="<?php _e('Undo', 'nimble-builder'); ?>" data-nimble-history="undo" data-nimble-state="disabled">
1396
- <span class="screen-reader-text"><?php _e('Undo', 'nimble-builder'); ?></span>
1397
- </button>
1398
- <button type="button" class="icon do" title="<?php _e('Redo', 'nimble-builder'); ?>" data-nimble-history="redo" data-nimble-state="disabled">
1399
- <span class="screen-reader-text"><?php _e('Redo', 'nimble-builder'); ?></span>
1400
- </button>
1401
- </div>
1402
- <div class="sek-settings">
1403
- <button type="button" class="fas fa-sliders-h" title="<?php _e('Global settings', 'nimble-builder'); ?>" data-nimble-state="enabled">
1404
- <span class="screen-reader-text"><?php _e('Global settings', 'nimble-builder'); ?></span>
1405
- </button>
1406
- </div>
1407
- <div class="sek-nimble-doc" data-doc-href="https://docs.presscustomizr.com/collection/334-nimble-builder">
1408
- <span class="sek-pointer" title="<?php _e('Nimble online documentation', 'nimble-builder'); ?>"><?php _e('Nimble online documentation', 'nimble-builder'); ?></span>
1409
- <button class="far fa-question-circle" type="button" title="<?php _e('Nimble online documentation', 'nimble-builder'); ?>" data-nimble-state="enabled">
1410
- <span class="screen-reader-text"><?php _e('Nimble online documentation', 'nimble-builder'); ?></span>
1411
- </button>
1412
- </div>
1413
- </div>
1414
- </script>
1415
- <?php
1416
- }
1417
- ?><?php
1418
- /* ------------------------------------------------------------------------- *
1419
- * SETUP DYNAMIC SERVER REGISTRATION FOR SETTING
1420
- /* ------------------------------------------------------------------------- */
1421
- if ( ! class_exists( 'SEK_CZR_Dyn_Register' ) ) :
1422
- class SEK_CZR_Dyn_Register {
1423
- static $instance;
1424
- public $sanitize_callbacks = array();// <= will be populated to cache the callbacks when invoking sek_get_module_sanitize_callbacks().
1425
-
1426
- public static function get_instance( $params ) {
1427
- if ( ! isset( self::$instance ) && ! ( self::$instance instanceof SEK_CZR_Dyn_Register ) )
1428
- self::$instance = new SEK_CZR_Dyn_Register( $params );
1429
- return self::$instance;
1430
- }
1431
-
1432
- function __construct( $params = array() ) {
1433
- add_action( 'customize_register', array( $this, 'load_nimble_setting_class' ) );
1434
-
1435
- add_filter( 'customize_dynamic_setting_args', array( $this, 'set_dyn_setting_args' ), 10, 2 );
1436
- add_filter( 'customize_dynamic_setting_class', array( $this, 'set_dyn_setting_class') , 10, 3 );
1437
- }//__construct
1438
- function load_nimble_setting_class() {
1439
- require_once( dirname( __FILE__ ) . '/customizer/seks_setting_class.php' );
1440
- }
1441
- function set_dyn_setting_args( $setting_args, $setting_id ) {
1442
- if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) || 0 === strpos( $setting_id, NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS ) ) {
1443
- return array(
1444
- 'transport' => 'refresh',
1445
- 'type' => 'option',
1446
- 'default' => array(),
1447
- );
1448
- } else if ( 0 === strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_LEVEL_UI ) ) {
1449
- return array(
1450
- 'transport' => 'refresh',
1451
- 'type' => '_nimble_ui_',//won't be saved as is,
1452
- 'default' => array(),
1453
- 'sanitize_callback' => array( $this, 'sanitize_callback' ),
1454
- 'validate_callback' => array( $this, 'validate_callback' )
1455
- );
1456
- }
1457
- return $setting_args;
1458
- }
1459
- function set_dyn_setting_class( $class, $setting_id, $args ) {
1460
- if ( 0 !== strpos( $setting_id, NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION ) )
1461
- return $class;
1462
- return '\Nimble\Nimble_Customizer_Setting';
1463
- }
1464
- function sanitize_callback( $setting_data, $setting_instance ) {
1465
- if ( isset( $_POST['skope_id'] ) ) {
1466
- $sektionSettingValue = sek_get_skoped_seks( $_POST['skope_id'] );
1467
- if ( is_array( $sektionSettingValue ) ) {
1468
- $sektion_collection = array_key_exists('collection', $sektionSettingValue) ? $sektionSettingValue['collection'] : array();
1469
- if ( is_array( $sektion_collection ) ) {
1470
- $model = sek_get_level_model( $setting_instance->id, $sektion_collection );
1471
- if ( is_array( $model ) && ! empty( $model['module_type'] ) ) {
1472
- $sanitize_callback = sek_get_registered_module_type_property( $model['module_type'], 'sanitize_callback' );
1473
- if ( ! empty( $sanitize_callback ) && is_string( $sanitize_callback ) && function_exists( $sanitize_callback ) ) {
1474
- $setting_data = $sanitize_callback( $setting_data );
1475
- }
1476
- }
1477
- }
1478
- }
1479
- }
1480
- return $setting_data;
1481
- }
1482
- function validate_callback( $validity, $setting_data, $setting_instance ) {
1483
- $validated = true;
1484
- if ( isset( $_POST['skope_id'] ) ) {
1485
- $sektionSettingValue = sek_get_skoped_seks( $_POST['skope_id'] );
1486
- if ( is_array( $sektionSettingValue ) ) {
1487
- $sektion_collection = array_key_exists('collection', $sektionSettingValue) ? $sektionSettingValue['collection'] : array();
1488
- if ( is_array( $sektion_collection ) ) {
1489
- $model = sek_get_level_model( $setting_instance->id, $sektion_collection );
1490
- if ( is_array( $model ) && ! empty( $model['module_type'] ) ) {
1491
- $validate_callback = sek_get_registered_module_type_property( $model['module_type'], 'validate_callback' );
1492
- if ( ! empty( $validate_callback ) && is_string( $validate_callback ) && function_exists( $validate_callback ) ) {
1493
- $validated = $validate_callback( $setting_data );
1494
- }
1495
- }
1496
- }
1497
- }
1498
- }
1499
- if ( true !== $validated ) {
1500
- if ( is_wp_error( $validated ) ) {
1501
- $validation_msg = $validation_msg->get_error_message();
1502
- $validity->add(
1503
- 'nimble_validation_error_in_' . $setting_instance->id ,
1504
- $validation_msg
1505
- );
1506
- }
1507
-
1508
- }
1509
- return $validity;
1510
- }
1511
-
1512
-
1513
- }//class
1514
- endif;
1515
-
1516
- ?><?php
1517
- add_action( 'czr_set_input_tmpl_content', '\Nimble\sek_set_input_tmpl_content', 10, 3 );
1518
- function sek_set_input_tmpl_content( $input_type, $input_id, $input_data ) {
1519
- if ( ! array_key_exists( 'input_type', $input_data ) || empty( $input_data[ 'input_type' ] ) ) {
1520
- wp_send_json_error( 'sek_set_input_tmpl_content => missing input type for input id : ' . $input_id );
1521
- }
1522
- switch( $input_type ) {
1523
- case 'content_type_switcher' :
1524
- sek_set_input_tmpl___content_type_switcher( $input_id, $input_data );
1525
- break;
1526
- case 'module_picker' :
1527
- sek_set_input_tmpl___module_picker( $input_id, $input_data );
1528
- break;
1529
- case 'section_picker' :
1530
- sek_set_input_tmpl___section_picker( $input_id, $input_data );
1531
- break;
1532
-
1533
- case 'spacing' :
1534
- case 'spacingWithDeviceSwitcher' :
1535
- sek_set_input_tmpl___spacing( $input_id, $input_data );
1536
- break;
1537
- case 'bg_position' :
1538
- case 'bgPositionWithDeviceSwitcher' :
1539
- sek_set_input_tmpl___bg_position( $input_id, $input_data );
1540
- break;
1541
- case 'h_alignment' :
1542
- case 'horizAlignmentWithDeviceSwitcher' :
1543
- sek_set_input_tmpl___h_alignment( $input_id, $input_data );
1544
- break;
1545
- case 'h_text_alignment' :
1546
- case 'horizTextAlignmentWithDeviceSwitcher' :
1547
- sek_set_input_tmpl___h_text_alignment( $input_id, $input_data );
1548
- break;
1549
- case 'verticalAlignWithDeviceSwitcher' :
1550
- sek_set_input_tmpl___v_alignment( $input_id, $input_data );
1551
- break;
1552
- case 'font_picker' :
1553
- sek_set_input_tmpl___font_picker( $input_id, $input_data );
1554
- break;
1555
- case 'fa_icon_picker' :
1556
- sek_set_input_tmpl___fa_icon_picker( $input_id, $input_data );
1557
- break;
1558
- case 'font_size' :
1559
- case 'line_height' :
1560
- sek_set_input_tmpl___font_size_line_height( $input_id, $input_data );
1561
- break;
1562
- case 'code_editor' :
1563
- sek_set_input_tmpl___code_editor( $input_id, $input_data );
1564
- break;
1565
- case 'range_with_unit_picker' :
1566
- sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data );
1567
- break;
1568
- case 'range_with_unit_picker_device_switcher' :
1569
- sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id, $input_data );
1570
- break;
1571
- case 'range_simple' :
1572
- sek_set_input_tmpl___range_simple( $input_id, $input_data );
1573
- break;
1574
- case 'borders' :
1575
- sek_set_input_tmpl___borders( $input_id, $input_data );
1576
- break;
1577
- case 'border_radius' :
1578
- sek_set_input_tmpl___border_radius( $input_id, $input_data );
1579
- break;
1580
- case 'buttons_choice' :
1581
- sek_set_input_tmpl___buttons_choice( $input_id, $input_data );
1582
- break;
1583
- case 'reset_button' :
1584
- sek_set_input_tmpl___reset_button( $input_id, $input_data );
1585
- break;
1586
- }
1587
- }
1588
- ?><?php
1589
-
1590
- /* ------------------------------------------------------------------------- *
1591
- * CONTENT TYPE SWITCHER INPUT
1592
- /* ------------------------------------------------------------------------- */
1593
- function sek_set_input_tmpl___content_type_switcher( $input_id, $input_data ) {
1594
- ?>
1595
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1596
- <div class="sek-content-type-wrapper">
1597
- <div aria-label="<?php _e( 'Content type', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1598
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Pick a section', 'nimble-builder');?>" data-sek-content-type="section"><?php _e('Pick a section', 'nimble-builder');?></button>
1599
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Pick a module', 'nimble-builder');?>" data-sek-content-type="module"><?php _e('Pick a module', 'nimble-builder');?></button>
1600
- </div>
1601
- </div>
1602
- <?php
1603
- }
1604
-
1605
-
1606
- /* ------------------------------------------------------------------------- *
1607
- * MODULE PICKER INPUT
1608
- /* ------------------------------------------------------------------------- */
1609
- function sek_set_input_tmpl___module_picker( $input_id, $input_data ) {
1610
- ?>
1611
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1612
- <div class="sek-content-type-wrapper">
1613
- <?php
1614
- $content_collection = array(
1615
- array(
1616
- 'content-type' => 'module',
1617
- 'content-id' => 'czr_tiny_mce_editor_module',
1618
- 'title' => __( 'WordPress Editor', 'nimble-builder' ),
1619
- 'icon' => 'Nimble_rich-text-editor_icon.svg'
1620
- ),
1621
- array(
1622
- 'content-type' => 'module',
1623
- 'content-id' => 'czr_image_module',
1624
- 'title' => __( 'Image', 'nimble-builder' ),
1625
- 'icon' => 'Nimble__image_icon.svg'
1626
- ),
1627
- array(
1628
- 'content-type' => 'module',
1629
- 'content-id' => 'czr_heading_module',
1630
- 'title' => __( 'Heading', 'nimble-builder' ),
1631
- 'icon' => 'Nimble__heading_icon.svg'
1632
- ),
1633
-
1634
- array(
1635
- 'content-type' => 'module',
1636
- 'content-id' => 'czr_icon_module',
1637
- 'title' => __( 'Icon', 'nimble-builder' ),
1638
- 'icon' => 'Nimble__icon_icon.svg'
1639
- ),
1640
- array(
1641
- 'content-type' => 'module',
1642
- 'content-id' => 'czr_button_module',
1643
- 'title' => __( 'Button', 'nimble-builder' ),
1644
- 'icon' => 'Nimble_button_icon.svg'
1645
- ),
1646
- array(
1647
- 'content-type' => 'module',
1648
- 'content-id' => 'czr_map_module',
1649
- 'title' => __( 'Map', 'nimble-builder' ),
1650
- 'icon' => 'Nimble_map_icon.svg'
1651
- ),
1652
-
1653
- array(
1654
- 'content-type' => 'preset_section',
1655
- 'content-id' => 'two_columns',
1656
- 'title' => __( 'Two Columns', 'nimble-builder' ),
1657
- 'icon' => 'Nimble_2-columns_icon.svg'
1658
- ),
1659
- array(
1660
- 'content-type' => 'preset_section',
1661
- 'content-id' => 'three_columns',
1662
- 'title' => __( 'Three Columns', 'nimble-builder' ),
1663
- 'icon' => 'Nimble_3-columns_icon.svg'
1664
- ),
1665
- array(
1666
- 'content-type' => 'preset_section',
1667
- 'content-id' => 'four_columns',
1668
- 'title' => __( 'Four Columns', 'nimble-builder' ),
1669
- 'icon' => 'Nimble_4-columns_icon.svg'
1670
- ),
1671
-
1672
- array(
1673
- 'content-type' => 'module',
1674
- 'content-id' => 'czr_simple_html_module',
1675
- 'title' => __( 'Html Content', 'nimble-builder' ),
1676
- 'icon' => 'Nimble_html_icon.svg'
1677
- ),
1678
- array(
1679
- 'content-type' => 'module',
1680
- 'content-id' => 'czr_quote_module',
1681
- 'title' => __( 'Quote', 'nimble-builder' ),
1682
- 'icon' => 'Nimble_quote_icon.svg'
1683
- ),
1684
- array(
1685
- 'content-type' => 'module',
1686
- 'content-id' => 'czr_spacer_module',
1687
- 'title' => __( 'Spacer', 'nimble-builder' ),
1688
- 'icon' => 'Nimble__spacer_icon.svg'
1689
- ),
1690
- array(
1691
- 'content-type' => 'module',
1692
- 'content-id' => 'czr_divider_module',
1693
- 'title' => __( 'Divider', 'nimble-builder' ),
1694
- 'icon' => 'Nimble__divider_icon.svg'
1695
- ),
1696
- array(
1697
- 'content-type' => 'module',
1698
- 'content-id' => 'czr_simple_form_module',
1699
- 'title' => __( 'Simple Contact Form', 'nimble-builder' ),
1700
- 'icon' => 'Nimble_contact-form_icon.svg'
1701
- ),
1702
-
1703
-
1704
- );
1705
- $i = 0;
1706
- foreach( $content_collection as $_params) {
1707
- $icon_img_src = '';
1708
- if ( !empty( $_params['icon'] ) ) {
1709
- $icon_img_src = NIMBLE_BASE_URL . '/assets/czr/sek/icons/modules/' . $_params['icon'];
1710
- }
1711
-
1712
- printf('<div draggable="true" data-sek-content-type="%1$s" data-sek-content-id="%2$s" title="%5$s"><div class="sek-module-icon">%3$s</div><div class="sek-module-title"><div class="sek-centered-module-title">%4$s</div></div></div>',
1713
- $_params['content-type'],
1714
- $_params['content-id'],
1715
- empty( $icon_img_src ) ? '<i style="color:red">Missing Icon</i>' : '<img draggable="false" title="'. $_params['title'] . '" alt="'. $_params['title'] . '" class="nimble-module-icons" src="' . $icon_img_src .'"/>',
1716
- $_params['title'],
1717
- __('Drag and drop the module in the previewed page.', 'nimble-builder' )
1718
- );
1719
- }
1720
- ?>
1721
- </div>
1722
- <?php
1723
- }
1724
-
1725
-
1726
-
1727
-
1728
-
1729
-
1730
-
1731
-
1732
-
1733
- /* ------------------------------------------------------------------------- *
1734
- * SECTION PICKER INPUT
1735
- /* ------------------------------------------------------------------------- */
1736
- function sek_set_input_tmpl___section_picker( $input_id, $input_data ) {
1737
- ?>
1738
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1739
- <div class="sek-content-type-wrapper">
1740
- <?php
1741
- switch( $input_id ) {
1742
- case 'intro_sections' :
1743
- $content_collection = array(
1744
- array(
1745
- 'content-type' => 'preset_section',
1746
- 'content-id' => 'intro_three',
1747
- 'title' => __('1 columns, call to action, full-width background', 'nimble-builder' ),
1748
- 'thumb' => 'intro_three.jpg'
1749
- ),
1750
- array(
1751
- 'content-type' => 'preset_section',
1752
- 'content-id' => 'intro_one',
1753
- 'title' => __('1 column, full-width background', 'nimble-builder' ),
1754
- 'thumb' => 'intro_one.jpg'
1755
- ),
1756
- array(
1757
- 'content-type' => 'preset_section',
1758
- 'content-id' => 'intro_two',
1759
- 'title' => __('2 columns, call to action, full-width background', 'nimble-builder' ),
1760
- 'thumb' => 'intro_two.jpg'
1761
- )
1762
- );
1763
- break;
1764
- case 'features_sections' :
1765
- $content_collection = array(
1766
- array(
1767
- 'content-type' => 'preset_section',
1768
- 'content-id' => 'features_one',
1769
- 'title' => __('3 columns with icon and call to action', 'nimble-builder' ),
1770
- 'thumb' => 'features_one.jpg',
1771
- ),
1772
- array(
1773
- 'content-type' => 'preset_section',
1774
- 'content-id' => 'features_two',
1775
- 'title' => __('3 columns with icon', 'nimble-builder' ),
1776
- 'thumb' => 'features_two.jpg',
1777
- )
1778
- );
1779
- break;
1780
- case 'contact_sections' :
1781
- $content_collection = array(
1782
- array(
1783
- 'content-type' => 'preset_section',
1784
- 'content-id' => 'contact_one',
1785
- 'title' => __('A contact form and a Google map', 'nimble-builder' ),
1786
- 'thumb' => 'contact_one.jpg',
1787
- ),
1788
- array(
1789
- 'content-type' => 'preset_section',
1790
- 'content-id' => 'contact_two',
1791
- 'title' => __('A contact form with an image background', 'nimble-builder' ),
1792
- 'thumb' => 'contact_two.jpg',
1793
- )
1794
- );
1795
- break;
1796
- case 'layout_sections' :
1797
- $content_collection = array(
1798
- array(
1799
- 'content-type' => 'preset_section',
1800
- 'content-id' => 'two_columns',
1801
- 'title' => __('two columns layout', 'nimble-builder' ),
1802
- 'thumb' => 'two_columns.jpg'
1803
- ),
1804
- array(
1805
- 'content-type' => 'preset_section',
1806
- 'content-id' => 'three_columns',
1807
- 'title' => __('three columns layout', 'nimble-builder' ),
1808
- 'thumb' => 'three_columns.jpg'
1809
- ),
1810
- array(
1811
- 'content-type' => 'preset_section',
1812
- 'content-id' => 'four_columns',
1813
- 'title' => __('four columns layout', 'nimble-builder' ),
1814
- 'thumb' => 'four_columns.jpg'
1815
- ),
1816
- );
1817
- break;
1818
- }
1819
- foreach( $content_collection as $_params) {
1820
- printf('<div draggable="true" data-sek-content-type="%1$s" data-sek-content-id="%2$s" style="%3$s" title="%4$s"><div class="sek-overlay"></div></div>',
1821
- $_params['content-type'],
1822
- $_params['content-id'],
1823
- sprintf( 'background: url(%1$s) 50% 50% / cover no-repeat;%2$s',
1824
- NIMBLE_BASE_URL . '/assets/img/section_assets/thumbs/' . $_params['thumb'],
1825
- isset( $_params['height'] ) ? 'height:'.$_params['height'] : ''
1826
- ),
1827
- $_params['title']
1828
- );
1829
- }
1830
- ?>
1831
- </div>
1832
- <?php
1833
- }
1834
-
1835
- ?><?php
1836
-
1837
- /* ------------------------------------------------------------------------- *
1838
- * SPACING INPUT
1839
- /* ------------------------------------------------------------------------- */
1840
- function sek_set_input_tmpl___spacing( $input_id, $input_data ) {
1841
- ?>
1842
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1843
- <div class="sek-spacing-wrapper">
1844
- <div class="sek-pad-marg-inner">
1845
- <div class="sek-pm-top-bottom-wrap sek-flex-justify-center">
1846
- <div class="sek-flex-center-stretch" data-sek-spacing="margin-top" title="<?php _e('Margin top', 'nimble-builder'); ?>">
1847
- <div class="sek-pm-input-parent">
1848
- <input class="sek-pm-input" value="" type="number" >
1849
- </div>
1850
- </div>
1851
- </div>
1852
- <div class="sek-pm-middle-wrap sek-flex-justify-center">
1853
- <div class="sek-flex-center-stretch sek-pm-margin-left" data-sek-spacing="margin-left" title="<?php _e('Margin left', 'nimble-builder'); ?>">
1854
- <div class="sek-pm-input-parent">
1855
- <input class="sek-pm-input" value="" type="number" >
1856
- </div>
1857
- </div>
1858
-
1859
- <div class="sek-pm-padding-wrapper">
1860
- <div class="sek-flex-justify-center">
1861
- <div class="sek-flex-center-stretch" data-sek-spacing="padding-top" title="<?php _e('Padding top', 'nimble-builder'); ?>">
1862
- <div class="sek-pm-input-parent">
1863
- <input class="sek-pm-input" value="" type="number" >
1864
- </div>
1865
- </div>
1866
- </div>
1867
- <div class="sek-flex-justify-center sek-flex-space-between">
1868
- <div class="sek-flex-center-stretch" data-sek-spacing="padding-left" title="<?php _e('Padding left', 'nimble-builder'); ?>">
1869
- <div class="sek-pm-input-parent">
1870
- <input class="sek-pm-input" value="" type="number" >
1871
- </div>
1872
- </div>
1873
- <div class="sek-flex-center-stretch" data-sek-spacing="padding-right" title="<?php _e('Padding right', 'nimble-builder'); ?>">
1874
- <div class="sek-pm-input-parent">
1875
- <input class="sek-pm-input" value="" type="number" >
1876
- </div>
1877
- </div>
1878
- </div>
1879
- <div class="sek-flex-justify-center">
1880
- <div class="sek-flex-center-stretch" data-sek-spacing="padding-bottom" title="<?php _e('Padding bottom', 'nimble-builder'); ?>">
1881
- <div class="sek-pm-input-parent">
1882
- <input class="sek-pm-input" value="" type="number" >
1883
- </div>
1884
- </div>
1885
- </div>
1886
- </div>
1887
-
1888
- <div class="sek-flex-center-stretch sek-pm-margin-right" data-sek-spacing="margin-right" title="<?php _e('Margin right', 'nimble-builder'); ?>">
1889
- <div class="sek-pm-input-parent">
1890
- <input class="sek-pm-input" value="" type="number" >
1891
- </div>
1892
- </div>
1893
- </div>
1894
-
1895
- <div class="sek-pm-top-bottom-wrap sek-flex-justify-center">
1896
- <div class="sek-flex-center-stretch" data-sek-spacing="margin-bottom" title="<?php _e('Margin bottom', 'nimble-builder'); ?>">
1897
- <div class="sek-pm-input-parent">
1898
- <input class="sek-pm-input" value="" type="number" >
1899
- </div>
1900
- </div>
1901
- </div>
1902
- </div><?php //sek-pad-marg-inner ?>
1903
- <div class="sek-unit-wrapper">
1904
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
1905
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
1906
- </div>
1907
- <div class="reset-spacing-wrap"><span class="sek-do-reset"><?php _e('Reset all spacing', 'nimble-builder' ); ?></span></div>
1908
-
1909
- </div><?php // sek-spacing-wrapper ?>
1910
- <?php
1911
- }
1912
-
1913
- ?><?php
1914
-
1915
- /* ------------------------------------------------------------------------- *
1916
- * BACKGROUND POSITION INPUT
1917
- /* ------------------------------------------------------------------------- */
1918
- function sek_set_input_tmpl___bg_position( $input_id, $input_data ) {
1919
- ?>
1920
- <div class="sek-bg-pos-wrapper">
1921
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
1922
- <label class="sek-bg-pos">
1923
- <input type="radio" name="sek-bg-pos" value="top_left">
1924
- <span>
1925
- <svg width="24" height="24">
1926
- <path id="sek-pth" fill-rule="evenodd" d="M14.96 16v-1h-1v-1h-1v-1h-1v-1h-1v-1.001h-1V14h-1v-4-1h5v1h-3v.938h1v.999h1v1h1v1.001h1v1h1V16h-1z" class="sek-svg-bg-pos">
1927
- </path>
1928
- </svg>
1929
- </span>
1930
- </label>
1931
- <label class="sek-bg-pos">
1932
- <input type="radio" name="sek-bg-pos" value="top">
1933
- <span>
1934
- <svg width="24" height="24">
1935
- <path id="sek-pth" fill-rule="evenodd" d="M14.969 12v-1h-1v-1h-1v7h-1v-7h-1v1h-1v1h-1v-1.062h1V9.937h1v-1h1V8h1v.937h1v1h1v1.001h1V12h-1z" class="sek-svg-bg-pos">
1936
- </path>
1937
- </svg>
1938
- </span>
1939
- </label>
1940
- <label class="sek-bg-pos">
1941
- <input type="radio" name="sek-bg-pos" value="top_right">
1942
- <span>
1943
- <svg width="24" height="24">
1944
- <path id="sek-pth" fill-rule="evenodd" d="M9.969 16v-1h1v-1h1v-1h1v-1h1v-1.001h1V14h1v-4-1h-1-4v1h3v.938h-1v.999h-1v1h-1v1.001h-1v1h-1V16h1z" class="sek-svg-bg-pos">
1945
- </path>
1946
- </svg>
1947
- </span>
1948
- </label>
1949
- <label class="sek-bg-pos">
1950
- <input type="radio" name="sek-bg-pos" value="left">
1951
- <span>
1952
- <svg width="24" height="24">
1953
- <path id="sek-pth" fill-rule="evenodd" d="M11.469 9.5h-1v1h-1v1h7v1h-7v1h1v1h1v1h-1.063v-1h-1v-1h-1v-1h-.937v-1h.937v-1h1v-1h1v-1h1.063v1z" class="sek-svg-bg-pos">
1954
- </path>
1955
- </svg>
1956
- </span>
1957
- </label>
1958
- <label class="sek-bg-pos">
1959
- <input type="radio" name="sek-bg-pos" value="center">
1960
- <span>
1961
- <svg width="24" height="24">
1962
- <path id="sek-pth" fill-rule="evenodd" d="M12 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z" class="sek-svg-bg-pos">
1963
- </path>
1964
- </svg>
1965
- </span>
1966
- </label>
1967
- <label class="sek-bg-pos">
1968
- <input type="radio" name="sek-bg-pos" value="right">
1969
- <span>
1970
- <svg width="24" height="24">
1971
- <path id="sek-pth" fill-rule="evenodd" d="M12.469 14.5h1v-1h1v-1h-7v-1h7v-1h-1v-1h-1v-1h1.062v1h1v1h1v1h.938v1h-.938v1h-1v1h-1v1h-1.062v-1z" class="sek-svg-bg-pos">
1972
- </path>
1973
- </svg>
1974
- </span>
1975
- </label>
1976
- <label class="sek-bg-pos">
1977
- <input type="radio" name="sek-bg-pos" value="bottom_left">
1978
- <span>
1979
- <svg width="24" height="24">
1980
- <path id="sek-pth" fill-rule="evenodd" d="M14.969 9v1h-1v1h-1v1h-1v1h-1v1.001h-1V11h-1v5h5v-1h-3v-.938h1v-.999h1v-1h1v-1.001h1v-1h1V9h-1z" class="sek-svg-bg-pos">
1981
- </path>
1982
- </svg>
1983
- </span>
1984
- </label>
1985
- <label class="sek-bg-pos">
1986
- <input type="radio" name="sek-bg-pos" value="bottom">
1987
- <span>
1988
- <svg width="24" height="24">
1989
- <path id="sek-pth" fill-rule="evenodd" d="M9.969 13v1h1v1h1V8h1v7h1v-1h1v-1h1v1.063h-1v.999h-1v1.001h-1V17h-1v-.937h-1v-1.001h-1v-.999h-1V13h1z" class="sek-svg-bg-pos">
1990
- </path>
1991
- </svg>
1992
- </span>
1993
- </label>
1994
- <label class="sek-bg-pos">
1995
- <input type="radio" name="sek-bg-pos" value="bottom_right">
1996
- <span>
1997
- <svg width="24" height="24">
1998
- <path id="sek-pth" fill-rule="evenodd" d="M9.969 9v1h1v1h1v1h1v1h1v1.001h1V11h1v5h-1-4v-1h3v-.938h-1v-.999h-1v-1h-1v-1.001h-1v-1h-1V9h1z" class="sek-svg-bg-pos">
1999
- </path>
2000
- </svg>
2001
- </span>
2002
- </label>
2003
- </div><?php // sek-bg-pos-wrapper ?>
2004
- <?php
2005
- }
2006
-
2007
- ?><?php
2008
-
2009
- /* ------------------------------------------------------------------------- *
2010
- * HORIZONTAL ALIGNMENT INPUT
2011
- /* ------------------------------------------------------------------------- */
2012
- /* ------------------------------------------------------------------------- *
2013
- * HORIZONTAL ALIGNMENT INPUT FOR TEXT => includes the 'justify' icon
2014
- /* ------------------------------------------------------------------------- */
2015
- function sek_set_input_tmpl___h_alignment( $input_id, $input_data ) {
2016
- ?>
2017
- <div class="sek-h-align-wrapper">
2018
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2019
- <div class="sek-align-icons">
2020
- <div data-sek-align="left" title="<?php _e('Align left','nimble-builder'); ?>"><i class="material-icons">format_align_left</i></div>
2021
- <div data-sek-align="center" title="<?php _e('Align center','nimble-builder'); ?>"><i class="material-icons">format_align_center</i></div>
2022
- <div data-sek-align="right" title="<?php _e('Align right','nimble-builder'); ?>"><i class="material-icons">format_align_right</i></div>
2023
- </div>
2024
- </div><?php // sek-h-align-wrapper ?>
2025
- <?php
2026
- }
2027
-
2028
- function sek_set_input_tmpl___h_text_alignment( $input_id, $input_data ) {
2029
- ?>
2030
- <div class="sek-h-align-wrapper">
2031
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2032
- <div class="sek-align-icons">
2033
- <div data-sek-align="left" title="<?php _e('Align left','nimble-builder'); ?>"><i class="material-icons">format_align_left</i></div>
2034
- <div data-sek-align="center" title="<?php _e('Align center','nimble-builder'); ?>"><i class="material-icons">format_align_center</i></div>
2035
- <div data-sek-align="right" title="<?php _e('Align right','nimble-builder'); ?>"><i class="material-icons">format_align_right</i></div>
2036
- <div data-sek-align="justify" title="<?php _e('Justified','nimble-builder'); ?>"><i class="material-icons">format_align_justify</i></div>
2037
- </div>
2038
- </div><?php // sek-h-align-wrapper ?>
2039
- <?php
2040
- }
2041
- ?><?php
2042
- /* ------------------------------------------------------------------------- *
2043
- * VERTICAL ALIGNMENT INPUT
2044
- /* ------------------------------------------------------------------------- */
2045
- function sek_set_input_tmpl___v_alignment( $input_id, $input_data ) {
2046
- ?>
2047
- <div class="sek-v-align-wrapper">
2048
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2049
- <div class="sek-align-icons">
2050
- <div data-sek-align="top" title="<?php _e('Align top','nimble-builder'); ?>"><i class="material-icons">vertical_align_top</i></div>
2051
- <div data-sek-align="center" title="<?php _e('Align center','nimble-builder'); ?>"><i class="material-icons">vertical_align_center</i></div>
2052
- <div data-sek-align="bottom" title="<?php _e('Align bottom','nimble-builder'); ?>"><i class="material-icons">vertical_align_bottom</i></div>
2053
- </div>
2054
- </div><?php // sek-h-align-wrapper ?>
2055
- <?php
2056
- }
2057
-
2058
- ?><?php
2059
- /* ------------------------------------------------------------------------- *
2060
- * FONT AWESOME ICON PICKER INPUT
2061
- /* ------------------------------------------------------------------------- */
2062
- function sek_set_input_tmpl___fa_icon_picker( $input_id, $input_data ) {
2063
- ?>
2064
- <select data-czrtype="<?php echo $input_id; ?>"></select>
2065
- <?php
2066
- }
2067
- add_filter( "ac_set_ajax_czr_tmpl___fa_icon_picker_input", '\Nimble\sek_get_fa_icon_list_tmpl', 10, 3 );
2068
- function sek_get_fa_icon_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
2069
- if ( empty( $requested_tmpl ) ) {
2070
- wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
2071
- }
2072
-
2073
- return wp_json_encode(
2074
- sek_retrieve_decoded_font_awesome_icons()
2075
- );//will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
2076
- }
2077
- function sek_retrieve_decoded_font_awesome_icons() {
2078
- $faicons_json_path = NIMBLE_BASE_PATH . '/assets/faicons.json';
2079
- $faicons_transient_name = 'sek_font_awesome_october_2018';
2080
- if ( false == get_transient( $faicons_transient_name ) ) {
2081
- if ( file_exists( $faicons_json_path ) ) {
2082
- $faicons_raw = @file_get_contents( $faicons_json_path );
2083
-
2084
- if ( false === $faicons_raw ) {
2085
- $faicons_raw = wp_remote_fopen( $faicons_json_path );
2086
  }
 
2087
 
2088
- $faicons_decoded = json_decode( $faicons_raw, true );
2089
- set_transient( $faicons_transient_name , $faicons_decoded , 60*60*24*3000 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2090
  } else {
2091
- wp_send_json_error( __FUNCTION__ . ' => the file faicons.json is missing' );
2092
  }
2093
  }
2094
- else {
2095
- $faicons_decoded = get_transient( $faicons_transient_name );
2096
- }
2097
 
2098
- return $faicons_decoded;
2099
- }
2100
-
2101
- ?>
2102
- <?php
2103
- /* ------------------------------------------------------------------------- *
2104
- * FONT PICKER INPUT
2105
- /* ------------------------------------------------------------------------- */
2106
- function sek_set_input_tmpl___font_picker( $input_id, $input_data ) {
2107
- ?>
2108
- <select data-czrtype="<?php echo $input_id; ?>"></select>
2109
- <?php
2110
- }
2111
- add_filter( "ac_set_ajax_czr_tmpl___font_picker_input", '\Nimble\sek_get_font_list_tmpl', 10, 3 );
2112
- function sek_get_font_list_tmpl( $html, $requested_tmpl = '', $posted_params = array() ) {
2113
- if ( empty( $requested_tmpl ) ) {
2114
- wp_send_json_error( __FUNCTION__ . ' => the requested tmpl is empty' );
2115
- }
2116
-
2117
- return wp_json_encode( array(
2118
- 'cfonts' => sek_get_cfonts(),
2119
- 'gfonts' => sek_get_gfonts(),
2120
- ) );//will be sent by wp_send_json_success() in ::ac_set_ajax_czr_tmpl()
2121
- }
2122
-
2123
-
2124
- function sek_get_cfonts() {
2125
- $cfonts = array();
2126
- $raw_cfonts = array(
2127
- 'Arial Black,Arial Black,Gadget,sans-serif',
2128
- 'Century Gothic',
2129
- 'Comic Sans MS,Comic Sans MS,cursive',
2130
- 'Courier New,Courier New,Courier,monospace',
2131
- 'Georgia,Georgia,serif',
2132
- 'Helvetica Neue, Helvetica, Arial, sans-serif',
2133
- 'Impact,Charcoal,sans-serif',
2134
- 'Lucida Console,Monaco,monospace',
2135
- 'Lucida Sans Unicode,Lucida Grande,sans-serif',
2136
- 'Palatino Linotype,Book Antiqua,Palatino,serif',
2137
- 'Tahoma,Geneva,sans-serif',
2138
- 'Times New Roman,Times,serif',
2139
- 'Trebuchet MS,Helvetica,sans-serif',
2140
- 'Verdana,Geneva,sans-serif',
2141
- );
2142
- foreach ( $raw_cfonts as $font ) {
2143
- $cfonts[] = array(
2144
- 'name' => $font ,
2145
- 'subsets' => array()
2146
- );
2147
- }
2148
- return apply_filters( 'sek_font_picker_cfonts', $cfonts );
2149
  }
2150
- function sek_retrieve_decoded_gfonts() {
2151
- if ( false == get_transient( 'sek_gfonts_may_2018' ) ) {
2152
- $gfont_raw = @file_get_contents( NIMBLE_BASE_PATH ."/assets/webfonts.json" );
2153
 
2154
- if ( $gfont_raw === false ) {
2155
- $gfont_raw = wp_remote_fopen( NIMBLE_BASE_PATH ."/assets/webfonts.json" );
2156
- }
2157
 
2158
- $gfonts_decoded = json_decode( $gfont_raw, true );
2159
- set_transient( 'sek_gfonts_may_2018' , $gfonts_decoded , 60*60*24*3000 );
2160
- }
2161
- else {
2162
- $gfonts_decoded = get_transient( 'sek_gfonts_may_2018' );
2163
- }
2164
 
2165
- return $gfonts_decoded;
2166
- }
2167
- function sek_get_gfonts( $what = null ) {
 
 
 
 
 
 
 
 
 
 
2168
 
2169
- $gfonts_decoded = sek_retrieve_decoded_gfonts();
2170
- $gfonts = array();
 
 
2171
 
2172
- foreach ( $gfonts_decoded['items'] as $font ) {
2173
- foreach ( $font['variants'] as $variant ) {
2174
- $name = str_replace( ' ', '+', $font['family'] );
2175
- $gfonts[] = array(
2176
- 'name' => $name . ':' .$variant
2177
- );
2178
  }
2179
- }
2180
 
2181
- return ('subsets' == $what) ? apply_filters( 'sek_font_picker_gfonts_subsets ', $subsets ) : apply_filters( 'sek_font_picker_gfonts', $gfonts ) ;
2182
- }
2183
 
2184
- ?><?php
 
 
 
 
 
 
 
2185
 
2186
- /* ------------------------------------------------------------------------- *
2187
- * FONT SIZE
2188
- /* ------------------------------------------------------------------------- */
2189
- /* ------------------------------------------------------------------------- *
2190
- * LINE HEIGHT INPUT TMPLS
2191
- /* ------------------------------------------------------------------------- */
2192
- function sek_set_input_tmpl___font_size_line_height( $input_id, $input_data ) {
2193
- ?>
2194
- <?php
2195
- ?>
2196
- <#
2197
- var value = data['<?php echo $input_id; ?>'],
2198
- unit = data['<?php echo $input_id; ?>'];
2199
- value = _.isString( value ) ? value.replace(/px|em|%/g,'') : '';
2200
- unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
2201
- unit = _.isEmpty( unit ) ? 'px' : unit;
2202
- #>
2203
- <div class="sek-font-size-line-height-wrapper">
2204
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
2205
 
2206
- <?php
2207
- printf( '<input type="number" %1$s %2$s %3$s value="{{ value }}" />',
2208
- ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
2209
- ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : '',
2210
- ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
2211
- );
2212
- ?>
2213
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group sek-float-right" role="group">
2214
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
2215
- </div><?php // sek-font-size-wrapper ?>
2216
- <?php
2217
- }
2218
- ?><?php
2219
- /* ------------------------------------------------------------------------- *
2220
- * CODE EDITOR INPUT TEMPLATE
2221
- /* ------------------------------------------------------------------------- */
2222
- function sek_set_input_tmpl___code_editor( $input_id, $input_data ) {
2223
- /*
2224
- * Needed to form the correct params to pass to the code mirror editor, based on the code type
2225
- */
2226
- $code_editor_params = nimble_get_code_editor_settings( array(
2227
- 'type' => ! empty( $input_data[ 'code_type' ] ) ? $input_data[ 'code_type' ] : 'text/html',
2228
- ));
2229
- ?>
2230
- <textarea data-czrtype="<?php echo $input_id; ?>" class="width-100" name="textarea" rows="10" cols="" data-editor-params="<?php echo htmlspecialchars( json_encode( $code_editor_params ) ); ?>">{{ data.value }}</textarea>
2231
- <?php
2232
- }
2233
- ?>
2234
- <?php
2235
- /* ------------------------------------------------------------------------- *
2236
- * CODE EDITOR INPUT TEMPLATE
2237
- /* ------------------------------------------------------------------------- */
2238
- function sek_set_input_tmpl___range_simple( $input_id, $input_data ) {
2239
- ?>
2240
- <?php
2241
- ?>
2242
- <#
2243
- var value = data['<?php echo $input_id; ?>'],
2244
- unit = data['<?php echo $input_id; ?>'];
2245
- value = _.isString( value ) ? value.replace(/px|em|%/g,'') : value;
2246
- unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
2247
- unit = _.isEmpty( unit ) ? 'px' : unit;
2248
- #>
2249
- <div class="sek-range-with-unit-picker-wrapper sek-no-unit-picker">
2250
- <# //console.log( 'IN php::sek_set_input_tmpl___range_simple() => data range_slide => ', data ); #>
2251
- <div class="sek-range-wrapper">
2252
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
2253
- <?php
2254
- printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
2255
- ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
2256
- ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
2257
- ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
2258
- ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
2259
- );
2260
- ?>
2261
- </div>
2262
- <div class="sek-number-wrapper">
2263
- <input class="sek-pm-input" value="{{ value }}" type="number" >
2264
- </div>
2265
- </div><?php // sek-spacing-wrapper ?>
2266
- <?php
2267
- }
2268
- ?>
2269
- <?php
2270
- /* ------------------------------------------------------------------------- *
2271
- * CODE EDITOR INPUT TEMPLATE
2272
- /* ------------------------------------------------------------------------- */
2273
- function sek_set_input_tmpl___range_with_unit_picker( $input_id, $input_data ) {
2274
- ?>
2275
- <?php
2276
- ?>
2277
- <#
2278
- var value = data['<?php echo $input_id; ?>'],
2279
- unit = data['<?php echo $input_id; ?>'];
2280
- value = _.isString( value ) ? value.replace(/px|em|%/g,'') : value;
2281
- unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
2282
- unit = _.isEmpty( unit ) ? 'px' : unit;
2283
- #>
2284
- <div class="sek-range-with-unit-picker-wrapper">
2285
- <# //console.log( 'IN php::sek_set_input_tmpl___range_with_unit_picker() => data range_slide => ', data ); #>
2286
- <div class="sek-range-wrapper">
2287
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
2288
- <?php
2289
- printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
2290
- ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
2291
- ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
2292
- ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
2293
- ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
2294
- );
2295
- ?>
2296
- </div>
2297
- <div class="sek-number-wrapper">
2298
- <input class="sek-pm-input" value="{{ value }}" type="number" >
2299
- </div>
2300
- <div class="sek-unit-wrapper">
2301
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
2302
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
2303
- </div>
2304
- </div><?php // sek-spacing-wrapper ?>
2305
- <?php
2306
- }
2307
- ?>
2308
- <?php
2309
- /* ------------------------------------------------------------------------- *
2310
- * CODE EDITOR INPUT TEMPLATE
2311
- /* ------------------------------------------------------------------------- */
2312
- function sek_set_input_tmpl___range_with_unit_picker_device_switcher( $input_id, $input_data ) {
2313
- ?>
2314
- <?php
2315
- ?>
2316
- <#
2317
- var value = data['<?php echo $input_id; ?>'],
2318
- unit = data['<?php echo $input_id; ?>'];
2319
- value = _.isString( value ) ? value.replace(/px|em|%/g,'') : value;
2320
- unit = _.isString( unit ) ? unit.replace(/[0-9]|\.|,/g, '') : 'px';
2321
- unit = _.isEmpty( unit ) ? 'px' : unit;
2322
- #>
2323
- <div class="sek-range-with-unit-picker-wrapper">
2324
- <# //console.log( 'IN php::sek_set_input_tmpl___range_with_unit_picker_device_switcher() => data range_slide => ', data ); #>
2325
- <div class="sek-range-wrapper">
2326
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden" data-sek-unit="{{ unit }}"/>
2327
- <?php
2328
- printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
2329
- ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
2330
- ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
2331
- ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
2332
- ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
2333
- );
2334
- ?>
2335
- </div>
2336
- <div class="sek-number-wrapper">
2337
- <input class="sek-pm-input" value="{{ value }}" type="number" >
2338
- </div>
2339
- <div class="sek-unit-wrapper">
2340
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
2341
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
2342
- </div>
2343
- </div><?php // sek-spacing-wrapper ?>
2344
- <?php
2345
- }
2346
- ?>
2347
- <?php
2348
- /* ------------------------------------------------------------------------- *
2349
- * BORDERS INPUT TEMPLATE
2350
- /* ------------------------------------------------------------------------- */
2351
- function sek_set_input_tmpl___borders( $input_id, $input_data ) {
2352
- ?>
2353
- <?php
2354
- ?>
2355
- <div class="sek-borders">
2356
- <# //console.log( 'IN php::sek_set_input_tmpl___borders() => data range_slide => ', data ); #>
2357
- <div class="sek-border-type-wrapper">
2358
- <div aria-label="unit" class="sek-ui-button-group" role="group"><button type="button" aria-pressed="true" class="sek-ui-button is-selected" title="<?php _e('All', 'nimble-builder');?>" data-sek-border-type="_all_"><?php _e('All', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Left', 'nimble-builder');?>" data-sek-border-type="left"><?php _e('Left', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Top', 'nimble-builder');?>" data-sek-border-type="top"><?php _e('Top', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Right', 'nimble-builder');?>" data-sek-border-type="right"><?php _e('Right', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Bottom', 'nimble-builder');?>" data-sek-border-type="bottom"><?php _e('Bottom', 'nimble-builder');?></button></div>
2359
- </div>
2360
- <div class="sek-range-unit-wrapper">
2361
- <div class="sek-range-wrapper">
2362
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2363
- <?php
2364
- printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
2365
- ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
2366
- ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
2367
- ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
2368
- ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
2369
- );
2370
- ?>
2371
- </div>
2372
- <div class="sek-number-wrapper">
2373
- <input class="sek-pm-input" value="{{ value }}" type="number" >
2374
- </div>
2375
- <div class="sek-unit-wrapper">
2376
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
2377
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button></div>
2378
- </div>
2379
- </div>
2380
- <div class="sek-color-wrapper">
2381
- <div class="sek-color-picker"><input class="sek-alpha-color-input" data-alpha="true" type="text" value=""/></div>
2382
- <div class="sek-reset-button"><button type="button" class="button sek-reset-button sek-float-right"><?php _e( 'Reset', 'nimble-builder'); ?></button></div>
2383
- </div>
2384
- </div><?php // sek-borders ?>
2385
- <?php
2386
- }
2387
- ?>
2388
- <?php
2389
- /* ------------------------------------------------------------------------- *
2390
- * BORDER RADIUS INPUT TEMPLATE
2391
- /* ------------------------------------------------------------------------- */
2392
- function sek_set_input_tmpl___border_radius( $input_id, $input_data ) {
2393
- ?>
2394
- <?php
2395
- ?>
2396
- <div class="sek-borders">
2397
- <# //console.log( 'IN php::sek_set_input_tmpl___border_radius() => data range_slide => ', data ); #>
2398
- <div class="sek-border-type-wrapper">
2399
- <div aria-label="unit" class="sek-ui-button-group sek-float-left" role="group"><button type="button" aria-pressed="true" class="sek-ui-button is-selected" title="<?php _e('All', 'nimble-builder');?>" data-sek-radius-type="_all_"><?php _e('All', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Top left', 'nimble-builder');?>" data-sek-radius-type="top_left"><i class="material-icons">border_style</i></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Top right', 'nimble-builder');?>" data-sek-radius-type="top_right"><i class="material-icons">border_style</i></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Bottom right', 'nimble-builder');?>" data-sek-radius-type="bottom_right"><i class="material-icons">border_style</i></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('Bottom left', 'nimble-builder');?>" data-sek-radius-type="bottom_left"><i class="material-icons">border_style</i></button></div>
2400
- <div class="sek-reset-button"><button type="button" class="button sek-reset-button sek-float-right"><?php _e( 'Reset', 'nimble-builder'); ?></button></div>
2401
- </div>
2402
- <div class="sek-range-unit-wrapper">
2403
- <div class="sek-range-wrapper">
2404
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2405
- <?php
2406
- printf( '<input class="sek-range-input" type="range" %1$s %2$s %3$s %4$s/>',
2407
- ! empty( $input_data['step'] ) ? 'step="'. $input_data['step'] .'"' : '',
2408
- ! empty( $input_data['unit'] ) ? 'data-unit="'. $input_data['unit'] .'"' : '',
2409
- ! empty( $input_data['min'] ) ? 'min="'. $input_data['min'] .'"' : 'min="0"',
2410
- ! empty( $input_data['max'] ) ? 'max="'. $input_data['max'] .'"' : ''
2411
- );
2412
- ?>
2413
- </div>
2414
- <div class="sek-number-wrapper">
2415
- <input class="sek-pm-input" value="{{ value }}" type="number" >
2416
- </div>
2417
- <div class="sek-unit-wrapper">
2418
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group" role="group">
2419
- <button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('pixels', 'nimble-builder');?>" data-sek-unit="px"><?php _e('px', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('em', 'nimble-builder');?>" data-sek-unit="em"><?php _e('em', 'nimble-builder');?></button><button type="button" aria-pressed="false" class="sek-ui-button" title="<?php _e('percents', 'nimble-builder');?>" data-sek-unit="%"><?php _e('%', 'nimble-builder');?></button></div>
2420
- </div>
2421
- </div>
2422
- </div><?php // sek-borders ?>
2423
- <?php
2424
- }
2425
- ?>
2426
- <?php
2427
- /* ------------------------------------------------------------------------- *
2428
- * MULTIPLE BUTTON CHOICES INPUT TEMPLATE
2429
- /* ------------------------------------------------------------------------- */
2430
- function sek_set_input_tmpl___buttons_choice( $input_id, $input_data ) {
2431
- ?>
2432
- <# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #>
2433
- <?php
2434
- if ( ! is_array( $input_data ) || empty( $input_data['choices'] ) || ! is_array( $input_data['choices'] ) ) {
2435
- sek_error_log( __FUNCTION__ . ' error => missing choices property' );
2436
- return;
2437
- }
2438
- ?>
2439
- <div class="sek-button-choice-wrapper">
2440
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2441
- <div aria-label="<?php _e( 'unit', 'nimble-builder'); ?>" class="sek-ui-button-group sek-float-right" role="group">
2442
- <?php
2443
- foreach( $input_data['choices'] as $choice => $label ) {
2444
- printf('<button type="button" aria-pressed="false" class="sek-ui-button" title="%1$s" data-sek-choice="%2$s">%1$s</button>',
2445
- $label,
2446
- $choice
2447
- );
2448
- }
2449
- ?>
2450
- </div>
2451
- </div>
2452
- <?php
2453
- }
2454
- ?>
2455
- <?php
2456
- /* ------------------------------------------------------------------------- *
2457
- * RESET BUTTON INPUT TEMPLATE
2458
- /* ------------------------------------------------------------------------- */
2459
- function sek_set_input_tmpl___reset_button( $input_id, $input_data ) {
2460
- ?>
2461
- <# //console.log( 'IN php::sek_set_input_tmpl___buttons_choice() => data range_slide => ', data ); #>
2462
- <?php
2463
- if ( ! is_array( $input_data ) || empty( $input_data['scope'] ) ) {
2464
- sek_error_log( __FUNCTION__ . ' error => missing scope property' );
2465
- return;
2466
  }
2467
- ?>
2468
- <div class="sek-button-choice-wrapper">
2469
- <input data-czrtype="<?php echo $input_id; ?>" type="hidden"/>
2470
- <button type="button" aria-pressed="false" class="sek-ui-button sek-float-right" title="%1$s" data-sek-reset-scope="<?php echo $input_data['scope']; ?>"><?php _e('Reset', 'nimble-builder'); ?></button>
2471
- </div>
2472
- <?php
2473
  }
2474
- ?>
2475
- <?php
2476
  function sek_generate_css_rules_for_multidimensional_border_options( $rules, $border_settings, $border_type, $css_selectors = '' ) {
2477
  if ( ! is_array( $rules ) )
2478
  return array();
@@ -3062,8 +1594,10 @@ function sek_register_modules() {
3062
  'sek_local_widths',
3063
  'sek_local_custom_css',
3064
  'sek_local_reset',
 
3065
  'sek_global_breakpoint',
3066
  'sek_global_widths',
 
3067
  'czr_simple_html_module',
3068
 
3069
  'czr_tiny_mce_editor_module',
@@ -3486,7 +2020,9 @@ function sek_add_css_rules_for_level_background( $rules, $level ) {
3486
  * background: [background-image] [background-position] / [background-size] [background-repeat] [background-attachment] [background-origin] [background-clip] [background-color];
3487
  */
3488
  if ( ! empty( $bg_options[ 'bg-image'] ) && is_numeric( $bg_options[ 'bg-image'] ) ) {
3489
- $background_properties[ 'background-image' ] = 'url("'. wp_get_attachment_url( $bg_options[ 'bg-image'] ) .'")';
 
 
3490
  if ( ! empty( $bg_options[ 'bg-position'] ) ) {
3491
  $pos_map = array(
3492
  'top_left' => '0% 0%',
@@ -4187,7 +2723,8 @@ function sek_get_module_params_for_sek_level_visibility_module() {
4187
  'title_width' => 'width-80',
4188
  'input_width' => 'width-20',
4189
  'refresh_markup' => true,
4190
- 'refresh_stylesheet' => false
 
4191
  ),
4192
  )
4193
  )//tmpl
@@ -4476,6 +3013,31 @@ function sek_get_module_params_for_sek_local_reset() {
4476
  );
4477
  }
4478
  ?><?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4479
  function sek_get_module_params_for_sek_global_breakpoint() {
4480
  return array(
4481
  'dynamic_registration' => true,
@@ -4643,6 +3205,27 @@ function sek_write_global_custom_section_widths() {
4643
  printf('<style type="text/css" id="nimble-global-options">%1$s</style>', $width_options_css );
4644
  }
4645
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4646
  ?><?php
4647
  /* ------------------------------------------------------------------------- *
4648
  * LOAD AND REGISTER SIMPLE HTML MODULE
@@ -8857,6 +7440,7 @@ if ( ! class_exists( 'SEK_Front_Construct' ) ) :
8857
  self::$instance = new Sek_Simple_Form( $params );
8858
  return self::$instance;
8859
  }
 
8860
  function __construct( $params = array() ) {
8861
  $this -> _schedule_front_ajax_actions();
8862
  $this -> _schedule_img_import_ajax_actions();
@@ -9226,8 +7810,8 @@ if ( ! class_exists( 'SEK_Front_Assets' ) ) :
9226
  );
9227
  wp_enqueue_script(
9228
  'sek-main-js',
9229
- NIMBLE_BASE_URL . '/assets/front/js/sek-main.js',
9230
- array( 'jquery', 'underscore'),
9231
  NIMBLE_ASSETS_VERSION,
9232
  true
9233
  );
@@ -9462,6 +8046,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
9462
  add_filter( 'the_content', array( $this, 'sek_wrap_wp_content' ), NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY );
9463
  add_action( 'wp_enqueue_scripts', array( $this, 'sek_enqueue_the_printed_module_assets') );
9464
  add_filter( 'template_include', array( $this, 'sek_maybe_set_local_nimble_template') );
 
9465
  }
9466
  function sek_schedule_rendering_hooks() {
9467
  $locale_template = sek_get_locale_template();
@@ -9543,7 +8128,7 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
9543
  }
9544
  public function _render_seks_for_location( $location = '', $location_data = array() ) {
9545
  if ( ! array_key_exists( $location, sek_get_locations() ) ) {
9546
- error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => the location ' . $location . ' is not registered in sek_get_locations()');
9547
  return;
9548
  }
9549
  $locationSettingValue = array();
@@ -9619,12 +8204,13 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
9619
  }
9620
 
9621
  ?>
9622
- <?php printf('<div data-sek-level="section" data-sek-id="%1$s" %2$s class="sek-section %3$s %4$s" %5$s>',
9623
  $id,
9624
  $is_nested ? 'data-sek-is-nested="true"' : '',
9625
  $has_at_least_one_module ? 'sek-has-modules' : '',
9626
  $this->get_level_visibility_css_class( $model ),
9627
- is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"'
 
9628
  ); ?>
9629
  <div class="<?php echo $column_container_class; ?>">
9630
  <div class="sek-row sek-sektion-inner">
@@ -9888,6 +8474,57 @@ if ( ! class_exists( 'SEK_Front_Render' ) ) :
9888
  }
9889
  return $template;
9890
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9891
  }//class
9892
  endif;
9893
  ?><?php
@@ -10807,13 +9444,6 @@ function simple_form_mail_template() {
10807
 
10808
 
10809
  ?><?php
10810
- function SEK_CZR_Dyn_Register( $params = array() ) {
10811
- if ( skp_is_customizing() ) {
10812
- return SEK_CZR_Dyn_Register::get_instance( $params );
10813
- }
10814
- }
10815
- add_action('after_setup_theme', '\Nimble\SEK_CZR_Dyn_Register', 20 );
10816
-
10817
  function SEK_Fire( $params = array() ) {
10818
  return Sek_Simple_Form::get_instance( $params );
10819
  }
512
  }
513
  return $bool;
514
  }
515
+
516
+
517
+
518
+
519
+
520
+ /* ------------------------------------------------------------------------- *
521
+ * IMAGE HELPER
522
+ /* ------------------------------------------------------------------------- */
523
+ function sek_get_img_sizes() {
524
+ global $_wp_additional_image_sizes;
525
+
526
+ $sizes = array();
527
+ $to_return = array(
528
+ 'original' => __('Original image dimensions', 'nimble-builder')
529
+ );
530
+
531
+ foreach ( get_intermediate_image_sizes() as $_size ) {
532
+
533
+ $first_to_upper_size = ucfirst(strtolower($_size));
534
+ $first_to_upper_size = preg_replace_callback( '/[.!?].*?\w/', '\Nimble\sek_img_sizes_preg_replace_callback', $first_to_upper_size );
535
+
536
+ if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
537
+ $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
538
+ $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
539
+ $sizes[ $_size ]['title'] = $first_to_upper_size;
540
+ } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
541
+ $sizes[ $_size ] = array(
542
+ 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
543
+ 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
544
+ 'title' => $first_to_upper_size
545
+ );
546
+ }
547
+ }
548
+ foreach ( $sizes as $_size => $data ) {
549
+ $to_return[ $_size ] = $data['title'] . ' - ' . $data['width'] . ' x ' . $data['height'];
550
+ }
551
+
552
+ return $to_return;
553
+ }
554
+
555
+ function sek_img_sizes_preg_replace_callback( $matches ) {
556
+ return strtoupper( $matches[0] );
557
+ }
558
+
559
+
560
+
561
+
562
+
563
+ /* ------------------------------------------------------------------------- *
564
+ * SMART LOAD HELPER
565
+ /* ------------------------------------------------------------------------- */
566
+ /**
567
+ * callback of preg_replace_callback in SEK_Front_Render::sek_maybe_process_img_for_js_smart_load
568
+ * @return string
569
+ */
570
+ function nimble_regex_callback( $matches ) {
571
+ $_placeholder = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
572
+
573
+ if ( false !== strpos( $matches[0], 'data-sek-src' ) || preg_match('/ data-sek-smartload *= *"false" */', $matches[0]) ) {
574
+ return $matches[0];
575
+ } else {
576
+ return apply_filters( 'nimble_img_smartloaded',
577
+ str_replace( array('srcset=', 'sizes='), array('data-sek-srcset=', 'data-sek-sizes='),
578
+ sprintf('<img %1$s src="%2$s" data-sek-src="%3$s" %4$s>',
579
+ $matches[1],
580
+ $_placeholder,
581
+ $matches[2],
582
+ $matches[3]
583
+ )
584
+ )
585
+ );
586
+ }
587
+ }
588
+ function sek_is_img_smartload_enabled() {
589
+ if ( skp_is_customizing() )
590
+ return false;
591
+ if ( 'not_cached' !== SEK_Fire()->img_smartload_enabled ) {
592
+ return SEK_Fire()->img_smartload_enabled;
593
+ }
594
+ $is_img_smartload_enabled = false;
595
+ $local_options = sek_get_skoped_seks( !empty( $_POST['skope_id'] ) ? $_POST['skope_id'] : skp_build_skope_id() );
596
+ $local_smartload = 'inherit';
597
+ if ( is_array( $local_options ) && !empty( $local_options['local_options']) && is_array( $local_options['local_options']) && !empty($local_options['local_options']['local_performances'] ) && is_array( $local_options['local_options']['local_performances'] ) ) {
598
+ if ( ! empty( $local_options['local_options']['local_performances']['local-img-smart-load'] ) && 'inherit' !== $local_options['local_options']['local_performances']['local-img-smart-load'] ) {
599
+ $local_smartload = 'yes' === $local_options['local_options']['local_performances']['local-img-smart-load'];
600
+ }
601
+ }
602
+
603
+ if ( 'inherit' !== $local_smartload ) {
604
+ $is_img_smartload_enabled = $local_smartload;
605
+ } else {
606
+ $glob_options = get_option( NIMBLE_OPT_NAME_FOR_GLOBAL_OPTIONS );
607
+ if ( is_array( $glob_options ) && !empty($glob_options['performances']) && is_array( $glob_options['performances'] ) && !empty( $glob_options['performances']['global-img-smart-load'] ) ) {
608
+ $is_img_smartload_enabled = sek_booleanize_checkbox_val( $glob_options['performances']['global-img-smart-load'] );
609
+ }
610
+ }
611
+ SEK_Fire()->img_smartload_enabled = $is_img_smartload_enabled;
612
+
613
+ return SEK_Fire()->img_smartload_enabled;
614
+ }
615
+
616
+
617
+
618
+ /**
619
+ * Returns a boolean
620
+ * check if user started to use the plugin before ( strictly < ) the requested version
621
+ * @param $_ver : string free version
622
+ */
623
+ function sek_user_started_before_version( $requested_version ) {
624
+ $started_with = get_option( 'nimble_started_with_version' );
625
+ if ( ! $started_with )
626
+ return false;
627
+
628
+ if ( ! is_string( $requested_version ) )
629
+ return false;
630
+
631
+ return version_compare( $started_with , $requested_version, '<' );
632
+ }
633
  ?><?php
634
  function sek_maybe_do_version_mapping() {
635
  if ( ! is_user_logged_in() || ! current_user_can( 'edit_theme_options' ) )
890
  return $post;
891
  }
892
 
893
+ /**
894
+ * Fetch the saved collection of sektion for a given skope_id / location
895
+ *
896
+ * @since 4.7.0
897
+ *
898
+ * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme.
899
+ * @return array => the skope setting items
900
+ */
901
+ function sek_get_skoped_seks( $skope_id = '', $location_id = '', $skope_level = 'local' ) {
902
+ if ( empty( $skope_id ) ) {
903
+ $skope_id = skp_get_skope_id( $skope_level );
904
+ }
905
+ if ( did_action('wp') && 'not_cached' != SEK_Fire()->local_seks ) {
906
+ $seks_data = SEK_Fire()->local_seks;
907
+ } else {
908
+
909
+ $seks_data = array();
910
+ $post = sek_get_seks_post( $skope_id );
911
+ if ( $post ) {
912
+ $seks_data = maybe_unserialize( $post->post_content );
913
+ }
914
+ $seks_data = is_array( $seks_data ) ? $seks_data : array();
915
+ $default_collection = sek_get_default_sektions_value();
916
+ $seks_data = wp_parse_args( $seks_data, $default_collection );
917
+ $maybe_incomplete_locations = [];
918
+ foreach( $seks_data['collection'] as $location_data ) {
919
+ if ( !empty( $location_data['id'] ) ) {
920
+ $maybe_incomplete_locations[] = $location_data['id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921
  }
922
+ }
923
 
924
+ foreach( SEK_Fire()->registered_locations as $loc_id => $params ) {
925
+ if ( !in_array( $loc_id, $maybe_incomplete_locations ) ) {
926
+ $seks_data['collection'][] = wp_parse_args( [ 'id' => $loc_id ], SEK_Fire()->default_location_model );
927
+ }
928
+ }
929
+ SEK_Fire()->local_seks = $seks_data;
930
+ }//end if
931
+ $seks_data = apply_filters(
932
+ 'sek_get_skoped_seks',
933
+ $seks_data,
934
+ $skope_id,
935
+ $location_id
936
+ );
937
+ if ( array_key_exists( 'collection', $seks_data ) && ! empty( $location_id ) ) {
938
+ if ( ! array_key_exists( $location_id, sek_get_locations() ) ) {
939
+ error_log( __FUNCTION__ . ' Error => location ' . $location_id . ' is not registered in the available locations' );
940
  } else {
941
+ $seks_data = sek_get_level_model( $location_id, $seks_data['collection'] );
942
  }
943
  }
 
 
 
944
 
945
+ return 'no_match' === $seks_data ? SEK_Fire()->default_location_model : $seks_data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946
  }
 
 
 
947
 
 
 
 
948
 
 
 
 
 
 
 
949
 
950
+ /**
951
+ * Update the `nimble_post_type` post for a given "{$skope_id}"
952
+ * Inserts a `nimble_post_type` post when one doesn't yet exist.
953
+ *
954
+ * @since 4.7.0
955
+ *
956
+ * }
957
+ * @return WP_Post|WP_Error Post on success, error on failure.
958
+ */
959
+ function sek_update_sek_post( $seks_data, $args = array() ) {
960
+ $args = wp_parse_args( $args, array(
961
+ 'skope_id' => ''
962
+ ) );
963
 
964
+ if ( ! is_array( $seks_data ) ) {
965
+ error_log( 'sek_update_sek_post => $seks_data is not an array' );
966
+ return new WP_Error( 'sek_update_sek_post => $seks_data is not an array');
967
+ }
968
 
969
+ $skope_id = $args['skope_id'];
970
+ if ( empty( $skope_id ) ) {
971
+ error_log( 'sek_update_sek_post => empty skope_id' );
972
+ return new WP_Error( 'sek_update_sek_post => empty skope_id');
 
 
973
  }
 
974
 
975
+ $post_title = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id;
 
976
 
977
+ $post_data = array(
978
+ 'post_title' => $post_title,
979
+ 'post_name' => sanitize_title( $post_title ),
980
+ 'post_type' => NIMBLE_CPT,
981
+ 'post_status' => 'publish',
982
+ 'post_content' => maybe_serialize( $seks_data )
983
+ );
984
+ $post = sek_get_seks_post( $skope_id );
985
 
986
+ if ( $post ) {
987
+ $post_data['ID'] = $post->ID;
988
+ $r = wp_update_post( wp_slash( $post_data ), true );
989
+ } else {
990
+ $r = wp_insert_post( wp_slash( $post_data ), true );
991
+ if ( ! is_wp_error( $r ) ) {
992
+ $option_name = NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . $skope_id;
993
+ $post_id = $r;//$r is the post ID
 
 
 
 
 
 
 
 
 
 
 
994
 
995
+ update_option( $option_name, (int)$post_id );
996
+ if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
997
+ wp_save_post_revision( $r );
998
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  }
1000
+ }
1001
+
1002
+ if ( is_wp_error( $r ) ) {
1003
+ return $r;
1004
+ }
1005
+ return get_post( $r );
1006
  }
1007
+ ?><?php
 
1008
  function sek_generate_css_rules_for_multidimensional_border_options( $rules, $border_settings, $border_type, $css_selectors = '' ) {
1009
  if ( ! is_array( $rules ) )
1010
  return array();
1594
  'sek_local_widths',
1595
  'sek_local_custom_css',
1596
  'sek_local_reset',
1597
+ 'sek_local_performances',
1598
  'sek_global_breakpoint',
1599
  'sek_global_widths',
1600
+ 'sek_global_performances',
1601
  'czr_simple_html_module',
1602
 
1603
  'czr_tiny_mce_editor_module',
2020
  * background: [background-image] [background-position] / [background-size] [background-repeat] [background-attachment] [background-origin] [background-clip] [background-color];
2021
  */
2022
  if ( ! empty( $bg_options[ 'bg-image'] ) && is_numeric( $bg_options[ 'bg-image'] ) ) {
2023
+ if ( ! sek_is_img_smartload_enabled() ) {
2024
+ $background_properties[ 'background-image' ] = 'url("'. wp_get_attachment_url( $bg_options[ 'bg-image'] ) .'")';
2025
+ }
2026
  if ( ! empty( $bg_options[ 'bg-position'] ) ) {
2027
  $pos_map = array(
2028
  'top_left' => '0% 0%',
2723
  'title_width' => 'width-80',
2724
  'input_width' => 'width-20',
2725
  'refresh_markup' => true,
2726
+ 'refresh_stylesheet' => false,
2727
+ 'notice_after' => __('Note that those options are not applied during the live customization of your site, but only when the changes are published.', 'nimble-builder')
2728
  ),
2729
  )
2730
  )//tmpl
3013
  );
3014
  }
3015
  ?><?php
3016
+ function sek_get_module_params_for_sek_local_performances() {
3017
+ return array(
3018
+ 'dynamic_registration' => true,
3019
+ 'module_type' => 'sek_local_performances',
3020
+ 'name' => __('Performance optimizations', 'nimble-builder'),
3021
+ 'tmpl' => array(
3022
+ 'item-inputs' => array(
3023
+ 'local-img-smart-load' => array(
3024
+ 'input_type' => 'select',
3025
+ 'title' => __('Select how you want to load the images in the sections of this page.', 'nimble-builder'),
3026
+ 'default' => 'inherit',
3027
+ 'choices' => array(
3028
+ 'inherit' => __('Inherit the site wide option', 'nimble-builder' ),
3029
+ 'yes' => __('Load images on scroll ( optimized )', 'nimble-builder' ),
3030
+ 'no' => __('Load all images on page load ( not optimized )', 'nimble-builder' )
3031
+ ),
3032
+ 'notice_after' => __( 'When you select "Load images on scroll", images below the viewport are loaded dynamically on scroll. This can boost performances by reducing the weight of long web pages designed with several images.', 'nimble-builder'),
3033
+ 'width-100' => true,
3034
+ 'title_width' => 'width-100'
3035
+ )
3036
+ )
3037
+ )//tmpl
3038
+ );
3039
+ }
3040
+ ?><?php
3041
  function sek_get_module_params_for_sek_global_breakpoint() {
3042
  return array(
3043
  'dynamic_registration' => true,
3205
  printf('<style type="text/css" id="nimble-global-options">%1$s</style>', $width_options_css );
3206
  }
3207
  }
3208
+ ?><?php
3209
+ function sek_get_module_params_for_sek_global_performances() {
3210
+ return array(
3211
+ 'dynamic_registration' => true,
3212
+ 'module_type' => 'sek_global_performances',
3213
+ 'name' => __('Site wide performance options', 'nimble-builder'),
3214
+ 'tmpl' => array(
3215
+ 'item-inputs' => array(
3216
+ 'global-img-smart-load' => array(
3217
+ 'input_type' => 'gutencheck',
3218
+ 'title' => __('Load images on scroll', 'nimble-builder'),
3219
+ 'default' => 0,
3220
+ 'title_width' => 'width-80',
3221
+ 'input_width' => 'width-20',
3222
+ 'notice_after' => __( 'Check this option to delay the loading of non visible images. Images below the viewport will be loaded dynamically on scroll. This can boost performances by reducing the weight of long web pages designed with several images.', 'nimble-builder')
3223
+ ),
3224
+ )
3225
+ )//tmpl
3226
+ );
3227
+ }
3228
+
3229
  ?><?php
3230
  /* ------------------------------------------------------------------------- *
3231
  * LOAD AND REGISTER SIMPLE HTML MODULE
7440
  self::$instance = new Sek_Simple_Form( $params );
7441
  return self::$instance;
7442
  }
7443
+ public $img_smartload_enabled = 'not_cached';
7444
  function __construct( $params = array() ) {
7445
  $this -> _schedule_front_ajax_actions();
7446
  $this -> _schedule_img_import_ajax_actions();
7810
  );
7811
  wp_enqueue_script(
7812
  'sek-main-js',
7813
+ sek_is_dev_mode() ? NIMBLE_BASE_URL . '/assets/front/js/ccat-nimble-front.js' : NIMBLE_BASE_URL . '/assets/front/js/ccat-nimble-front.min.js',
7814
+ array( 'jquery'),
7815
  NIMBLE_ASSETS_VERSION,
7816
  true
7817
  );
8046
  add_filter( 'the_content', array( $this, 'sek_wrap_wp_content' ), NIMBLE_WP_CONTENT_WRAP_FILTER_PRIORITY );
8047
  add_action( 'wp_enqueue_scripts', array( $this, 'sek_enqueue_the_printed_module_assets') );
8048
  add_filter( 'template_include', array( $this, 'sek_maybe_set_local_nimble_template') );
8049
+ add_filter( 'nimble_parse_for_smart_load', array( $this, 'sek_maybe_process_img_for_js_smart_load') );
8050
  }
8051
  function sek_schedule_rendering_hooks() {
8052
  $locale_template = sek_get_locale_template();
8128
  }
8129
  public function _render_seks_for_location( $location = '', $location_data = array() ) {
8130
  if ( ! array_key_exists( $location, sek_get_locations() ) ) {
8131
+ sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => the location ' . $location . ' is not registered in sek_get_locations()');
8132
  return;
8133
  }
8134
  $locationSettingValue = array();
8204
  }
8205
 
8206
  ?>
8207
+ <?php printf('<div data-sek-level="section" data-sek-id="%1$s" %2$s class="sek-section %3$s %4$s" %5$s %6$s>',
8208
  $id,
8209
  $is_nested ? 'data-sek-is-nested="true"' : '',
8210
  $has_at_least_one_module ? 'sek-has-modules' : '',
8211
  $this->get_level_visibility_css_class( $model ),
8212
+ is_null( $custom_anchor ) ? '' : 'id="' . $custom_anchor . '"',
8213
+ $this -> sek_maybe_add_smart_loaded_bg_attributes( $model )
8214
  ); ?>
8215
  <div class="<?php echo $column_container_class; ?>">
8216
  <div class="sek-row sek-sektion-inner">
8474
  }
8475
  return $template;
8476
  }
8477
+
8478
+
8479
+
8480
+ /* ------------------------------------------------------------------------- *
8481
+ * SMART LOAD.
8482
+ /* ------------------------------------------------------------------------- */
8483
+ function sek_maybe_add_smart_loaded_bg_attributes( $model ) {
8484
+ if ( !sek_is_img_smartload_enabled() )
8485
+ return false;
8486
+ $bg_url = '';
8487
+ if ( !empty( $model[ 'options' ] ) && is_array( $model['options'] ) ) {
8488
+ $bg_options = ( ! empty( $model[ 'options' ][ 'bg' ] ) && is_array( $model[ 'options' ][ 'bg' ] ) ) ? $model[ 'options' ][ 'bg' ] : array();
8489
+ if ( ! empty( $bg_options[ 'bg-image'] ) && is_numeric( $bg_options[ 'bg-image'] ) ) {
8490
+ $bg_url = wp_get_attachment_url( $bg_options[ 'bg-image'] );
8491
+ }
8492
+ }
8493
+ return ! empty( $bg_url ) ? sprintf('data-sek-lazy-bg="true" data-sek-src="%1$s"', $bg_url ) : '';
8494
+ }
8495
+ function sek_maybe_process_img_for_js_smart_load( $html ) {
8496
+ if ( !sek_is_img_smartload_enabled() )
8497
+ return $html;
8498
+ if ( ! is_string( $html ) ) {
8499
+ sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' Error => provided html is not a string', $html );
8500
+ return $html;
8501
+ }
8502
+ if ( is_feed() || is_preview() )
8503
+ return $html;
8504
+
8505
+ $allowed_image_extensions = apply_filters( 'nimble_smartload_allowed_img_extensions', array(
8506
+ 'bmp',
8507
+ 'gif',
8508
+ 'jpeg',
8509
+ 'jpg',
8510
+ 'jpe',
8511
+ 'tif',
8512
+ 'tiff',
8513
+ 'ico',
8514
+ 'png',
8515
+ 'svg',
8516
+ 'svgz'
8517
+ ) );
8518
+
8519
+ if ( empty( $allowed_image_extensions ) || ! is_array( $allowed_image_extensions ) ) {
8520
+ return $html;
8521
+ }
8522
+
8523
+ $img_extensions_pattern = sprintf( "(?:%s)", implode( '|', $allowed_image_extensions ) );
8524
+ $pattern = '#<img([^>]+?)src=[\'"]?([^\'"\s>]+\.'.$img_extensions_pattern.'[^\'"\s>]*)[\'"]?([^>]*)>#i';
8525
+
8526
+ return preg_replace_callback( $pattern, '\Nimble\nimble_regex_callback', $html);
8527
+ }
8528
  }//class
8529
  endif;
8530
  ?><?php
9444
 
9445
 
9446
  ?><?php
 
 
 
 
 
 
 
9447
  function SEK_Fire( $params = array() ) {
9448
  return Sek_Simple_Form::get_instance( $params );
9449
  }
inc/sektions/customizer/seks_tiny_mce_editor_actions.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- namespace Nimble;
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- }
6
-
7
- /*
8
- * This approach has been inspired by the excellent https://github.com/xwp/wp-customize-posts
9
- */
10
- add_action( 'customize_controls_print_footer_scripts', '\Nimble\sek_print_tiny_mce_editor_template', 0 );
11
- function sek_print_tiny_mce_editor_template() {
12
- ?>
13
- <div id="czr-customize-content_editor-pane">
14
- <div data-czr-action="close-tinymce-editor" class="czr-close-editor"><i class="fas fa-arrow-circle-down" title="<?php _e( 'Hide Editor', 'nimble-builder' ); ?>"></i>&nbsp;<span><?php _e( 'Hide Editor', 'nimble-builder');?></span></div>
15
- <div id="czr-customize-content_editor-dragbar" title="<?php _e('Resize the editor', 'nimble-builder'); ?>">
16
- <span class="screen-reader-text"><?php _e( 'Resize the editor', 'nimble-builder' ); ?></span>
17
- <i class="czr-resize-handle fas fa-arrows-alt-v"></i>
18
- </div>
19
-
20
- <?php
21
- // The settings passed in here are inspired from edit-form-advanced.php.
22
- wp_editor( '', 'czr-customize-content_editor', array(
23
- '_content_editor_dfw' => false,
24
- 'drag_drop_upload' => true,
25
- 'tabfocus_elements' => 'content-html,save-post',
26
- 'editor_height' => 200,
27
- 'default_editor' => 'tinymce',
28
- 'tinymce' => array(
29
- 'resize' => false,
30
- 'wp_autoresize_on' => false,
31
- 'add_unload_trigger' => false,
32
- ),
33
- ) );
34
- ?>
35
- </div>
36
- <?php
37
- }
38
-
39
- /**
40
- * Enqueue a WP Editor instance we can use for rich text editing.
41
- */
42
- add_action( 'customize_controls_init', '\Nimble\sek_enqueue_tiny_mce_editor' );
43
- function sek_enqueue_tiny_mce_editor() {
44
- //add_action( 'customize_controls_print_footer_scripts', 'render_editor' , 0 );
45
- // @todo These should be included in \_WP_Editors::editor_settings()
46
- if ( false === has_action( 'customize_controls_print_footer_scripts', array( '_WP_Editors', 'enqueue_scripts' ) ) ) {
47
- add_action( 'customize_controls_print_footer_scripts', array( '_WP_Editors', 'enqueue_scripts' ) );
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/sektions/{customizer/seks_setting_class.php → seks_setting_class.php} RENAMED
@@ -3,7 +3,6 @@ namespace Nimble;
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
-
7
  /**
8
  * This handles validation, sanitization and saving of the value.
9
  */
@@ -179,4 +178,6 @@ final class Nimble_Customizer_Setting extends \WP_Customize_Setting {
179
 
180
  return $post_id;
181
  }
182
- }
 
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
 
6
  /**
7
  * This handles validation, sanitization and saving of the value.
8
  */
178
 
179
  return $post_id;
180
  }
181
+ }
182
+
183
+ ?>
nimble-builder.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Nimble Builder
4
  * Description: Drag-and-drop section builder companion of the Customizr and Hueman themes.
5
- * Version: 1.1.7
6
  * Text Domain: nimble-builder
7
  * Author: Press Customizr
8
  * Author URI: https://presscustomizr.com
@@ -11,13 +11,14 @@
11
  /* ------------------------------------------------------------------------- *
12
  * CONSTANTS
13
  /* ------------------------------------------------------------------------- */
14
- $current_version = "1.1.7";
15
  if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
16
  if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
17
  if ( !defined( 'NIMBLE_BASE_URL' ) ) { define( 'NIMBLE_BASE_URL' , plugins_url( NIMBLE_DIR_NAME ) ); }
18
  if ( !defined( 'NIMBLE_BASE_PATH' ) ) { define( 'NIMBLE_BASE_PATH' , dirname( __FILE__ ) ); }
19
  if ( !defined( 'NIMBLE_MIN_PHP_VERSION' ) ) { define ( 'NIMBLE_MIN_PHP_VERSION', '5.4' ); }
20
  if ( !defined( 'NIMBLE_MIN_WP_VERSION' ) ) { define ( 'NIMBLE_MIN_WP_VERSION', '4.7' ); }
 
21
 
22
 
23
  /* ------------------------------------------------------------------------- *
@@ -67,23 +68,43 @@ function nimble_load_czr_base_fmk() {
67
  }
68
  return;
69
  }
70
- require_once( dirname( __FILE__ ) . '/inc/czr-base-fmk/czr-base-fmk.php' );
71
- \Nimble\CZR_Fmk_Base( array(
72
- 'base_url' => NIMBLE_BASE_URL . '/inc/czr-base-fmk',
73
- 'version' => NIMBLE_VERSION
74
- ));
 
 
 
75
  }
76
  if ( nimble_pass_requirements() ) {
77
- require_once( plugin_dir_path( __FILE__ ) . 'inc/czr-skope/index.php' );
78
- add_action( 'after_setup_theme', function() {
79
- \Nimble\Flat_Skop_Base( array(
80
- 'base_url_path' => NIMBLE_BASE_URL . '/inc/czr-skope'
81
- ) );
82
- });
83
- require_once( plugin_dir_path( __FILE__ ) . 'inc/sektions/ccat-sektions.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  if ( defined( 'NIMBLE_PRINT_TEST' ) && NIMBLE_PRINT_TEST && file_exists( plugin_dir_path( __FILE__ ) . 'tests.php' ) ) {
86
- require_once( plugin_dir_path( __FILE__ ) . 'tests.php' );
87
  }
88
 
89
  add_action('plugins_loaded', 'nimble_load_plugin_textdomain');
@@ -104,5 +125,11 @@ if ( nimble_pass_requirements() ) {
104
  }
105
 
106
  // Fire the retro compatibility functions
 
107
  add_action( 'wp_loaded', '\Nimble\sek_maybe_do_version_mapping' );
 
 
 
 
 
108
  }
2
  /**
3
  * Plugin Name: Nimble Builder
4
  * Description: Drag-and-drop section builder companion of the Customizr and Hueman themes.
5
+ * Version: 1.1.8
6
  * Text Domain: nimble-builder
7
  * Author: Press Customizr
8
  * Author URI: https://presscustomizr.com
11
  /* ------------------------------------------------------------------------- *
12
  * CONSTANTS
13
  /* ------------------------------------------------------------------------- */
14
+ $current_version = "1.1.8";
15
  if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
16
  if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
17
  if ( !defined( 'NIMBLE_BASE_URL' ) ) { define( 'NIMBLE_BASE_URL' , plugins_url( NIMBLE_DIR_NAME ) ); }
18
  if ( !defined( 'NIMBLE_BASE_PATH' ) ) { define( 'NIMBLE_BASE_PATH' , dirname( __FILE__ ) ); }
19
  if ( !defined( 'NIMBLE_MIN_PHP_VERSION' ) ) { define ( 'NIMBLE_MIN_PHP_VERSION', '5.4' ); }
20
  if ( !defined( 'NIMBLE_MIN_WP_VERSION' ) ) { define ( 'NIMBLE_MIN_WP_VERSION', '4.7' ); }
21
+ if ( ! defined( 'NIMBLE_PLUGIN_FILE' ) ) {define( 'NIMBLE_PLUGIN_FILE', __FILE__ ); }// Plugin Root File used register_activation_hook( NIMBLE_PLUGIN_FILE, 'nimble_install' );
22
 
23
 
24
  /* ------------------------------------------------------------------------- *
68
  }
69
  return;
70
  }
71
+
72
+ require_once( NIMBLE_BASE_PATH . '/inc/czr-base-fmk/czr-base-fmk.php' );
73
+ if ( class_exists('\Nimble\CZR_Fmk_Base') ) {
74
+ \Nimble\CZR_Fmk_Base( array(
75
+ 'base_url' => NIMBLE_BASE_URL . '/inc/czr-base-fmk',
76
+ 'version' => NIMBLE_VERSION
77
+ ));
78
+ }
79
  }
80
  if ( nimble_pass_requirements() ) {
81
+
82
+ require_once( NIMBLE_BASE_PATH . '/inc/czr-skope/index.php' );
83
+ add_action( 'after_setup_theme', 'nimble_load_skope_php');
84
+ function nimble_load_skope_php() {
85
+ if ( class_exists('\Nimble\Flat_Skop_Base') ) {
86
+ \Nimble\Flat_Skop_Base( array(
87
+ 'base_url_path' => NIMBLE_BASE_URL . '/inc/czr-skope'
88
+ ) );
89
+ }
90
+ }
91
+
92
+ require_once( NIMBLE_BASE_PATH . '/inc/sektions/ccat-sektions.php' );
93
+ // $_POST['ac_get_template'] <= scenario of an input template getting ajaxily fetched
94
+ if ( \Nimble\skp_is_customizing() || isset( $_POST['ac_get_template']) || ( defined('DOING_AJAX') && DOING_AJAX ) ) {
95
+ require_once( NIMBLE_BASE_PATH . '/inc/sektions/ccat-czr-sektions.php' );
96
+ }
97
+
98
+ add_action( 'after_setup_theme', 'nimble_setup_dyn_register', 20 );
99
+ function nimble_setup_dyn_register( $params = array() ) {
100
+ if ( class_exists('\Nimble\SEK_CZR_Dyn_Register') ) {
101
+ // instantiate if not done yet
102
+ \Nimble\SEK_CZR_Dyn_Register::get_instance( $params );
103
+ }
104
+ }
105
 
106
  if ( defined( 'NIMBLE_PRINT_TEST' ) && NIMBLE_PRINT_TEST && file_exists( plugin_dir_path( __FILE__ ) . 'tests.php' ) ) {
107
+ require_once( NIMBLE_BASE_PATH . '/tests.php' );
108
  }
109
 
110
  add_action('plugins_loaded', 'nimble_load_plugin_textdomain');
125
  }
126
 
127
  // Fire the retro compatibility functions
128
+ // Note : if fired @plugins_loaded, invoking wp_update_post() generates php notices
129
  add_action( 'wp_loaded', '\Nimble\sek_maybe_do_version_mapping' );
130
+
131
+ // Load admin
132
+ if ( is_admin() ) {
133
+ require_once( NIMBLE_BASE_PATH . '/inc/admin/nimble-admin.php' );
134
+ }
135
  }
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: customizer, editor, page builder, drag and drop
6
  Requires at least: 4.7
7
  Requires PHP: 5.4
8
  Tested up to: 4.9.8
9
- Stable tag: 1.1.7
10
  License: GPLv3
11
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
 
@@ -26,10 +26,11 @@ The Nimble Builder is a lightweight section builder intended to be the content c
26
  You'll find an online knowledge base for the Nimble builder here : [Nimble builder documentation](https://docs.presscustomizr.com/collection/334-nimble-builder).
27
 
28
  == Screenshots ==
29
- 1. Dragging and dropping a pre-designed section
30
- 2. Editing content in live preview
31
- 3. Creating columns layouts
32
- 4. Customizing a section with an image background
 
33
 
34
  == Installation ==
35
  1. Install the plugin through the WordPress plugins screen. Or download the plugin, unzip the package and upload it to your /wp-content/plugins/ directory
@@ -44,6 +45,11 @@ You'll find an online knowledge base for the Nimble builder here : [Nimble build
44
  The Nimble builder has been optimized to work with the Customizr and Hueman theme, but it works with any WordPress theme. If you experience any problem with a specific theme, please report it in the [plugin support forum](https://wordpress.org/support/plugin/nimble-builder).
45
 
46
  == Upgrade Notice ==
 
 
 
 
 
47
  = 1.1.7 : October 11th, 2018 =
48
  * fixed : check on php and wordpress version not preventing some plugin functions to be fired.
49
 
@@ -88,6 +94,11 @@ The Nimble builder has been optimized to work with the Customizr and Hueman them
88
  * fixed : dynamic CSS can be printed twice : inline and enqueued as CSS file when user logged in.
89
 
90
  == Changelog ==
 
 
 
 
 
91
  = 1.1.7 : October 11th, 2018 =
92
  * fixed : check on php and wordpress version not preventing some plugin functions to be fired.
93
 
6
  Requires at least: 4.7
7
  Requires PHP: 5.4
8
  Tested up to: 4.9.8
9
+ Stable tag: 1.1.8
10
  License: GPLv3
11
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
 
26
  You'll find an online knowledge base for the Nimble builder here : [Nimble builder documentation](https://docs.presscustomizr.com/collection/334-nimble-builder).
27
 
28
  == Screenshots ==
29
+ 1. Creating a page with 3 sections
30
+ 2. Dragging and dropping a pre-designed section
31
+ 3. Editing content in live preview
32
+ 4. Creating columns layouts
33
+ 5. Customizing a section with an image background
34
 
35
  == Installation ==
36
  1. Install the plugin through the WordPress plugins screen. Or download the plugin, unzip the package and upload it to your /wp-content/plugins/ directory
45
  The Nimble builder has been optimized to work with the Customizr and Hueman theme, but it works with any WordPress theme. If you experience any problem with a specific theme, please report it in the [plugin support forum](https://wordpress.org/support/plugin/nimble-builder).
46
 
47
  == Upgrade Notice ==
48
+ = 1.1.8 : October 23rd, 2018 =
49
+ * improved : performance improvements with new options to lazy load images
50
+ * added : an admin page for Nimble Builder, to display the system informations
51
+ * added : a dismissable update notifications in admin
52
+
53
  = 1.1.7 : October 11th, 2018 =
54
  * fixed : check on php and wordpress version not preventing some plugin functions to be fired.
55
 
94
  * fixed : dynamic CSS can be printed twice : inline and enqueued as CSS file when user logged in.
95
 
96
  == Changelog ==
97
+ = 1.1.8 : October 23rd, 2018 =
98
+ * improved : performance improvements with new options to lazy load images
99
+ * added : an admin page for Nimble Builder, to display the system informations
100
+ * added : a dismissable update notifications in admin
101
+
102
  = 1.1.7 : October 11th, 2018 =
103
  * fixed : check on php and wordpress version not preventing some plugin functions to be fired.
104
 
tmpl/modules/image_module_tmpl.php CHANGED
@@ -33,7 +33,10 @@ if ( ! function_exists( '\Nimble\sek_get_img_module_img_html') ) {
33
  if ( is_int( $value['img'] ) ) {
34
  $html = wp_get_attachment_image( $value['img'], empty( $value['img-size'] ) ? 'large' : $value['img-size']);
35
  } else if ( ! empty( $value['img'] ) && is_string( $value['img'] ) ) {
36
- $html = sprintf( '<img alt="default img" src="%1$s"/>', esc_url( $value['img'] ) );
 
 
 
37
  } else {
38
  //falls back on an icon if previewing
39
  if ( skp_is_customizing() ) {
@@ -65,7 +68,7 @@ if ( ! function_exists( '\Nimble\sek_get_img_module_img_html') ) {
65
  }
66
  }
67
  }
68
- return sprintf('<figure class="%1$s" title="%3$s">%2$s</figure>', $visual_effect_class, $html, esc_html( $title ) );
69
  }
70
  }
71
 
33
  if ( is_int( $value['img'] ) ) {
34
  $html = wp_get_attachment_image( $value['img'], empty( $value['img-size'] ) ? 'large' : $value['img-size']);
35
  } else if ( ! empty( $value['img'] ) && is_string( $value['img'] ) ) {
36
+ // the default img is excluded from the smart loading parsing @see nimble_regex_callback()
37
+ // => this is needed because this image has no specific dimensions set. And therefore can create false javascript computations of other element's distance to top on page load.
38
+ // in particular when calculting if is_visible() to decide if we smart load.
39
+ $html = sprintf( '<img alt="default img" data-sek-smartload="false" src="%1$s"/>', esc_url( $value['img'] ) );
40
  } else {
41
  //falls back on an icon if previewing
42
  if ( skp_is_customizing() ) {
68
  }
69
  }
70
  }
71
+ return apply_filters( 'nimble_parse_for_smart_load', sprintf('<figure class="%1$s" title="%3$s">%2$s</figure>', $visual_effect_class, $html, esc_html( $title ) ) );
72
  }
73
  }
74
 
tmpl/modules/tinymce_editor_module_tmpl.php CHANGED
@@ -26,7 +26,7 @@ if ( ! function_exists( '\Nimble\sek_print_tiny_mce_text_content') ) {
26
  if ( skp_is_customizing() ) {
27
  printf('<div title="%3$s" data-sek-input-type="tiny_mce_editor" data-sek-input-id="%1$s">%2$s</div>', $input_id, $content, __( 'Click to edit', 'nimble-builder' ) );
28
  } else {
29
- echo $content;
30
  }
31
  }
32
  }
26
  if ( skp_is_customizing() ) {
27
  printf('<div title="%3$s" data-sek-input-type="tiny_mce_editor" data-sek-input-id="%1$s">%2$s</div>', $input_id, $content, __( 'Click to edit', 'nimble-builder' ) );
28
  } else {
29
+ echo apply_filters( 'nimble_parse_for_smart_load', $content );
30
  }
31
  }
32
  }