Passed
Pull Request — master (#258)
by
unknown
05:41 queued 32s
created

assets/customizerControls.js   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 14
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
c 0
b 0
f 0
dl 0
loc 14
rs 10
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 0
1
import $ from 'jquery'
2
import './customizerControls.scss'
3
4
$(document).on('change input', '.flynt-range', function () {
5
  const $el = $(this)
6
  const change = $el.data('change')
7
  $el.parent().find(`.flynt-range-${change}`).val($el.val())
8
})
9
10
$(document).on('click', '.flynt-range-reset', function () {
11
  const $el = $(this)
12
  const value = $el.data('default')
13
  $el.parent().find('.flynt-range').val(value)
14
})
15
16
// (function (wp, $) {
17
// wp.customize.controlConstructor['flynt-range'] = wp.customize.Control.extend({
18
//   ready: function () {
19
//     const control = this
20
21
//     this.container.on('change', '.flynt-range[type=range]', function () {
22
//       console.log('this range', this)
23
//       const $range = $(this)
24
//       const $number = $range.next()
25
//       $number.val($range.val())
26
//       control.setting.set($range.val());
27
//     })
28
//   }
29
// })
30
// })(wp, $)
31