PluginProbe
Boxzilla – WordPress Popup Builder / 3.4.4
Boxzilla – WordPress Popup Builder v3.4.4
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
boxzilla / assets / js / src / admin / _option.js

_option.js in Boxzilla – WordPress Popup Builder 3.4.4, at assets/js/src/admin/_option.js

52 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var $ = window.jQuery
2 var Option = function (element) {
3 // find corresponding element
4 if (typeof (element) === 'string') {
5 element = document.getElementById('boxzilla-' + element)
6 }
7
8 if (!element) {
9 console.error('Unable to find option element.')
10 }
11
12 this.element = element
13 }
14
15 Option.prototype.getColorValue = function () {
16 if (this.element.value.length > 0) {
17 if ($(this.element).hasClass('wp-color-field')) {
18 return $(this.element).wpColorPicker('color')
19 } else {
20 return this.element.value
21 }
22 }
23
24 return ''
25 }
26
27 Option.prototype.getPxValue = function (fallbackValue) {
28 if (this.element.value.length > 0) {
29 return parseInt(this.element.value) + 'px'
30 }
31
32 return fallbackValue || ''
33 }
34
35 Option.prototype.getValue = function (fallbackValue) {
36 if (this.element.value.length > 0) {
37 return this.element.value
38 }
39
40 return fallbackValue || ''
41 }
42
43 Option.prototype.clear = function () {
44 this.element.value = ''
45 }
46
47 Option.prototype.setValue = function (value) {
48 this.element.value = value
49 }
50
51 module.exports = Option
52