Kirki - Version 3.0.16

Version Description

November 19 2017, dev time: 8 hours

  • Fix: typography controls not working when they are the only fields used #1627
  • Fix: slider controls were not updating the numeric value visually in their textfield when the control was not using postMessage #1633
  • Fix: Deprecated call to non-existing Kirki_Styles_Frontend, props @FrankM1 #1644
  • Fix: Updated the customizer-styling module for compatibility with WP 4.9 #1639
  • Fix: code controls were not using the corect priority #1622
  • Fix: Multiple reports of errors in the console.
  • New: Refactored the number controls #1631
  • New: Refactored the color controls. #1646
Download this release

Release Info

Developer aristath
Plugin Icon 128x128 Kirki
Version 3.0.16
Comparing to
See all releases

Code changes from version 3.0.15 to 3.0.16

controls/css/styles.css CHANGED
@@ -206,39 +206,20 @@
206
.customize-control-kirki-multicolor .multicolor-group-wrapper .wp-picker-container .wp-color-result .wp-color-result-text {
207
display: none !important; }
208
209
- .customize-control-kirki-number {
210
- position: relative; }
211
- .customize-control-kirki-number .ui-spinner.ui-widget-content {
212
- position: relative; }
213
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button {
214
- position: absolute;
215
- right: 0;
216
- color: rgba(0, 0, 0, 0.3);
217
- border: none;
218
- padding: 0 5px;
219
- width: 20px;
220
- height: calc(50% + 0.5em);
221
- border-radius: 0;
222
- box-shadow: none;
223
- background: transparent;
224
- background: none;
225
margin: 0; }
226
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button .ui-button-text {
227
- display: none; }
228
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button.ui-spinner-down:before, .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button.ui-spinner-up:before {
229
- font-family: dashicons;
230
- position: absolute;
231
- left: 0; }
232
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button.ui-spinner-up {
233
- top: -50%; }
234
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button.ui-spinner-up:before {
235
- content: "\f343"; }
236
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button.ui-spinner-down {
237
- top: 50%; }
238
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button.ui-spinner-down:before {
239
- content: "\f347"; }
240
- .customize-control-kirki-number .ui-spinner.ui-widget-content .ui-spinner-button:hover {
241
- color: rgba(0, 0, 0, 0.7); }
242
243
.customize-control-kirki-palette {
244
position: relative; }
@@ -282,8 +263,8 @@
282
display: flex;
283
flex-wrap: wrap; }
284
.customize-control-kirki-radio-buttonset .buttonset .switch-label {
285
- background: #fbfbfc;
286
- border: 1px solid #f3f4f5;
287
color: rgba(50, 55, 60, 0.5);
288
margin: 0;
289
text-align: center;
206
.customize-control-kirki-multicolor .multicolor-group-wrapper .wp-picker-container .wp-color-result .wp-color-result-text {
207
display: none !important; }
208
209
+ .customize-control-kirki-number .customize-control-content {
210
+ display: flex;
211
+ align-items: stretch; }
212
+ .customize-control-kirki-number .customize-control-content input {
213
+ width: 100%;
214
+ -moz-appearance: textfield; }
215
+ .customize-control-kirki-number .customize-control-content input::-webkit-inner-spin-button, .customize-control-kirki-number .customize-control-content input::-webkit-outer-spin-button {
216
+ -webkit-appearance: none;
217
margin: 0; }
218
+ .customize-control-kirki-number .customize-control-content .quantity {
219
+ min-width: 2rem;
220
+ max-width: 2rem;
221
+ text-align: center;
222
+ line-height: 24px; }
223
224
.customize-control-kirki-palette {
225
position: relative; }
263
display: flex;
264
flex-wrap: wrap; }
265
.customize-control-kirki-radio-buttonset .buttonset .switch-label {
266
+ background: rgba(0, 0, 0, 0.1);
267
+ border: 1px rgba(0, 0, 0, 0.1);
268
color: rgba(50, 55, 60, 0.5);
269
margin: 0;
270
text-align: center;
controls/js/dist/script-legacy.js CHANGED
@@ -208,7 +208,305 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
208
}
209
};
210
}
211
- ;/**
212
* The majority of the code in this file
213
* is derived from the wp-customize-posts plugin
214
* and the work of @westonruter to whom I am very grateful.
@@ -325,7 +623,7 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
325
wp.customize.Control.prototype.ready.call( control );
326
327
control.deferred.embedded.done( function() {
328
- control.initKirkiControl();
329
});
330
},
331
@@ -388,9 +686,17 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
388
wp.customize.Control.prototype.focus.call( control, args );
389
},
390
391
- initKirkiControl: function() {
392
-
393
- var control = this;
394
395
// Save the value
396
this.container.on( 'change keyup paste click', 'input', function() {
@@ -423,6 +729,10 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
423
}
424
});
425
})();
426
;/* global kirkiControlLoader */
427
wp.customize.controlConstructor['kirki-background'] = wp.customize.Control.extend({
428
@@ -627,38 +937,6 @@ wp.customize.controlConstructor['kirki-background'] = wp.customize.Control.exten
627
}
628
});
629
;wp.customize.controlConstructor['kirki-color-palette'] = wp.customize.kirkiDynamicControl.extend({});
630
- ;wp.customize.controlConstructor['kirki-color'] = wp.customize.kirkiDynamicControl.extend({
631
-
632
- initKirkiControl: function() {
633
- var control = this,
634
- picker = control.container.find( '.kirki-color-control' ),
635
- clear;
636
-
637
- // If we have defined any extra choices, make sure they are passed-on to Iris.
638
- if ( ! _.isUndefined( control.params.choices ) ) {
639
- picker.wpColorPicker( control.params.choices );
640
- }
641
-
642
- // Tweaks to make the "clear" buttons work.
643
- setTimeout( function() {
644
- clear = control.container.find( '.wp-picker-clear' );
645
- clear.click( function() {
646
- control.setting.set( '' );
647
- });
648
- }, 200 );
649
-
650
- // Saves our settings to the WP API
651
- picker.wpColorPicker({
652
- change: function() {
653
-
654
- // Small hack: the picker needs a small delay
655
- setTimeout( function() {
656
- control.setting.set( picker.val() );
657
- }, 20 );
658
- }
659
- });
660
- }
661
- });
662
;wp.customize.controlConstructor['kirki-dashicons'] = wp.customize.kirkiDynamicControl.extend({});
663
;wp.customize.controlConstructor['kirki-date'] = wp.customize.kirkiDynamicControl.extend({
664
@@ -1203,65 +1481,76 @@ wp.customize.controlConstructor['kirki-number'] = wp.customize.kirkiDynamicContr
1203
initKirkiControl: function() {
1204
1205
var control = this,
1206
- element = this.container.find( 'input' ),
1207
- step = 1;
1208
1209
- // Set step value.
1210
- if ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.step ) ) {
1211
- step = ( 'any' === control.params.choices.step ) ? '0.001' : control.params.choices.step;
1212
}
1213
1214
- // Init the spinner
1215
- jQuery( element ).spinner({
1216
- min: ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.min ) ) ? control.params.choices.min : -99999,
1217
- max: ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.max ) ) ? control.params.choices.max : 99999,
1218
- step: step
1219
- });
1220
1221
- // On change
1222
- this.container.on( 'change click keyup paste', 'input', function() {
1223
- control.setting.set( jQuery( this ).val() );
1224
- });
1225
1226
- // Notifications.
1227
- control.kirkiNotifications();
1228
- },
1229
1230
- /**
1231
- * Handles notifications.
1232
- */
1233
- kirkiNotifications: function() {
1234
1235
- var control = this;
1236
1237
- wp.customize( control.id, function( setting ) {
1238
- setting.bind( function( value ) {
1239
- var code = 'long_title',
1240
- min = ( ! _.isUndefined( control.params.choices.min ) ) ? Number( control.params.choices.min ) : false,
1241
- max = ( ! _.isUndefined( control.params.choices.max ) ) ? Number( control.params.choices.max ) : false,
1242
- step = ( ! _.isUndefined( control.params.choices.step ) ) ? Number( control.params.choices.step ) : false,
1243
- invalid = false;
1244
-
1245
- // Make sure value is a number.
1246
- value = Number( value );
1247
-
1248
- if ( false !== min && value < min ) {
1249
- invalid = 'min-error';
1250
- } else if ( false !== max && value > max ) {
1251
- invalid = 'max-error';
1252
- } else if ( false !== step && false !== min && ! Number.isInteger( ( value - min ) / step ) ) {
1253
- invalid = 'step-error';
1254
- }
1255
1256
- if ( false !== invalid ) {
1257
- setting.notifications.add( code, new wp.customize.Notification( code, {
1258
- type: 'warning',
1259
- message: numberKirkiL10n[ invalid ]
1260
- } ) );
1261
- } else {
1262
- setting.notifications.remove( code );
1263
- }
1264
- });
1265
});
1266
}
1267
});
@@ -2238,11 +2527,17 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({
2238
// Set the initial value in the text input.
2239
textInput.attr( 'value', value );
2240
2241
- // If the range input value changes,
2242
- // copy the value to the text input
2243
- // and then save.
2244
- rangeInput.on( changeAction, function() {
2245
textInput.attr( 'value', rangeInput.val() );
2246
control.setting.set( rangeInput.val() );
2247
} );
2248
208
}
209
};
210
}
211
+ ;var kirki = {
212
+
213
+ /**
214
+ * An object containing definitions for controls.
215
+ *
216
+ * @since 3.0.16
217
+ */
218
+ control: {
219
+
220
+ /**
221
+ * The color control.
222
+ *
223
+ * @since 3.0.16
224
+ */
225
+ 'kirki-color': {
226
+
227
+ /**
228
+ * Init the control.
229
+ *
230
+ * @since 3.0.16
231
+ * @param {object} [control] The customizer control object.
232
+ * @returns {void}
233
+ */
234
+ init: function( control ) {
235
+ var self = this;
236
+
237
+ // Render the template.
238
+ self.template( control );
239
+
240
+ // Init the control.
241
+ kirki.input.color.init( control );
242
+
243
+ },
244
+
245
+ /**
246
+ * Render the template.
247
+ *
248
+ * @since 3.0.16
249
+ * @param {object} [control] The customizer control object.
250
+ * @returns {void}
251
+ */
252
+ template: function( control ) {
253
+ control.container.html( kirki.input.color.getTemplate( {
254
+ label: control.params.label,
255
+ description: control.params.description,
256
+ 'data-id': control.id,
257
+ mode: control.params.mode,
258
+ inputAttrs: control.params.inputAttrs,
259
+ 'data-palette': control.params.palette,
260
+ 'data-default-color': control.params['default'],
261
+ 'data-alpha': control.params.choices.alpha,
262
+ value: control.setting._value
263
+ } ) );
264
+ }
265
+ }
266
+ },
267
+
268
+ /**
269
+ * An object containing definitions for input fields.
270
+ *
271
+ * @since 3.0.16
272
+ */
273
+ input: {
274
+
275
+ /**
276
+ * Color input fields.
277
+ *
278
+ * @since 3.0.16
279
+ */
280
+ color: {
281
+
282
+ /**
283
+ * Get the HTML for color inputs.
284
+ *
285
+ * @since 3.0.16
286
+ * @param {object} [data] The arguments.
287
+ * @returns {string}
288
+ */
289
+ getTemplate: function( data ) {
290
+
291
+ var html = '';
292
+
293
+ data = _.defaults( data, {
294
+ label: '',
295
+ description: '',
296
+ mode: 'full',
297
+ inputAttrs: '',
298
+ 'data-palette': data['data-palette'] ? data['data-palette'] : true,
299
+ 'data-default-color': data['data-default-color'] ? data['data-default-color'] : '',
300
+ 'data-alpha': data['data-alpha'] ? data['data-alpha'] : false,
301
+ value: '',
302
+ 'data-id': ''
303
+ } );
304
+
305
+ html += '<label>';
306
+ if ( data.label ) {
307
+ html += '<span class="customize-control-title">' + data.label + '</span>';
308
+ }
309
+ if ( data.description ) {
310
+ html += '<span class="description customize-control-description">' + data.description + '</span>';
311
+ }
312
+ html += '</label>';
313
+ html += '<input type="text" data-type="' + data.mode + '" ' + data.inputAttrs + ' data-palette="' + data['data-palette'] + '" data-default-color="' + data['data-default-color'] + '" data-alpha="' + data['data-alpha'] + '" value="' + data.value + '" class="kirki-color-control" data-id="' + data['data-id'] + '"/>';
314
+
315
+ return '<div class="kirki-input-container" data-id="' + data.id + '">' + html + '</div>';
316
+ },
317
+
318
+ /**
319
+ * Init the control.
320
+ *
321
+ * @since 3.0.16
322
+ * @param {object} [control] The control object.
323
+ * @returns {void}
324
+ */
325
+ init: function( control ) {
326
+ var picker = jQuery( '.kirki-color-control[data-id="' + control.id + '"]' ),
327
+ clear;
328
+
329
+ control.choices = control.choices || {};
330
+ if ( _.isEmpty( control.choices ) && control.params.choices ) {
331
+ control.choices = control.params.choices;
332
+ }
333
+
334
+ // If we have defined any extra choices, make sure they are passed-on to Iris.
335
+ if ( ! _.isEmpty( control.choices ) ) {
336
+ picker.wpColorPicker( control.choices );
337
+ }
338
+
339
+ // Tweaks to make the "clear" buttons work.
340
+ setTimeout( function() {
341
+ clear = jQuery( '.kirki-input-container[data-id="' + control.id + '"] .wp-picker-clear' );
342
+ if ( clear.length ) {
343
+ clear.click( function() {
344
+ control.setting.set( '' );
345
+ });
346
+ }
347
+ }, 200 );
348
+
349
+ // Saves our settings to the WP API
350
+ picker.wpColorPicker({
351
+ change: function() {
352
+
353
+ // Small hack: the picker needs a small delay
354
+ setTimeout( function() {
355
+ kirki.setting.set( control.id, picker.val() );
356
+ }, 20 );
357
+ }
358
+ });
359
+ }
360
+ }
361
+ },
362
+
363
+ /**
364
+ * An object containing definitions for settings.
365
+ *
366
+ * @since 3.0.16
367
+ */
368
+ setting: {
369
+
370
+ /**
371
+ * Gets the value of a setting.
372
+ *
373
+ * This is a helper function that allows us to get the value of
374
+ * control[key1][key2] for example, when the setting used in the
375
+ * customizer API is "control".
376
+ *
377
+ * @since 3.0.16
378
+ * @param {string} [setting] The setting for which we're getting the value.
379
+ * @returns {mixed} Depends on the value.
380
+ */
381
+ get: function( setting ) {
382
+ var parts = setting.split( '[' ),
383
+ foundSetting = '',
384
+ foundInStep = 0,
385
+ currentVal = '';
386
+
387
+ _.each( parts, function( part, i ) {
388
+ part = part.replace( ']', '' );
389
+
390
+ if ( 0 === i ) {
391
+ foundSetting = part;
392
+ } else {
393
+ foundSetting += '[' + part + ']';
394
+ }
395
+
396
+ if ( ! _.isUndefined( wp.customize.instance( foundSetting ) ) ) {
397
+ currentVal = wp.customize.instance( foundSetting ).get();
398
+ foundInStep = i;
399
+ }
400
+
401
+ if ( foundInStep < i ) {
402
+ if ( _.isObject( currentVal ) && ! _.isUndefined( currentVal[ part ] ) ) {
403
+ currentVal = currentVal[ part ];
404
+ }
405
+ }
406
+ });
407
+
408
+ return currentVal;
409
+ },
410
+
411
+ /**
412
+ * Sets the value of a setting.
413
+ *
414
+ * This function is a bit complicated because there any many scenarios to consider.
415
+ * Example: We want to save the value for my_setting[something][3][something-else].
416
+ * The control's setting is my_setting[something].
417
+ * So we need to find that first, then figure out the remaining parts,
418
+ * merge the values recursively to avoid destroying my_setting[something][2]
419
+ * and also take into account any defined "key" arguments which take this even deeper.
420
+ *
421
+ * @since 3.0.16
422
+ * @param {object|string} [element] The DOM element whose value has changed,
423
+ * or an ID.
424
+ * @param {mixed} [value] Depends on the control-type.
425
+ * @param {string} [key] If we only want to save an item in an object
426
+ * we can define the key here.
427
+ * @returns {void}
428
+ */
429
+ set: function( element, value, key ) {
430
+ var setting,
431
+ parts,
432
+ currentNode = '',
433
+ foundNode = '',
434
+ subSettingObj = {},
435
+ currentVal,
436
+ subSetting,
437
+ subSettingParts;
438
+
439
+ // Get the setting from the element.
440
+ setting = element;
441
+ if ( _.isObject( element ) ) {
442
+ if ( jQuery( element ).attr( 'data-id' ) ) {
443
+ setting = element.attr( 'data-id' );
444
+ } else {
445
+ setting = element.parents( '[data-id]' ).attr( 'data-id' );
446
+ }
447
+ }
448
+
449
+ parts = setting.split( '[' ),
450
+
451
+ // Find the setting we're using in the control using the customizer API.
452
+ _.each( parts, function( part, i ) {
453
+ part = part.replace( ']', '' );
454
+
455
+ // The current part of the setting.
456
+ currentNode = ( 0 === i ) ? part : '[' + part + ']';
457
+
458
+ // When we find the node, get the value from it.
459
+ // In case of an object we'll need to merge with current values.
460
+ if ( ! _.isUndefined( wp.customize.instance( currentNode ) ) ) {
461
+ foundNode = currentNode;
462
+ currentVal = wp.customize.instance( foundNode ).get();
463
+ }
464
+ } );
465
+
466
+ // Get the remaining part of the setting that was unused.
467
+ subSetting = setting.replace( foundNode, '' );
468
+
469
+ // If subSetting is not empty, then we're dealing with an object
470
+ // and we need to dig deeper and recursively merge the values.
471
+ if ( '' !== subSetting ) {
472
+ if ( ! _.isObject( currentVal ) ) {
473
+ currentVal = {};
474
+ }
475
+ if ( '[' === subSetting.charAt( 0 ) ) {
476
+ subSetting = subSetting.replace( '[', '' );
477
+ }
478
+ subSettingParts = subSetting.split( '[' );
479
+ _.each( subSettingParts, function( subSettingPart, i ) {
480
+ subSettingParts[ i ] = subSettingPart.replace( ']', '' );
481
+ } );
482
+
483
+ // If using a key, we need to go 1 level deeper.
484
+ if ( key ) {
485
+ subSettingParts.push( key );
486
+ }
487
+
488
+ // Converting to a JSON string and then parsing that to an object
489
+ // may seem a bit hacky and crude but it's efficient and works.
490
+ subSettingObj = '{"' + subSettingParts.join( '":{"' ) + '":"' + value + '"' + '}'.repeat( subSettingParts.length );
491
+ subSettingObj = JSON.parse( subSettingObj );
492
+
493
+ // Recursively merge with current value.
494
+ jQuery.extend( true, currentVal, subSettingObj );
495
+ value = currentVal;
496
+
497
+ } else {
498
+ if ( key ) {
499
+ currentVal = ( ! _.isObject( currentVal ) ) ? {} : currentVal;
500
+ currentVal[ key ] = value;
501
+ value = currentVal;
502
+ }
503
+ }
504
+ wp.customize.control( foundNode ).setting.set( value );
505
+ }
506
+ }
507
+ };
508
+ ;/* global kirki */
509
+ /**
510
* The majority of the code in this file
511
* is derived from the wp-customize-posts plugin
512
* and the work of @westonruter to whom I am very grateful.
623
wp.customize.Control.prototype.ready.call( control );
624
625
control.deferred.embedded.done( function() {
626
+ control.initKirkiControl( control );
627
});
628
},
629
686
wp.customize.Control.prototype.focus.call( control, args );
687
},
688
689
+ /**
690
+ * Additional actions that run on ready.
691
+ *
692
+ * @param {object} [args] Args.
693
+ * @returns {void}
694
+ */
695
+ initKirkiControl: function( control ) {
696
+ if ( 'undefined' !== typeof kirki.control[ control.params.type ] ) {
697
+ kirki.control[ control.params.type ].init( control );
698
+ return;
699
+ }
700
701
// Save the value
702
this.container.on( 'change keyup paste click', 'input', function() {
729
}
730
});
731
})();
732
+
733
+ _.each( kirki.control, function( obj, type ) {
734
+ wp.customize.controlConstructor[ type ] = wp.customize.kirkiDynamicControl.extend({});
735
+ } );
736
;/* global kirkiControlLoader */
737
wp.customize.controlConstructor['kirki-background'] = wp.customize.Control.extend({
738
937
}
938
});
939
;wp.customize.controlConstructor['kirki-color-palette'] = wp.customize.kirkiDynamicControl.extend({});
940
;wp.customize.controlConstructor['kirki-dashicons'] = wp.customize.kirkiDynamicControl.extend({});
941
;wp.customize.controlConstructor['kirki-date'] = wp.customize.kirkiDynamicControl.extend({
942
1481
initKirkiControl: function() {
1482
1483
var control = this,
1484
+ value = control.setting._value,
1485
+ html = '',
1486
+ input,
1487
+ up,
1488
+ down;
1489
+
1490
+ // Make sure we use default values if none are define for some arguments.
1491
+ control.params.choices = _.defaults( control.params.choices, {
1492
+ min: 0,
1493
+ max: 100,
1494
+ step: 1
1495
+ } );
1496
1497
+ // Make sure we have a valid value.
1498
+ if ( isNaN( value ) || '' === value ) {
1499
+ value = ( 0 > control.params.choices.min && 0 < control.params.choices.max ) ? 0 : control.params.choices.min;
1500
}
1501
+ value = parseFloat( value );
1502
1503
+ // If step is 'any', set to 0.001.
1504
+ control.params.choices.step = ( 'any' === control.params.choices.step ) ? 0.001 : control.params.choices.step;
1505
1506
+ // Make sure choices are properly formtted as numbers.
1507
+ control.params.choices.min = parseFloat( control.params.choices.min );
1508
+ control.params.choices.max = parseFloat( control.params.choices.max );
1509
+ control.params.choices.step = parseFloat( control.params.choices.step );
1510
1511
+ // Build the HTML for the control.
1512
+ html += '<label>';
1513
+ if ( control.params.label ) {
1514
+ html += '<span class="customize-control-title">' + control.params.label + '</span>';
1515
+ }
1516
+ if ( control.params.description ) {
1517
+ html += '<span class="description customize-control-description">' + control.params.description + '</span>';
1518
+ }
1519
+ html += '<div class="customize-control-content">';
1520
+ html += '<input ' + control.params.inputAttrs + ' type="text" ' + control.params.link + ' value="' + value + '" />';
1521
+ html += '<div class="quantity button minus">-</div>';
1522
+ html += '<div class="quantity button plus">+</div>';
1523
+ html += '</div>';
1524
+ html += '</label>';
1525
1526
+ control.container.html( html );
1527
1528
+ input = control.container.find( 'input' );
1529
+ up = control.container.find( '.plus' );
1530
+ down = control.container.find( '.minus' );
1531
1532
+ up.click( function() {
1533
+ var oldVal = parseFloat( input.val() ),
1534
+ newVal;
1535
1536
+ newVal = ( oldVal >= control.params.choices.max ) ? oldVal : oldVal + control.params.choices.step;
1537
+
1538
+ input.val( newVal );
1539
+ input.trigger( 'change' );
1540
+ } );
1541
+
1542
+ down.click( function() {
1543
+ var oldVal = parseFloat( input.val() ),
1544
+ newVal;
1545
+
1546
+ newVal = ( oldVal <= control.params.choices.min ) ? oldVal : oldVal - control.params.choices.step;
1547
+
1548
+ input.val( newVal );
1549
+ input.trigger( 'change' );
1550
+ } );
1551
+
1552
+ this.container.on( 'change keyup paste click', 'input', function() {
1553
+ control.setting.set( jQuery( this ).val() );
1554
});
1555
}
1556
});
2527
// Set the initial value in the text input.
2528
textInput.attr( 'value', value );
2529
2530
+ // If the range input value changes copy the value to the text input.
2531
+ rangeInput.on( 'mousemove change', function() {
2532
textInput.attr( 'value', rangeInput.val() );
2533
+ } );
2534
+
2535
+ // Save the value when the range input value changes.
2536
+ // This is separate from the above because of the postMessage differences.
2537
+ // If the control refreshes the preview pane,
2538
+ // we don't want a refresh for every change
2539
+ // but 1 final refresh when the value is changed.
2540
+ rangeInput.on( changeAction, function() {
2541
control.setting.set( rangeInput.val() );
2542
} );
2543
controls/js/dist/script-legacy.min.js CHANGED
@@ -1 +1 @@
1
- if(_.isUndefined(window.kirkiSetSettingValue))var kirkiSetSettingValue={set:function(e,t){var i,n=this,r=wp.customize.settings.controls[e];if(_.isUndefined(r))return!0;switch(n.setValue(e,t),r.type){case"kirki-background":_.isUndefined(t["background-color"])||n.setColorPicker(n.findElement(e,".kirki-color-control"),t["background-color"]),n.findElement(e,".placeholder, .thumbnail").removeClass().addClass("placeholder").html("No file selected"),_.each(["background-repeat","background-position"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["background-size","background-attachment"],function(i){jQuery(n.findElement(e,"."+i+' input[value="'+t+'"]')).prop("checked",!0)}),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".background-hidden-value").attr("value",i)).trigger("change");break;case"kirki-code":jQuery(n.findElement(e,".CodeMirror"))[0].CodeMirror.setValue(t);break;case"checkbox":case"kirki-switch":case"kirki-toggle":t=1===t||"1"===t||!0===t,jQuery(n.findElement(e,"input")).prop("checked",t),wp.customize.instance(e).set(t);break;case"kirki-select":case"kirki-preset":case"kirki-fontawesome":n.setSelectWoo(n.findElement(e,"select"),t);break;case"kirki-slider":jQuery(n.findElement(e,"input")).prop("value",t),jQuery(n.findElement(e,".kirki_range_value .value")).html(t);break;case"kirki-generic":(_.isUndefined(r.choices)||_.isUndefined(r.choices.element))&&(r.choices.element="input"),jQuery(n.findElement(e,r.choices.element)).prop("value",t);break;case"kirki-color":n.setColorPicker(n.findElement(e,".kirki-color-control"),t);break;case"kirki-multicheck":n.findElement(e,"input").each(function(){jQuery(this).prop("checked",!1)}),_.each(t,function(i,r){jQuery(n.findElement(e,'input[value="'+t[r]+'"]')).prop("checked",!0)});break;case"kirki-multicolor":_.each(t,function(t,i){n.setColorPicker(n.findElement(e,".multicolor-index-"+i),t)});break;case"kirki-radio-buttonset":case"kirki-radio-image":case"kirki-radio":case"kirki-dashicons":case"kirki-color-palette":case"kirki-palette":jQuery(n.findElement(e,'input[value="'+t+'"]')).prop("checked",!0);break;case"kirki-typography":_.each(["font-family","variant","subsets"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["font-size","line-height","letter-spacing","word-spacing"],function(i){_.isUndefined(t[i])||jQuery(n.findElement(e,"."+i+" input")).prop("value",t[i])}),_.isUndefined(t.color)||n.setColorPicker(n.findElement(e,".kirki-color-control"),t.color),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".typography-hidden-value").attr("value",i)).trigger("change");break;case"kirki-dimensions":_.each(t,function(t,i){jQuery(n.findElement(e,"."+i+" input")).prop("value",t)});break;case"kirki-repeater":case"kirki-custom":break;default:jQuery(n.findElement(e,"input")).prop("value",t)}},setColorPicker:function(e,t){e.attr("data-default-color",t).data("default-color",t).wpColorPicker("color",t)},setSelectWoo:function(e,t){jQuery(e).selectWoo().val(t).trigger("change")},setTextarea:function(e,t){jQuery(e).prop("value",t)},findElement:function(e,t){return wp.customize.control(e).container.find(t)},setValue:function(e,t,i){i=_.isUndefined(i)?100:parseInt(i,10),wp.customize.instance(e).set({}),setTimeout(function(){wp.customize.instance(e).set(t)},i)}};!function(){"use strict";wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(e,t){var i=this,n=t||{};n.params=n.params||{},n.params.type||(n.params.type="kirki-generic"),n.params.content||(n.params.content=jQuery("<li></li>"),n.params.content.attr("id","customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-")),n.params.content.attr("class","customize-control customize-control-"+n.params.type)),i.propertyElements=[],wp.customize.Control.prototype.initialize.call(i,e,n)},_setUpSettingRootLinks:function(){var e=this;e.container.find("[data-customize-setting-link]").each(function(){var t=jQuery(this);wp.customize(t.data("customizeSettingLink"),function(i){var n=new wp.customize.Element(t);e.elements.push(n),n.sync(i),n.set(i())})})},_setUpSettingPropertyLinks:function(){var e=this;e.setting&&e.container.find("[data-customize-setting-property-link]").each(function(){var t,i=jQuery(this),n=i.data("customizeSettingPropertyLink");t=new wp.customize.Element(i),e.propertyElements.push(t),t.set(e.setting()[n]),t.bind(function(t){var i=e.setting();t!==i[n]&&((i=_.clone(i))[n]=t,e.setting.set(i))}),e.setting.bind(function(e){e[n]!==t.get()&&t.set(e[n])})})},ready:function(){var e=this;e._setUpSettingRootLinks(),e._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(e),e.deferred.embedded.done(function(){e.initKirkiControl()})},embed:function(){var e=this,t=e.section();t&&wp.customize.section(t,function(t){"kirki-expanded"===t.params.type||t.expanded()||wp.customize.settings.autofocus.control===e.id?e.actuallyEmbed():t.expanded.bind(function(t){t&&e.actuallyEmbed()})})},actuallyEmbed:function(){var e=this;"resolved"!==e.deferred.embedded.state()&&(e.renderContent(),e.deferred.embedded.resolve())},focus:function(e){var t=this;t.actuallyEmbed(),wp.customize.Control.prototype.focus.call(t,e)},initKirkiControl:function(){var e=this;this.container.on("change keyup paste click","input",function(){e.setting.set(jQuery(this).val())})},kirkiValidateCSSValue:function(e){var t,i,n=["rem","em","ex","%","px","cm","mm","in","pt","pc","ch","vh","vw","vmin","vmax"];return"0"===e||0<=e.indexOf("calc(")&&0<=e.indexOf(")")||(t=parseFloat(e),i=e.replace(t,""),!isNaN(t)&&-1!==jQuery.inArray(i,n))}})}(),wp.customize.controlConstructor["kirki-background"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.getValue(),i=e.container.find(".kirki-color-control");(_.isUndefined(t["background-image"])||""===t["background-image"])&&(e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide()),i.wpColorPicker({change:function(){setTimeout(function(){e.saveValue("background-color",i.val())},100)}}),e.container.on("change",".background-repeat select",function(){e.saveValue("background-repeat",jQuery(this).val())}),e.container.on("change click",".background-size input",function(){e.saveValue("background-size",jQuery(this).val())}),e.container.on("change",".background-position select",function(){e.saveValue("background-position",jQuery(this).val())}),e.container.on("change click",".background-attachment input",function(){e.saveValue("background-attachment",jQuery(this).val())}),e.container.on("click",".background-image-upload-button",function(t){var i=wp.media({multiple:!1}).open().on("select",function(){var t,n,r,a=i.state().get("selection").first(),o=a.toJSON().sizes.full.url;_.isUndefined(a.toJSON().sizes.medium)?_.isUndefined(a.toJSON().sizes.thumbnail)||(o=a.toJSON().sizes.thumbnail.url):o=a.toJSON().sizes.medium.url,t=a.toJSON().sizes.full.url,a.toJSON().id,a.toJSON().width,a.toJSON().height,""!==t&&e.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),e.saveValue("background-image",t),n=e.container.find(".placeholder, .thumbnail"),r=e.container.find(".background-image-upload-remove-button"),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+o+'" alt="" />'),r.length&&r.show()});t.preventDefault()}),e.container.on("click",".background-image-upload-remove-button",function(t){var i,n;t.preventDefault(),e.saveValue("background-image",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".background-image-upload-remove-button"),e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide(),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&n.hide()})},getValue:function(){var e=this,t={};return _.each(e.params.default,function(i,n){!1!==i&&(t[n]=i,_.isUndefined(e.setting._value[n])||(t[n]=e.setting._value[n]))}),_.each(e.setting._value,function(e,i){_.isUndefined(t[i])&&(t[i]=e)}),t},saveValue:function(e,t){"use strict";var i=this,n=jQuery("#customize-control-"+i.id.replace("[","-").replace("]","")+" .background-hidden-value"),r=jQuery(n).val(),a=JSON.parse(r);a[e]=t,i.setting.set(a),jQuery(n).attr("value",JSON.stringify(a)).trigger("change")}}),wp.customize.controlConstructor["kirki-code"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.CodeEditorControl)||(jQuery(e.container.find("textarea.kirki-codemirror-editor")).hide(),wp.customize.control.add(new wp.customize.CodeEditorControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,editor_settings:{codemirror:{mode:e.params.choices.language}},settings:{default:e.id}})))}}),wp.customize.controlConstructor["kirki-color-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-color"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.container.find(".kirki-color-control");_.isUndefined(t.params.choices)||i.wpColorPicker(t.params.choices),setTimeout(function(){(e=t.container.find(".wp-picker-clear")).click(function(){t.setting.set("")})},200),i.wpColorPicker({change:function(){setTimeout(function(){t.setting.set(i.val())},20)}})}}),wp.customize.controlConstructor["kirki-dashicons"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-date"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.DateTimeControl)||wp.customize.control.add(new wp.customize.DateTimeControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,description:e.params.description,settings:{default:e.id},default:e.params.default}))}}),wp.customize.controlConstructor["kirki-dimension"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;t.kirkiNotifications(),this.container.on("change keyup paste","input",function(){e=jQuery(this).val(),t.setting.set(e)})},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n="long_title";!1===e.kirkiValidateCSSValue(i)?t.notifications.add(n,new wp.customize.Notification(n,{type:"warning",message:dimensionkirkiL10n["invalid-value"]})):t.notifications.remove(n)})})}}),wp.customize.controlConstructor["kirki-dimensions"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.params.choices.controls,n={},r=[];for(_.each(i,function(e,t){!0===e&&r.push(t)}),e=0;e<r.length;e++)n[r[e]]=t.setting._value[r[e]],t.updateDimensionsValue(r[e],n)},updateDimensionsValue:function(e,t){var i=this;i.container.on("change keyup paste","."+e+" input",function(){t[e]=jQuery(this).val(),i.kirkiNotifications(),i.saveValue(t)})},saveValue:function(e){var t=this,i={};_.each(e,function(e,t){i[t]=e}),t.setting.set(i)},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n,r="long_title",a={};t.notifications.remove(r),_.each(["top","bottom","left","right"],function(t){_.isUndefined(i[t])||(!1===e.kirkiValidateCSSValue(i[t])?a[t]=dimensionskirkiL10n[t]:delete a[t])}),_.isEmpty(a)?t.notifications.remove(r):(n=dimensionskirkiL10n["invalid-value"]+" ("+_.values(a).toString()+") ",t.notifications.add(r,new wp.customize.Notification(r,{type:"warning",message:n})))})})}}),wp.customize.controlConstructor["kirki-editor"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.container.find("textarea"),n="kirki-editor-"+t.id.replace("[","").replace("]","");wp.editor.initialize(n,{tinymce:{wpautop:!0},quicktags:!0,mediaButtons:!0}),(e=tinyMCE.get(n))&&e.onChange.add(function(n){var r;n.save(),r=e.getContent(),i.val(r).trigger("change"),wp.customize.instance(t.id).set(r)})}}),wp.customize.controlConstructor["kirki-fontawesome"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t,i=this,n=this.container.find("select"),r=jQuery.parseJSON(fontAwesomeJSON),a={data:[],escapeMarkup:function(e){return e},templateResult:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text},templateSelection:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text}};_.each(r.icons,function(e){a.data.push({id:e.id,text:e.name})}),(t=jQuery(n).selectWoo(a)).on("change",function(){e=jQuery(this).val(),i.setting.set(e)}),t.val(i.setting._value).trigger("change")}}),wp.customize.controlConstructor["kirki-generic"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-image"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.getValue(),i=_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as,n=e.container.find(".placeholder, .thumbnail"),r="array"===i?t.url:t,a=e.container.find(".image-upload-remove-button"),o=e.container.find(".image-default-button");e.container.find(".kirki-controls-loading-spinner").hide(),"id"!==i&&"ID"!==i||""===t||wp.media.attachment(t).fetch().then(function(e){setTimeout(function(){var e=wp.media.attachment(t).get("url");n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e+'" alt="" />')},700)}),("url"===i&&""!==t||"array"===i&&!_.isUndefined(t.url)&&""!==t.url)&&e.container.find("image-default-button").hide(),("url"===i&&""===t||"array"===i&&(_.isUndefined(t.url)||""===t.url))&&a.hide(),t===e.params.default&&e.container.find("image-default-button").hide(),""!==r&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+r+'" alt="" />'),e.container.on("click",".image-upload-button",function(t){var r=wp.media({multiple:!1}).open().on("select",function(){var t=r.state().get("selection").first(),s=t.toJSON().sizes.full.url;_.isUndefined(t.toJSON().sizes.medium)?_.isUndefined(t.toJSON().sizes.thumbnail)||(s=t.toJSON().sizes.thumbnail.url):s=t.toJSON().sizes.medium.url,"array"===i?(e.saveValue("id",t.toJSON().id),e.saveValue("url",t.toJSON().sizes.full.url),e.saveValue("width",t.toJSON().width),e.saveValue("height",t.toJSON().height)):"id"===i?e.saveValue("id",t.toJSON().id):e.saveValue("url",t.toJSON().sizes.full.url),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+s+'" alt="" />'),a.length&&(a.show(),o.hide())});t.preventDefault()}),e.container.on("click",".image-upload-remove-button",function(t){var i,n,r;t.preventDefault(),e.saveValue("id",""),e.saveValue("url",""),e.saveValue("width",""),e.saveValue("height",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),r=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&(n.hide(),jQuery(r).hasClass("button")&&r.show())}),e.container.on("click",".image-default-button",function(t){var i,n,r;t.preventDefault(),e.saveValue("url",e.params.default),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),r=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e.params.default+'" alt="" />'),n.length&&(n.show(),r.hide())})},getValue:function(){var e=this,t=e.setting._value;return"array"===(_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as)&&_.isString(t)&&(t={url:t}),t},saveValue:function(e,t){var i=this,n=i.setting._value;if("array"===(_.isUndefined(i.params.choices)||_.isUndefined(i.params.choices.save_as)?"url":i.params.choices.save_as))return _.isString(n)&&(n={}),n[e]=t,i.setting.set(n),void i.container.find("button").trigger("change");i.setting.set(t),i.container.find("button").trigger("change")}}),wp.customize.controlConstructor["kirki-multicheck"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;e.container.on("change","input",function(){var t=[],i=0;jQuery.each(e.params.choices,function(n){e.container.find('input[value="'+n+'"]').is(":checked")&&(t[i]=n,i++)}),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-multicolor"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";for(var e,t,i=this,n=i.params.choices,r=Object.keys(n),a=(this.params.value,i.container.find(".iris-target")),o=0;o<Object.keys(n).length;)!function(e,t,i){var r=e.container.find(".multicolor-index-"+i),o={target:a[0],change:function(){setTimeout(function(){e.saveValue(i,r.val()),e.container.find(".multicolor-index-"+i).trigger("change")},100)}};_.isObject(n.irisArgs)&&_.each(n.irisArgs,function(e,t){o[t]=e}),r.wpColorPicker(o)}(this,0,r[o]),e=i.container.find(".wp-picker-container .wp-picker-input-wrap"),t=i.container.find(".wp-picker-container .wp-picker-holder"),jQuery(e[0]).detach().appendTo(a[0]),jQuery(t[0]).detach().appendTo(a[0]),o++},saveValue:function(e,t){"use strict";var i=this,n=i.container.find(".multicolor-hidden-value"),r=jQuery(n).val(),a=JSON.parse(r);a[e]=t,jQuery(n).attr("value",JSON.stringify(a)).trigger("change"),i.setting.set(a)}}),wp.customize.controlConstructor["kirki-number"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=this.container.find("input"),i=1;_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.step)||(i="any"===e.params.choices.step?"0.001":e.params.choices.step),jQuery(t).spinner({min:_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.min)?-99999:e.params.choices.min,max:_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.max)?99999:e.params.choices.max,step:i}),this.container.on("change click keyup paste","input",function(){e.setting.set(jQuery(this).val())}),e.kirkiNotifications()},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n="long_title",r=!_.isUndefined(e.params.choices.min)&&Number(e.params.choices.min),a=!_.isUndefined(e.params.choices.max)&&Number(e.params.choices.max),o=!_.isUndefined(e.params.choices.step)&&Number(e.params.choices.step),s=!1;i=Number(i),!1!==r&&i<r?s="min-error":!1!==a&&i>a?s="max-error":!1===o||!1===r||Number.isInteger((i-r)/o)||(s="step-error"),!1!==s?t.notifications.add(n,new wp.customize.Notification(n,{type:"warning",message:numberKirkiL10n[s]})):t.notifications.remove(n)})})}}),wp.customize.controlConstructor["kirki-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-preset"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;this.container.on("change","select",function(){e=jQuery(this).val(),t.setting.set(e),jQuery.each(t.params.choices,function(t,i){e===t&&jQuery.each(i.settings,function(e,t){kirkiSetSettingValue.set(e,t)})}),wp.customize.previewer.refresh()})}}),wp.customize.controlConstructor["kirki-radio-buttonset"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio-image"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio"]=wp.customize.kirkiDynamicControl.extend({});var RepeaterRow=function(e,t,i,n){"use strict";var r=this;this.rowIndex=e,this.container=t,this.label=i,this.header=this.container.find(".repeater-row-header"),this.header.on("click",function(){r.toggleMinimize()}),this.container.on("click",".repeater-row-remove",function(){r.remove()}),this.header.on("mousedown",function(){r.container.trigger("row:start-dragging")}),this.container.on("keyup change","input, select, textarea",function(e){r.container.trigger("row:update",[r.rowIndex,jQuery(e.target).data("field"),e.target])}),this.setRowIndex=function(e){this.rowIndex=e,this.container.attr("data-row",e),this.container.data("row",e),this.updateLabel()},this.toggleMinimize=function(){this.container.toggleClass("minimized"),this.header.find(".dashicons").toggleClass("dashicons-arrow-up").toggleClass("dashicons-arrow-down")},this.remove=function(){this.container.slideUp(300,function(){jQuery(this).detach()}),this.container.trigger("row:remove",[this.rowIndex])},this.updateLabel=function(){var e,t,i;if("field"===this.label.type&&(e=this.container.find('.repeater-field [data-field="'+this.label.field+'"]'),_.isFunction(e.val)&&""!==(t=e.val())))return _.isUndefined(n.params.fields[this.label.field])||_.isUndefined(n.params.fields[this.label.field].type)||("select"===n.params.fields[this.label.field].type?_.isUndefined(n.params.fields[this.label.field].choices)||_.isUndefined(n.params.fields[this.label.field].choices[e.val()])||(t=n.params.fields[this.label.field].choices[e.val()]):"radio"!==n.params.fields[this.label.field].type&&"radio-image"!==n.params.fields[this.label.field].type||(i=n.selector+' [data-row="'+this.rowIndex+'"] .repeater-field [data-field="'+this.label.field+'"]:checked',t=jQuery(i).val())),void this.header.find(".repeater-row-label").text(t);this.header.find(".repeater-row-label").text(this.label.value+" "+(this.rowIndex+1))},this.updateLabel()};wp.customize.controlConstructor.repeater=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t,i=this,n=this.params.value;i.container.find(".kirki-controls-loading-spinner").hide(),this.settingField=this.container.find("[data-customize-setting-link]").first(),this.setValue([],!1),this.repeaterFieldsContainer=this.container.find(".repeater-fields").first(),this.currentIndex=0,this.rows=[],e=!1,_.isUndefined(this.params.choices.limit)||(e=!(0>=this.params.choices.limit)&&parseInt(this.params.choices.limit,10)),this.container.on("click","button.repeater-add",function(n){n.preventDefault(),!e||i.currentIndex<e?((t=i.addRow()).toggleMinimize(),i.initColorPicker(),i.initSelect(t)):jQuery(i.selector+" .limit").addClass("highlight")}),this.container.on("click",".repeater-row-remove",function(){i.currentIndex--,(!e||i.currentIndex<e)&&jQuery(i.selector+" .limit").removeClass("highlight")}),this.container.on("click keypress",".repeater-field-image .upload-button,.repeater-field-cropped_image .upload-button,.repeater-field-upload .upload-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.openFrame(e)}),this.container.on("click keypress",".repeater-field-image .remove-button,.repeater-field-cropped_image .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeImage(e)}),this.container.on("click keypress",".repeater-field-upload .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeFile(e)}),this.repeaterTemplate=_.memoize(function(){var e,t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(n){return(e=_.template(i.container.find(".customize-control-repeater-content").first().html(),null,t))(n)}}),n.length&&_.each(n,function(e){t=i.addRow(e),i.initColorPicker(),i.initSelect(t,e)}),this.setValue(n,!0,!0),this.repeaterFieldsContainer.sortable({handle:".repeater-row-header",update:function(){i.sort()}})},openFrame:function(e){"use strict";wp.customize.utils.isKeydownButNotEnterEvent(e)||(this.$thisButton.closest(".repeater-field").hasClass("repeater-field-cropped_image")?this.initCropperFrame():this.initFrame(),this.frame.open())},initFrame:function(){"use strict";var e=this.getMimeType();this.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1})]}),this.frame.on("select",this.onSelect,this)},initCropperFrame:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field"),t=["width","height","flex_width","flex_height"],i=this.getMimeType();_.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"cropped_image"===this.params.fields[e].type&&t.forEach(function(t){_.isUndefined(this.params.fields[e][t])||(this.params[t]=this.params.fields[e][t])}.bind(this)),this.frame=wp.media({button:{text:"Select and Crop",close:!1},states:[new wp.media.controller.Library({library:wp.media.query({type:i}),multiple:!1,date:!1,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelectForCrop,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.$thisButton.closest(".repeater-field").hasClass("repeater-field-upload")?this.setFileInRepeaterField(e):this.setImageInRepeaterField(e)},onSelectForCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):this.setImageInRepeaterField(e)},onCropped:function(e){"use strict";this.setImageInRepeaterField(e)},calculateImageSelectOptions:function(e,t){"use strict";var i,n,r,a=t.get("control"),o=!!parseInt(a.params.flex_width,10),s=!!parseInt(a.params.flex_height,10),c=e.get("width"),l=e.get("height"),u=parseInt(a.params.width,10),d=parseInt(a.params.height,10),p=u/d,h=c,f=l;return t.set("canSkipCrop",!a.mustBeCropped(o,s,u,d,c,l)),h/f>p?u=(d=f)*p:d=(u=h)/p,i=(h-u)/2,n=(f-d)/2,r={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:c,imageHeight:l,x1:i,y1:n,x2:u+i,y2:d+n},!1===s&&!1===o&&(r.aspectRatio=u+":"+d),!1===s&&(r.maxHeight=d),!1===o&&(r.maxWidth=u),r},mustBeCropped:function(e,t,i,n,r,a){"use strict";return!(!0===e&&!0===t||!0===e&&n===a||!0===t&&i===r||i===r&&n===a||r<=i)},onSkippedCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.setImageInRepeaterField(e)},setImageInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image");t.find(".kirki-image-attachment").html('<img src="'+e.url+'">').hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},setFileInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-upload");t.find(".kirki-file-attachment").html('<span class="file"><span class="dashicons dashicons-media-default"></span> '+e.filename+"</span>").hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".upload-button").show(),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},getMimeType:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field");return _.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"upload"===this.params.fields[e].type&&!_.isUndefined(this.params.fields[e].mime_type)?this.params.fields[e].mime_type:"image"},removeImage:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload")).find(".upload-button"),t.find(".kirki-image-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},removeFile:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-upload")).find(".upload-button"),t.find(".kirki-file-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},getValue:function(){"use strict";return JSON.parse(decodeURI(this.setting.get()))},setValue:function(e,t,i){"use strict";var n=e,r=[];i&&(jQuery.each(this.params.fields,function(e,t){"image"!==t.type&&"cropped_image"!==t.type&&"upload"!==t.type||r.push(e)}),jQuery.each(e,function(e,t){jQuery.each(r,function(i,r){_.isUndefined(t[r])||_.isUndefined(t[r].id)||(n[e][r]=t[r].id)})})),this.setting.set(encodeURI(JSON.stringify(n))),t&&this.settingField.trigger("change")},addRow:function(e){"use strict";var t,i,n,r=this,a=r.repeaterTemplate(),o=this.getValue(),s={};if(a){if(t=jQuery.extend(!0,{},r.params.fields),e)for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(t[n].default=e[n]);t.index=this.currentIndex,a=a(t),(i=new RepeaterRow(r.currentIndex,jQuery(a).appendTo(r.repeaterFieldsContainer),r.params.row_label,r)).container.on("row:remove",function(e,t){r.deleteRow(t)}),i.container.on("row:update",function(e,t,n,a){r.updateField.call(r,e,t,n,a),i.updateLabel()}),this.rows[this.currentIndex]=i;for(n in t)t.hasOwnProperty(n)&&(s[n]=t[n].default);return o[this.currentIndex]=s,this.setValue(o,!0),this.currentIndex++,i}},sort:function(){"use strict";var e=this,t=this.repeaterFieldsContainer.find(".repeater-row"),i=[],n=e.getValue(),r=[],a=[];t.each(function(e,t){i.push(jQuery(t).data("row"))}),jQuery.each(i,function(t,i){r[t]=e.rows[i],r[t].setRowIndex(t),a[t]=n[i]}),e.rows=r,e.setValue(a)},deleteRow:function(e){"use strict";var t,i=this.getValue();i[e]&&this.rows[e]&&(delete i[e],delete this.rows[e],this.setValue(i,!0));for(t in this.rows)this.rows.hasOwnProperty(t)&&this.rows[t]&&(this.rows[t].updateLabel(),0)},updateField:function(e,t,i,n){"use strict";var r,a,o;this.rows[t]&&this.params.fields[i]&&(r=this.params.fields[i].type,a=this.rows[t],o=this.getValue(),n=jQuery(n),_.isUndefined(o[a.rowIndex][i])||(o[a.rowIndex][i]="checkbox"===r?n.is(":checked"):n.val(),this.setValue(o,!0)))},initColorPicker:function(){"use strict";var e=this,t=e.container.find(".color-picker-hex"),i={},n=t.data("field");_.isUndefined(n)||_.isUndefined(e.params.fields[n])||_.isUndefined(e.params.fields[n].palettes)||!_.isObject(e.params.fields[n].palettes)||(i.palettes=e.params.fields[n].palettes),i.change=function(t,i){var n=jQuery(t.target),r=n.closest(".repeater-row").data("row"),a=e.getValue();a[r][n.data("field")]=i.color.toString(),e.setValue(a,!0)},0!==t.length&&t.wpColorPicker(i)},initSelect:function(e,t){"use strict";var i,n,r=this,a=e.container.find(".repeater-field select"),o={};0!==a.length&&(i=a.data("field"),"undefed"!==(n=jQuery(a).data("multiple"))&&jQuery.isNumeric(n)&&1<(n=parseInt(n,10))&&(o.maximumSelectionLength=n),jQuery(a).selectWoo(o).val(t[i]),this.container.on("change",".repeater-field select",function(e){var t=jQuery(e.target),i=t.closest(".repeater-row").data("row"),n=r.getValue();n[i][t.data("field")]=jQuery(this).val(),r.setValue(n)}))}}),wp.customize.controlConstructor["kirki-select"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=this.container.find("select"),n=parseInt(i.data("multiple"),10),r={escapeMarkup:function(e){return e}};1<n&&(r.maximumSelectionLength=n),jQuery(i).selectWoo(r).on("change",function(){e=jQuery(this).val(),t.setting.set(e)})}}),wp.customize.controlConstructor["kirki-slider"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t="postMessage"===e.setting.transport?"mousemove change":"change",i=e.container.find('input[type="range"]'),n=e.container.find('input[type="text"]'),r=e.setting._value;n.attr("value",r),i.on(t,function(){n.attr("value",i.val()),e.setting.set(i.val())}),n.on("input paste change",function(){i.attr("value",n.val()),e.setting.set(n.val())}),e.container.find(".slider-reset").on("click",function(){n.attr("value",e.params.default),i.attr("value",e.params.default),e.setting.set(n.val())})}}),wp.customize.controlConstructor["kirki-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e=this;e.container.find(".kirki-controls-loading-spinner").hide(),e.sortableContainer=e.container.find("ul.sortable").first(),e.sortableContainer.sortable({stop:function(){e.updateValue()}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.updateValue()})},updateValue:function(){"use strict";var e=this,t=[];this.sortableContainer.find("li").each(function(){jQuery(this).is(".invisible")||t.push(jQuery(this).data("value"))}),e.setting.set(t)}}),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e=this,t=e.setting._value,i=jQuery(e.container.find(".switch-on")),n=jQuery(e.container.find(".switch-off"));jQuery(e.container.find(".switch label ")).css("width",i.width()+n.width()+40+"px"),jQuery("#customize-control-"+e.id.replace("[","-").replace("]","")).append("<style>#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch label:after{width:"+(i.width()+13)+"px;}#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch input:checked + label:after{left:"+(i.width()+22)+"px;width:"+(n.width()+13)+"px;}</style>"),this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-typography"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t=this,i=t.getValue();t.renderFontSelector(),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector(),t.params.default["font-size"]&&this.container.on("change keyup paste",".font-size input",function(){t.saveValue("font-size",jQuery(this).val())}),t.params.default["line-height"]&&this.container.on("change keyup paste",".line-height input",function(){t.saveValue("line-height",jQuery(this).val())}),t.params.default["margin-top"]&&this.container.on("change keyup paste",".margin-top input",function(){t.saveValue("margin-top",jQuery(this).val())}),t.params.default["margin-bottom"]&&this.container.on("change keyup paste",".margin-bottom input",function(){t.saveValue("margin-bottom",jQuery(this).val())}),t.params.default["letter-spacing"]&&(i["letter-spacing"]=jQuery.isNumeric(i["letter-spacing"])?i["letter-spacing"]+"px":i["letter-spacing"],this.container.on("change keyup paste",".letter-spacing input",function(){i["letter-spacing"]=jQuery.isNumeric(jQuery(this).val())?jQuery(this).val()+"px":jQuery(this).val(),t.saveValue("letter-spacing",i["letter-spacing"])})),t.params.default["word-spacing"]&&this.container.on("change keyup paste",".word-spacing input",function(){t.saveValue("word-spacing",jQuery(this).val())}),t.params.default["text-align"]&&this.container.on("change",".text-align input",function(){t.saveValue("text-align",jQuery(this).val())}),t.params.default["text-transform"]&&jQuery(t.selector+" .text-transform select").selectWoo().on("change",function(){t.saveValue("text-transform",jQuery(this).val())}),t.params.default.color&&(e=this.container.find(".kirki-color-control")).wpColorPicker({change:function(){setTimeout(function(){t.saveValue("color",e.val())},100)}})},renderFontSelector:function(){var e,t=this,i=t.selector+" .font-family select",n=[],r=[],a=[],o=t.getValue(),s=t.getFonts();_.isUndefined(s.standard)||_.each(s.standard,function(e){r.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),_.isUndefined(s.standard)||_.each(s.google,function(e){a.push({id:e.family,text:e.label})}),n=[{text:"Standard Fonts",children:r},{text:"Google Fonts",children:a}],e=jQuery(i).selectWoo({data:n}),o["font-family"]&&e.val(o["font-family"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-family",jQuery(this).val()),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector()})},renderBackupFontSelector:function(){var e,t=this,i=t.selector+" .font-backup select",n=[],r=t.getValue(),a=r["font-family"],o=t.getVariants(a),s=t.getFonts();(_.isUndefined(r["font-backup"])||null===r["font-backup"])&&(r["font-backup"]=""),!1!==o?jQuery(t.selector+" .font-backup").show():jQuery(t.selector+" .font-backup").hide(),_.isUndefined(s.standard)||_.each(s.standard,function(e){n.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),e=jQuery(i).selectWoo({data:n}),void 0!==r["font-backup"]&&e.val(r["font-backup"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-backup",jQuery(this).val())})},renderVariantSelector:function(){var e,t,i,n=this,r=n.getValue(),a=r["font-family"],o=n.getVariants(a),s=n.selector+" .variant select",c=[],l=!1;!1!==o?(jQuery(n.selector+" .variant").show(),_.each(o,function(e){r.variant===e.id&&(l=!0),c.push({id:e.id,text:e.label})}),l||(r.variant="regular"),jQuery(s).hasClass("select2-hidden-accessible")&&(jQuery(s).selectWoo("destroy"),jQuery(s).empty()),(t=jQuery(s).selectWoo({data:c})).val(r.variant).trigger("change"),t.on("change",function(){n.saveValue("variant",jQuery(this).val()),e=_.isString(r.variant)?r.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",i=-1!==r.variant.indexOf("italic")?"italic":"normal",n.saveValue("font-weight",e),n.saveValue("font-style",i)})):jQuery(n.selector+" .variant").hide()},renderSubsetSelector:function(){var e,t=this,i=t.getValue(),n=i["font-family"],r=t.getSubsets(n),a=t.selector+" .subsets select",o=[],s=i.subsets;!1!==r?(jQuery(t.selector+" .subsets").show(),_.each(r,function(e){_.isObject(s)&&-1===s.indexOf(e.id)&&(s=_.reject(s,function(t){return t===e.id})),o.push({id:e.id,text:e.label})})):jQuery(t.selector+" .subsets").hide(),jQuery(a).hasClass("select2-hidden-accessible")&&(jQuery(a).selectWoo("destroy"),jQuery(a).empty()),(e=jQuery(a).selectWoo({data:o})).val(s).trigger("change"),e.on("change",function(){t.saveValue("subsets",jQuery(this).val())})},getFonts:function(){var e=this;return _.isUndefined(window["kirkiFonts"+e.id])?"undefined"!=typeof kirkiAllFonts?kirkiAllFonts:{google:[],standard:[]}:window["kirkiFonts"+e.id]},getVariants:function(e){var t=this.getFonts(),i=!1;return _.each(t.standard,function(t){if(e&&t.family===e.replace(/'/g,'"'))return i=t.variants,t.variants}),_.each(t.google,function(t){if(t.family===e)return i=t.variants,t.variants}),i},getSubsets:function(e){var t=!1,i=this.getFonts();return _.each(i.google,function(i){i.family===e&&(t=i.subsets)}),t},getValue:function(){"use strict";var e=this.container.find(".typography-hidden-value"),t=jQuery(e).val();return JSON.parse(t)},saveValue:function(e,t){"use strict";var i=this,n=i.container.find(".typography-hidden-value"),r=jQuery(n).val(),a=JSON.parse(r);a[e]=t,wp.customize.control(i.id).setting.set(a),jQuery(n).attr("value",JSON.stringify(a)).trigger("change")}});
1
+ if(_.isUndefined(window.kirkiSetSettingValue))var kirkiSetSettingValue={set:function(e,t){var i,n=this,a=wp.customize.settings.controls[e];if(_.isUndefined(a))return!0;switch(n.setValue(e,t),a.type){case"kirki-background":_.isUndefined(t["background-color"])||n.setColorPicker(n.findElement(e,".kirki-color-control"),t["background-color"]),n.findElement(e,".placeholder, .thumbnail").removeClass().addClass("placeholder").html("No file selected"),_.each(["background-repeat","background-position"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["background-size","background-attachment"],function(i){jQuery(n.findElement(e,"."+i+' input[value="'+t+'"]')).prop("checked",!0)}),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".background-hidden-value").attr("value",i)).trigger("change");break;case"kirki-code":jQuery(n.findElement(e,".CodeMirror"))[0].CodeMirror.setValue(t);break;case"checkbox":case"kirki-switch":case"kirki-toggle":t=1===t||"1"===t||!0===t,jQuery(n.findElement(e,"input")).prop("checked",t),wp.customize.instance(e).set(t);break;case"kirki-select":case"kirki-preset":case"kirki-fontawesome":n.setSelectWoo(n.findElement(e,"select"),t);break;case"kirki-slider":jQuery(n.findElement(e,"input")).prop("value",t),jQuery(n.findElement(e,".kirki_range_value .value")).html(t);break;case"kirki-generic":(_.isUndefined(a.choices)||_.isUndefined(a.choices.element))&&(a.choices.element="input"),jQuery(n.findElement(e,a.choices.element)).prop("value",t);break;case"kirki-color":n.setColorPicker(n.findElement(e,".kirki-color-control"),t);break;case"kirki-multicheck":n.findElement(e,"input").each(function(){jQuery(this).prop("checked",!1)}),_.each(t,function(i,a){jQuery(n.findElement(e,'input[value="'+t[a]+'"]')).prop("checked",!0)});break;case"kirki-multicolor":_.each(t,function(t,i){n.setColorPicker(n.findElement(e,".multicolor-index-"+i),t)});break;case"kirki-radio-buttonset":case"kirki-radio-image":case"kirki-radio":case"kirki-dashicons":case"kirki-color-palette":case"kirki-palette":jQuery(n.findElement(e,'input[value="'+t+'"]')).prop("checked",!0);break;case"kirki-typography":_.each(["font-family","variant","subsets"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["font-size","line-height","letter-spacing","word-spacing"],function(i){_.isUndefined(t[i])||jQuery(n.findElement(e,"."+i+" input")).prop("value",t[i])}),_.isUndefined(t.color)||n.setColorPicker(n.findElement(e,".kirki-color-control"),t.color),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".typography-hidden-value").attr("value",i)).trigger("change");break;case"kirki-dimensions":_.each(t,function(t,i){jQuery(n.findElement(e,"."+i+" input")).prop("value",t)});break;case"kirki-repeater":case"kirki-custom":break;default:jQuery(n.findElement(e,"input")).prop("value",t)}},setColorPicker:function(e,t){e.attr("data-default-color",t).data("default-color",t).wpColorPicker("color",t)},setSelectWoo:function(e,t){jQuery(e).selectWoo().val(t).trigger("change")},setTextarea:function(e,t){jQuery(e).prop("value",t)},findElement:function(e,t){return wp.customize.control(e).container.find(t)},setValue:function(e,t,i){i=_.isUndefined(i)?100:parseInt(i,10),wp.customize.instance(e).set({}),setTimeout(function(){wp.customize.instance(e).set(t)},i)}};var kirki={control:{"kirki-color":{init:function(e){this.template(e),kirki.input.color.init(e)},template:function(e){e.container.html(kirki.input.color.getTemplate({label:e.params.label,description:e.params.description,"data-id":e.id,mode:e.params.mode,inputAttrs:e.params.inputAttrs,"data-palette":e.params.palette,"data-default-color":e.params.default,"data-alpha":e.params.choices.alpha,value:e.setting._value}))}}},input:{color:{getTemplate:function(e){var t="";return e=_.defaults(e,{label:"",description:"",mode:"full",inputAttrs:"","data-palette":!e["data-palette"]||e["data-palette"],"data-default-color":e["data-default-color"]?e["data-default-color"]:"","data-alpha":!!e["data-alpha"]&&e["data-alpha"],value:"","data-id":""}),t+="<label>",e.label&&(t+='<span class="customize-control-title">'+e.label+"</span>"),e.description&&(t+='<span class="description customize-control-description">'+e.description+"</span>"),t+="</label>",t+='<input type="text" data-type="'+e.mode+'" '+e.inputAttrs+' data-palette="'+e["data-palette"]+'" data-default-color="'+e["data-default-color"]+'" data-alpha="'+e["data-alpha"]+'" value="'+e.value+'" class="kirki-color-control" data-id="'+e["data-id"]+'"/>','<div class="kirki-input-container" data-id="'+e.id+'">'+t+"</div>"},init:function(e){var t,i=jQuery('.kirki-color-control[data-id="'+e.id+'"]');e.choices=e.choices||{},_.isEmpty(e.choices)&&e.params.choices&&(e.choices=e.params.choices),_.isEmpty(e.choices)||i.wpColorPicker(e.choices),setTimeout(function(){(t=jQuery('.kirki-input-container[data-id="'+e.id+'"] .wp-picker-clear')).length&&t.click(function(){e.setting.set("")})},200),i.wpColorPicker({change:function(){setTimeout(function(){kirki.setting.set(e.id,i.val())},20)}})}}},setting:{get:function(e){var t=e.split("["),i="",n=0,a="";return _.each(t,function(e,t){e=e.replace("]",""),0===t?i=e:i+="["+e+"]",_.isUndefined(wp.customize.instance(i))||(a=wp.customize.instance(i).get(),n=t),n<t&&_.isObject(a)&&!_.isUndefined(a[e])&&(a=a[e])}),a},set:function(e,t,i){var n,a,r,o,s,c="",l="",u={};n=e,_.isObject(e)&&(n=jQuery(e).attr("data-id")?e.attr("data-id"):e.parents("[data-id]").attr("data-id")),a=n.split("["),_.each(a,function(e,t){e=e.replace("]",""),c=0===t?e:"["+e+"]",_.isUndefined(wp.customize.instance(c))||(l=c,r=wp.customize.instance(l).get())}),""!==(o=n.replace(l,""))?(_.isObject(r)||(r={}),"["===o.charAt(0)&&(o=o.replace("[","")),s=o.split("["),_.each(s,function(e,t){s[t]=e.replace("]","")}),i&&s.push(i),u='{"'+s.join('":{"')+'":"'+t+'"'+"}".repeat(s.length),u=JSON.parse(u),jQuery.extend(!0,r,u),t=r):i&&((r=_.isObject(r)?r:{})[i]=t,t=r),wp.customize.control(l).setting.set(t)}}};!function(){"use strict";wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(e,t){var i=this,n=t||{};n.params=n.params||{},n.params.type||(n.params.type="kirki-generic"),n.params.content||(n.params.content=jQuery("<li></li>"),n.params.content.attr("id","customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-")),n.params.content.attr("class","customize-control customize-control-"+n.params.type)),i.propertyElements=[],wp.customize.Control.prototype.initialize.call(i,e,n)},_setUpSettingRootLinks:function(){var e=this;e.container.find("[data-customize-setting-link]").each(function(){var t=jQuery(this);wp.customize(t.data("customizeSettingLink"),function(i){var n=new wp.customize.Element(t);e.elements.push(n),n.sync(i),n.set(i())})})},_setUpSettingPropertyLinks:function(){var e=this;e.setting&&e.container.find("[data-customize-setting-property-link]").each(function(){var t,i=jQuery(this),n=i.data("customizeSettingPropertyLink");t=new wp.customize.Element(i),e.propertyElements.push(t),t.set(e.setting()[n]),t.bind(function(t){var i=e.setting();t!==i[n]&&((i=_.clone(i))[n]=t,e.setting.set(i))}),e.setting.bind(function(e){e[n]!==t.get()&&t.set(e[n])})})},ready:function(){var e=this;e._setUpSettingRootLinks(),e._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(e),e.deferred.embedded.done(function(){e.initKirkiControl(e)})},embed:function(){var e=this,t=e.section();t&&wp.customize.section(t,function(t){"kirki-expanded"===t.params.type||t.expanded()||wp.customize.settings.autofocus.control===e.id?e.actuallyEmbed():t.expanded.bind(function(t){t&&e.actuallyEmbed()})})},actuallyEmbed:function(){var e=this;"resolved"!==e.deferred.embedded.state()&&(e.renderContent(),e.deferred.embedded.resolve())},focus:function(e){var t=this;t.actuallyEmbed(),wp.customize.Control.prototype.focus.call(t,e)},initKirkiControl:function(e){void 0===kirki.control[e.params.type]?this.container.on("change keyup paste click","input",function(){e.setting.set(jQuery(this).val())}):kirki.control[e.params.type].init(e)},kirkiValidateCSSValue:function(e){var t,i,n=["rem","em","ex","%","px","cm","mm","in","pt","pc","ch","vh","vw","vmin","vmax"];return"0"===e||0<=e.indexOf("calc(")&&0<=e.indexOf(")")||(t=parseFloat(e),i=e.replace(t,""),!isNaN(t)&&-1!==jQuery.inArray(i,n))}})}(),_.each(kirki.control,function(e,t){wp.customize.controlConstructor[t]=wp.customize.kirkiDynamicControl.extend({})}),wp.customize.controlConstructor["kirki-background"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.getValue(),i=e.container.find(".kirki-color-control");(_.isUndefined(t["background-image"])||""===t["background-image"])&&(e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide()),i.wpColorPicker({change:function(){setTimeout(function(){e.saveValue("background-color",i.val())},100)}}),e.container.on("change",".background-repeat select",function(){e.saveValue("background-repeat",jQuery(this).val())}),e.container.on("change click",".background-size input",function(){e.saveValue("background-size",jQuery(this).val())}),e.container.on("change",".background-position select",function(){e.saveValue("background-position",jQuery(this).val())}),e.container.on("change click",".background-attachment input",function(){e.saveValue("background-attachment",jQuery(this).val())}),e.container.on("click",".background-image-upload-button",function(t){var i=wp.media({multiple:!1}).open().on("select",function(){var t,n,a,r=i.state().get("selection").first(),o=r.toJSON().sizes.full.url;_.isUndefined(r.toJSON().sizes.medium)?_.isUndefined(r.toJSON().sizes.thumbnail)||(o=r.toJSON().sizes.thumbnail.url):o=r.toJSON().sizes.medium.url,t=r.toJSON().sizes.full.url,r.toJSON().id,r.toJSON().width,r.toJSON().height,""!==t&&e.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),e.saveValue("background-image",t),n=e.container.find(".placeholder, .thumbnail"),a=e.container.find(".background-image-upload-remove-button"),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+o+'" alt="" />'),a.length&&a.show()});t.preventDefault()}),e.container.on("click",".background-image-upload-remove-button",function(t){var i,n;t.preventDefault(),e.saveValue("background-image",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".background-image-upload-remove-button"),e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide(),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&n.hide()})},getValue:function(){var e=this,t={};return _.each(e.params.default,function(i,n){!1!==i&&(t[n]=i,_.isUndefined(e.setting._value[n])||(t[n]=e.setting._value[n]))}),_.each(e.setting._value,function(e,i){_.isUndefined(t[i])&&(t[i]=e)}),t},saveValue:function(e,t){"use strict";var i=this,n=jQuery("#customize-control-"+i.id.replace("[","-").replace("]","")+" .background-hidden-value"),a=jQuery(n).val(),r=JSON.parse(a);r[e]=t,i.setting.set(r),jQuery(n).attr("value",JSON.stringify(r)).trigger("change")}}),wp.customize.controlConstructor["kirki-code"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.CodeEditorControl)||(jQuery(e.container.find("textarea.kirki-codemirror-editor")).hide(),wp.customize.control.add(new wp.customize.CodeEditorControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,editor_settings:{codemirror:{mode:e.params.choices.language}},settings:{default:e.id}})))}}),wp.customize.controlConstructor["kirki-color-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-dashicons"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-date"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.DateTimeControl)||wp.customize.control.add(new wp.customize.DateTimeControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,description:e.params.description,settings:{default:e.id},default:e.params.default}))}}),wp.customize.controlConstructor["kirki-dimension"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;t.kirkiNotifications(),this.container.on("change keyup paste","input",function(){e=jQuery(this).val(),t.setting.set(e)})},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n="long_title";!1===e.kirkiValidateCSSValue(i)?t.notifications.add(n,new wp.customize.Notification(n,{type:"warning",message:dimensionkirkiL10n["invalid-value"]})):t.notifications.remove(n)})})}}),wp.customize.controlConstructor["kirki-dimensions"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.params.choices.controls,n={},a=[];for(_.each(i,function(e,t){!0===e&&a.push(t)}),e=0;e<a.length;e++)n[a[e]]=t.setting._value[a[e]],t.updateDimensionsValue(a[e],n)},updateDimensionsValue:function(e,t){var i=this;i.container.on("change keyup paste","."+e+" input",function(){t[e]=jQuery(this).val(),i.kirkiNotifications(),i.saveValue(t)})},saveValue:function(e){var t=this,i={};_.each(e,function(e,t){i[t]=e}),t.setting.set(i)},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n,a="long_title",r={};t.notifications.remove(a),_.each(["top","bottom","left","right"],function(t){_.isUndefined(i[t])||(!1===e.kirkiValidateCSSValue(i[t])?r[t]=dimensionskirkiL10n[t]:delete r[t])}),_.isEmpty(r)?t.notifications.remove(a):(n=dimensionskirkiL10n["invalid-value"]+" ("+_.values(r).toString()+") ",t.notifications.add(a,new wp.customize.Notification(a,{type:"warning",message:n})))})})}}),wp.customize.controlConstructor["kirki-editor"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.container.find("textarea"),n="kirki-editor-"+t.id.replace("[","").replace("]","");wp.editor.initialize(n,{tinymce:{wpautop:!0},quicktags:!0,mediaButtons:!0}),(e=tinyMCE.get(n))&&e.onChange.add(function(n){var a;n.save(),a=e.getContent(),i.val(a).trigger("change"),wp.customize.instance(t.id).set(a)})}}),wp.customize.controlConstructor["kirki-fontawesome"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t,i=this,n=this.container.find("select"),a=jQuery.parseJSON(fontAwesomeJSON),r={data:[],escapeMarkup:function(e){return e},templateResult:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text},templateSelection:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text}};_.each(a.icons,function(e){r.data.push({id:e.id,text:e.name})}),(t=jQuery(n).selectWoo(r)).on("change",function(){e=jQuery(this).val(),i.setting.set(e)}),t.val(i.setting._value).trigger("change")}}),wp.customize.controlConstructor["kirki-generic"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-image"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.getValue(),i=_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as,n=e.container.find(".placeholder, .thumbnail"),a="array"===i?t.url:t,r=e.container.find(".image-upload-remove-button"),o=e.container.find(".image-default-button");e.container.find(".kirki-controls-loading-spinner").hide(),"id"!==i&&"ID"!==i||""===t||wp.media.attachment(t).fetch().then(function(e){setTimeout(function(){var e=wp.media.attachment(t).get("url");n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e+'" alt="" />')},700)}),("url"===i&&""!==t||"array"===i&&!_.isUndefined(t.url)&&""!==t.url)&&e.container.find("image-default-button").hide(),("url"===i&&""===t||"array"===i&&(_.isUndefined(t.url)||""===t.url))&&r.hide(),t===e.params.default&&e.container.find("image-default-button").hide(),""!==a&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+a+'" alt="" />'),e.container.on("click",".image-upload-button",function(t){var a=wp.media({multiple:!1}).open().on("select",function(){var t=a.state().get("selection").first(),s=t.toJSON().sizes.full.url;_.isUndefined(t.toJSON().sizes.medium)?_.isUndefined(t.toJSON().sizes.thumbnail)||(s=t.toJSON().sizes.thumbnail.url):s=t.toJSON().sizes.medium.url,"array"===i?(e.saveValue("id",t.toJSON().id),e.saveValue("url",t.toJSON().sizes.full.url),e.saveValue("width",t.toJSON().width),e.saveValue("height",t.toJSON().height)):"id"===i?e.saveValue("id",t.toJSON().id):e.saveValue("url",t.toJSON().sizes.full.url),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+s+'" alt="" />'),r.length&&(r.show(),o.hide())});t.preventDefault()}),e.container.on("click",".image-upload-remove-button",function(t){var i,n,a;t.preventDefault(),e.saveValue("id",""),e.saveValue("url",""),e.saveValue("width",""),e.saveValue("height",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),a=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&(n.hide(),jQuery(a).hasClass("button")&&a.show())}),e.container.on("click",".image-default-button",function(t){var i,n,a;t.preventDefault(),e.saveValue("url",e.params.default),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),a=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e.params.default+'" alt="" />'),n.length&&(n.show(),a.hide())})},getValue:function(){var e=this,t=e.setting._value;return"array"===(_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as)&&_.isString(t)&&(t={url:t}),t},saveValue:function(e,t){var i=this,n=i.setting._value;if("array"===(_.isUndefined(i.params.choices)||_.isUndefined(i.params.choices.save_as)?"url":i.params.choices.save_as))return _.isString(n)&&(n={}),n[e]=t,i.setting.set(n),void i.container.find("button").trigger("change");i.setting.set(t),i.container.find("button").trigger("change")}}),wp.customize.controlConstructor["kirki-multicheck"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;e.container.on("change","input",function(){var t=[],i=0;jQuery.each(e.params.choices,function(n){e.container.find('input[value="'+n+'"]').is(":checked")&&(t[i]=n,i++)}),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-multicolor"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";for(var e,t,i=this,n=i.params.choices,a=Object.keys(n),r=(this.params.value,i.container.find(".iris-target")),o=0;o<Object.keys(n).length;)!function(e,t,i){var a=e.container.find(".multicolor-index-"+i),o={target:r[0],change:function(){setTimeout(function(){e.saveValue(i,a.val()),e.container.find(".multicolor-index-"+i).trigger("change")},100)}};_.isObject(n.irisArgs)&&_.each(n.irisArgs,function(e,t){o[t]=e}),a.wpColorPicker(o)}(this,0,a[o]),e=i.container.find(".wp-picker-container .wp-picker-input-wrap"),t=i.container.find(".wp-picker-container .wp-picker-holder"),jQuery(e[0]).detach().appendTo(r[0]),jQuery(t[0]).detach().appendTo(r[0]),o++},saveValue:function(e,t){"use strict";var i=this,n=i.container.find(".multicolor-hidden-value"),a=jQuery(n).val(),r=JSON.parse(a);r[e]=t,jQuery(n).attr("value",JSON.stringify(r)).trigger("change"),i.setting.set(r)}}),wp.customize.controlConstructor["kirki-number"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t,i,n=this,a=n.setting._value,r="";n.params.choices=_.defaults(n.params.choices,{min:0,max:100,step:1}),(isNaN(a)||""===a)&&(a=0>n.params.choices.min&&0<n.params.choices.max?0:n.params.choices.min),a=parseFloat(a),n.params.choices.step="any"===n.params.choices.step?.001:n.params.choices.step,n.params.choices.min=parseFloat(n.params.choices.min),n.params.choices.max=parseFloat(n.params.choices.max),n.params.choices.step=parseFloat(n.params.choices.step),r+="<label>",n.params.label&&(r+='<span class="customize-control-title">'+n.params.label+"</span>"),n.params.description&&(r+='<span class="description customize-control-description">'+n.params.description+"</span>"),r+='<div class="customize-control-content">',r+="<input "+n.params.inputAttrs+' type="text" '+n.params.link+' value="'+a+'" />',r+='<div class="quantity button minus">-</div>',r+='<div class="quantity button plus">+</div>',r+="</div>",r+="</label>",n.container.html(r),e=n.container.find("input"),t=n.container.find(".plus"),i=n.container.find(".minus"),t.click(function(){var t,i=parseFloat(e.val());t=i>=n.params.choices.max?i:i+n.params.choices.step,e.val(t),e.trigger("change")}),i.click(function(){var t,i=parseFloat(e.val());t=i<=n.params.choices.min?i:i-n.params.choices.step,e.val(t),e.trigger("change")}),this.container.on("change keyup paste click","input",function(){n.setting.set(jQuery(this).val())})}}),wp.customize.controlConstructor["kirki-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-preset"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;this.container.on("change","select",function(){e=jQuery(this).val(),t.setting.set(e),jQuery.each(t.params.choices,function(t,i){e===t&&jQuery.each(i.settings,function(e,t){kirkiSetSettingValue.set(e,t)})}),wp.customize.previewer.refresh()})}}),wp.customize.controlConstructor["kirki-radio-buttonset"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio-image"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio"]=wp.customize.kirkiDynamicControl.extend({});var RepeaterRow=function(e,t,i,n){"use strict";var a=this;this.rowIndex=e,this.container=t,this.label=i,this.header=this.container.find(".repeater-row-header"),this.header.on("click",function(){a.toggleMinimize()}),this.container.on("click",".repeater-row-remove",function(){a.remove()}),this.header.on("mousedown",function(){a.container.trigger("row:start-dragging")}),this.container.on("keyup change","input, select, textarea",function(e){a.container.trigger("row:update",[a.rowIndex,jQuery(e.target).data("field"),e.target])}),this.setRowIndex=function(e){this.rowIndex=e,this.container.attr("data-row",e),this.container.data("row",e),this.updateLabel()},this.toggleMinimize=function(){this.container.toggleClass("minimized"),this.header.find(".dashicons").toggleClass("dashicons-arrow-up").toggleClass("dashicons-arrow-down")},this.remove=function(){this.container.slideUp(300,function(){jQuery(this).detach()}),this.container.trigger("row:remove",[this.rowIndex])},this.updateLabel=function(){var e,t,i;if("field"===this.label.type&&(e=this.container.find('.repeater-field [data-field="'+this.label.field+'"]'),_.isFunction(e.val)&&""!==(t=e.val())))return _.isUndefined(n.params.fields[this.label.field])||_.isUndefined(n.params.fields[this.label.field].type)||("select"===n.params.fields[this.label.field].type?_.isUndefined(n.params.fields[this.label.field].choices)||_.isUndefined(n.params.fields[this.label.field].choices[e.val()])||(t=n.params.fields[this.label.field].choices[e.val()]):"radio"!==n.params.fields[this.label.field].type&&"radio-image"!==n.params.fields[this.label.field].type||(i=n.selector+' [data-row="'+this.rowIndex+'"] .repeater-field [data-field="'+this.label.field+'"]:checked',t=jQuery(i).val())),void this.header.find(".repeater-row-label").text(t);this.header.find(".repeater-row-label").text(this.label.value+" "+(this.rowIndex+1))},this.updateLabel()};wp.customize.controlConstructor.repeater=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t,i=this,n=this.params.value;i.container.find(".kirki-controls-loading-spinner").hide(),this.settingField=this.container.find("[data-customize-setting-link]").first(),this.setValue([],!1),this.repeaterFieldsContainer=this.container.find(".repeater-fields").first(),this.currentIndex=0,this.rows=[],e=!1,_.isUndefined(this.params.choices.limit)||(e=!(0>=this.params.choices.limit)&&parseInt(this.params.choices.limit,10)),this.container.on("click","button.repeater-add",function(n){n.preventDefault(),!e||i.currentIndex<e?((t=i.addRow()).toggleMinimize(),i.initColorPicker(),i.initSelect(t)):jQuery(i.selector+" .limit").addClass("highlight")}),this.container.on("click",".repeater-row-remove",function(){i.currentIndex--,(!e||i.currentIndex<e)&&jQuery(i.selector+" .limit").removeClass("highlight")}),this.container.on("click keypress",".repeater-field-image .upload-button,.repeater-field-cropped_image .upload-button,.repeater-field-upload .upload-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.openFrame(e)}),this.container.on("click keypress",".repeater-field-image .remove-button,.repeater-field-cropped_image .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeImage(e)}),this.container.on("click keypress",".repeater-field-upload .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeFile(e)}),this.repeaterTemplate=_.memoize(function(){var e,t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(n){return(e=_.template(i.container.find(".customize-control-repeater-content").first().html(),null,t))(n)}}),n.length&&_.each(n,function(e){t=i.addRow(e),i.initColorPicker(),i.initSelect(t,e)}),this.setValue(n,!0,!0),this.repeaterFieldsContainer.sortable({handle:".repeater-row-header",update:function(){i.sort()}})},openFrame:function(e){"use strict";wp.customize.utils.isKeydownButNotEnterEvent(e)||(this.$thisButton.closest(".repeater-field").hasClass("repeater-field-cropped_image")?this.initCropperFrame():this.initFrame(),this.frame.open())},initFrame:function(){"use strict";var e=this.getMimeType();this.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1})]}),this.frame.on("select",this.onSelect,this)},initCropperFrame:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field"),t=["width","height","flex_width","flex_height"],i=this.getMimeType();_.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"cropped_image"===this.params.fields[e].type&&t.forEach(function(t){_.isUndefined(this.params.fields[e][t])||(this.params[t]=this.params.fields[e][t])}.bind(this)),this.frame=wp.media({button:{text:"Select and Crop",close:!1},states:[new wp.media.controller.Library({library:wp.media.query({type:i}),multiple:!1,date:!1,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelectForCrop,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.$thisButton.closest(".repeater-field").hasClass("repeater-field-upload")?this.setFileInRepeaterField(e):this.setImageInRepeaterField(e)},onSelectForCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):this.setImageInRepeaterField(e)},onCropped:function(e){"use strict";this.setImageInRepeaterField(e)},calculateImageSelectOptions:function(e,t){"use strict";var i,n,a,r=t.get("control"),o=!!parseInt(r.params.flex_width,10),s=!!parseInt(r.params.flex_height,10),c=e.get("width"),l=e.get("height"),u=parseInt(r.params.width,10),d=parseInt(r.params.height,10),p=u/d,h=c,f=l;return t.set("canSkipCrop",!r.mustBeCropped(o,s,u,d,c,l)),h/f>p?u=(d=f)*p:d=(u=h)/p,i=(h-u)/2,n=(f-d)/2,a={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:c,imageHeight:l,x1:i,y1:n,x2:u+i,y2:d+n},!1===s&&!1===o&&(a.aspectRatio=u+":"+d),!1===s&&(a.maxHeight=d),!1===o&&(a.maxWidth=u),a},mustBeCropped:function(e,t,i,n,a,r){"use strict";return!(!0===e&&!0===t||!0===e&&n===r||!0===t&&i===a||i===a&&n===r||a<=i)},onSkippedCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.setImageInRepeaterField(e)},setImageInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image");t.find(".kirki-image-attachment").html('<img src="'+e.url+'">').hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},setFileInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-upload");t.find(".kirki-file-attachment").html('<span class="file"><span class="dashicons dashicons-media-default"></span> '+e.filename+"</span>").hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".upload-button").show(),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},getMimeType:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field");return _.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"upload"===this.params.fields[e].type&&!_.isUndefined(this.params.fields[e].mime_type)?this.params.fields[e].mime_type:"image"},removeImage:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload")).find(".upload-button"),t.find(".kirki-image-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},removeFile:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-upload")).find(".upload-button"),t.find(".kirki-file-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},getValue:function(){"use strict";return JSON.parse(decodeURI(this.setting.get()))},setValue:function(e,t,i){"use strict";var n=e,a=[];i&&(jQuery.each(this.params.fields,function(e,t){"image"!==t.type&&"cropped_image"!==t.type&&"upload"!==t.type||a.push(e)}),jQuery.each(e,function(e,t){jQuery.each(a,function(i,a){_.isUndefined(t[a])||_.isUndefined(t[a].id)||(n[e][a]=t[a].id)})})),this.setting.set(encodeURI(JSON.stringify(n))),t&&this.settingField.trigger("change")},addRow:function(e){"use strict";var t,i,n,a=this,r=a.repeaterTemplate(),o=this.getValue(),s={};if(r){if(t=jQuery.extend(!0,{},a.params.fields),e)for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(t[n].default=e[n]);t.index=this.currentIndex,r=r(t),(i=new RepeaterRow(a.currentIndex,jQuery(r).appendTo(a.repeaterFieldsContainer),a.params.row_label,a)).container.on("row:remove",function(e,t){a.deleteRow(t)}),i.container.on("row:update",function(e,t,n,r){a.updateField.call(a,e,t,n,r),i.updateLabel()}),this.rows[this.currentIndex]=i;for(n in t)t.hasOwnProperty(n)&&(s[n]=t[n].default);return o[this.currentIndex]=s,this.setValue(o,!0),this.currentIndex++,i}},sort:function(){"use strict";var e=this,t=this.repeaterFieldsContainer.find(".repeater-row"),i=[],n=e.getValue(),a=[],r=[];t.each(function(e,t){i.push(jQuery(t).data("row"))}),jQuery.each(i,function(t,i){a[t]=e.rows[i],a[t].setRowIndex(t),r[t]=n[i]}),e.rows=a,e.setValue(r)},deleteRow:function(e){"use strict";var t,i=this.getValue();i[e]&&this.rows[e]&&(delete i[e],delete this.rows[e],this.setValue(i,!0));for(t in this.rows)this.rows.hasOwnProperty(t)&&this.rows[t]&&(this.rows[t].updateLabel(),0)},updateField:function(e,t,i,n){"use strict";var a,r,o;this.rows[t]&&this.params.fields[i]&&(a=this.params.fields[i].type,r=this.rows[t],o=this.getValue(),n=jQuery(n),_.isUndefined(o[r.rowIndex][i])||(o[r.rowIndex][i]="checkbox"===a?n.is(":checked"):n.val(),this.setValue(o,!0)))},initColorPicker:function(){"use strict";var e=this,t=e.container.find(".color-picker-hex"),i={},n=t.data("field");_.isUndefined(n)||_.isUndefined(e.params.fields[n])||_.isUndefined(e.params.fields[n].palettes)||!_.isObject(e.params.fields[n].palettes)||(i.palettes=e.params.fields[n].palettes),i.change=function(t,i){var n=jQuery(t.target),a=n.closest(".repeater-row").data("row"),r=e.getValue();r[a][n.data("field")]=i.color.toString(),e.setValue(r,!0)},0!==t.length&&t.wpColorPicker(i)},initSelect:function(e,t){"use strict";var i,n,a=this,r=e.container.find(".repeater-field select"),o={};0!==r.length&&(i=r.data("field"),"undefed"!==(n=jQuery(r).data("multiple"))&&jQuery.isNumeric(n)&&1<(n=parseInt(n,10))&&(o.maximumSelectionLength=n),jQuery(r).selectWoo(o).val(t[i]),this.container.on("change",".repeater-field select",function(e){var t=jQuery(e.target),i=t.closest(".repeater-row").data("row"),n=a.getValue();n[i][t.data("field")]=jQuery(this).val(),a.setValue(n)}))}}),wp.customize.controlConstructor["kirki-select"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=this.container.find("select"),n=parseInt(i.data("multiple"),10),a={escapeMarkup:function(e){return e}};1<n&&(a.maximumSelectionLength=n),jQuery(i).selectWoo(a).on("change",function(){e=jQuery(this).val(),t.setting.set(e)})}}),wp.customize.controlConstructor["kirki-slider"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t="postMessage"===e.setting.transport?"mousemove change":"change",i=e.container.find('input[type="range"]'),n=e.container.find('input[type="text"]'),a=e.setting._value;n.attr("value",a),i.on("mousemove change",function(){n.attr("value",i.val())}),i.on(t,function(){e.setting.set(i.val())}),n.on("input paste change",function(){i.attr("value",n.val()),e.setting.set(n.val())}),e.container.find(".slider-reset").on("click",function(){n.attr("value",e.params.default),i.attr("value",e.params.default),e.setting.set(n.val())})}}),wp.customize.controlConstructor["kirki-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e=this;e.container.find(".kirki-controls-loading-spinner").hide(),e.sortableContainer=e.container.find("ul.sortable").first(),e.sortableContainer.sortable({stop:function(){e.updateValue()}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.updateValue()})},updateValue:function(){"use strict";var e=this,t=[];this.sortableContainer.find("li").each(function(){jQuery(this).is(".invisible")||t.push(jQuery(this).data("value"))}),e.setting.set(t)}}),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e=this,t=e.setting._value,i=jQuery(e.container.find(".switch-on")),n=jQuery(e.container.find(".switch-off"));jQuery(e.container.find(".switch label ")).css("width",i.width()+n.width()+40+"px"),jQuery("#customize-control-"+e.id.replace("[","-").replace("]","")).append("<style>#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch label:after{width:"+(i.width()+13)+"px;}#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch input:checked + label:after{left:"+(i.width()+22)+"px;width:"+(n.width()+13)+"px;}</style>"),this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-typography"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t=this,i=t.getValue();t.renderFontSelector(),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector(),t.params.default["font-size"]&&this.container.on("change keyup paste",".font-size input",function(){t.saveValue("font-size",jQuery(this).val())}),t.params.default["line-height"]&&this.container.on("change keyup paste",".line-height input",function(){t.saveValue("line-height",jQuery(this).val())}),t.params.default["margin-top"]&&this.container.on("change keyup paste",".margin-top input",function(){t.saveValue("margin-top",jQuery(this).val())}),t.params.default["margin-bottom"]&&this.container.on("change keyup paste",".margin-bottom input",function(){t.saveValue("margin-bottom",jQuery(this).val())}),t.params.default["letter-spacing"]&&(i["letter-spacing"]=jQuery.isNumeric(i["letter-spacing"])?i["letter-spacing"]+"px":i["letter-spacing"],this.container.on("change keyup paste",".letter-spacing input",function(){i["letter-spacing"]=jQuery.isNumeric(jQuery(this).val())?jQuery(this).val()+"px":jQuery(this).val(),t.saveValue("letter-spacing",i["letter-spacing"])})),t.params.default["word-spacing"]&&this.container.on("change keyup paste",".word-spacing input",function(){t.saveValue("word-spacing",jQuery(this).val())}),t.params.default["text-align"]&&this.container.on("change",".text-align input",function(){t.saveValue("text-align",jQuery(this).val())}),t.params.default["text-transform"]&&jQuery(t.selector+" .text-transform select").selectWoo().on("change",function(){t.saveValue("text-transform",jQuery(this).val())}),t.params.default.color&&(e=this.container.find(".kirki-color-control")).wpColorPicker({change:function(){setTimeout(function(){t.saveValue("color",e.val())},100)}})},renderFontSelector:function(){var e,t=this,i=t.selector+" .font-family select",n=[],a=[],r=[],o=t.getValue(),s=t.getFonts();_.isUndefined(s.standard)||_.each(s.standard,function(e){a.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),_.isUndefined(s.standard)||_.each(s.google,function(e){r.push({id:e.family,text:e.label})}),n=[{text:"Standard Fonts",children:a},{text:"Google Fonts",children:r}],e=jQuery(i).selectWoo({data:n}),o["font-family"]&&e.val(o["font-family"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-family",jQuery(this).val()),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector()})},renderBackupFontSelector:function(){var e,t=this,i=t.selector+" .font-backup select",n=[],a=t.getValue(),r=a["font-family"],o=t.getVariants(r),s=t.getFonts();(_.isUndefined(a["font-backup"])||null===a["font-backup"])&&(a["font-backup"]=""),!1!==o?jQuery(t.selector+" .font-backup").show():jQuery(t.selector+" .font-backup").hide(),_.isUndefined(s.standard)||_.each(s.standard,function(e){n.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),e=jQuery(i).selectWoo({data:n}),void 0!==a["font-backup"]&&e.val(a["font-backup"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-backup",jQuery(this).val())})},renderVariantSelector:function(){var e,t,i,n=this,a=n.getValue(),r=a["font-family"],o=n.getVariants(r),s=n.selector+" .variant select",c=[],l=!1;!1!==o?(jQuery(n.selector+" .variant").show(),_.each(o,function(e){a.variant===e.id&&(l=!0),c.push({id:e.id,text:e.label})}),l||(a.variant="regular"),jQuery(s).hasClass("select2-hidden-accessible")&&(jQuery(s).selectWoo("destroy"),jQuery(s).empty()),(t=jQuery(s).selectWoo({data:c})).val(a.variant).trigger("change"),t.on("change",function(){n.saveValue("variant",jQuery(this).val()),e=_.isString(a.variant)?a.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",i=-1!==a.variant.indexOf("italic")?"italic":"normal",n.saveValue("font-weight",e),n.saveValue("font-style",i)})):jQuery(n.selector+" .variant").hide()},renderSubsetSelector:function(){var e,t=this,i=t.getValue(),n=i["font-family"],a=t.getSubsets(n),r=t.selector+" .subsets select",o=[],s=i.subsets;!1!==a?(jQuery(t.selector+" .subsets").show(),_.each(a,function(e){_.isObject(s)&&-1===s.indexOf(e.id)&&(s=_.reject(s,function(t){return t===e.id})),o.push({id:e.id,text:e.label})})):jQuery(t.selector+" .subsets").hide(),jQuery(r).hasClass("select2-hidden-accessible")&&(jQuery(r).selectWoo("destroy"),jQuery(r).empty()),(e=jQuery(r).selectWoo({data:o})).val(s).trigger("change"),e.on("change",function(){t.saveValue("subsets",jQuery(this).val())})},getFonts:function(){var e=this;return _.isUndefined(window["kirkiFonts"+e.id])?"undefined"!=typeof kirkiAllFonts?kirkiAllFonts:{google:[],standard:[]}:window["kirkiFonts"+e.id]},getVariants:function(e){var t=this.getFonts(),i=!1;return _.each(t.standard,function(t){if(e&&t.family===e.replace(/'/g,'"'))return i=t.variants,t.variants}),_.each(t.google,function(t){if(t.family===e)return i=t.variants,t.variants}),i},getSubsets:function(e){var t=!1,i=this.getFonts();return _.each(i.google,function(i){i.family===e&&(t=i.subsets)}),t},getValue:function(){"use strict";var e=this.container.find(".typography-hidden-value"),t=jQuery(e).val();return JSON.parse(t)},saveValue:function(e,t){"use strict";var i=this,n=i.container.find(".typography-hidden-value"),a=jQuery(n).val(),r=JSON.parse(a);r[e]=t,wp.customize.control(i.id).setting.set(r),jQuery(n).attr("value",JSON.stringify(r)).trigger("change")}});
controls/js/dist/script.js CHANGED
@@ -208,7 +208,305 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
208
}
209
};
210
}
211
- ;/**
212
* The majority of the code in this file
213
* is derived from the wp-customize-posts plugin
214
* and the work of @westonruter to whom I am very grateful.
@@ -325,7 +623,7 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
325
wp.customize.Control.prototype.ready.call( control );
326
327
control.deferred.embedded.done( function() {
328
- control.initKirkiControl();
329
});
330
},
331
@@ -388,9 +686,17 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
388
wp.customize.Control.prototype.focus.call( control, args );
389
},
390
391
- initKirkiControl: function() {
392
-
393
- var control = this;
394
395
// Save the value
396
this.container.on( 'change keyup paste click', 'input', function() {
@@ -423,6 +729,10 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
423
}
424
});
425
})();
426
;/* global kirkiControlLoader */
427
wp.customize.controlConstructor['kirki-background'] = wp.customize.Control.extend({
428
@@ -600,38 +910,6 @@ wp.customize.controlConstructor['kirki-background'] = wp.customize.Control.exten
600
}
601
});
602
;wp.customize.controlConstructor['kirki-color-palette'] = wp.customize.kirkiDynamicControl.extend({});
603
- ;wp.customize.controlConstructor['kirki-color'] = wp.customize.kirkiDynamicControl.extend({
604
-
605
- initKirkiControl: function() {
606
- var control = this,
607
- picker = control.container.find( '.kirki-color-control' ),
608
- clear;
609
-
610
- // If we have defined any extra choices, make sure they are passed-on to Iris.
611
- if ( ! _.isUndefined( control.params.choices ) ) {
612
- picker.wpColorPicker( control.params.choices );
613
- }
614
-
615
- // Tweaks to make the "clear" buttons work.
616
- setTimeout( function() {
617
- clear = control.container.find( '.wp-picker-clear' );
618
- clear.click( function() {
619
- control.setting.set( '' );
620
- });
621
- }, 200 );
622
-
623
- // Saves our settings to the WP API
624
- picker.wpColorPicker({
625
- change: function() {
626
-
627
- // Small hack: the picker needs a small delay
628
- setTimeout( function() {
629
- control.setting.set( picker.val() );
630
- }, 20 );
631
- }
632
- });
633
- }
634
- });
635
;wp.customize.controlConstructor['kirki-dashicons'] = wp.customize.kirkiDynamicControl.extend({});
636
;wp.customize.controlConstructor['kirki-date'] = wp.customize.kirkiDynamicControl.extend({
637
@@ -1174,65 +1452,76 @@ wp.customize.controlConstructor['kirki-number'] = wp.customize.kirkiDynamicContr
1174
initKirkiControl: function() {
1175
1176
var control = this,
1177
- element = this.container.find( 'input' ),
1178
- step = 1;
1179
1180
- // Set step value.
1181
- if ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.step ) ) {
1182
- step = ( 'any' === control.params.choices.step ) ? '0.001' : control.params.choices.step;
1183
}
1184
1185
- // Init the spinner
1186
- jQuery( element ).spinner({
1187
- min: ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.min ) ) ? control.params.choices.min : -99999,
1188
- max: ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.max ) ) ? control.params.choices.max : 99999,
1189
- step: step
1190
- });
1191
1192
- // On change
1193
- this.container.on( 'change click keyup paste', 'input', function() {
1194
- control.setting.set( jQuery( this ).val() );
1195
- });
1196
1197
- // Notifications.
1198
- control.kirkiNotifications();
1199
- },
1200
1201
- /**
1202
- * Handles notifications.
1203
- */
1204
- kirkiNotifications: function() {
1205
1206
- var control = this;
1207
1208
- wp.customize( control.id, function( setting ) {
1209
- setting.bind( function( value ) {
1210
- var code = 'long_title',
1211
- min = ( ! _.isUndefined( control.params.choices.min ) ) ? Number( control.params.choices.min ) : false,
1212
- max = ( ! _.isUndefined( control.params.choices.max ) ) ? Number( control.params.choices.max ) : false,
1213
- step = ( ! _.isUndefined( control.params.choices.step ) ) ? Number( control.params.choices.step ) : false,
1214
- invalid = false;
1215
-
1216
- // Make sure value is a number.
1217
- value = Number( value );
1218
-
1219
- if ( false !== min && value < min ) {
1220
- invalid = 'min-error';
1221
- } else if ( false !== max && value > max ) {
1222
- invalid = 'max-error';
1223
- } else if ( false !== step && false !== min && ! Number.isInteger( ( value - min ) / step ) ) {
1224
- invalid = 'step-error';
1225
- }
1226
1227
- if ( false !== invalid ) {
1228
- setting.notifications.add( code, new wp.customize.Notification( code, {
1229
- type: 'warning',
1230
- message: numberKirkiL10n[ invalid ]
1231
- } ) );
1232
- } else {
1233
- setting.notifications.remove( code );
1234
- }
1235
- });
1236
});
1237
}
1238
});
@@ -2209,11 +2498,17 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({
2209
// Set the initial value in the text input.
2210
textInput.attr( 'value', value );
2211
2212
- // If the range input value changes,
2213
- // copy the value to the text input
2214
- // and then save.
2215
- rangeInput.on( changeAction, function() {
2216
textInput.attr( 'value', rangeInput.val() );
2217
control.setting.set( rangeInput.val() );
2218
} );
2219
208
}
209
};
210
}
211
+ ;var kirki = {
212
+
213
+ /**
214
+ * An object containing definitions for controls.
215
+ *
216
+ * @since 3.0.16
217
+ */
218
+ control: {
219
+
220
+ /**
221
+ * The color control.
222
+ *
223
+ * @since 3.0.16
224
+ */
225
+ 'kirki-color': {
226
+
227
+ /**
228
+ * Init the control.
229
+ *
230
+ * @since 3.0.16
231
+ * @param {object} [control] The customizer control object.
232
+ * @returns {void}
233
+ */
234
+ init: function( control ) {
235
+ var self = this;
236
+
237
+ // Render the template.
238
+ self.template( control );
239
+
240
+ // Init the control.
241
+ kirki.input.color.init( control );
242
+
243
+ },
244
+
245
+ /**
246
+ * Render the template.
247
+ *
248
+ * @since 3.0.16
249
+ * @param {object} [control] The customizer control object.
250
+ * @returns {void}
251
+ */
252
+ template: function( control ) {
253
+ control.container.html( kirki.input.color.getTemplate( {
254
+ label: control.params.label,
255
+ description: control.params.description,
256
+ 'data-id': control.id,
257
+ mode: control.params.mode,
258
+ inputAttrs: control.params.inputAttrs,
259
+ 'data-palette': control.params.palette,
260
+ 'data-default-color': control.params['default'],
261
+ 'data-alpha': control.params.choices.alpha,
262
+ value: control.setting._value
263
+ } ) );
264
+ }
265
+ }
266
+ },
267
+
268
+ /**
269
+ * An object containing definitions for input fields.
270
+ *
271
+ * @since 3.0.16
272
+ */
273
+ input: {
274
+
275
+ /**
276
+ * Color input fields.
277
+ *
278
+ * @since 3.0.16
279
+ */
280
+ color: {
281
+
282
+ /**
283
+ * Get the HTML for color inputs.
284
+ *
285
+ * @since 3.0.16
286
+ * @param {object} [data] The arguments.
287
+ * @returns {string}
288
+ */
289
+ getTemplate: function( data ) {
290
+
291
+ var html = '';
292
+
293
+ data = _.defaults( data, {
294
+ label: '',
295
+ description: '',
296
+ mode: 'full',
297
+ inputAttrs: '',
298
+ 'data-palette': data['data-palette'] ? data['data-palette'] : true,
299
+ 'data-default-color': data['data-default-color'] ? data['data-default-color'] : '',
300
+ 'data-alpha': data['data-alpha'] ? data['data-alpha'] : false,
301
+ value: '',
302
+ 'data-id': ''
303
+ } );
304
+
305
+ html += '<label>';
306
+ if ( data.label ) {
307
+ html += '<span class="customize-control-title">' + data.label + '</span>';
308
+ }
309
+ if ( data.description ) {
310
+ html += '<span class="description customize-control-description">' + data.description + '</span>';
311
+ }
312
+ html += '</label>';
313
+ html += '<input type="text" data-type="' + data.mode + '" ' + data.inputAttrs + ' data-palette="' + data['data-palette'] + '" data-default-color="' + data['data-default-color'] + '" data-alpha="' + data['data-alpha'] + '" value="' + data.value + '" class="kirki-color-control" data-id="' + data['data-id'] + '"/>';
314
+
315
+ return '<div class="kirki-input-container" data-id="' + data.id + '">' + html + '</div>';
316
+ },
317
+
318
+ /**
319
+ * Init the control.
320
+ *
321
+ * @since 3.0.16
322
+ * @param {object} [control] The control object.
323
+ * @returns {void}
324
+ */
325
+ init: function( control ) {
326
+ var picker = jQuery( '.kirki-color-control[data-id="' + control.id + '"]' ),
327
+ clear;
328
+
329
+ control.choices = control.choices || {};
330
+ if ( _.isEmpty( control.choices ) && control.params.choices ) {
331
+ control.choices = control.params.choices;
332
+ }
333
+
334
+ // If we have defined any extra choices, make sure they are passed-on to Iris.
335
+ if ( ! _.isEmpty( control.choices ) ) {
336
+ picker.wpColorPicker( control.choices );
337
+ }
338
+
339
+ // Tweaks to make the "clear" buttons work.
340
+ setTimeout( function() {
341
+ clear = jQuery( '.kirki-input-container[data-id="' + control.id + '"] .wp-picker-clear' );
342
+ if ( clear.length ) {
343
+ clear.click( function() {
344
+ control.setting.set( '' );
345
+ });
346
+ }
347
+ }, 200 );
348
+
349
+ // Saves our settings to the WP API
350
+ picker.wpColorPicker({
351
+ change: function() {
352
+
353
+ // Small hack: the picker needs a small delay
354
+ setTimeout( function() {
355
+ kirki.setting.set( control.id, picker.val() );
356
+ }, 20 );
357
+ }
358
+ });
359
+ }
360
+ }
361
+ },
362
+
363
+ /**
364
+ * An object containing definitions for settings.
365
+ *
366
+ * @since 3.0.16
367
+ */
368
+ setting: {
369
+
370
+ /**
371
+ * Gets the value of a setting.
372
+ *
373
+ * This is a helper function that allows us to get the value of
374
+ * control[key1][key2] for example, when the setting used in the
375
+ * customizer API is "control".
376
+ *
377
+ * @since 3.0.16
378
+ * @param {string} [setting] The setting for which we're getting the value.
379
+ * @returns {mixed} Depends on the value.
380
+ */
381
+ get: function( setting ) {
382
+ var parts = setting.split( '[' ),
383
+ foundSetting = '',
384
+ foundInStep = 0,
385
+ currentVal = '';
386
+
387
+ _.each( parts, function( part, i ) {
388
+ part = part.replace( ']', '' );
389
+
390
+ if ( 0 === i ) {
391
+ foundSetting = part;
392
+ } else {
393
+ foundSetting += '[' + part + ']';
394
+ }
395
+
396
+ if ( ! _.isUndefined( wp.customize.instance( foundSetting ) ) ) {
397
+ currentVal = wp.customize.instance( foundSetting ).get();
398
+ foundInStep = i;
399
+ }
400
+
401
+ if ( foundInStep < i ) {
402
+ if ( _.isObject( currentVal ) && ! _.isUndefined( currentVal[ part ] ) ) {
403
+ currentVal = currentVal[ part ];
404
+ }
405
+ }
406
+ });
407
+
408
+ return currentVal;
409
+ },
410
+
411
+ /**
412
+ * Sets the value of a setting.
413
+ *
414
+ * This function is a bit complicated because there any many scenarios to consider.
415
+ * Example: We want to save the value for my_setting[something][3][something-else].
416
+ * The control's setting is my_setting[something].
417
+ * So we need to find that first, then figure out the remaining parts,
418
+ * merge the values recursively to avoid destroying my_setting[something][2]
419
+ * and also take into account any defined "key" arguments which take this even deeper.
420
+ *
421
+ * @since 3.0.16
422
+ * @param {object|string} [element] The DOM element whose value has changed,
423
+ * or an ID.
424
+ * @param {mixed} [value] Depends on the control-type.
425
+ * @param {string} [key] If we only want to save an item in an object
426
+ * we can define the key here.
427
+ * @returns {void}
428
+ */
429
+ set: function( element, value, key ) {
430
+ var setting,
431
+ parts,
432
+ currentNode = '',
433
+ foundNode = '',
434
+ subSettingObj = {},
435
+ currentVal,
436
+ subSetting,
437
+ subSettingParts;
438
+
439
+ // Get the setting from the element.
440
+ setting = element;
441
+ if ( _.isObject( element ) ) {
442
+ if ( jQuery( element ).attr( 'data-id' ) ) {
443
+ setting = element.attr( 'data-id' );
444
+ } else {
445
+ setting = element.parents( '[data-id]' ).attr( 'data-id' );
446
+ }
447
+ }
448
+
449
+ parts = setting.split( '[' ),
450
+
451
+ // Find the setting we're using in the control using the customizer API.
452
+ _.each( parts, function( part, i ) {
453
+ part = part.replace( ']', '' );
454
+
455
+ // The current part of the setting.
456
+ currentNode = ( 0 === i ) ? part : '[' + part + ']';
457
+
458
+ // When we find the node, get the value from it.
459
+ // In case of an object we'll need to merge with current values.
460
+ if ( ! _.isUndefined( wp.customize.instance( currentNode ) ) ) {
461
+ foundNode = currentNode;
462
+ currentVal = wp.customize.instance( foundNode ).get();
463
+ }
464
+ } );
465
+
466
+ // Get the remaining part of the setting that was unused.
467
+ subSetting = setting.replace( foundNode, '' );
468
+
469
+ // If subSetting is not empty, then we're dealing with an object
470
+ // and we need to dig deeper and recursively merge the values.
471
+ if ( '' !== subSetting ) {
472
+ if ( ! _.isObject( currentVal ) ) {
473
+ currentVal = {};
474
+ }
475
+ if ( '[' === subSetting.charAt( 0 ) ) {
476
+ subSetting = subSetting.replace( '[', '' );
477
+ }
478
+ subSettingParts = subSetting.split( '[' );
479
+ _.each( subSettingParts, function( subSettingPart, i ) {
480
+ subSettingParts[ i ] = subSettingPart.replace( ']', '' );
481
+ } );
482
+
483
+ // If using a key, we need to go 1 level deeper.
484
+ if ( key ) {
485
+ subSettingParts.push( key );
486
+ }
487
+
488
+ // Converting to a JSON string and then parsing that to an object
489
+ // may seem a bit hacky and crude but it's efficient and works.
490
+ subSettingObj = '{"' + subSettingParts.join( '":{"' ) + '":"' + value + '"' + '}'.repeat( subSettingParts.length );
491
+ subSettingObj = JSON.parse( subSettingObj );
492
+
493
+ // Recursively merge with current value.
494
+ jQuery.extend( true, currentVal, subSettingObj );
495
+ value = currentVal;
496
+
497
+ } else {
498
+ if ( key ) {
499
+ currentVal = ( ! _.isObject( currentVal ) ) ? {} : currentVal;
500
+ currentVal[ key ] = value;
501
+ value = currentVal;
502
+ }
503
+ }
504
+ wp.customize.control( foundNode ).setting.set( value );
505
+ }
506
+ }
507
+ };
508
+ ;/* global kirki */
509
+ /**
510
* The majority of the code in this file
511
* is derived from the wp-customize-posts plugin
512
* and the work of @westonruter to whom I am very grateful.
623
wp.customize.Control.prototype.ready.call( control );
624
625
control.deferred.embedded.done( function() {
626
+ control.initKirkiControl( control );
627
});
628
},
629
686
wp.customize.Control.prototype.focus.call( control, args );
687
},
688
689
+ /**
690
+ * Additional actions that run on ready.
691
+ *
692
+ * @param {object} [args] Args.
693
+ * @returns {void}
694
+ */
695
+ initKirkiControl: function( control ) {
696
+ if ( 'undefined' !== typeof kirki.control[ control.params.type ] ) {
697
+ kirki.control[ control.params.type ].init( control );
698
+ return;
699
+ }
700
701
// Save the value
702
this.container.on( 'change keyup paste click', 'input', function() {
729
}
730
});
731
})();
732
+
733
+ _.each( kirki.control, function( obj, type ) {
734
+ wp.customize.controlConstructor[ type ] = wp.customize.kirkiDynamicControl.extend({});
735
+ } );
736
;/* global kirkiControlLoader */
737
wp.customize.controlConstructor['kirki-background'] = wp.customize.Control.extend({
738
910
}
911
});
912
;wp.customize.controlConstructor['kirki-color-palette'] = wp.customize.kirkiDynamicControl.extend({});
913
;wp.customize.controlConstructor['kirki-dashicons'] = wp.customize.kirkiDynamicControl.extend({});
914
;wp.customize.controlConstructor['kirki-date'] = wp.customize.kirkiDynamicControl.extend({
915
1452
initKirkiControl: function() {
1453
1454
var control = this,
1455
+ value = control.setting._value,
1456
+ html = '',
1457
+ input,
1458
+ up,
1459
+ down;
1460
+
1461
+ // Make sure we use default values if none are define for some arguments.
1462
+ control.params.choices = _.defaults( control.params.choices, {
1463
+ min: 0,
1464
+ max: 100,
1465
+ step: 1
1466
+ } );
1467
1468
+ // Make sure we have a valid value.
1469
+ if ( isNaN( value ) || '' === value ) {
1470
+ value = ( 0 > control.params.choices.min && 0 < control.params.choices.max ) ? 0 : control.params.choices.min;
1471
}
1472
+ value = parseFloat( value );
1473
1474
+ // If step is 'any', set to 0.001.
1475
+ control.params.choices.step = ( 'any' === control.params.choices.step ) ? 0.001 : control.params.choices.step;
1476
1477
+ // Make sure choices are properly formtted as numbers.
1478
+ control.params.choices.min = parseFloat( control.params.choices.min );
1479
+ control.params.choices.max = parseFloat( control.params.choices.max );
1480
+ control.params.choices.step = parseFloat( control.params.choices.step );
1481
1482
+ // Build the HTML for the control.
1483
+ html += '<label>';
1484
+ if ( control.params.label ) {
1485
+ html += '<span class="customize-control-title">' + control.params.label + '</span>';
1486
+ }
1487
+ if ( control.params.description ) {
1488
+ html += '<span class="description customize-control-description">' + control.params.description + '</span>';
1489
+ }
1490
+ html += '<div class="customize-control-content">';
1491
+ html += '<input ' + control.params.inputAttrs + ' type="text" ' + control.params.link + ' value="' + value + '" />';
1492
+ html += '<div class="quantity button minus">-</div>';
1493
+ html += '<div class="quantity button plus">+</div>';
1494
+ html += '</div>';
1495
+ html += '</label>';
1496
1497
+ control.container.html( html );
1498
1499
+ input = control.container.find( 'input' );
1500
+ up = control.container.find( '.plus' );
1501
+ down = control.container.find( '.minus' );
1502
1503
+ up.click( function() {
1504
+ var oldVal = parseFloat( input.val() ),
1505
+ newVal;
1506
1507
+ newVal = ( oldVal >= control.params.choices.max ) ? oldVal : oldVal + control.params.choices.step;
1508
+
1509
+ input.val( newVal );
1510
+ input.trigger( 'change' );
1511
+ } );
1512
+
1513
+ down.click( function() {
1514
+ var oldVal = parseFloat( input.val() ),
1515
+ newVal;
1516
+
1517
+ newVal = ( oldVal <= control.params.choices.min ) ? oldVal : oldVal - control.params.choices.step;
1518
+
1519
+ input.val( newVal );
1520
+ input.trigger( 'change' );
1521
+ } );
1522
+
1523
+ this.container.on( 'change keyup paste click', 'input', function() {
1524
+ control.setting.set( jQuery( this ).val() );
1525
});
1526
}
1527
});
2498
// Set the initial value in the text input.
2499
textInput.attr( 'value', value );
2500
2501
+ // If the range input value changes copy the value to the text input.
2502
+ rangeInput.on( 'mousemove change', function() {
2503
textInput.attr( 'value', rangeInput.val() );
2504
+ } );
2505
+
2506
+ // Save the value when the range input value changes.
2507
+ // This is separate from the above because of the postMessage differences.
2508
+ // If the control refreshes the preview pane,
2509
+ // we don't want a refresh for every change
2510
+ // but 1 final refresh when the value is changed.
2511
+ rangeInput.on( changeAction, function() {
2512
control.setting.set( rangeInput.val() );
2513
} );
2514
controls/js/dist/script.min.js CHANGED
@@ -1 +1 @@
1
- if(_.isUndefined(window.kirkiSetSettingValue))var kirkiSetSettingValue={set:function(e,t){var i,n=this,r=wp.customize.settings.controls[e];if(_.isUndefined(r))return!0;switch(n.setValue(e,t),r.type){case"kirki-background":_.isUndefined(t["background-color"])||n.setColorPicker(n.findElement(e,".kirki-color-control"),t["background-color"]),n.findElement(e,".placeholder, .thumbnail").removeClass().addClass("placeholder").html("No file selected"),_.each(["background-repeat","background-position"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["background-size","background-attachment"],function(i){jQuery(n.findElement(e,"."+i+' input[value="'+t+'"]')).prop("checked",!0)}),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".background-hidden-value").attr("value",i)).trigger("change");break;case"kirki-code":jQuery(n.findElement(e,".CodeMirror"))[0].CodeMirror.setValue(t);break;case"checkbox":case"kirki-switch":case"kirki-toggle":t=1===t||"1"===t||!0===t,jQuery(n.findElement(e,"input")).prop("checked",t),wp.customize.instance(e).set(t);break;case"kirki-select":case"kirki-preset":case"kirki-fontawesome":n.setSelectWoo(n.findElement(e,"select"),t);break;case"kirki-slider":jQuery(n.findElement(e,"input")).prop("value",t),jQuery(n.findElement(e,".kirki_range_value .value")).html(t);break;case"kirki-generic":(_.isUndefined(r.choices)||_.isUndefined(r.choices.element))&&(r.choices.element="input"),jQuery(n.findElement(e,r.choices.element)).prop("value",t);break;case"kirki-color":n.setColorPicker(n.findElement(e,".kirki-color-control"),t);break;case"kirki-multicheck":n.findElement(e,"input").each(function(){jQuery(this).prop("checked",!1)}),_.each(t,function(i,r){jQuery(n.findElement(e,'input[value="'+t[r]+'"]')).prop("checked",!0)});break;case"kirki-multicolor":_.each(t,function(t,i){n.setColorPicker(n.findElement(e,".multicolor-index-"+i),t)});break;case"kirki-radio-buttonset":case"kirki-radio-image":case"kirki-radio":case"kirki-dashicons":case"kirki-color-palette":case"kirki-palette":jQuery(n.findElement(e,'input[value="'+t+'"]')).prop("checked",!0);break;case"kirki-typography":_.each(["font-family","variant","subsets"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["font-size","line-height","letter-spacing","word-spacing"],function(i){_.isUndefined(t[i])||jQuery(n.findElement(e,"."+i+" input")).prop("value",t[i])}),_.isUndefined(t.color)||n.setColorPicker(n.findElement(e,".kirki-color-control"),t.color),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".typography-hidden-value").attr("value",i)).trigger("change");break;case"kirki-dimensions":_.each(t,function(t,i){jQuery(n.findElement(e,"."+i+" input")).prop("value",t)});break;case"kirki-repeater":case"kirki-custom":break;default:jQuery(n.findElement(e,"input")).prop("value",t)}},setColorPicker:function(e,t){e.attr("data-default-color",t).data("default-color",t).wpColorPicker("color",t)},setSelectWoo:function(e,t){jQuery(e).selectWoo().val(t).trigger("change")},setTextarea:function(e,t){jQuery(e).prop("value",t)},findElement:function(e,t){return wp.customize.control(e).container.find(t)},setValue:function(e,t,i){i=_.isUndefined(i)?100:parseInt(i,10),wp.customize.instance(e).set({}),setTimeout(function(){wp.customize.instance(e).set(t)},i)}};!function(){"use strict";wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(e,t){var i=this,n=t||{};n.params=n.params||{},n.params.type||(n.params.type="kirki-generic"),n.params.content||(n.params.content=jQuery("<li></li>"),n.params.content.attr("id","customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-")),n.params.content.attr("class","customize-control customize-control-"+n.params.type)),i.propertyElements=[],wp.customize.Control.prototype.initialize.call(i,e,n)},_setUpSettingRootLinks:function(){var e=this;e.container.find("[data-customize-setting-link]").each(function(){var t=jQuery(this);wp.customize(t.data("customizeSettingLink"),function(i){var n=new wp.customize.Element(t);e.elements.push(n),n.sync(i),n.set(i())})})},_setUpSettingPropertyLinks:function(){var e=this;e.setting&&e.container.find("[data-customize-setting-property-link]").each(function(){var t,i=jQuery(this),n=i.data("customizeSettingPropertyLink");t=new wp.customize.Element(i),e.propertyElements.push(t),t.set(e.setting()[n]),t.bind(function(t){var i=e.setting();t!==i[n]&&((i=_.clone(i))[n]=t,e.setting.set(i))}),e.setting.bind(function(e){e[n]!==t.get()&&t.set(e[n])})})},ready:function(){var e=this;e._setUpSettingRootLinks(),e._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(e),e.deferred.embedded.done(function(){e.initKirkiControl()})},embed:function(){var e=this,t=e.section();t&&wp.customize.section(t,function(t){"kirki-expanded"===t.params.type||t.expanded()||wp.customize.settings.autofocus.control===e.id?e.actuallyEmbed():t.expanded.bind(function(t){t&&e.actuallyEmbed()})})},actuallyEmbed:function(){var e=this;"resolved"!==e.deferred.embedded.state()&&(e.renderContent(),e.deferred.embedded.resolve())},focus:function(e){var t=this;t.actuallyEmbed(),wp.customize.Control.prototype.focus.call(t,e)},initKirkiControl:function(){var e=this;this.container.on("change keyup paste click","input",function(){e.setting.set(jQuery(this).val())})},kirkiValidateCSSValue:function(e){var t,i,n=["rem","em","ex","%","px","cm","mm","in","pt","pc","ch","vh","vw","vmin","vmax"];return"0"===e||0<=e.indexOf("calc(")&&0<=e.indexOf(")")||(t=parseFloat(e),i=e.replace(t,""),!isNaN(t)&&-1!==jQuery.inArray(i,n))}})}(),wp.customize.controlConstructor["kirki-background"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.setting._value,i=e.container.find(".kirki-color-control");(_.isUndefined(t["background-image"])||""===t["background-image"])&&(e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide()),i.wpColorPicker({change:function(){setTimeout(function(){e.saveValue("background-color",i.val())},100)}}),e.container.on("change",".background-repeat select",function(){e.saveValue("background-repeat",jQuery(this).val())}),e.container.on("change click",".background-size input",function(){e.saveValue("background-size",jQuery(this).val())}),e.container.on("change",".background-position select",function(){e.saveValue("background-position",jQuery(this).val())}),e.container.on("change click",".background-attachment input",function(){e.saveValue("background-attachment",jQuery(this).val())}),e.container.on("click",".background-image-upload-button",function(t){var i=wp.media({multiple:!1}).open().on("select",function(){var t,n,r,a=i.state().get("selection").first(),o=a.toJSON().sizes.full.url;_.isUndefined(a.toJSON().sizes.medium)?_.isUndefined(a.toJSON().sizes.thumbnail)||(o=a.toJSON().sizes.thumbnail.url):o=a.toJSON().sizes.medium.url,t=a.toJSON().sizes.full.url,a.toJSON().id,a.toJSON().width,a.toJSON().height,""!==t&&e.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),e.saveValue("background-image",t),n=e.container.find(".placeholder, .thumbnail"),r=e.container.find(".background-image-upload-remove-button"),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+o+'" alt="" />'),r.length&&r.show()});t.preventDefault()}),e.container.on("click",".background-image-upload-remove-button",function(t){var i,n;t.preventDefault(),e.saveValue("background-image",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".background-image-upload-remove-button"),e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide(),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&n.hide()})},saveValue:function(e,t){var i=this,n=jQuery("#customize-control-"+i.id.replace("[","-").replace("]","")+" .background-hidden-value"),r=i.setting._value;r[e]=t,jQuery(n).attr("value",JSON.stringify(r)).trigger("change"),i.setting.set(r)}}),wp.customize.controlConstructor["kirki-code"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.CodeEditorControl)||(jQuery(e.container.find("textarea.kirki-codemirror-editor")).hide(),wp.customize.control.add(new wp.customize.CodeEditorControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,editor_settings:{codemirror:{mode:e.params.choices.language}},settings:{default:e.id}})))}}),wp.customize.controlConstructor["kirki-color-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-color"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.container.find(".kirki-color-control");_.isUndefined(t.params.choices)||i.wpColorPicker(t.params.choices),setTimeout(function(){(e=t.container.find(".wp-picker-clear")).click(function(){t.setting.set("")})},200),i.wpColorPicker({change:function(){setTimeout(function(){t.setting.set(i.val())},20)}})}}),wp.customize.controlConstructor["kirki-dashicons"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-date"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.DateTimeControl)||wp.customize.control.add(new wp.customize.DateTimeControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,description:e.params.description,settings:{default:e.id},default:e.params.default}))}}),wp.customize.controlConstructor["kirki-dimension"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;t.kirkiNotifications(),this.container.on("change keyup paste","input",function(){e=jQuery(this).val(),t.setting.set(e)})},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n="long_title";!1===e.kirkiValidateCSSValue(i)?t.notifications.add(n,new wp.customize.Notification(n,{type:"warning",message:dimensionkirkiL10n["invalid-value"]})):t.notifications.remove(n)})})}}),wp.customize.controlConstructor["kirki-dimensions"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.params.choices.controls,n={},r=[];for(_.each(i,function(e,t){!0===e&&r.push(t)}),e=0;e<r.length;e++)n[r[e]]=t.setting._value[r[e]],t.updateDimensionsValue(r[e],n)},updateDimensionsValue:function(e,t){var i=this;i.container.on("change keyup paste","."+e+" input",function(){t[e]=jQuery(this).val(),i.kirkiNotifications(),i.saveValue(t)})},saveValue:function(e){var t=this,i={};_.each(e,function(e,t){i[t]=e}),t.setting.set(i)},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n,r="long_title",a={};t.notifications.remove(r),_.each(["top","bottom","left","right"],function(t){_.isUndefined(i[t])||(!1===e.kirkiValidateCSSValue(i[t])?a[t]=dimensionskirkiL10n[t]:delete a[t])}),_.isEmpty(a)?t.notifications.remove(r):(n=dimensionskirkiL10n["invalid-value"]+" ("+_.values(a).toString()+") ",t.notifications.add(r,new wp.customize.Notification(r,{type:"warning",message:n})))})})}}),wp.customize.controlConstructor["kirki-editor"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.container.find("textarea"),n="kirki-editor-"+t.id.replace("[","").replace("]","");wp.editor.initialize(n,{tinymce:{wpautop:!0},quicktags:!0,mediaButtons:!0}),(e=tinyMCE.get(n))&&e.onChange.add(function(n){var r;n.save(),r=e.getContent(),i.val(r).trigger("change"),wp.customize.instance(t.id).set(r)})}}),wp.customize.controlConstructor["kirki-fontawesome"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t,i=this,n=this.container.find("select"),r=jQuery.parseJSON(fontAwesomeJSON),a={data:[],escapeMarkup:function(e){return e},templateResult:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text},templateSelection:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text}};_.each(r.icons,function(e){a.data.push({id:e.id,text:e.name})}),(t=jQuery(n).selectWoo(a)).on("change",function(){e=jQuery(this).val(),i.setting.set(e)}),t.val(i.setting._value).trigger("change")}}),wp.customize.controlConstructor["kirki-generic"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-image"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.getValue(),i=_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as,n=e.container.find(".placeholder, .thumbnail"),r="array"===i?t.url:t,a=e.container.find(".image-upload-remove-button"),o=e.container.find(".image-default-button");e.container.find(".kirki-controls-loading-spinner").hide(),"id"!==i&&"ID"!==i||""===t||wp.media.attachment(t).fetch().then(function(e){setTimeout(function(){var e=wp.media.attachment(t).get("url");n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e+'" alt="" />')},700)}),("url"===i&&""!==t||"array"===i&&!_.isUndefined(t.url)&&""!==t.url)&&e.container.find("image-default-button").hide(),("url"===i&&""===t||"array"===i&&(_.isUndefined(t.url)||""===t.url))&&a.hide(),t===e.params.default&&e.container.find("image-default-button").hide(),""!==r&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+r+'" alt="" />'),e.container.on("click",".image-upload-button",function(t){var r=wp.media({multiple:!1}).open().on("select",function(){var t=r.state().get("selection").first(),s=t.toJSON().sizes.full.url;_.isUndefined(t.toJSON().sizes.medium)?_.isUndefined(t.toJSON().sizes.thumbnail)||(s=t.toJSON().sizes.thumbnail.url):s=t.toJSON().sizes.medium.url,"array"===i?(e.saveValue("id",t.toJSON().id),e.saveValue("url",t.toJSON().sizes.full.url),e.saveValue("width",t.toJSON().width),e.saveValue("height",t.toJSON().height)):"id"===i?e.saveValue("id",t.toJSON().id):e.saveValue("url",t.toJSON().sizes.full.url),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+s+'" alt="" />'),a.length&&(a.show(),o.hide())});t.preventDefault()}),e.container.on("click",".image-upload-remove-button",function(t){var i,n,r;t.preventDefault(),e.saveValue("id",""),e.saveValue("url",""),e.saveValue("width",""),e.saveValue("height",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),r=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&(n.hide(),jQuery(r).hasClass("button")&&r.show())}),e.container.on("click",".image-default-button",function(t){var i,n,r;t.preventDefault(),e.saveValue("url",e.params.default),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),r=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e.params.default+'" alt="" />'),n.length&&(n.show(),r.hide())})},getValue:function(){var e=this,t=e.setting._value;return"array"===(_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as)&&_.isString(t)&&(t={url:t}),t},saveValue:function(e,t){var i=this,n=i.setting._value;if("array"===(_.isUndefined(i.params.choices)||_.isUndefined(i.params.choices.save_as)?"url":i.params.choices.save_as))return _.isString(n)&&(n={}),n[e]=t,i.setting.set(n),void i.container.find("button").trigger("change");i.setting.set(t),i.container.find("button").trigger("change")}}),wp.customize.controlConstructor["kirki-multicheck"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;e.container.on("change","input",function(){var t=[],i=0;jQuery.each(e.params.choices,function(n){e.container.find('input[value="'+n+'"]').is(":checked")&&(t[i]=n,i++)}),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-multicolor"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";for(var e,t,i=this,n=i.params.choices,r=Object.keys(n),a=(this.params.value,i.container.find(".iris-target")),o=0;o<Object.keys(n).length;)!function(e,t,i){var r=e.container.find(".multicolor-index-"+i),o={target:a[0],change:function(){setTimeout(function(){e.saveValue(i,r.val()),e.container.find(".multicolor-index-"+i).trigger("change")},100)}};_.isObject(n.irisArgs)&&_.each(n.irisArgs,function(e,t){o[t]=e}),r.wpColorPicker(o)}(this,0,r[o]),e=i.container.find(".wp-picker-container .wp-picker-input-wrap"),t=i.container.find(".wp-picker-container .wp-picker-holder"),jQuery(e[0]).detach().appendTo(a[0]),jQuery(t[0]).detach().appendTo(a[0]),o++},saveValue:function(e,t){var i=this,n=i.container.find(".multicolor-hidden-value"),r=i.setting._value;r[e]=t,jQuery(n).attr("value",JSON.stringify(r)).trigger("change"),i.setting.set(r)}}),wp.customize.controlConstructor["kirki-number"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=this.container.find("input"),i=1;_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.step)||(i="any"===e.params.choices.step?"0.001":e.params.choices.step),jQuery(t).spinner({min:_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.min)?-99999:e.params.choices.min,max:_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.max)?99999:e.params.choices.max,step:i}),this.container.on("change click keyup paste","input",function(){e.setting.set(jQuery(this).val())}),e.kirkiNotifications()},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n="long_title",r=!_.isUndefined(e.params.choices.min)&&Number(e.params.choices.min),a=!_.isUndefined(e.params.choices.max)&&Number(e.params.choices.max),o=!_.isUndefined(e.params.choices.step)&&Number(e.params.choices.step),s=!1;i=Number(i),!1!==r&&i<r?s="min-error":!1!==a&&i>a?s="max-error":!1===o||!1===r||Number.isInteger((i-r)/o)||(s="step-error"),!1!==s?t.notifications.add(n,new wp.customize.Notification(n,{type:"warning",message:numberKirkiL10n[s]})):t.notifications.remove(n)})})}}),wp.customize.controlConstructor["kirki-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-preset"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;this.container.on("change","select",function(){e=jQuery(this).val(),t.setting.set(e),jQuery.each(t.params.choices,function(t,i){e===t&&jQuery.each(i.settings,function(e,t){kirkiSetSettingValue.set(e,t)})}),wp.customize.previewer.refresh()})}}),wp.customize.controlConstructor["kirki-radio-buttonset"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio-image"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio"]=wp.customize.kirkiDynamicControl.extend({});var RepeaterRow=function(e,t,i,n){"use strict";var r=this;this.rowIndex=e,this.container=t,this.label=i,this.header=this.container.find(".repeater-row-header"),this.header.on("click",function(){r.toggleMinimize()}),this.container.on("click",".repeater-row-remove",function(){r.remove()}),this.header.on("mousedown",function(){r.container.trigger("row:start-dragging")}),this.container.on("keyup change","input, select, textarea",function(e){r.container.trigger("row:update",[r.rowIndex,jQuery(e.target).data("field"),e.target])}),this.setRowIndex=function(e){this.rowIndex=e,this.container.attr("data-row",e),this.container.data("row",e),this.updateLabel()},this.toggleMinimize=function(){this.container.toggleClass("minimized"),this.header.find(".dashicons").toggleClass("dashicons-arrow-up").toggleClass("dashicons-arrow-down")},this.remove=function(){this.container.slideUp(300,function(){jQuery(this).detach()}),this.container.trigger("row:remove",[this.rowIndex])},this.updateLabel=function(){var e,t,i;if("field"===this.label.type&&(e=this.container.find('.repeater-field [data-field="'+this.label.field+'"]'),_.isFunction(e.val)&&""!==(t=e.val())))return _.isUndefined(n.params.fields[this.label.field])||_.isUndefined(n.params.fields[this.label.field].type)||("select"===n.params.fields[this.label.field].type?_.isUndefined(n.params.fields[this.label.field].choices)||_.isUndefined(n.params.fields[this.label.field].choices[e.val()])||(t=n.params.fields[this.label.field].choices[e.val()]):"radio"!==n.params.fields[this.label.field].type&&"radio-image"!==n.params.fields[this.label.field].type||(i=n.selector+' [data-row="'+this.rowIndex+'"] .repeater-field [data-field="'+this.label.field+'"]:checked',t=jQuery(i).val())),void this.header.find(".repeater-row-label").text(t);this.header.find(".repeater-row-label").text(this.label.value+" "+(this.rowIndex+1))},this.updateLabel()};wp.customize.controlConstructor.repeater=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t,i=this,n=this.params.value;i.container.find(".kirki-controls-loading-spinner").hide(),this.settingField=this.container.find("[data-customize-setting-link]").first(),this.setValue([],!1),this.repeaterFieldsContainer=this.container.find(".repeater-fields").first(),this.currentIndex=0,this.rows=[],e=!1,_.isUndefined(this.params.choices.limit)||(e=!(0>=this.params.choices.limit)&&parseInt(this.params.choices.limit,10)),this.container.on("click","button.repeater-add",function(n){n.preventDefault(),!e||i.currentIndex<e?((t=i.addRow()).toggleMinimize(),i.initColorPicker(),i.initSelect(t)):jQuery(i.selector+" .limit").addClass("highlight")}),this.container.on("click",".repeater-row-remove",function(){i.currentIndex--,(!e||i.currentIndex<e)&&jQuery(i.selector+" .limit").removeClass("highlight")}),this.container.on("click keypress",".repeater-field-image .upload-button,.repeater-field-cropped_image .upload-button,.repeater-field-upload .upload-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.openFrame(e)}),this.container.on("click keypress",".repeater-field-image .remove-button,.repeater-field-cropped_image .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeImage(e)}),this.container.on("click keypress",".repeater-field-upload .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeFile(e)}),this.repeaterTemplate=_.memoize(function(){var e,t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(n){return(e=_.template(i.container.find(".customize-control-repeater-content").first().html(),null,t))(n)}}),n.length&&_.each(n,function(e){t=i.addRow(e),i.initColorPicker(),i.initSelect(t,e)}),this.setValue(n,!0,!0),this.repeaterFieldsContainer.sortable({handle:".repeater-row-header",update:function(){i.sort()}})},openFrame:function(e){"use strict";wp.customize.utils.isKeydownButNotEnterEvent(e)||(this.$thisButton.closest(".repeater-field").hasClass("repeater-field-cropped_image")?this.initCropperFrame():this.initFrame(),this.frame.open())},initFrame:function(){"use strict";var e=this.getMimeType();this.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1})]}),this.frame.on("select",this.onSelect,this)},initCropperFrame:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field"),t=["width","height","flex_width","flex_height"],i=this.getMimeType();_.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"cropped_image"===this.params.fields[e].type&&t.forEach(function(t){_.isUndefined(this.params.fields[e][t])||(this.params[t]=this.params.fields[e][t])}.bind(this)),this.frame=wp.media({button:{text:"Select and Crop",close:!1},states:[new wp.media.controller.Library({library:wp.media.query({type:i}),multiple:!1,date:!1,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelectForCrop,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.$thisButton.closest(".repeater-field").hasClass("repeater-field-upload")?this.setFileInRepeaterField(e):this.setImageInRepeaterField(e)},onSelectForCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):this.setImageInRepeaterField(e)},onCropped:function(e){"use strict";this.setImageInRepeaterField(e)},calculateImageSelectOptions:function(e,t){"use strict";var i,n,r,a=t.get("control"),o=!!parseInt(a.params.flex_width,10),s=!!parseInt(a.params.flex_height,10),c=e.get("width"),l=e.get("height"),u=parseInt(a.params.width,10),d=parseInt(a.params.height,10),p=u/d,h=c,f=l;return t.set("canSkipCrop",!a.mustBeCropped(o,s,u,d,c,l)),h/f>p?u=(d=f)*p:d=(u=h)/p,i=(h-u)/2,n=(f-d)/2,r={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:c,imageHeight:l,x1:i,y1:n,x2:u+i,y2:d+n},!1===s&&!1===o&&(r.aspectRatio=u+":"+d),!1===s&&(r.maxHeight=d),!1===o&&(r.maxWidth=u),r},mustBeCropped:function(e,t,i,n,r,a){"use strict";return!(!0===e&&!0===t||!0===e&&n===a||!0===t&&i===r||i===r&&n===a||r<=i)},onSkippedCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.setImageInRepeaterField(e)},setImageInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image");t.find(".kirki-image-attachment").html('<img src="'+e.url+'">').hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},setFileInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-upload");t.find(".kirki-file-attachment").html('<span class="file"><span class="dashicons dashicons-media-default"></span> '+e.filename+"</span>").hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".upload-button").show(),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},getMimeType:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field");return _.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"upload"===this.params.fields[e].type&&!_.isUndefined(this.params.fields[e].mime_type)?this.params.fields[e].mime_type:"image"},removeImage:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload")).find(".upload-button"),t.find(".kirki-image-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},removeFile:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-upload")).find(".upload-button"),t.find(".kirki-file-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},getValue:function(){"use strict";return JSON.parse(decodeURI(this.setting.get()))},setValue:function(e,t,i){"use strict";var n=e,r=[];i&&(jQuery.each(this.params.fields,function(e,t){"image"!==t.type&&"cropped_image"!==t.type&&"upload"!==t.type||r.push(e)}),jQuery.each(e,function(e,t){jQuery.each(r,function(i,r){_.isUndefined(t[r])||_.isUndefined(t[r].id)||(n[e][r]=t[r].id)})})),this.setting.set(encodeURI(JSON.stringify(n))),t&&this.settingField.trigger("change")},addRow:function(e){"use strict";var t,i,n,r=this,a=r.repeaterTemplate(),o=this.getValue(),s={};if(a){if(t=jQuery.extend(!0,{},r.params.fields),e)for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(t[n].default=e[n]);t.index=this.currentIndex,a=a(t),(i=new RepeaterRow(r.currentIndex,jQuery(a).appendTo(r.repeaterFieldsContainer),r.params.row_label,r)).container.on("row:remove",function(e,t){r.deleteRow(t)}),i.container.on("row:update",function(e,t,n,a){r.updateField.call(r,e,t,n,a),i.updateLabel()}),this.rows[this.currentIndex]=i;for(n in t)t.hasOwnProperty(n)&&(s[n]=t[n].default);return o[this.currentIndex]=s,this.setValue(o,!0),this.currentIndex++,i}},sort:function(){"use strict";var e=this,t=this.repeaterFieldsContainer.find(".repeater-row"),i=[],n=e.getValue(),r=[],a=[];t.each(function(e,t){i.push(jQuery(t).data("row"))}),jQuery.each(i,function(t,i){r[t]=e.rows[i],r[t].setRowIndex(t),a[t]=n[i]}),e.rows=r,e.setValue(a)},deleteRow:function(e){"use strict";var t,i=this.getValue();i[e]&&this.rows[e]&&(delete i[e],delete this.rows[e],this.setValue(i,!0));for(t in this.rows)this.rows.hasOwnProperty(t)&&this.rows[t]&&(this.rows[t].updateLabel(),0)},updateField:function(e,t,i,n){"use strict";var r,a,o;this.rows[t]&&this.params.fields[i]&&(r=this.params.fields[i].type,a=this.rows[t],o=this.getValue(),n=jQuery(n),_.isUndefined(o[a.rowIndex][i])||(o[a.rowIndex][i]="checkbox"===r?n.is(":checked"):n.val(),this.setValue(o,!0)))},initColorPicker:function(){"use strict";var e=this,t=e.container.find(".color-picker-hex"),i={},n=t.data("field");_.isUndefined(n)||_.isUndefined(e.params.fields[n])||_.isUndefined(e.params.fields[n].palettes)||!_.isObject(e.params.fields[n].palettes)||(i.palettes=e.params.fields[n].palettes),i.change=function(t,i){var n=jQuery(t.target),r=n.closest(".repeater-row").data("row"),a=e.getValue();a[r][n.data("field")]=i.color.toString(),e.setValue(a,!0)},0!==t.length&&t.wpColorPicker(i)},initSelect:function(e,t){"use strict";var i,n,r=this,a=e.container.find(".repeater-field select"),o={};0!==a.length&&(i=a.data("field"),"undefed"!==(n=jQuery(a).data("multiple"))&&jQuery.isNumeric(n)&&1<(n=parseInt(n,10))&&(o.maximumSelectionLength=n),jQuery(a).selectWoo(o).val(t[i]),this.container.on("change",".repeater-field select",function(e){var t=jQuery(e.target),i=t.closest(".repeater-row").data("row"),n=r.getValue();n[i][t.data("field")]=jQuery(this).val(),r.setValue(n)}))}}),wp.customize.controlConstructor["kirki-select"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=this.container.find("select"),n=parseInt(i.data("multiple"),10),r={escapeMarkup:function(e){return e}};1<n&&(r.maximumSelectionLength=n),jQuery(i).selectWoo(r).on("change",function(){e=jQuery(this).val(),t.setting.set(e)})}}),wp.customize.controlConstructor["kirki-slider"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t="postMessage"===e.setting.transport?"mousemove change":"change",i=e.container.find('input[type="range"]'),n=e.container.find('input[type="text"]'),r=e.setting._value;n.attr("value",r),i.on(t,function(){n.attr("value",i.val()),e.setting.set(i.val())}),n.on("input paste change",function(){i.attr("value",n.val()),e.setting.set(n.val())}),e.container.find(".slider-reset").on("click",function(){n.attr("value",e.params.default),i.attr("value",e.params.default),e.setting.set(n.val())})}}),wp.customize.controlConstructor["kirki-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e=this;e.container.find(".kirki-controls-loading-spinner").hide(),e.sortableContainer=e.container.find("ul.sortable").first(),e.sortableContainer.sortable({stop:function(){e.updateValue()}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.updateValue()})},updateValue:function(){"use strict";var e=this,t=[];this.sortableContainer.find("li").each(function(){jQuery(this).is(".invisible")||t.push(jQuery(this).data("value"))}),e.setting.set(t)}}),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e=this,t=e.setting._value,i=jQuery(e.container.find(".switch-on")),n=jQuery(e.container.find(".switch-off"));jQuery(e.container.find(".switch label ")).css("width",i.width()+n.width()+40+"px"),jQuery("#customize-control-"+e.id.replace("[","-").replace("]","")).append("<style>#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch label:after{width:"+(i.width()+13)+"px;}#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch input:checked + label:after{left:"+(i.width()+22)+"px;width:"+(n.width()+13)+"px;}</style>"),this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-typography"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t=this,i=t.setting._value;t.renderFontSelector(),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector(),t.params.default["font-size"]&&this.container.on("change keyup paste",".font-size input",function(){t.saveValue("font-size",jQuery(this).val())}),t.params.default["line-height"]&&this.container.on("change keyup paste",".line-height input",function(){t.saveValue("line-height",jQuery(this).val())}),t.params.default["margin-top"]&&this.container.on("change keyup paste",".margin-top input",function(){t.saveValue("margin-top",jQuery(this).val())}),t.params.default["margin-bottom"]&&this.container.on("change keyup paste",".margin-bottom input",function(){t.saveValue("margin-bottom",jQuery(this).val())}),t.params.default["letter-spacing"]&&(i["letter-spacing"]=jQuery.isNumeric(i["letter-spacing"])?i["letter-spacing"]+"px":i["letter-spacing"],this.container.on("change keyup paste",".letter-spacing input",function(){i["letter-spacing"]=jQuery.isNumeric(jQuery(this).val())?jQuery(this).val()+"px":jQuery(this).val(),t.saveValue("letter-spacing",i["letter-spacing"])})),t.params.default["word-spacing"]&&this.container.on("change keyup paste",".word-spacing input",function(){t.saveValue("word-spacing",jQuery(this).val())}),t.params.default["text-align"]&&this.container.on("change",".text-align input",function(){t.saveValue("text-align",jQuery(this).val())}),t.params.default["text-transform"]&&jQuery(t.selector+" .text-transform select").selectWoo().on("change",function(){t.saveValue("text-transform",jQuery(this).val())}),t.params.default.color&&(e=this.container.find(".kirki-color-control")).wpColorPicker({change:function(){setTimeout(function(){t.saveValue("color",e.val())},100)}})},renderFontSelector:function(){var e,t=this,i=t.selector+" .font-family select",n=[],r=[],a=[],o=t.setting._value,s=t.getFonts();_.isUndefined(s.standard)||_.each(s.standard,function(e){r.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),_.isUndefined(s.standard)||_.each(s.google,function(e){a.push({id:e.family,text:e.label})}),n=[{text:"Standard Fonts",children:r},{text:"Google Fonts",children:a}],e=jQuery(i).selectWoo({data:n}),o["font-family"]&&e.val(o["font-family"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-family",jQuery(this).val()),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector()})},renderBackupFontSelector:function(){var e,t=this,i=t.selector+" .font-backup select",n=[],r=t.setting._value,a=r["font-family"],o=t.getVariants(a),s=t.getFonts();(_.isUndefined(r["font-backup"])||null===r["font-backup"])&&(r["font-backup"]=""),!1!==o?jQuery(t.selector+" .font-backup").show():jQuery(t.selector+" .font-backup").hide(),_.isUndefined(s.standard)||_.each(s.standard,function(e){n.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),e=jQuery(i).selectWoo({data:n}),void 0!==r["font-backup"]&&e.val(r["font-backup"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-backup",jQuery(this).val())})},renderVariantSelector:function(){var e,t,i,n=this,r=n.setting._value,a=r["font-family"],o=n.getVariants(a),s=n.selector+" .variant select",c=[],l=!1;!1!==o?(jQuery(n.selector+" .variant").show(),_.each(o,function(e){r.variant===e.id&&(l=!0),c.push({id:e.id,text:e.label})}),l||(r.variant="regular"),jQuery(s).hasClass("select2-hidden-accessible")&&(jQuery(s).selectWoo("destroy"),jQuery(s).empty()),(t=jQuery(s).selectWoo({data:c})).val(r.variant).trigger("change"),t.on("change",function(){n.saveValue("variant",jQuery(this).val()),e=_.isString(r.variant)?r.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",i=-1!==r.variant.indexOf("italic")?"italic":"normal",n.saveValue("font-weight",e),n.saveValue("font-style",i)})):jQuery(n.selector+" .variant").hide()},renderSubsetSelector:function(){var e,t=this,i=t.setting._value,n=i["font-family"],r=t.getSubsets(n),a=t.selector+" .subsets select",o=[],s=i.subsets;!1!==r?(jQuery(t.selector+" .subsets").show(),_.each(r,function(e){_.isObject(s)&&-1===s.indexOf(e.id)&&(s=_.reject(s,function(t){return t===e.id})),o.push({id:e.id,text:e.label})})):jQuery(t.selector+" .subsets").hide(),jQuery(a).hasClass("select2-hidden-accessible")&&(jQuery(a).selectWoo("destroy"),jQuery(a).empty()),(e=jQuery(a).selectWoo({data:o})).val(s).trigger("change"),e.on("change",function(){t.saveValue("subsets",jQuery(this).val())})},getFonts:function(){var e=this;return _.isUndefined(window["kirkiFonts"+e.id])?_.isUndefined(kirkiAllFonts)?{google:[],standard:[]}:kirkiAllFonts:window["kirkiFonts"+e.id]},getVariants:function(e){var t=this.getFonts(),i=!1;return _.each(t.standard,function(t){if(e&&t.family===e.replace(/'/g,'"'))return i=t.variants,t.variants}),_.each(t.google,function(t){if(t.family===e)return i=t.variants,t.variants}),i},getSubsets:function(e){var t=!1,i=this.getFonts();return _.each(i.google,function(i){i.family===e&&(t=i.subsets)}),t},saveValue:function(e,t){var i=this,n=i.container.find(".typography-hidden-value"),r=i.setting._value;r[e]=t,jQuery(n).attr("value",JSON.stringify(r)).trigger("change"),i.setting.set(r)}});
1
+ if(_.isUndefined(window.kirkiSetSettingValue))var kirkiSetSettingValue={set:function(e,t){var i,n=this,a=wp.customize.settings.controls[e];if(_.isUndefined(a))return!0;switch(n.setValue(e,t),a.type){case"kirki-background":_.isUndefined(t["background-color"])||n.setColorPicker(n.findElement(e,".kirki-color-control"),t["background-color"]),n.findElement(e,".placeholder, .thumbnail").removeClass().addClass("placeholder").html("No file selected"),_.each(["background-repeat","background-position"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["background-size","background-attachment"],function(i){jQuery(n.findElement(e,"."+i+' input[value="'+t+'"]')).prop("checked",!0)}),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".background-hidden-value").attr("value",i)).trigger("change");break;case"kirki-code":jQuery(n.findElement(e,".CodeMirror"))[0].CodeMirror.setValue(t);break;case"checkbox":case"kirki-switch":case"kirki-toggle":t=1===t||"1"===t||!0===t,jQuery(n.findElement(e,"input")).prop("checked",t),wp.customize.instance(e).set(t);break;case"kirki-select":case"kirki-preset":case"kirki-fontawesome":n.setSelectWoo(n.findElement(e,"select"),t);break;case"kirki-slider":jQuery(n.findElement(e,"input")).prop("value",t),jQuery(n.findElement(e,".kirki_range_value .value")).html(t);break;case"kirki-generic":(_.isUndefined(a.choices)||_.isUndefined(a.choices.element))&&(a.choices.element="input"),jQuery(n.findElement(e,a.choices.element)).prop("value",t);break;case"kirki-color":n.setColorPicker(n.findElement(e,".kirki-color-control"),t);break;case"kirki-multicheck":n.findElement(e,"input").each(function(){jQuery(this).prop("checked",!1)}),_.each(t,function(i,a){jQuery(n.findElement(e,'input[value="'+t[a]+'"]')).prop("checked",!0)});break;case"kirki-multicolor":_.each(t,function(t,i){n.setColorPicker(n.findElement(e,".multicolor-index-"+i),t)});break;case"kirki-radio-buttonset":case"kirki-radio-image":case"kirki-radio":case"kirki-dashicons":case"kirki-color-palette":case"kirki-palette":jQuery(n.findElement(e,'input[value="'+t+'"]')).prop("checked",!0);break;case"kirki-typography":_.each(["font-family","variant","subsets"],function(i){_.isUndefined(t[i])||n.setSelectWoo(n.findElement(e,"."+i+" select"),t[i])}),_.each(["font-size","line-height","letter-spacing","word-spacing"],function(i){_.isUndefined(t[i])||jQuery(n.findElement(e,"."+i+" input")).prop("value",t[i])}),_.isUndefined(t.color)||n.setColorPicker(n.findElement(e,".kirki-color-control"),t.color),i=JSON.stringify(t).replace(/'/g,"&#39"),jQuery(n.findElement(e,".typography-hidden-value").attr("value",i)).trigger("change");break;case"kirki-dimensions":_.each(t,function(t,i){jQuery(n.findElement(e,"."+i+" input")).prop("value",t)});break;case"kirki-repeater":case"kirki-custom":break;default:jQuery(n.findElement(e,"input")).prop("value",t)}},setColorPicker:function(e,t){e.attr("data-default-color",t).data("default-color",t).wpColorPicker("color",t)},setSelectWoo:function(e,t){jQuery(e).selectWoo().val(t).trigger("change")},setTextarea:function(e,t){jQuery(e).prop("value",t)},findElement:function(e,t){return wp.customize.control(e).container.find(t)},setValue:function(e,t,i){i=_.isUndefined(i)?100:parseInt(i,10),wp.customize.instance(e).set({}),setTimeout(function(){wp.customize.instance(e).set(t)},i)}};var kirki={control:{"kirki-color":{init:function(e){this.template(e),kirki.input.color.init(e)},template:function(e){e.container.html(kirki.input.color.getTemplate({label:e.params.label,description:e.params.description,"data-id":e.id,mode:e.params.mode,inputAttrs:e.params.inputAttrs,"data-palette":e.params.palette,"data-default-color":e.params.default,"data-alpha":e.params.choices.alpha,value:e.setting._value}))}}},input:{color:{getTemplate:function(e){var t="";return e=_.defaults(e,{label:"",description:"",mode:"full",inputAttrs:"","data-palette":!e["data-palette"]||e["data-palette"],"data-default-color":e["data-default-color"]?e["data-default-color"]:"","data-alpha":!!e["data-alpha"]&&e["data-alpha"],value:"","data-id":""}),t+="<label>",e.label&&(t+='<span class="customize-control-title">'+e.label+"</span>"),e.description&&(t+='<span class="description customize-control-description">'+e.description+"</span>"),t+="</label>",t+='<input type="text" data-type="'+e.mode+'" '+e.inputAttrs+' data-palette="'+e["data-palette"]+'" data-default-color="'+e["data-default-color"]+'" data-alpha="'+e["data-alpha"]+'" value="'+e.value+'" class="kirki-color-control" data-id="'+e["data-id"]+'"/>','<div class="kirki-input-container" data-id="'+e.id+'">'+t+"</div>"},init:function(e){var t,i=jQuery('.kirki-color-control[data-id="'+e.id+'"]');e.choices=e.choices||{},_.isEmpty(e.choices)&&e.params.choices&&(e.choices=e.params.choices),_.isEmpty(e.choices)||i.wpColorPicker(e.choices),setTimeout(function(){(t=jQuery('.kirki-input-container[data-id="'+e.id+'"] .wp-picker-clear')).length&&t.click(function(){e.setting.set("")})},200),i.wpColorPicker({change:function(){setTimeout(function(){kirki.setting.set(e.id,i.val())},20)}})}}},setting:{get:function(e){var t=e.split("["),i="",n=0,a="";return _.each(t,function(e,t){e=e.replace("]",""),0===t?i=e:i+="["+e+"]",_.isUndefined(wp.customize.instance(i))||(a=wp.customize.instance(i).get(),n=t),n<t&&_.isObject(a)&&!_.isUndefined(a[e])&&(a=a[e])}),a},set:function(e,t,i){var n,a,r,o,s,c="",l="",u={};n=e,_.isObject(e)&&(n=jQuery(e).attr("data-id")?e.attr("data-id"):e.parents("[data-id]").attr("data-id")),a=n.split("["),_.each(a,function(e,t){e=e.replace("]",""),c=0===t?e:"["+e+"]",_.isUndefined(wp.customize.instance(c))||(l=c,r=wp.customize.instance(l).get())}),""!==(o=n.replace(l,""))?(_.isObject(r)||(r={}),"["===o.charAt(0)&&(o=o.replace("[","")),s=o.split("["),_.each(s,function(e,t){s[t]=e.replace("]","")}),i&&s.push(i),u='{"'+s.join('":{"')+'":"'+t+'"'+"}".repeat(s.length),u=JSON.parse(u),jQuery.extend(!0,r,u),t=r):i&&((r=_.isObject(r)?r:{})[i]=t,t=r),wp.customize.control(l).setting.set(t)}}};!function(){"use strict";wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(e,t){var i=this,n=t||{};n.params=n.params||{},n.params.type||(n.params.type="kirki-generic"),n.params.content||(n.params.content=jQuery("<li></li>"),n.params.content.attr("id","customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-")),n.params.content.attr("class","customize-control customize-control-"+n.params.type)),i.propertyElements=[],wp.customize.Control.prototype.initialize.call(i,e,n)},_setUpSettingRootLinks:function(){var e=this;e.container.find("[data-customize-setting-link]").each(function(){var t=jQuery(this);wp.customize(t.data("customizeSettingLink"),function(i){var n=new wp.customize.Element(t);e.elements.push(n),n.sync(i),n.set(i())})})},_setUpSettingPropertyLinks:function(){var e=this;e.setting&&e.container.find("[data-customize-setting-property-link]").each(function(){var t,i=jQuery(this),n=i.data("customizeSettingPropertyLink");t=new wp.customize.Element(i),e.propertyElements.push(t),t.set(e.setting()[n]),t.bind(function(t){var i=e.setting();t!==i[n]&&((i=_.clone(i))[n]=t,e.setting.set(i))}),e.setting.bind(function(e){e[n]!==t.get()&&t.set(e[n])})})},ready:function(){var e=this;e._setUpSettingRootLinks(),e._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(e),e.deferred.embedded.done(function(){e.initKirkiControl(e)})},embed:function(){var e=this,t=e.section();t&&wp.customize.section(t,function(t){"kirki-expanded"===t.params.type||t.expanded()||wp.customize.settings.autofocus.control===e.id?e.actuallyEmbed():t.expanded.bind(function(t){t&&e.actuallyEmbed()})})},actuallyEmbed:function(){var e=this;"resolved"!==e.deferred.embedded.state()&&(e.renderContent(),e.deferred.embedded.resolve())},focus:function(e){var t=this;t.actuallyEmbed(),wp.customize.Control.prototype.focus.call(t,e)},initKirkiControl:function(e){void 0===kirki.control[e.params.type]?this.container.on("change keyup paste click","input",function(){e.setting.set(jQuery(this).val())}):kirki.control[e.params.type].init(e)},kirkiValidateCSSValue:function(e){var t,i,n=["rem","em","ex","%","px","cm","mm","in","pt","pc","ch","vh","vw","vmin","vmax"];return"0"===e||0<=e.indexOf("calc(")&&0<=e.indexOf(")")||(t=parseFloat(e),i=e.replace(t,""),!isNaN(t)&&-1!==jQuery.inArray(i,n))}})}(),_.each(kirki.control,function(e,t){wp.customize.controlConstructor[t]=wp.customize.kirkiDynamicControl.extend({})}),wp.customize.controlConstructor["kirki-background"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.setting._value,i=e.container.find(".kirki-color-control");(_.isUndefined(t["background-image"])||""===t["background-image"])&&(e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide()),i.wpColorPicker({change:function(){setTimeout(function(){e.saveValue("background-color",i.val())},100)}}),e.container.on("change",".background-repeat select",function(){e.saveValue("background-repeat",jQuery(this).val())}),e.container.on("change click",".background-size input",function(){e.saveValue("background-size",jQuery(this).val())}),e.container.on("change",".background-position select",function(){e.saveValue("background-position",jQuery(this).val())}),e.container.on("change click",".background-attachment input",function(){e.saveValue("background-attachment",jQuery(this).val())}),e.container.on("click",".background-image-upload-button",function(t){var i=wp.media({multiple:!1}).open().on("select",function(){var t,n,a,r=i.state().get("selection").first(),o=r.toJSON().sizes.full.url;_.isUndefined(r.toJSON().sizes.medium)?_.isUndefined(r.toJSON().sizes.thumbnail)||(o=r.toJSON().sizes.thumbnail.url):o=r.toJSON().sizes.medium.url,t=r.toJSON().sizes.full.url,r.toJSON().id,r.toJSON().width,r.toJSON().height,""!==t&&e.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),e.saveValue("background-image",t),n=e.container.find(".placeholder, .thumbnail"),a=e.container.find(".background-image-upload-remove-button"),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+o+'" alt="" />'),a.length&&a.show()});t.preventDefault()}),e.container.on("click",".background-image-upload-remove-button",function(t){var i,n;t.preventDefault(),e.saveValue("background-image",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".background-image-upload-remove-button"),e.container.find(".background-wrapper > .background-repeat").hide(),e.container.find(".background-wrapper > .background-position").hide(),e.container.find(".background-wrapper > .background-size").hide(),e.container.find(".background-wrapper > .background-attachment").hide(),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&n.hide()})},saveValue:function(e,t){var i=this,n=jQuery("#customize-control-"+i.id.replace("[","-").replace("]","")+" .background-hidden-value"),a=i.setting._value;a[e]=t,jQuery(n).attr("value",JSON.stringify(a)).trigger("change"),i.setting.set(a)}}),wp.customize.controlConstructor["kirki-code"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.CodeEditorControl)||(jQuery(e.container.find("textarea.kirki-codemirror-editor")).hide(),wp.customize.control.add(new wp.customize.CodeEditorControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,editor_settings:{codemirror:{mode:e.params.choices.language}},settings:{default:e.id}})))}}),wp.customize.controlConstructor["kirki-color-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-dashicons"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-date"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;_.isUndefined(wp.customize.DateTimeControl)||wp.customize.control.add(new wp.customize.DateTimeControl(e.id,{section:e.params.section,priority:e.params.priority,label:e.params.label,description:e.params.description,settings:{default:e.id},default:e.params.default}))}}),wp.customize.controlConstructor["kirki-dimension"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;t.kirkiNotifications(),this.container.on("change keyup paste","input",function(){e=jQuery(this).val(),t.setting.set(e)})},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n="long_title";!1===e.kirkiValidateCSSValue(i)?t.notifications.add(n,new wp.customize.Notification(n,{type:"warning",message:dimensionkirkiL10n["invalid-value"]})):t.notifications.remove(n)})})}}),wp.customize.controlConstructor["kirki-dimensions"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.params.choices.controls,n={},a=[];for(_.each(i,function(e,t){!0===e&&a.push(t)}),e=0;e<a.length;e++)n[a[e]]=t.setting._value[a[e]],t.updateDimensionsValue(a[e],n)},updateDimensionsValue:function(e,t){var i=this;i.container.on("change keyup paste","."+e+" input",function(){t[e]=jQuery(this).val(),i.kirkiNotifications(),i.saveValue(t)})},saveValue:function(e){var t=this,i={};_.each(e,function(e,t){i[t]=e}),t.setting.set(i)},kirkiNotifications:function(){var e=this;wp.customize(e.id,function(t){t.bind(function(i){var n,a="long_title",r={};t.notifications.remove(a),_.each(["top","bottom","left","right"],function(t){_.isUndefined(i[t])||(!1===e.kirkiValidateCSSValue(i[t])?r[t]=dimensionskirkiL10n[t]:delete r[t])}),_.isEmpty(r)?t.notifications.remove(a):(n=dimensionskirkiL10n["invalid-value"]+" ("+_.values(r).toString()+") ",t.notifications.add(a,new wp.customize.Notification(a,{type:"warning",message:n})))})})}}),wp.customize.controlConstructor["kirki-editor"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=t.container.find("textarea"),n="kirki-editor-"+t.id.replace("[","").replace("]","");wp.editor.initialize(n,{tinymce:{wpautop:!0},quicktags:!0,mediaButtons:!0}),(e=tinyMCE.get(n))&&e.onChange.add(function(n){var a;n.save(),a=e.getContent(),i.val(a).trigger("change"),wp.customize.instance(t.id).set(a)})}}),wp.customize.controlConstructor["kirki-fontawesome"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t,i=this,n=this.container.find("select"),a=jQuery.parseJSON(fontAwesomeJSON),r={data:[],escapeMarkup:function(e){return e},templateResult:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text},templateSelection:function(e){return'<i class="fa fa-lg fa-'+e.id+'" aria-hidden="true"></i> '+e.text}};_.each(a.icons,function(e){r.data.push({id:e.id,text:e.name})}),(t=jQuery(n).selectWoo(r)).on("change",function(){e=jQuery(this).val(),i.setting.set(e)}),t.val(i.setting._value).trigger("change")}}),wp.customize.controlConstructor["kirki-generic"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-image"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){var e=this,t=e.getValue(),i=_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as,n=e.container.find(".placeholder, .thumbnail"),a="array"===i?t.url:t,r=e.container.find(".image-upload-remove-button"),o=e.container.find(".image-default-button");e.container.find(".kirki-controls-loading-spinner").hide(),"id"!==i&&"ID"!==i||""===t||wp.media.attachment(t).fetch().then(function(e){setTimeout(function(){var e=wp.media.attachment(t).get("url");n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e+'" alt="" />')},700)}),("url"===i&&""!==t||"array"===i&&!_.isUndefined(t.url)&&""!==t.url)&&e.container.find("image-default-button").hide(),("url"===i&&""===t||"array"===i&&(_.isUndefined(t.url)||""===t.url))&&r.hide(),t===e.params.default&&e.container.find("image-default-button").hide(),""!==a&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+a+'" alt="" />'),e.container.on("click",".image-upload-button",function(t){var a=wp.media({multiple:!1}).open().on("select",function(){var t=a.state().get("selection").first(),s=t.toJSON().sizes.full.url;_.isUndefined(t.toJSON().sizes.medium)?_.isUndefined(t.toJSON().sizes.thumbnail)||(s=t.toJSON().sizes.thumbnail.url):s=t.toJSON().sizes.medium.url,"array"===i?(e.saveValue("id",t.toJSON().id),e.saveValue("url",t.toJSON().sizes.full.url),e.saveValue("width",t.toJSON().width),e.saveValue("height",t.toJSON().height)):"id"===i?e.saveValue("id",t.toJSON().id):e.saveValue("url",t.toJSON().sizes.full.url),n.length&&n.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+s+'" alt="" />'),r.length&&(r.show(),o.hide())});t.preventDefault()}),e.container.on("click",".image-upload-remove-button",function(t){var i,n,a;t.preventDefault(),e.saveValue("id",""),e.saveValue("url",""),e.saveValue("width",""),e.saveValue("height",""),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),a=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("placeholder").html("No file selected"),n.length&&(n.hide(),jQuery(a).hasClass("button")&&a.show())}),e.container.on("click",".image-default-button",function(t){var i,n,a;t.preventDefault(),e.saveValue("url",e.params.default),i=e.container.find(".placeholder, .thumbnail"),n=e.container.find(".image-upload-remove-button"),a=e.container.find(".image-default-button"),i.length&&i.removeClass().addClass("thumbnail thumbnail-image").html('<img src="'+e.params.default+'" alt="" />'),n.length&&(n.show(),a.hide())})},getValue:function(){var e=this,t=e.setting._value;return"array"===(_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.save_as)?"url":e.params.choices.save_as)&&_.isString(t)&&(t={url:t}),t},saveValue:function(e,t){var i=this,n=i.setting._value;if("array"===(_.isUndefined(i.params.choices)||_.isUndefined(i.params.choices.save_as)?"url":i.params.choices.save_as))return _.isString(n)&&(n={}),n[e]=t,i.setting.set(n),void i.container.find("button").trigger("change");i.setting.set(t),i.container.find("button").trigger("change")}}),wp.customize.controlConstructor["kirki-multicheck"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this;e.container.on("change","input",function(){var t=[],i=0;jQuery.each(e.params.choices,function(n){e.container.find('input[value="'+n+'"]').is(":checked")&&(t[i]=n,i++)}),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-multicolor"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";for(var e,t,i=this,n=i.params.choices,a=Object.keys(n),r=(this.params.value,i.container.find(".iris-target")),o=0;o<Object.keys(n).length;)!function(e,t,i){var a=e.container.find(".multicolor-index-"+i),o={target:r[0],change:function(){setTimeout(function(){e.saveValue(i,a.val()),e.container.find(".multicolor-index-"+i).trigger("change")},100)}};_.isObject(n.irisArgs)&&_.each(n.irisArgs,function(e,t){o[t]=e}),a.wpColorPicker(o)}(this,0,a[o]),e=i.container.find(".wp-picker-container .wp-picker-input-wrap"),t=i.container.find(".wp-picker-container .wp-picker-holder"),jQuery(e[0]).detach().appendTo(r[0]),jQuery(t[0]).detach().appendTo(r[0]),o++},saveValue:function(e,t){var i=this,n=i.container.find(".multicolor-hidden-value"),a=i.setting._value;a[e]=t,jQuery(n).attr("value",JSON.stringify(a)).trigger("change"),i.setting.set(a)}}),wp.customize.controlConstructor["kirki-number"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t,i,n=this,a=n.setting._value,r="";n.params.choices=_.defaults(n.params.choices,{min:0,max:100,step:1}),(isNaN(a)||""===a)&&(a=0>n.params.choices.min&&0<n.params.choices.max?0:n.params.choices.min),a=parseFloat(a),n.params.choices.step="any"===n.params.choices.step?.001:n.params.choices.step,n.params.choices.min=parseFloat(n.params.choices.min),n.params.choices.max=parseFloat(n.params.choices.max),n.params.choices.step=parseFloat(n.params.choices.step),r+="<label>",n.params.label&&(r+='<span class="customize-control-title">'+n.params.label+"</span>"),n.params.description&&(r+='<span class="description customize-control-description">'+n.params.description+"</span>"),r+='<div class="customize-control-content">',r+="<input "+n.params.inputAttrs+' type="text" '+n.params.link+' value="'+a+'" />',r+='<div class="quantity button minus">-</div>',r+='<div class="quantity button plus">+</div>',r+="</div>",r+="</label>",n.container.html(r),e=n.container.find("input"),t=n.container.find(".plus"),i=n.container.find(".minus"),t.click(function(){var t,i=parseFloat(e.val());t=i>=n.params.choices.max?i:i+n.params.choices.step,e.val(t),e.trigger("change")}),i.click(function(){var t,i=parseFloat(e.val());t=i<=n.params.choices.min?i:i-n.params.choices.step,e.val(t),e.trigger("change")}),this.container.on("change keyup paste click","input",function(){n.setting.set(jQuery(this).val())})}}),wp.customize.controlConstructor["kirki-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-preset"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;this.container.on("change","select",function(){e=jQuery(this).val(),t.setting.set(e),jQuery.each(t.params.choices,function(t,i){e===t&&jQuery.each(i.settings,function(e,t){kirkiSetSettingValue.set(e,t)})}),wp.customize.previewer.refresh()})}}),wp.customize.controlConstructor["kirki-radio-buttonset"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio-image"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio"]=wp.customize.kirkiDynamicControl.extend({});var RepeaterRow=function(e,t,i,n){"use strict";var a=this;this.rowIndex=e,this.container=t,this.label=i,this.header=this.container.find(".repeater-row-header"),this.header.on("click",function(){a.toggleMinimize()}),this.container.on("click",".repeater-row-remove",function(){a.remove()}),this.header.on("mousedown",function(){a.container.trigger("row:start-dragging")}),this.container.on("keyup change","input, select, textarea",function(e){a.container.trigger("row:update",[a.rowIndex,jQuery(e.target).data("field"),e.target])}),this.setRowIndex=function(e){this.rowIndex=e,this.container.attr("data-row",e),this.container.data("row",e),this.updateLabel()},this.toggleMinimize=function(){this.container.toggleClass("minimized"),this.header.find(".dashicons").toggleClass("dashicons-arrow-up").toggleClass("dashicons-arrow-down")},this.remove=function(){this.container.slideUp(300,function(){jQuery(this).detach()}),this.container.trigger("row:remove",[this.rowIndex])},this.updateLabel=function(){var e,t,i;if("field"===this.label.type&&(e=this.container.find('.repeater-field [data-field="'+this.label.field+'"]'),_.isFunction(e.val)&&""!==(t=e.val())))return _.isUndefined(n.params.fields[this.label.field])||_.isUndefined(n.params.fields[this.label.field].type)||("select"===n.params.fields[this.label.field].type?_.isUndefined(n.params.fields[this.label.field].choices)||_.isUndefined(n.params.fields[this.label.field].choices[e.val()])||(t=n.params.fields[this.label.field].choices[e.val()]):"radio"!==n.params.fields[this.label.field].type&&"radio-image"!==n.params.fields[this.label.field].type||(i=n.selector+' [data-row="'+this.rowIndex+'"] .repeater-field [data-field="'+this.label.field+'"]:checked',t=jQuery(i).val())),void this.header.find(".repeater-row-label").text(t);this.header.find(".repeater-row-label").text(this.label.value+" "+(this.rowIndex+1))},this.updateLabel()};wp.customize.controlConstructor.repeater=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t,i=this,n=this.params.value;i.container.find(".kirki-controls-loading-spinner").hide(),this.settingField=this.container.find("[data-customize-setting-link]").first(),this.setValue([],!1),this.repeaterFieldsContainer=this.container.find(".repeater-fields").first(),this.currentIndex=0,this.rows=[],e=!1,_.isUndefined(this.params.choices.limit)||(e=!(0>=this.params.choices.limit)&&parseInt(this.params.choices.limit,10)),this.container.on("click","button.repeater-add",function(n){n.preventDefault(),!e||i.currentIndex<e?((t=i.addRow()).toggleMinimize(),i.initColorPicker(),i.initSelect(t)):jQuery(i.selector+" .limit").addClass("highlight")}),this.container.on("click",".repeater-row-remove",function(){i.currentIndex--,(!e||i.currentIndex<e)&&jQuery(i.selector+" .limit").removeClass("highlight")}),this.container.on("click keypress",".repeater-field-image .upload-button,.repeater-field-cropped_image .upload-button,.repeater-field-upload .upload-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.openFrame(e)}),this.container.on("click keypress",".repeater-field-image .remove-button,.repeater-field-cropped_image .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeImage(e)}),this.container.on("click keypress",".repeater-field-upload .remove-button",function(e){e.preventDefault(),i.$thisButton=jQuery(this),i.removeFile(e)}),this.repeaterTemplate=_.memoize(function(){var e,t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(n){return(e=_.template(i.container.find(".customize-control-repeater-content").first().html(),null,t))(n)}}),n.length&&_.each(n,function(e){t=i.addRow(e),i.initColorPicker(),i.initSelect(t,e)}),this.setValue(n,!0,!0),this.repeaterFieldsContainer.sortable({handle:".repeater-row-header",update:function(){i.sort()}})},openFrame:function(e){"use strict";wp.customize.utils.isKeydownButNotEnterEvent(e)||(this.$thisButton.closest(".repeater-field").hasClass("repeater-field-cropped_image")?this.initCropperFrame():this.initFrame(),this.frame.open())},initFrame:function(){"use strict";var e=this.getMimeType();this.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1})]}),this.frame.on("select",this.onSelect,this)},initCropperFrame:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field"),t=["width","height","flex_width","flex_height"],i=this.getMimeType();_.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"cropped_image"===this.params.fields[e].type&&t.forEach(function(t){_.isUndefined(this.params.fields[e][t])||(this.params[t]=this.params.fields[e][t])}.bind(this)),this.frame=wp.media({button:{text:"Select and Crop",close:!1},states:[new wp.media.controller.Library({library:wp.media.query({type:i}),multiple:!1,date:!1,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelectForCrop,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.$thisButton.closest(".repeater-field").hasClass("repeater-field-upload")?this.setFileInRepeaterField(e):this.setImageInRepeaterField(e)},onSelectForCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):this.setImageInRepeaterField(e)},onCropped:function(e){"use strict";this.setImageInRepeaterField(e)},calculateImageSelectOptions:function(e,t){"use strict";var i,n,a,r=t.get("control"),o=!!parseInt(r.params.flex_width,10),s=!!parseInt(r.params.flex_height,10),c=e.get("width"),l=e.get("height"),u=parseInt(r.params.width,10),d=parseInt(r.params.height,10),p=u/d,h=c,f=l;return t.set("canSkipCrop",!r.mustBeCropped(o,s,u,d,c,l)),h/f>p?u=(d=f)*p:d=(u=h)/p,i=(h-u)/2,n=(f-d)/2,a={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:c,imageHeight:l,x1:i,y1:n,x2:u+i,y2:d+n},!1===s&&!1===o&&(a.aspectRatio=u+":"+d),!1===s&&(a.maxHeight=d),!1===o&&(a.maxWidth=u),a},mustBeCropped:function(e,t,i,n,a,r){"use strict";return!(!0===e&&!0===t||!0===e&&n===r||!0===t&&i===a||i===a&&n===r||a<=i)},onSkippedCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.setImageInRepeaterField(e)},setImageInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image");t.find(".kirki-image-attachment").html('<img src="'+e.url+'">').hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},setFileInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-upload");t.find(".kirki-file-attachment").html('<span class="file"><span class="dashicons dashicons-media-default"></span> '+e.filename+"</span>").hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".upload-button").show(),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},getMimeType:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field");return _.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"upload"===this.params.fields[e].type&&!_.isUndefined(this.params.fields[e].mime_type)?this.params.fields[e].mime_type:"image"},removeImage:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload")).find(".upload-button"),t.find(".kirki-image-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},removeFile:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-upload")).find(".upload-button"),t.find(".kirki-file-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},getValue:function(){"use strict";return JSON.parse(decodeURI(this.setting.get()))},setValue:function(e,t,i){"use strict";var n=e,a=[];i&&(jQuery.each(this.params.fields,function(e,t){"image"!==t.type&&"cropped_image"!==t.type&&"upload"!==t.type||a.push(e)}),jQuery.each(e,function(e,t){jQuery.each(a,function(i,a){_.isUndefined(t[a])||_.isUndefined(t[a].id)||(n[e][a]=t[a].id)})})),this.setting.set(encodeURI(JSON.stringify(n))),t&&this.settingField.trigger("change")},addRow:function(e){"use strict";var t,i,n,a=this,r=a.repeaterTemplate(),o=this.getValue(),s={};if(r){if(t=jQuery.extend(!0,{},a.params.fields),e)for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(t[n].default=e[n]);t.index=this.currentIndex,r=r(t),(i=new RepeaterRow(a.currentIndex,jQuery(r).appendTo(a.repeaterFieldsContainer),a.params.row_label,a)).container.on("row:remove",function(e,t){a.deleteRow(t)}),i.container.on("row:update",function(e,t,n,r){a.updateField.call(a,e,t,n,r),i.updateLabel()}),this.rows[this.currentIndex]=i;for(n in t)t.hasOwnProperty(n)&&(s[n]=t[n].default);return o[this.currentIndex]=s,this.setValue(o,!0),this.currentIndex++,i}},sort:function(){"use strict";var e=this,t=this.repeaterFieldsContainer.find(".repeater-row"),i=[],n=e.getValue(),a=[],r=[];t.each(function(e,t){i.push(jQuery(t).data("row"))}),jQuery.each(i,function(t,i){a[t]=e.rows[i],a[t].setRowIndex(t),r[t]=n[i]}),e.rows=a,e.setValue(r)},deleteRow:function(e){"use strict";var t,i=this.getValue();i[e]&&this.rows[e]&&(delete i[e],delete this.rows[e],this.setValue(i,!0));for(t in this.rows)this.rows.hasOwnProperty(t)&&this.rows[t]&&(this.rows[t].updateLabel(),0)},updateField:function(e,t,i,n){"use strict";var a,r,o;this.rows[t]&&this.params.fields[i]&&(a=this.params.fields[i].type,r=this.rows[t],o=this.getValue(),n=jQuery(n),_.isUndefined(o[r.rowIndex][i])||(o[r.rowIndex][i]="checkbox"===a?n.is(":checked"):n.val(),this.setValue(o,!0)))},initColorPicker:function(){"use strict";var e=this,t=e.container.find(".color-picker-hex"),i={},n=t.data("field");_.isUndefined(n)||_.isUndefined(e.params.fields[n])||_.isUndefined(e.params.fields[n].palettes)||!_.isObject(e.params.fields[n].palettes)||(i.palettes=e.params.fields[n].palettes),i.change=function(t,i){var n=jQuery(t.target),a=n.closest(".repeater-row").data("row"),r=e.getValue();r[a][n.data("field")]=i.color.toString(),e.setValue(r,!0)},0!==t.length&&t.wpColorPicker(i)},initSelect:function(e,t){"use strict";var i,n,a=this,r=e.container.find(".repeater-field select"),o={};0!==r.length&&(i=r.data("field"),"undefed"!==(n=jQuery(r).data("multiple"))&&jQuery.isNumeric(n)&&1<(n=parseInt(n,10))&&(o.maximumSelectionLength=n),jQuery(r).selectWoo(o).val(t[i]),this.container.on("change",".repeater-field select",function(e){var t=jQuery(e.target),i=t.closest(".repeater-row").data("row"),n=a.getValue();n[i][t.data("field")]=jQuery(this).val(),a.setValue(n)}))}}),wp.customize.controlConstructor["kirki-select"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this,i=this.container.find("select"),n=parseInt(i.data("multiple"),10),a={escapeMarkup:function(e){return e}};1<n&&(a.maximumSelectionLength=n),jQuery(i).selectWoo(a).on("change",function(){e=jQuery(this).val(),t.setting.set(e)})}}),wp.customize.controlConstructor["kirki-slider"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t="postMessage"===e.setting.transport?"mousemove change":"change",i=e.container.find('input[type="range"]'),n=e.container.find('input[type="text"]'),a=e.setting._value;n.attr("value",a),i.on("mousemove change",function(){n.attr("value",i.val())}),i.on(t,function(){e.setting.set(i.val())}),n.on("input paste change",function(){i.attr("value",n.val()),e.setting.set(n.val())}),e.container.find(".slider-reset").on("click",function(){n.attr("value",e.params.default),i.attr("value",e.params.default),e.setting.set(n.val())})}}),wp.customize.controlConstructor["kirki-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e=this;e.container.find(".kirki-controls-loading-spinner").hide(),e.sortableContainer=e.container.find("ul.sortable").first(),e.sortableContainer.sortable({stop:function(){e.updateValue()}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.updateValue()})},updateValue:function(){"use strict";var e=this,t=[];this.sortableContainer.find("li").each(function(){jQuery(this).is(".invisible")||t.push(jQuery(this).data("value"))}),e.setting.set(t)}}),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e=this,t=e.setting._value,i=jQuery(e.container.find(".switch-on")),n=jQuery(e.container.find(".switch-off"));jQuery(e.container.find(".switch label ")).css("width",i.width()+n.width()+40+"px"),jQuery("#customize-control-"+e.id.replace("[","-").replace("]","")).append("<style>#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch label:after{width:"+(i.width()+13)+"px;}#customize-control-"+e.id.replace("[","-").replace("]","")+" .switch input:checked + label:after{left:"+(i.width()+22)+"px;width:"+(n.width()+13)+"px;}</style>"),this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-typography"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(e):e.initKirkiControl()},initKirkiControl:function(){"use strict";var e,t=this,i=t.setting._value;t.renderFontSelector(),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector(),t.params.default["font-size"]&&this.container.on("change keyup paste",".font-size input",function(){t.saveValue("font-size",jQuery(this).val())}),t.params.default["line-height"]&&this.container.on("change keyup paste",".line-height input",function(){t.saveValue("line-height",jQuery(this).val())}),t.params.default["margin-top"]&&this.container.on("change keyup paste",".margin-top input",function(){t.saveValue("margin-top",jQuery(this).val())}),t.params.default["margin-bottom"]&&this.container.on("change keyup paste",".margin-bottom input",function(){t.saveValue("margin-bottom",jQuery(this).val())}),t.params.default["letter-spacing"]&&(i["letter-spacing"]=jQuery.isNumeric(i["letter-spacing"])?i["letter-spacing"]+"px":i["letter-spacing"],this.container.on("change keyup paste",".letter-spacing input",function(){i["letter-spacing"]=jQuery.isNumeric(jQuery(this).val())?jQuery(this).val()+"px":jQuery(this).val(),t.saveValue("letter-spacing",i["letter-spacing"])})),t.params.default["word-spacing"]&&this.container.on("change keyup paste",".word-spacing input",function(){t.saveValue("word-spacing",jQuery(this).val())}),t.params.default["text-align"]&&this.container.on("change",".text-align input",function(){t.saveValue("text-align",jQuery(this).val())}),t.params.default["text-transform"]&&jQuery(t.selector+" .text-transform select").selectWoo().on("change",function(){t.saveValue("text-transform",jQuery(this).val())}),t.params.default.color&&(e=this.container.find(".kirki-color-control")).wpColorPicker({change:function(){setTimeout(function(){t.saveValue("color",e.val())},100)}})},renderFontSelector:function(){var e,t=this,i=t.selector+" .font-family select",n=[],a=[],r=[],o=t.setting._value,s=t.getFonts();_.isUndefined(s.standard)||_.each(s.standard,function(e){a.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),_.isUndefined(s.standard)||_.each(s.google,function(e){r.push({id:e.family,text:e.label})}),n=[{text:"Standard Fonts",children:a},{text:"Google Fonts",children:r}],e=jQuery(i).selectWoo({data:n}),o["font-family"]&&e.val(o["font-family"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-family",jQuery(this).val()),t.renderBackupFontSelector(),t.renderVariantSelector(),t.renderSubsetSelector()})},renderBackupFontSelector:function(){var e,t=this,i=t.selector+" .font-backup select",n=[],a=t.setting._value,r=a["font-family"],o=t.getVariants(r),s=t.getFonts();(_.isUndefined(a["font-backup"])||null===a["font-backup"])&&(a["font-backup"]=""),!1!==o?jQuery(t.selector+" .font-backup").show():jQuery(t.selector+" .font-backup").hide(),_.isUndefined(s.standard)||_.each(s.standard,function(e){n.push({id:e.family.replace(/&quot;/g,"&#39"),text:e.label})}),e=jQuery(i).selectWoo({data:n}),void 0!==a["font-backup"]&&e.val(a["font-backup"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-backup",jQuery(this).val())})},renderVariantSelector:function(){var e,t,i,n=this,a=n.setting._value,r=a["font-family"],o=n.getVariants(r),s=n.selector+" .variant select",c=[],l=!1;!1!==o?(jQuery(n.selector+" .variant").show(),_.each(o,function(e){a.variant===e.id&&(l=!0),c.push({id:e.id,text:e.label})}),l||(a.variant="regular"),jQuery(s).hasClass("select2-hidden-accessible")&&(jQuery(s).selectWoo("destroy"),jQuery(s).empty()),(t=jQuery(s).selectWoo({data:c})).val(a.variant).trigger("change"),t.on("change",function(){n.saveValue("variant",jQuery(this).val()),e=_.isString(a.variant)?a.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",i=-1!==a.variant.indexOf("italic")?"italic":"normal",n.saveValue("font-weight",e),n.saveValue("font-style",i)})):jQuery(n.selector+" .variant").hide()},renderSubsetSelector:function(){var e,t=this,i=t.setting._value,n=i["font-family"],a=t.getSubsets(n),r=t.selector+" .subsets select",o=[],s=i.subsets;!1!==a?(jQuery(t.selector+" .subsets").show(),_.each(a,function(e){_.isObject(s)&&-1===s.indexOf(e.id)&&(s=_.reject(s,function(t){return t===e.id})),o.push({id:e.id,text:e.label})})):jQuery(t.selector+" .subsets").hide(),jQuery(r).hasClass("select2-hidden-accessible")&&(jQuery(r).selectWoo("destroy"),jQuery(r).empty()),(e=jQuery(r).selectWoo({data:o})).val(s).trigger("change"),e.on("change",function(){t.saveValue("subsets",jQuery(this).val())})},getFonts:function(){var e=this;return _.isUndefined(window["kirkiFonts"+e.id])?_.isUndefined(kirkiAllFonts)?{google:[],standard:[]}:kirkiAllFonts:window["kirkiFonts"+e.id]},getVariants:function(e){var t=this.getFonts(),i=!1;return _.each(t.standard,function(t){if(e&&t.family===e.replace(/'/g,'"'))return i=t.variants,t.variants}),_.each(t.google,function(t){if(t.family===e)return i=t.variants,t.variants}),i},getSubsets:function(e){var t=!1,i=this.getFonts();return _.each(i.google,function(i){i.family===e&&(t=i.subsets)}),t},saveValue:function(e,t){var i=this,n=i.container.find(".typography-hidden-value"),a=i.setting._value;a[e]=t,jQuery(n).attr("value",JSON.stringify(a)).trigger("change"),i.setting.set(a)}});
controls/php/class-kirki-control-base.php CHANGED
@@ -84,7 +84,6 @@ class Kirki_Control_Base extends WP_Customize_Control {
84
'wp-color-picker-alpha',
85
'selectWoo',
86
'jquery-ui-button',
87
- 'jquery-ui-spinner',
88
),
89
KIRKI_VERSION
90
);
84
'wp-color-picker-alpha',
85
'selectWoo',
86
'jquery-ui-button',
87
),
88
KIRKI_VERSION
89
);
controls/php/class-kirki-control-color.php CHANGED
@@ -57,28 +57,4 @@ class Kirki_Control_Color extends Kirki_Control_Base {
57
$this->json['choices']['alpha'] = ( isset( $this->choices['alpha'] ) && $this->choices['alpha'] ) ? 'true' : 'false';
58
$this->json['mode'] = $this->mode;
59
}
60
-
61
- /**
62
- * An Underscore (JS) template for this control's content (but not its container).
63
- *
64
- * Class variables for this control class are available in the `data` JS object;
65
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
66
- *
67
- * @see WP_Customize_Control::print_template()
68
- *
69
- * @access protected
70
- */
71
- protected function content_template() {
72
- ?>
73
- <label>
74
- <span class="customize-control-title">
75
- {{{ data.label }}}
76
- </span>
77
- <# if ( data.description ) { #>
78
- <span class="description customize-control-description">{{{ data.description }}}</span>
79
- <# } #>
80
- </label>
81
- <input type="text" data-type="{{{ data.mode }}}" {{{ data.inputAttrs }}} data-palette="{{ data.palette }}" data-default-color="{{ data.default }}" data-alpha="{{ data.choices['alpha'] }}" value="{{ data.value }}" class="kirki-color-control" {{{ data.link }}} />
82
- <?php
83
- }
84
}
57
$this->json['choices']['alpha'] = ( isset( $this->choices['alpha'] ) && $this->choices['alpha'] ) ? 'true' : 'false';
58
$this->json['mode'] = $this->mode;
59
}
60
}
controls/php/class-kirki-control-number.php CHANGED
@@ -26,41 +26,4 @@ class Kirki_Control_Number extends Kirki_Control_Base {
26
* @var string
27
*/
28
public $type = 'kirki-number';
29
-
30
- /**
31
- * Enqueue control related scripts/styles.
32
- *
33
- * @access public
34
- */
35
- public function enqueue() {
36
- parent::enqueue();
37
-
38
- wp_localize_script( 'kirki-script', 'numberKirkiL10n', array(
39
- 'min-error' => esc_attr__( 'Value lower than allowed minimum', 'kirki' ),
40
- 'max-error' => esc_attr__( 'Value higher than allowed maximum', 'kirki' ),
41
- 'step-error' => esc_attr__( 'Invalid Value', 'kirki' ),
42
- ) );
43
- }
44
-
45
- /**
46
- * An Underscore (JS) template for this control's content (but not its container).
47
- *
48
- * Class variables for this control class are available in the `data` JS object;
49
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
50
- *
51
- * @see WP_Customize_Control::print_template()
52
- *
53
- * @access protected
54
- */
55
- protected function content_template() {
56
- ?>
57
- <label>
58
- <# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
59
- <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
60
- <div class="customize-control-content">
61
- <input {{{ data.inputAttrs }}} type="text" {{{ data.link }}} value="{{ data.value }}" />
62
- </div>
63
- </label>
64
- <?php
65
- }
66
}
26
* @var string
27
*/
28
public $type = 'kirki-number';
29
}
controls/php/class-kirki-control-typography.php CHANGED
@@ -34,6 +34,8 @@ class Kirki_Control_Typography extends Kirki_Control_Base {
34
*/
35
public function enqueue() {
36
37
$custom_fonts_array = ( isset( $this->choices['fonts'] ) && ( isset( $this->choices['fonts']['google'] ) || isset( $this->choices['fonts']['standard'] ) ) && ( ! empty( $this->choices['fonts']['google'] ) || ! empty( $this->choices['fonts']['standard'] ) ) );
38
$localize_script_var = ( $custom_fonts_array ) ? 'kirkiFonts' . $this->id : 'kirkiAllFonts';
39
wp_localize_script( 'kirki-script', $localize_script_var, array(
34
*/
35
public function enqueue() {
36
37
+ parent::enqueue();
38
+
39
$custom_fonts_array = ( isset( $this->choices['fonts'] ) && ( isset( $this->choices['fonts']['google'] ) || isset( $this->choices['fonts']['standard'] ) ) && ( ! empty( $this->choices['fonts']['google'] ) || ! empty( $this->choices['fonts']['standard'] ) ) );
40
$localize_script_var = ( $custom_fonts_array ) ? 'kirkiFonts' . $this->id : 'kirkiAllFonts';
41
wp_localize_script( 'kirki-script', $localize_script_var, array(
core/class-kirki-control.php CHANGED
@@ -83,6 +83,27 @@ class Kirki_Control {
83
84
// Get the name of the class we're going to use.
85
$class_name = $this->get_control_class_name( $args );
86
// Add the control.
87
$this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) );
88
83
84
// Get the name of the class we're going to use.
85
$class_name = $this->get_control_class_name( $args );
86
+ // Fixes https://github.com/aristath/kirki/issues/1622.
87
+ if ( 'kirki-code' === $args['type'] && class_exists( 'WP_Customize_Code_Editor_Control' ) ) {
88
+ $this->wp_customize->add_control(
89
+ new WP_Customize_Code_Editor_Control(
90
+ $this->wp_customize,
91
+ $args['settings'],
92
+ array(
93
+ 'label' => $args['label'],
94
+ 'section' => $args['section'],
95
+ 'settings' => $args['settings'],
96
+ 'code_type' => $args['choices']['language'],
97
+ 'priority' => $args['priority'],
98
+ 'input_attrs' => array(
99
+ 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4',
100
+ ),
101
+ )
102
+ )
103
+ );
104
+ return;
105
+ }
106
+
107
// Add the control.
108
$this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) );
109
core/deprecated.php CHANGED
@@ -60,3 +60,9 @@ if ( ! function_exists( 'kirki_get_brightness' ) ) {
60
return Kirki_Color::get_brightness( $hex );
61
}
62
}
60
return Kirki_Color::get_brightness( $hex );
61
}
62
}
63
+
64
+ if ( ! function_exists( 'Kirki' ) ) {
65
+ function Kirki() {
66
+ return kirki();
67
+ }
68
+ }
core/dynamic-css.php CHANGED
@@ -24,7 +24,7 @@ foreach ( $configs as $config_id => $args ) {
24
continue;
25
}
26
27
- $styles = Kirki_Styles_Frontend::loop_controls( $config_id );
28
$styles = apply_filters( "kirki/{$config_id}/dynamic_css", $styles );
29
30
// Some people put weird stuff in their CSS, KSES tends to be greedy.
24
continue;
25
}
26
27
+ $styles = Kirki_Modules_CSS::loop_controls( $config_id );
28
$styles = apply_filters( "kirki/{$config_id}/dynamic_css", $styles );
29
30
// Some people put weird stuff in their CSS, KSES tends to be greedy.
example.php CHANGED
@@ -25,21 +25,25 @@ if ( ! class_exists( 'Kirki' ) ) {
25
*
26
* @link https://aristath.github.io/kirki/docs/getting-started/config.html
27
*/
28
- Kirki::add_config( 'kirki_demo', array(
29
- 'capability' => 'edit_theme_options',
30
- 'option_type' => 'theme_mod',
31
- ) );
32
33
/**
34
* Add a panel.
35
*
36
* @link https://aristath.github.io/kirki/docs/getting-started/panels.html
37
*/
38
- Kirki::add_panel( 'kirki_demo_panel', array(
39
- 'priority' => 10,
40
- 'title' => esc_attr__( 'Kirki Demo Panel', 'kirki' ),
41
- 'description' => esc_attr__( 'Contains sections for all kirki controls.', 'kirki' ),
42
- ) );
43
44
/**
45
* Add Sections.
@@ -81,11 +85,22 @@ $sections = array(
81
'typography' => array( esc_attr__( 'Typography', 'kirki' ), '' ),
82
);
83
foreach ( $sections as $section_id => $section ) {
84
- Kirki::add_section( str_replace( '-', '_', $section_id ) . '_section', array(
85
- 'title' => $section[0],
86
- 'description' => $section[1],
87
- 'panel' => 'kirki_demo_panel',
88
- ) );
89
}
90
91
/**
@@ -93,601 +108,654 @@ foreach ( $sections as $section_id => $section ) {
93
*
94
* @todo Triggers change on load.
95
*/
96
- Kirki::add_field( 'kirki_demo', array(
97
- 'type' => 'background',
98
- 'settings' => 'background_setting',
99
- 'label' => esc_attr__( 'Background Control', 'kirki' ),
100
- 'description' => esc_attr__( 'Background conrols are pretty complex! (but useful if properly used)', 'kirki' ),
101
- 'section' => 'background_section',
102
- 'default' => array(
103
- 'background-color' => 'rgba(20,20,20,.8)',
104
- 'background-image' => '',
105
- 'background-repeat' => 'repeat-all',
106
- 'background-position' => 'center center',
107
- 'background-size' => 'cover',
108
- 'background-attachment' => 'scroll',
109
- ),
110
- ) );
111
112
/**
113
* Code control.
114
*
115
* @link https://aristath.github.io/kirki/docs/controls/code.html
116
*/
117
- Kirki::add_field( 'kirki_demo', array(
118
- 'type' => 'code',
119
- 'settings' => 'code_setting',
120
- 'label' => esc_attr__( 'Code Control', 'kirki' ),
121
- 'description' => esc_attr__( 'Description', 'kirki' ),
122
- 'section' => 'code_section',
123
- 'default' => '',
124
- 'choices' => array(
125
- 'language' => 'css',
126
- 'theme' => 'monokai',
127
- ),
128
- ) );
129
130
/**
131
* Checkbox control.
132
*
133
* @link https://aristath.github.io/kirki/docs/controls/checkbox.html
134
*/
135
- Kirki::add_field( 'kirki_demo', array(
136
- 'type' => 'checkbox',
137
- 'settings' => 'checkbox_setting',
138
- 'label' => esc_attr__( 'Checkbox Control', 'kirki' ),
139
- 'description' => esc_attr__( 'Description', 'kirki' ),
140
- 'section' => 'checkbox_section',
141
- 'default' => true,
142
- ) );
143
144
/**
145
* Color Controls.
146
*
147
* @link https://aristath.github.io/kirki/docs/controls/color.html
148
*/
149
- Kirki::add_field( 'kirki_demo', array(
150
- 'type' => 'color',
151
- 'settings' => 'color_setting_hex',
152
- 'label' => __( 'Color Control (hex-only)', 'kirki' ),
153
- 'description' => esc_attr__( 'This is a color control - without alpha channel.', 'kirki' ),
154
- 'section' => 'color_section',
155
- 'default' => '#0088CC',
156
- ) );
157
-
158
- Kirki::add_field( 'kirki_demo', array(
159
- 'type' => 'color',
160
- 'settings' => 'color_setting_rgba',
161
- 'label' => __( 'Color Control (with alpha channel)', 'kirki' ),
162
- 'description' => esc_attr__( 'This is a color control - with alpha channel.', 'kirki' ),
163
- 'section' => 'color_section',
164
- 'default' => '#0088CC',
165
- 'choices' => array(
166
- 'alpha' => true,
167
- ),
168
- ) );
169
-
170
- Kirki::add_field( 'kirki_demo', array(
171
- 'type' => 'color',
172
- 'settings' => 'color_setting_hue',
173
- 'label' => __( 'Color Control - hue only.', 'kirki' ),
174
- 'description' => esc_attr__( 'This is a color control - hue only.', 'kirki' ),
175
- 'section' => 'color_section',
176
- 'default' => '#0088CC',
177
- 'mode' => 'hue',
178
- ) );
179
180
/**
181
* DateTime Control.
182
*/
183
- Kirki::add_field( 'kirki_demo', array(
184
- 'type' => 'date',
185
- 'settings' => 'date_setting',
186
- 'label' => esc_attr__( 'Date Control', 'kirki' ),
187
- 'description' => esc_attr__( 'This is a date control.', 'kirki' ),
188
- 'section' => 'date_section',
189
- 'default' => '',
190
- ) );
191
192
/**
193
* Editor Controls
194
*/
195
- Kirki::add_field( 'kirki_demo', array(
196
- 'type' => 'editor',
197
- 'settings' => 'editor_1',
198
- 'label' => esc_attr__( 'First Editor Control', 'kirki' ),
199
- 'description' => esc_attr__( 'This is an editor control.', 'kirki' ),
200
- 'section' => 'editor_section',
201
- 'default' => '',
202
- ) );
203
-
204
- Kirki::add_field( 'kirki_demo', array(
205
- 'type' => 'editor',
206
- 'settings' => 'editor_2',
207
- 'label' => esc_attr__( 'Second Editor Control', 'kirki' ),
208
- 'description' => esc_attr__( 'This is a 2nd editor control just to check that we do not have issues with multiple instances.', 'kirki' ),
209
- 'section' => 'editor_section',
210
- 'default' => esc_attr__( 'Default Text', 'kirki' ),
211
- ) );
212
213
/**
214
* Color-Palette Controls.
215
*
216
* @link https://aristath.github.io/kirki/docs/controls/color-palette.html
217
*/
218
- Kirki::add_field( 'kirki_demo', array(
219
- 'type' => 'color-palette',
220
- 'settings' => 'color_palette_setting_0',
221
- 'label' => esc_attr__( 'Color-Palette', 'kirki' ),
222
- 'description' => esc_attr__( 'This is a color-palette control', 'kirki' ),
223
- 'section' => 'color_palette_section',
224
- 'default' => '#888888',
225
- 'choices' => array(
226
- 'colors' => array( '#000000', '#222222', '#444444', '#666666', '#888888', '#aaaaaa', '#cccccc', '#eeeeee', '#ffffff' ),
227
- 'style' => 'round',
228
- ),
229
- ) );
230
-
231
- Kirki::add_field( 'kirki_demo', array(
232
- 'type' => 'color-palette',
233
- 'settings' => 'color_palette_setting_4',
234
- 'label' => esc_attr__( 'Color-Palette', 'kirki' ),
235
- 'description' => esc_attr__( 'Material Design Colors - all', 'kirki' ),
236
- 'section' => 'color_palette_section',
237
- 'default' => '#F44336',
238
- 'choices' => array(
239
- 'colors' => Kirki_Helper::get_material_design_colors( 'all' ),
240
- 'size' => 17,
241
- ),
242
- ) );
243
-
244
- Kirki::add_field( 'kirki_demo', array(
245
- 'type' => 'color-palette',
246
- 'settings' => 'color_palette_setting_1',
247
- 'label' => esc_attr__( 'Color-Palette', 'kirki' ),
248
- 'description' => esc_attr__( 'Material Design Colors - primary', 'kirki' ),
249
- 'section' => 'color_palette_section',
250
- 'default' => '#000000',
251
- 'choices' => array(
252
- 'colors' => Kirki_Helper::get_material_design_colors( 'primary' ),
253
- 'size' => 25,
254
- ),
255
- ) );
256
-
257
- Kirki::add_field( 'kirki_demo', array(
258
- 'type' => 'color-palette',
259
- 'settings' => 'color_palette_setting_2',
260
- 'label' => esc_attr__( 'Color-Palette', 'kirki' ),
261
- 'description' => esc_attr__( 'Material Design Colors - red', 'kirki' ),
262
- 'section' => 'color_palette_section',
263
- 'default' => '#FF1744',
264
- 'choices' => array(
265
- 'colors' => Kirki_Helper::get_material_design_colors( 'red' ),
266
- 'size' => 16,
267
- ),
268
- ) );
269
-
270
- Kirki::add_field( 'kirki_demo', array(
271
- 'type' => 'color-palette',
272
- 'settings' => 'color_palette_setting_3',
273
- 'label' => esc_attr__( 'Color-Palette', 'kirki' ),
274
- 'description' => esc_attr__( 'Material Design Colors - A100', 'kirki' ),
275
- 'section' => 'color_palette_section',
276
- 'default' => '#FF80AB',
277
- 'choices' => array(
278
- 'colors' => Kirki_Helper::get_material_design_colors( 'A100' ),
279
- 'size' => 60,
280
- 'style' => 'round',
281
- ),
282
- ) );
283
284
/**
285
* Dashicons control.
286
*
287
* @link https://aristath.github.io/kirki/docs/controls/dashicons.html
288
*/
289
- Kirki::add_field( 'kirki_demo', array(
290
- 'type' => 'dashicons',
291
- 'settings' => 'dashicons_setting_0',
292
- 'label' => esc_attr__( 'Dashicons Control', 'kirki' ),
293
- 'description' => esc_attr__( 'Using a custom array of dashicons', 'kirki' ),
294
- 'section' => 'dashicons_section',
295
- 'default' => 'menu',
296
- 'choices' => array(
297
- 'menu',
298
- 'admin-site',
299
- 'dashboard',
300
- 'admin-post',
301
- 'admin-media',
302
- 'admin-links',
303
- 'admin-page',
304
- ),
305
- ) );
306
-
307
- Kirki::add_field( 'kirki_demo', array(
308
- 'type' => 'dashicons',
309
- 'settings' => 'dashicons_setting_1',
310
- 'label' => esc_attr__( 'All Dashicons', 'kirki' ),
311
- 'description' => esc_attr__( 'Showing all dashicons', 'kirki' ),
312
- 'section' => 'dashicons_section',
313
- 'default' => 'menu',
314
- ) );
315
316
/**
317
* Dimension Control.
318
*/
319
- Kirki::add_field( 'kirki_demo', array(
320
- 'type' => 'dimension',
321
- 'settings' => 'dimension_0',
322
- 'label' => esc_attr__( 'Dimension Control', 'kirki' ),
323
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
324
- 'section' => 'dimension_section',
325
- 'default' => '10px',
326
- ) );
327
328
/**
329
* Dimensions Control.
330
*/
331
- Kirki::add_field( 'kirki_demo', array(
332
- 'type' => 'dimensions',
333
- 'settings' => 'dimensions_0',
334
- 'label' => esc_attr__( 'Dimension Control', 'kirki' ),
335
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
336
- 'section' => 'dimensions_section',
337
- 'default' => array(
338
- 'width' => '100px',
339
- 'height' => '100px',
340
- ),
341
- ) );
342
-
343
- Kirki::add_field( 'kirki_demo', array(
344
- 'type' => 'dimensions',
345
- 'settings' => 'dimensions_1',
346
- 'label' => esc_attr__( 'Dimension Control', 'kirki' ),
347
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
348
- 'section' => 'dimensions_section',
349
- 'default' => array(
350
- 'padding-top' => '1em',
351
- 'padding-bottom' => '10rem',
352
- 'padding-left' => '1vh',
353
- 'padding-right' => '10px',
354
- ),
355
- ) );
356
357
/**
358
* Font-Awesome Control.
359
*/
360
- Kirki::add_field( 'kirki_demo', array(
361
- 'type' => 'fontawesome',
362
- 'settings' => 'fontawesome_setting',
363
- 'label' => esc_attr__( 'Font Awesome Control', 'kirki' ),
364
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
365
- 'section' => 'fontawesome_section',
366
- 'default' => 'bath',
367
- ) );
368
369
/**
370
* Generic Controls.
371
*/
372
- Kirki::add_field( 'kirki_demo', array(
373
- 'type' => 'text',
374
- 'settings' => 'generic_text_setting',
375
- 'label' => esc_attr__( 'Text Control', 'kirki' ),
376
- 'description' => esc_attr__( 'Description', 'kirki' ),
377
- 'section' => 'generic_section',
378
- 'default' => '',
379
- ) );
380
-
381
- Kirki::add_field( 'kirki_demo', array(
382
- 'type' => 'textarea',
383
- 'settings' => 'generic_textarea_setting',
384
- 'label' => esc_attr__( 'Textarea Control', 'kirki' ),
385
- 'description' => esc_attr__( 'Description', 'kirki' ),
386
- 'section' => 'generic_section',
387
- 'default' => '',
388
- ) );
389
-
390
- Kirki::add_field( 'kirki_demo', array(
391
- 'type' => 'generic',
392
- 'settings' => 'generic_custom_setting',
393
- 'label' => esc_attr__( 'Custom input Control.', 'kirki' ),
394
- 'description' => esc_attr__( 'The "generic" control allows you to add any input type you want. In this case we use type="password" and define custom styles.', 'kirki' ),
395
- 'section' => 'generic_section',
396
- 'default' => '',
397
- 'choices' => array(
398
- 'element' => 'input',
399
- 'type' => 'password',
400
- 'style' => 'background-color:black;color:red;',
401
- 'data-foo' => 'bar',
402
- ),
403
- ) );
404
405
/**
406
* Image Control.
407
*/
408
- Kirki::add_field( 'kirki_demo', array(
409
- 'type' => 'image',
410
- 'settings' => 'image_setting_url',
411
- 'label' => esc_attr__( 'Image Control (URL)', 'kirki' ),
412
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
413
- 'section' => 'image_section',
414
- 'default' => '',
415
- ) );
416
-
417
- Kirki::add_field( 'kirki_demo', array(
418
- 'type' => 'image',
419
- 'settings' => 'image_setting_id',
420
- 'label' => esc_attr__( 'Image Control (ID)', 'kirki' ),
421
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
422
- 'section' => 'image_section',
423
- 'default' => '',
424
- 'choices' => array(
425
- 'save_as' => 'id',
426
- ),
427
- ) );
428
-
429
- Kirki::add_field( 'kirki_demo', array(
430
- 'type' => 'image',
431
- 'settings' => 'image_setting_array',
432
- 'label' => esc_attr__( 'Image Control (array)', 'kirki' ),
433
- 'description' => esc_attr__( 'Description Here.', 'kirki' ),
434
- 'section' => 'image_section',
435
- 'default' => '',
436
- 'choices' => array(
437
- 'save_as' => 'array',
438
- ),
439
- ) );
440
441
/**
442
* Multicheck Control.
443
*/
444
- Kirki::add_field( 'kirki_demo', array(
445
- 'type' => 'multicheck',
446
- 'settings' => 'multicheck_setting',
447
- 'label' => esc_attr__( 'Multickeck Control', 'kirki' ),
448
- 'section' => 'multicheck_section',
449
- 'default' => array( 'option-1', 'option-3', 'option-4' ),
450
- 'priority' => 10,
451
- 'choices' => array(
452
- 'option-1' => esc_attr__( 'Option 1', 'kirki' ),
453
- 'option-2' => esc_attr__( 'Option 2', 'kirki' ),
454
- 'option-3' => esc_attr__( 'Option 3', 'kirki' ),
455
- 'option-4' => esc_attr__( 'Option 4', 'kirki' ),
456
- 'option-5' => esc_attr__( 'Option 5', 'kirki' ),
457
- ),
458
- ) );
459
460
/**
461
* Multicolor Control.
462
*/
463
- Kirki::add_field( 'kirki_demo', array(
464
- 'type' => 'multicolor',
465
- 'settings' => 'multicolor_setting',
466
- 'label' => esc_attr__( 'Label', 'kirki' ),
467
- 'section' => 'multicolor_section',
468
- 'priority' => 10,
469
- 'choices' => array(
470
- 'link' => esc_attr__( 'Color', 'kirki' ),
471
- 'hover' => esc_attr__( 'Hover', 'kirki' ),
472
- 'active' => esc_attr__( 'Active', 'kirki' ),
473
- ),
474
- 'default' => array(
475
- 'link' => '#0088cc',
476
- 'hover' => '#00aaff',
477
- 'active' => '#00ffff',
478
- ),
479
- ) );
480
481
/**
482
* Number Control.
483
*/
484
- Kirki::add_field( 'kirki_demo', array(
485
- 'type' => 'number',
486
- 'settings' => 'number_setting',
487
- 'label' => esc_attr__( 'Label', 'kirki' ),
488
- 'section' => 'number_section',
489
- 'priority' => 10,
490
- 'choices' => array(
491
- 'min' => -5,
492
- 'max' => 5,
493
- 'step' => 1,
494
- ),
495
- ) );
496
497
/**
498
* Palette Control.
499
*/
500
- Kirki::add_field( 'kirki_demo', array(
501
- 'type' => 'palette',
502
- 'settings' => 'palette_setting',
503
- 'label' => esc_attr__( 'Label', 'kirki' ),
504
- 'section' => 'palette_section',
505
- 'default' => 'blue',
506
- 'choices' => array(
507
- 'a200' => Kirki_Helper::get_material_design_colors( 'A200' ),
508
- 'blue' => Kirki_Helper::get_material_design_colors( 'blue' ),
509
- 'green' => array( '#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853' ),
510
- 'bnw' => array( '#000000', '#ffffff' ),
511
- ),
512
- ) );
513
514
/**
515
* Radio Control.
516
*/
517
- Kirki::add_field( 'kirki_demo', array(
518
- 'type' => 'radio',
519
- 'settings' => 'radio_setting',
520
- 'label' => esc_attr__( 'Radio Control', 'kirki' ),
521
- 'description' => esc_attr__( 'The description here.', 'kirki' ),
522
- 'section' => 'radio_section',
523
- 'default' => 'option-3',
524
- 'choices' => array(
525
- 'option-1' => esc_attr__( 'Option 1', 'kirki' ),
526
- 'option-2' => esc_attr__( 'Option 2', 'kirki' ),
527
- 'option-3' => esc_attr__( 'Option 3', 'kirki' ),
528
- 'option-4' => esc_attr__( 'Option 4', 'kirki' ),
529
- 'option-5' => esc_attr__( 'Option 5', 'kirki' ),
530
- ),
531
- ) );
532
533
/**
534
* Radio-Buttonset Control.
535
*/
536
- Kirki::add_field( 'kirki_demo', array(
537
- 'type' => 'radio-buttonset',
538
- 'settings' => 'radio_buttonset_setting',
539
- 'label' => esc_attr__( 'Radio-Buttonset Control', 'kirki' ),