PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.14
Boxzilla – WordPress Popup Builder v3.1.14
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 / browserify / admin / _option.js

_option.js in Boxzilla – WordPress Popup Builder 3.1.14, at assets/browserify/admin/_option.js

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