PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.2.10
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.2.10
3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 All 156 releases
notificationx / vendor / wpdeveloper / lib-settings / static / scripts / src / udx.settings.js

udx.settings.js in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.2.10, at vendor/wpdeveloper/lib-settings/static/scripts/src/udx.settings.js

142 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Settings
3 *
4 * @version 0.1.4
5 * @returns {Object}
6 */
7 define( 'udx.settings', [ 'udx.utility' ], function settings() {
8 console.log( 'udx.settings', 'loaded' );
9
10 function Settings( name, options ) {
11 console.log( 'udx.settings', 'created' );
12
13 Object.defineProperties( this, {
14 store: {
15 value: {},
16 enumerable: false,
17 configurable: true,
18 writable: true
19 }
20 });
21
22 return this;
23
24 }
25
26 /**
27 * Settings Instance Properties.
28 *
29 */
30 Object.defineProperties( Settings.prototype, {
31 set: {
32 value: function set( sKey, sValue, vEnd, sPath, sDomain, bSecure ) {
33 if( !sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test( sKey ) ) {
34 return false;
35 }
36 var sExpires = "";
37 if( vEnd ) {
38 switch( vEnd.constructor ) {
39 case Number:
40 sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
41 break;
42 case String:
43 sExpires = "; expires=" + vEnd;
44 break;
45 case Date:
46 sExpires = "; expires=" + vEnd.toUTCString();
47 break;
48 }
49 }
50 document.cookie = encodeURIComponent( sKey ) + "=" + encodeURIComponent( sValue ) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
51 return true;
52
53 },
54 enumerable: true,
55 configurable: true,
56 writable: true
57 },
58 get: {
59 value: function get( key ) {
60
61 return decodeURIComponent( document.cookie.replace( new RegExp( "(?:(?:^|.*;)\\s*" + encodeURIComponent( key ).replace( /[\-\.\+\*]/g, "\\$&" ) + "\\s*\\=\\s*([^;]*).*$)|^.*$" ), "$1" ) ) || null;
62
63 },
64 enumerable: true,
65 configurable: true,
66 writable: true
67 },
68 remove: {
69 value: function remove( sKey, sPath, sDomain ) {
70 if( !sKey || !this.has( sKey ) ) {
71 return false;
72 }
73 document.cookie = encodeURIComponent( sKey ) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + ( sDomain ? "; domain=" + sDomain : "") + ( sPath ? "; path=" + sPath : "");
74 return true;
75
76 },
77 enumerable: true,
78 configurable: true,
79 writable: true
80 },
81 has: {
82 value: function has( sKey ) {
83 return (new RegExp( "(?:^|;\\s*)" + encodeURIComponent( sKey ).replace( /[\-\.\+\*]/g, "\\$&" ) + "\\s*\\=" )).test( document.cookie );
84
85 },
86 enumerable: true,
87 configurable: true,
88 writable: true
89 },
90 keys: {
91 value: function keys() {
92 var aKeys = document.cookie.replace( /((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "" ).split( /\s*(?:\=[^;]*)?;\s*/ );
93
94 for( var nIdx = 0; nIdx < aKeys.length; nIdx++ ) {
95 aKeys[nIdx] = decodeURIComponent( aKeys[nIdx] );
96 }
97 return aKeys;
98
99 },
100 enumerable: true,
101 configurable: true,
102 writable: true
103 },
104 data: {
105 value: function data() {
106
107 var data = {};
108
109 var aKeys = document.cookie.replace( /((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "" ).split( /\s*(?:\=[^;]*)?;\s*/ );
110
111 for( var nIdx = 0; nIdx < aKeys.length; nIdx++ ) {
112 var key = decodeURIComponent( aKeys[nIdx] );
113 data[ key ] = this.get( key );
114 }
115
116 return data;
117
118 },
119 enumerable: true,
120 configurable: true,
121 writable: true
122 }
123 });
124
125 /**
126 * Settings Constructor Properties.
127 *
128 */
129 Object.defineProperties( Settings, {
130 create: {
131 value: function create( name, options ) {
132 return new Settings( name, options )
133 },
134 enumerable: true,
135 configurable: true,
136 writable: true
137 }
138 });
139
140 return Settings;
141
142 });