diff --git a/assets/js/controls/checkbox.js b/assets/js/controls/checkbox.js index b6843e07f..b4c6e7a02 100644 --- a/assets/js/controls/checkbox.js +++ b/assets/js/controls/checkbox.js @@ -3,10 +3,8 @@ wp.customize.controlConstructor['kirki-checkbox'] = wp.customize.Control.extend( // When we're finished loading continue processing ready: function() { - var control = this; - - // Get the initial value - var value = control.setting._value; + var control = this, + value = control.setting._value; // Change the value this.container.on( 'change', 'input', function() { diff --git a/assets/js/controls/code.js b/assets/js/controls/code.js index b020d813e..8b35ae55d 100755 --- a/assets/js/controls/code.js +++ b/assets/js/controls/code.js @@ -6,8 +6,8 @@ wp.customize.controlConstructor['kirki-code'] = wp.customize.Control.extend({ var control = this, element = control.container.find( '.kirki-codemirror-editor' ), language = control.params.choices.language, - openButton = control.container.find( 'a.edit' ), - closeButton = control.container.find( 'a.close' ), + openButton = control.container.find( 'a.edit' ), + closeButton = control.container.find( 'a.close' ), editor; // HTML mode requires a small hack because CodeMirror uses 'htmlmixed'. diff --git a/assets/js/controls/date.js b/assets/js/controls/date.js index fee49d5be..ea2f4b88b 100644 --- a/assets/js/controls/date.js +++ b/assets/js/controls/date.js @@ -3,7 +3,7 @@ wp.customize.controlConstructor['kirki-date'] = wp.customize.Control.extend({ // When we're finished loading continue processing ready: function() { - var control = this, + var control = this, selector = control.selector + ' input.datepicker'; // Init the datepicker diff --git a/assets/js/controls/editor.js b/assets/js/controls/editor.js index 884c2ddc9..a7c773fa2 100644 --- a/assets/js/controls/editor.js +++ b/assets/js/controls/editor.js @@ -5,10 +5,10 @@ wp.customize.controlConstructor['kirki-editor'] = wp.customize.Control.extend({ var control = this, element = control.container.find( 'textarea' ), - toggler = control.container.find( '.toggle-editor' ), - editorWrapper = jQuery( '#kirki-editor-editor-pane' ), - setChange, - content; + toggler = control.container.find( '.toggle-editor' ), + editorWrapper = jQuery( '#kirki-editor-editor-pane' ), + setChange, + content; jQuery( window ).load( function() { diff --git a/assets/js/controls/repeater.js b/assets/js/controls/repeater.js index a935e01b6..67c58f48b 100644 --- a/assets/js/controls/repeater.js +++ b/assets/js/controls/repeater.js @@ -221,7 +221,7 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ // We get the field id from which this was called var currentFieldId = this.$thisButton.siblings( 'input.hidden-field' ).attr( 'data-field' ), attrs = [ 'width', 'height', 'flex_width', 'flex_height' ], // A list of attributes to look for - libMediaType = this.getMimeType(); + libMediaType = this.getMimeType(); // Make sure we got it if ( 'string' === typeof currentFieldId && '' !== currentFieldId ) { @@ -314,16 +314,18 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ */ calculateImageSelectOptions: function( attachment, controller ) { var control = controller.get( 'control' ), - flexWidth = !! parseInt( control.params.flex_width, 10 ), - flexHeight = !! parseInt( control.params.flex_height, 10 ), - realWidth = attachment.get( 'width' ), - realHeight = attachment.get( 'height' ), - xInit = parseInt( control.params.width, 10 ), - yInit = parseInt( control.params.height, 10 ), - ratio = xInit / yInit, - xImg = realWidth, - yImg = realHeight, - x1, y1, imgSelectOptions; + flexWidth = !! parseInt( control.params.flex_width, 10 ), + flexHeight = !! parseInt( control.params.flex_height, 10 ), + realWidth = attachment.get( 'width' ), + realHeight = attachment.get( 'height' ), + xInit = parseInt( control.params.width, 10 ), + yInit = parseInt( control.params.height, 10 ), + ratio = xInit / yInit, + xImg = realWidth, + yImg = realHeight, + x1, + y1, + imgSelectOptions; controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) ); @@ -533,8 +535,8 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ setValue: function( newValue, refresh, filtering ) { // We need to filter the values after the first load to remove data requrired for diplay but that we don't want to save in DB - var filteredValue = newValue; - var filter = []; + var filteredValue = newValue, + filter = []; if ( filtering ) { jQuery.each( this.params.fields, function( index, value ) { @@ -569,13 +571,13 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ * @param data (Optional) Object of field => value pairs (undefined if you want to get the default values) */ addRow: function( data ) { - var control = this, - i, - template = control.repeaterTemplate(), // The template for the new row (defined on Kirki_Customize_Repeater_Control::render_content() ). - settingValue = this.getValue(), // Get the current setting value. - newRowSetting = {}, // Saves the new setting data. - templateData, // Data to pass to the template - newRow; + var control = this, + template = control.repeaterTemplate(), // The template for the new row (defined on Kirki_Customize_Repeater_Control::render_content() ). + settingValue = this.getValue(), // Get the current setting value. + newRowSetting = {}, // Saves the new setting data. + templateData, // Data to pass to the template + newRow, + i; if ( template ) { @@ -635,9 +637,9 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ }, sort: function() { - var control = this, - $rows = this.repeaterFieldsContainer.find( '.repeater-row' ), - newOrder = [], + var control = this, + $rows = this.repeaterFieldsContainer.find( '.repeater-row' ), + newOrder = [], settings = control.getValue(), newRows = [], newSettings = []; @@ -749,9 +751,9 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ */ initColorPicker: function() { var control = this, - colorPicker = control.container.find( '.color-picker-hex' ), - options = {}, - fieldId = colorPicker.data( 'field' ); + colorPicker = control.container.find( '.color-picker-hex' ), + options = {}, + fieldId = colorPicker.data( 'field' ); // We check if the color palette parameter is defined. if ( 'undefined' !== typeof fieldId && 'undefined' !== typeof control.params.fields[ fieldId ] && 'undefined' !== typeof control.params.fields[ fieldId ].palettes && 'object' === typeof control.params.fields[ fieldId ].palettes ) { @@ -787,10 +789,10 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({ */ initDropdownPages: function( theNewRow, data ) { var control = this, - dropdown = theNewRow.container.find( '.repeater-dropdown-pages select' ), - $select, - selectize, - dataField; + dropdown = theNewRow.container.find( '.repeater-dropdown-pages select' ), + $select, + selectize, + dataField; if ( 0 === dropdown.length ) { return; diff --git a/assets/js/controls/slider.js b/assets/js/controls/slider.js index dec278d0a..0493329ce 100644 --- a/assets/js/controls/slider.js +++ b/assets/js/controls/slider.js @@ -16,7 +16,7 @@ jQuery( document ).ready(function() { jQuery( '.kirki-slider-reset' ).click( function() { var thisInput = jQuery( this ).closest( 'label' ).find( 'input' ), - inputDefault = thisInput.data( 'reset_value' ); + inputDefault = thisInput.data( 'reset_value' ); thisInput.val( inputDefault ); thisInput.change(); diff --git a/assets/js/controls/toggle.js b/assets/js/controls/toggle.js index bcb063ccf..ebd2a5930 100644 --- a/assets/js/controls/toggle.js +++ b/assets/js/controls/toggle.js @@ -2,10 +2,10 @@ wp.customize.controlConstructor['kirki-toggle'] = wp.customize.Control.extend({ ready: function() { - var control = this; + var control = this, // Get the initial value - var checkboxValue = control.setting._value; + checkboxValue = control.setting._value; // Save the value this.container.on( 'change', 'input', function() {