Cookie Notice by dFactory - Version 1.2.50

Version Description

  • Fix: The body css class always set to "cookies-refused"
  • Tweak: Improve IE & Safari CustomEvent and ClassList support
  • Tweak: Change the plugin js init event
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Cookie Notice by dFactory
Version 1.2.50
Comparing to
See all releases

Code changes from version 1.2.49 to 1.2.50

Files changed (5) hide show
  1. cookie-notice.php +4 -4
  2. includes/upgrade.php +0 -34
  3. js/front.js +116 -44
  4. js/front.min.js +1 -1
  5. readme.txt +10 -5
cookie-notice.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /*
3
  Plugin Name: Cookie Notice
4
- Description: Cookie Notice allows you to elegantly inform users that your site uses cookies and to comply with the EU GDPR cookie law and CCPA regulations.
5
- Version: 1.2.49
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) )
29
  * Cookie Notice class.
30
  *
31
  * @class Cookie_Notice
32
- * @version 1.2.49
33
  */
34
  class Cookie_Notice {
35
 
@@ -78,7 +78,7 @@ class Cookie_Notice {
78
  'update_notice' => true,
79
  'update_delay_date' => 0
80
  ),
81
- 'version' => '1.2.49'
82
  );
83
  private $positions = array();
84
  private $styles = array();
1
  <?php
2
  /*
3
  Plugin Name: Cookie Notice
4
+ Description: Cookie Notice allows you to elegantly inform users that your site uses cookies and helps you comply with the EU GDPR cookie law and CCPA regulations.
5
+ Version: 1.2.50
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
29
  * Cookie Notice class.
30
  *
31
  * @class Cookie_Notice
32
+ * @version 1.2.50
33
  */
34
  class Cookie_Notice {
35
 
78
  'update_notice' => true,
79
  'update_delay_date' => 0
80
  ),
81
+ 'version' => '1.2.50'
82
  );
83
  private $positions = array();
84
  private $styles = array();
includes/upgrade.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- // exit if accessed directly
3
- if ( ! defined( 'ABSPATH' ) )
4
- exit;
5
-
6
- new Cookie_Notice_Upgrade( $cookie_notice );
7
-
8
- class Cookie_Notice_Upgrade {
9
-
10
- private $defaults;
11
-
12
- public function __construct( $cookie_notice ) {
13
- // attributes
14
- $this->defaults = $cookie_notice->get_defaults();
15
-
16
- // actions
17
- add_action( 'init', array( $this, 'check_upgrade' ) );
18
- }
19
-
20
- public function check_upgrade() {
21
- if ( ! current_user_can( 'manage_options' ) )
22
- return;
23
-
24
- // gets current database version
25
- $current_db_version = get_option( 'cookie_notice_version', '1.0.0' );
26
-
27
- // new version?
28
- if ( version_compare( $current_db_version, $this->defaults['version'], '<' ) ) {
29
- // updates plugin version
30
- update_option( 'cookie_notice_version', $this->defaults['version'] );
31
- }
32
- }
33
-
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/front.js CHANGED
@@ -1,3 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ( function( window, document, undefined ) {
2
 
3
  var cookieNotice = new function () {
@@ -38,9 +113,7 @@
38
  time: date,
39
  expires: laterDate,
40
  data: cnArgs
41
- },
42
- bubbles: true,
43
- cancelable: true
44
  }
45
  );
46
 
@@ -54,12 +127,12 @@
54
  if ( cnArgs.revoke_cookies_opt === 'automatic' ) {
55
  // show cookie notice after the revoke is hidden
56
  this.noticeContainer.addEventListener( 'animationend', function handler() {
57
- _this.showRevokeNotice();
58
  _this.noticeContainer.removeEventListener( 'animationend', handler );
 
59
  } );
60
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
61
- _this.showRevokeNotice();
62
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
 
63
  } );
64
  }
65
 
@@ -80,11 +153,6 @@
80
  }
81
 
82
  return;
83
- } else {
84
- // show revoke notice if enabled
85
- if ( cnArgs.revoke_cookies_opt === 'automatic' ) {
86
- // cnShowRevokeNotice();
87
- }
88
  }
89
  };
90
 
@@ -114,29 +182,26 @@
114
  {
115
  detail: {
116
  data: cnArgs,
117
- },
118
- bubbles: true,
119
- cancelable: true
120
  }
121
  );
122
 
123
  document.dispatchEvent( event );
 
 
124
 
125
  this.noticeContainer.classList.remove( 'cookie-notice-hidden' );
126
- this.noticeContainer.classList.add( 'cn-animated', 'cookie-notice-visible' );
127
-
128
- // console.log( 'show' );
129
 
130
  // detect animation
131
  this.noticeContainer.addEventListener( 'animationend', function handler() {
132
- _this.noticeContainer.classList.remove( 'cn-animated' );
133
  _this.noticeContainer.removeEventListener( 'animationend', handler );
134
- // console.log( 'show end' );
135
  } );
136
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
137
- _this.noticeContainer.classList.remove( 'cn-animated' );
138
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
139
- // console.log( 'show end' );
140
  } );
141
  };
142
 
@@ -150,27 +215,27 @@
150
  {
151
  detail: {
152
  data: cnArgs,
153
- },
154
- bubbles: true,
155
- cancelable: true
156
  }
157
  );
158
 
159
  document.dispatchEvent( event );
160
 
 
 
161
  this.noticeContainer.classList.add( 'cn-animated' );
162
  this.noticeContainer.classList.remove( 'cookie-notice-visible' );
163
 
164
  // detect animation
165
  this.noticeContainer.addEventListener( 'animationend', function handler() {
 
166
  _this.noticeContainer.classList.remove( 'cn-animated' );
167
  _this.noticeContainer.classList.add( 'cookie-notice-hidden' );
168
- _this.noticeContainer.removeEventListener( 'animationend', handler );
169
  } );
170
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
 
171
  _this.noticeContainer.classList.remove( 'cn-animated' );
172
  _this.noticeContainer.classList.add( 'cookie-notice-hidden' );
173
- _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
174
  } );
175
  };
176
 
@@ -184,25 +249,26 @@
184
  {
185
  detail: {
186
  data: cnArgs,
187
- },
188
- bubbles: true,
189
- cancelable: true
190
  }
191
  );
192
 
193
  document.dispatchEvent( event );
 
 
194
 
195
  this.noticeContainer.classList.remove( 'cookie-revoke-hidden' );
196
- this.noticeContainer.classList.add( 'cn-animated', 'cookie-revoke-visible' );
 
197
 
198
  // detect animation
199
  this.noticeContainer.addEventListener( 'animationend', function handler() {
200
- _this.noticeContainer.classList.remove( 'cn-animated' );
201
  _this.noticeContainer.removeEventListener( 'animationend', handler );
 
202
  } );
203
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
204
- _this.noticeContainer.classList.remove( 'cn-animated' );
205
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
 
206
  } );
207
  };
208
 
@@ -216,34 +282,38 @@
216
  {
217
  detail: {
218
  data: cnArgs,
219
- },
220
- bubbles: true,
221
- cancelable: true
222
  }
223
  );
224
 
225
  document.dispatchEvent( event );
 
 
226
 
227
  this.noticeContainer.classList.add( 'cn-animated' );
228
  this.noticeContainer.classList.remove( 'cookie-revoke-visible' );
229
 
230
  // detect animation
231
  this.noticeContainer.addEventListener( 'animationend', function handler() {
 
232
  _this.noticeContainer.classList.remove( 'cn-animated' );
233
  _this.noticeContainer.classList.add( 'cookie-revoke-hidden' );
234
- _this.noticeContainer.removeEventListener( 'animationend', handler );
235
  } );
236
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
 
237
  _this.noticeContainer.classList.remove( 'cn-animated' );
238
  _this.noticeContainer.classList.add( 'cookie-revoke-hidden' );
239
- _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
240
  } );
241
  };
242
 
243
  // change body classes
244
  this.setBodyClass = function ( classes ) {
245
  // remove body classes
246
- document.body.classList.remove( 'cookies-revoke', 'cookies-accepted', 'cookies-refused', 'cookies-set', 'cookies-not-set' );
 
 
 
 
247
 
248
  // add body classes
249
  for ( var i = 0; i < classes.length; i++ ) {
@@ -349,10 +419,10 @@
349
  // show cookie notice
350
  this.showCookieNotice();
351
  } else {
352
- this.setBodyClass( [ 'cookies-set', this.cookiesAccepted === 'true' ? 'cookies-accepted' : 'cookies-refused' ] );
353
 
354
  // show revoke notice if enabled
355
- if ( cnArgs.revoke_cookies_opt === 'automatic' ) {
356
  this.showRevokeNotice();
357
  }
358
  }
@@ -361,6 +431,8 @@
361
  for ( var i = 0; i < cookieButtons.length; i++ ) {
362
  cookieButtons[i].addEventListener( 'click', function ( e ) {
363
  e.preventDefault();
 
 
364
 
365
  _this.setStatus( this.dataset.cookieSet );
366
  } );
@@ -377,15 +449,15 @@
377
 
378
  // show cookie notice after the revoke is hidden
379
  _this.noticeContainer.addEventListener( 'animationend', function handler() {
380
- _this.showCookieNotice();
381
  _this.noticeContainer.removeEventListener( 'animationend', handler );
 
382
  } );
383
  _this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
384
- _this.showCookieNotice();
385
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
 
386
  } );
387
  // show cookie notice
388
- } else {
389
  _this.showCookieNotice();
390
  }
391
  } );
@@ -394,8 +466,8 @@
394
  }
395
 
396
  // initialie plugin
397
- window.onload = function() {
398
  cookieNotice.init();
399
- };
400
 
401
  } )( window, document, undefined );
1
+ // CustomEvent polyfil for IE support
2
+ ( function () {
3
+
4
+ if ( typeof window.CustomEvent === "function" )
5
+ return false;
6
+
7
+ function CustomEvent( event, params ) {
8
+ params = params || { bubbles: false, cancelable: false, detail: undefined };
9
+ var evt = document.createEvent( 'CustomEvent' );
10
+ evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
11
+ return evt;
12
+ }
13
+
14
+ CustomEvent.prototype = window.Event.prototype;
15
+
16
+ window.CustomEvent = CustomEvent;
17
+ } )();
18
+
19
+ // ClassList polyfil for IE/Safari support
20
+ ( function () {
21
+ var regExp = function ( name ) {
22
+ return new RegExp( '(^| )' + name + '( |$)' );
23
+ };
24
+ var forEach = function ( list, fn, scope ) {
25
+ for ( var i = 0; i < list.length; i++ ) {
26
+ fn.call( scope, list[i] );
27
+ }
28
+ };
29
+
30
+ function ClassList( element ) {
31
+ this.element = element;
32
+ }
33
+
34
+ ClassList.prototype = {
35
+ add: function () {
36
+ forEach( arguments, function ( name ) {
37
+ if ( !this.contains( name ) ) {
38
+ this.element.className += this.element.className.length > 0 ? ' ' + name : name;
39
+ }
40
+ }, this );
41
+ },
42
+ remove: function () {
43
+ forEach( arguments, function ( name ) {
44
+ this.element.className =
45
+ this.element.className.replace( regExp( name ), '' );
46
+ }, this );
47
+ },
48
+ toggle: function ( name ) {
49
+ return this.contains( name )
50
+ ? ( this.remove( name ), false ) : ( this.add( name ), true );
51
+ },
52
+ contains: function ( name ) {
53
+ return regExp( name ).test( this.element.className );
54
+ },
55
+ // bonus..
56
+ replace: function ( oldName, newName ) {
57
+ this.remove( oldName ), this.add( newName );
58
+ }
59
+ };
60
+
61
+ // IE8/9, Safari
62
+ if ( !( 'classList' in Element.prototype ) ) {
63
+ Object.defineProperty( Element.prototype, 'classList', {
64
+ get: function () {
65
+ return new ClassList( this );
66
+ }
67
+ } );
68
+ }
69
+
70
+ if ( window.DOMTokenList && DOMTokenList.prototype.replace == null ) {
71
+ DOMTokenList.prototype.replace = ClassList.prototype.replace;
72
+ }
73
+ } )();
74
+
75
+ // cookieNotice
76
  ( function( window, document, undefined ) {
77
 
78
  var cookieNotice = new function () {
113
  time: date,
114
  expires: laterDate,
115
  data: cnArgs
116
+ }
 
 
117
  }
118
  );
119
 
127
  if ( cnArgs.revoke_cookies_opt === 'automatic' ) {
128
  // show cookie notice after the revoke is hidden
129
  this.noticeContainer.addEventListener( 'animationend', function handler() {
 
130
  _this.noticeContainer.removeEventListener( 'animationend', handler );
131
+ _this.showRevokeNotice();
132
  } );
133
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
 
134
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
135
+ _this.showRevokeNotice();
136
  } );
137
  }
138
 
153
  }
154
 
155
  return;
 
 
 
 
 
156
  }
157
  };
158
 
182
  {
183
  detail: {
184
  data: cnArgs,
185
+ }
 
 
186
  }
187
  );
188
 
189
  document.dispatchEvent( event );
190
+
191
+ // console.log( 'show' );
192
 
193
  this.noticeContainer.classList.remove( 'cookie-notice-hidden' );
194
+ this.noticeContainer.classList.add( 'cn-animated' );
195
+ this.noticeContainer.classList.add( 'cookie-notice-visible' );
 
196
 
197
  // detect animation
198
  this.noticeContainer.addEventListener( 'animationend', function handler() {
 
199
  _this.noticeContainer.removeEventListener( 'animationend', handler );
200
+ _this.noticeContainer.classList.remove( 'cn-animated' );
201
  } );
202
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
 
203
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
204
+ _this.noticeContainer.classList.remove( 'cn-animated' );
205
  } );
206
  };
207
 
215
  {
216
  detail: {
217
  data: cnArgs,
218
+ }
 
 
219
  }
220
  );
221
 
222
  document.dispatchEvent( event );
223
 
224
+ // console.log( 'hide' );
225
+
226
  this.noticeContainer.classList.add( 'cn-animated' );
227
  this.noticeContainer.classList.remove( 'cookie-notice-visible' );
228
 
229
  // detect animation
230
  this.noticeContainer.addEventListener( 'animationend', function handler() {
231
+ _this.noticeContainer.removeEventListener( 'animationend', handler );
232
  _this.noticeContainer.classList.remove( 'cn-animated' );
233
  _this.noticeContainer.classList.add( 'cookie-notice-hidden' );
 
234
  } );
235
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
236
+ _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
237
  _this.noticeContainer.classList.remove( 'cn-animated' );
238
  _this.noticeContainer.classList.add( 'cookie-notice-hidden' );
 
239
  } );
240
  };
241
 
249
  {
250
  detail: {
251
  data: cnArgs,
252
+ }
 
 
253
  }
254
  );
255
 
256
  document.dispatchEvent( event );
257
+
258
+ // console.log( 'show revoke' );
259
 
260
  this.noticeContainer.classList.remove( 'cookie-revoke-hidden' );
261
+ this.noticeContainer.classList.add( 'cn-animated' );
262
+ this.noticeContainer.classList.add( 'cookie-revoke-visible' );
263
 
264
  // detect animation
265
  this.noticeContainer.addEventListener( 'animationend', function handler() {
 
266
  _this.noticeContainer.removeEventListener( 'animationend', handler );
267
+ _this.noticeContainer.classList.remove( 'cn-animated' );
268
  } );
269
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
 
270
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
271
+ _this.noticeContainer.classList.remove( 'cn-animated' );
272
  } );
273
  };
274
 
282
  {
283
  detail: {
284
  data: cnArgs,
285
+ }
 
 
286
  }
287
  );
288
 
289
  document.dispatchEvent( event );
290
+
291
+ // console.log( 'hide revoke' );
292
 
293
  this.noticeContainer.classList.add( 'cn-animated' );
294
  this.noticeContainer.classList.remove( 'cookie-revoke-visible' );
295
 
296
  // detect animation
297
  this.noticeContainer.addEventListener( 'animationend', function handler() {
298
+ _this.noticeContainer.removeEventListener( 'animationend', handler );
299
  _this.noticeContainer.classList.remove( 'cn-animated' );
300
  _this.noticeContainer.classList.add( 'cookie-revoke-hidden' );
 
301
  } );
302
  this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
303
+ _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
304
  _this.noticeContainer.classList.remove( 'cn-animated' );
305
  _this.noticeContainer.classList.add( 'cookie-revoke-hidden' );
 
306
  } );
307
  };
308
 
309
  // change body classes
310
  this.setBodyClass = function ( classes ) {
311
  // remove body classes
312
+ document.body.classList.remove( 'cookies-revoke' );
313
+ document.body.classList.remove( 'cookies-accepted' );
314
+ document.body.classList.remove( 'cookies-refused' );
315
+ document.body.classList.remove( 'cookies-set' );
316
+ document.body.classList.remove( 'cookies-not-set' );
317
 
318
  // add body classes
319
  for ( var i = 0; i < classes.length; i++ ) {
419
  // show cookie notice
420
  this.showCookieNotice();
421
  } else {
422
+ this.setBodyClass( [ 'cookies-set', this.cookiesAccepted === true ? 'cookies-accepted' : 'cookies-refused' ] );
423
 
424
  // show revoke notice if enabled
425
+ if ( cnArgs.revoke_cookies == 1 && cnArgs.revoke_cookies_opt === 'automatic' ) {
426
  this.showRevokeNotice();
427
  }
428
  }
431
  for ( var i = 0; i < cookieButtons.length; i++ ) {
432
  cookieButtons[i].addEventListener( 'click', function ( e ) {
433
  e.preventDefault();
434
+ // Chrome double click event fix
435
+ e.stopPropagation();
436
 
437
  _this.setStatus( this.dataset.cookieSet );
438
  } );
449
 
450
  // show cookie notice after the revoke is hidden
451
  _this.noticeContainer.addEventListener( 'animationend', function handler() {
 
452
  _this.noticeContainer.removeEventListener( 'animationend', handler );
453
+ _this.showCookieNotice();
454
  } );
455
  _this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
 
456
  _this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
457
+ _this.showCookieNotice();
458
  } );
459
  // show cookie notice
460
+ } else if ( _this.noticeContainer.classList.contains( 'cookie-notice-hidden' ) && _this.noticeContainer.classList.contains( 'cookie-revoke-hidden' ) ) {
461
  _this.showCookieNotice();
462
  }
463
  } );
466
  }
467
 
468
  // initialie plugin
469
+ window.addEventListener( 'load', function () {
470
  cookieNotice.init();
471
+ }, false );
472
 
473
  } )( window, document, undefined );
js/front.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,r){var e=new function(){this.cookiesAccepted=null,this.noticeContainer=null,this.setStatus=function(e){var t=this;"yes"===cnArgs.onScroll&&a.removeEventListener("scroll",this.handleScroll);var n=new Date,i=new Date;i.setTime(parseInt(n.getTime())+1e3*parseInt(cnArgs.cookieTime)),e="accept"===e?"true":"false",r.cookie=cnArgs.cookieName+"="+e+";expires="+i.toUTCString()+";"+(""!==cnArgs.cookieDomain?"domain="+cnArgs.cookieDomain+";":"")+(""!==cnArgs.cookiePath?"path="+cnArgs.cookiePath+";":"")+("1"===cnArgs.secure?"secure;":""),this.cookiesAccepted="true"===e||"false"!==e&&null;var o=new CustomEvent("setCookieNotice",{detail:{value:e,time:n,expires:i,data:cnArgs},bubbles:!0,cancelable:!0});if(r.dispatchEvent(o),this.setBodyClass(["cookies-set","true"===e?"cookies-accepted":"cookies-refused"]),this.hideCookieNotice(),"automatic"===cnArgs.revoke_cookies_opt&&(this.noticeContainer.addEventListener("animationend",function e(){t.showRevokeNotice(),t.noticeContainer.removeEventListener("animationend",e)}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.showRevokeNotice(),t.noticeContainer.removeEventListener("webkitAnimationEnd",e)})),"1"===cnArgs.redirection&&("true"===e&&null===this.cookiesAccepted||e!==this.cookiesAccepted&&null!==this.cookiesAccepted)){var c=a.location.protocol+"//",s=a.location.host+"/"+a.location.pathname;"1"===cnArgs.cache?(c=c+s.replace("//","/")+(""===a.location.search?"?":a.location.search+"&")+"cn-reloaded=1"+a.location.hash,a.location.href=c):(c=c+s.replace("//","/")+a.location.search+a.location.hash,a.location.reload(!0))}else cnArgs.revoke_cookies_opt},this.getStatus=function(e){var t=("; "+r.cookie).split("; cookie_notice_accepted=");if(2!==t.length)return null;var n=t.pop().split(";").shift();return e?"true"===n:n},this.showCookieNotice=function(){var t=this,e=new CustomEvent("showCookieNotice",{detail:{data:cnArgs},bubbles:!0,cancelable:!0});r.dispatchEvent(e),this.noticeContainer.classList.remove("cookie-notice-hidden"),this.noticeContainer.classList.add("cn-animated","cookie-notice-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.removeEventListener("animationend",e)}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.removeEventListener("webkitAnimationEnd",e)})},this.hideCookieNotice=function(){var t=this,e=new CustomEvent("hideCookieNotice",{detail:{data:cnArgs},bubbles:!0,cancelable:!0});r.dispatchEvent(e),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.remove("cookie-notice-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-notice-hidden"),t.noticeContainer.removeEventListener("animationend",e)}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-notice-hidden"),t.noticeContainer.removeEventListener("webkitAnimationEnd",e)})},this.showRevokeNotice=function(){var t=this,e=new CustomEvent("showRevokeNotice",{detail:{data:cnArgs},bubbles:!0,cancelable:!0});r.dispatchEvent(e),this.noticeContainer.classList.remove("cookie-revoke-hidden"),this.noticeContainer.classList.add("cn-animated","cookie-revoke-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.removeEventListener("animationend",e)}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.removeEventListener("webkitAnimationEnd",e)})},this.hideRevokeNotice=function(){var t=this,e=new CustomEvent("hideRevokeNotice",{detail:{data:cnArgs},bubbles:!0,cancelable:!0});r.dispatchEvent(e),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.remove("cookie-revoke-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-revoke-hidden"),t.noticeContainer.removeEventListener("animationend",e)}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-revoke-hidden"),t.noticeContainer.removeEventListener("webkitAnimationEnd",e)})},this.setBodyClass=function(e){r.body.classList.remove("cookies-revoke","cookies-accepted","cookies-refused","cookies-set","cookies-not-set");for(var t=0;t<e.length;t++)r.body.classList.add(e[t])},this.handleScroll=function(){(a.pageYOffset||(r.documentElement||r.body.parentNode||r.body).scrollTop)>parseInt(cnArgs.onScrollOffset)&&this.setStatus("accept")},this.getClosest=function(e,t){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n});e&&e!==r;e=e.parentNode)if(e.matches(t))return e;return null},this.init=function(){var t=this;this.cookiesAccepted=this.getStatus(!0),this.noticeContainer=r.getElementById("cookie-notice");var e=r.getElementsByClassName("cn-set-cookie"),n=r.getElementsByClassName("cn-revoke-cookie");this.noticeContainer.classList.add("cn-effect-"+cnArgs.hideEffect),null===this.cookiesAccepted?("yes"===cnArgs.onScroll&&a.addEventListener("scroll",function(e){t.handleScroll()}),"yes"===cnArgs.onClick&&a.addEventListener("click",function(e){null===t.getClosest(e.target,"#cookie-notice")&&t.setStatus("accept")},!0),this.setBodyClass(["cookies-not-set"]),this.showCookieNotice()):(this.setBodyClass(["cookies-set","true"===this.cookiesAccepted?"cookies-accepted":"cookies-refused"]),"automatic"===cnArgs.revoke_cookies_opt&&this.showRevokeNotice());for(var i=0;i<e.length;i++)e[i].addEventListener("click",function(e){e.preventDefault(),t.setStatus(this.dataset.cookieSet)});for(i=0;i<n.length;i++)n[i].addEventListener("click",function(e){e.preventDefault(),t.noticeContainer.classList.contains("cookie-revoke-visible")?(t.hideRevokeNotice(),t.noticeContainer.addEventListener("animationend",function e(){t.showCookieNotice(),t.noticeContainer.removeEventListener("animationend",e)}),t.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.showCookieNotice(),t.noticeContainer.removeEventListener("webkitAnimationEnd",e)})):t.showCookieNotice()})}};a.onload=function(){e.init()}}(window,document);
1
+ !function(){if("function"==typeof window.CustomEvent)return;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(),function(){function t(e){return new RegExp("(^| )"+e+"( |$)")}function e(e,t,n){for(var i=0;i<e.length;i++)t.call(n,e[i])}function n(e){this.element=e}n.prototype={add:function(){e(arguments,function(e){this.contains(e)||(this.element.className+=0<this.element.className.length?" "+e:e)},this)},remove:function(){e(arguments,function(e){this.element.className=this.element.className.replace(t(e),"")},this)},toggle:function(e){return this.contains(e)?(this.remove(e),!1):(this.add(e),!0)},contains:function(e){return t(e).test(this.element.className)},replace:function(e,t){this.remove(e),this.add(t)}},"classList"in Element.prototype||Object.defineProperty(Element.prototype,"classList",{get:function(){return new n(this)}}),window.DOMTokenList&&null==DOMTokenList.prototype.replace&&(DOMTokenList.prototype.replace=n.prototype.replace)}(),function(a,r){var e=new function(){this.cookiesAccepted=null,this.noticeContainer=null,this.setStatus=function(e){var t=this;"yes"===cnArgs.onScroll&&a.removeEventListener("scroll",this.handleScroll);var n=new Date,i=new Date;i.setTime(parseInt(n.getTime())+1e3*parseInt(cnArgs.cookieTime)),e="accept"===e?"true":"false",r.cookie=cnArgs.cookieName+"="+e+";expires="+i.toUTCString()+";"+(""!==cnArgs.cookieDomain?"domain="+cnArgs.cookieDomain+";":"")+(""!==cnArgs.cookiePath?"path="+cnArgs.cookiePath+";":"")+("1"===cnArgs.secure?"secure;":""),this.cookiesAccepted="true"===e||"false"!==e&&null;var o=new CustomEvent("setCookieNotice",{detail:{value:e,time:n,expires:i,data:cnArgs}});if(r.dispatchEvent(o),this.setBodyClass(["cookies-set","true"===e?"cookies-accepted":"cookies-refused"]),this.hideCookieNotice(),"automatic"===cnArgs.revoke_cookies_opt&&(this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.removeEventListener("animationend",e),t.showRevokeNotice()}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.removeEventListener("webkitAnimationEnd",e),t.showRevokeNotice()})),"1"===cnArgs.redirection&&("true"===e&&null===this.cookiesAccepted||e!==this.cookiesAccepted&&null!==this.cookiesAccepted)){var s=a.location.protocol+"//",c=a.location.host+"/"+a.location.pathname;"1"===cnArgs.cache?(s=s+c.replace("//","/")+(""===a.location.search?"?":a.location.search+"&")+"cn-reloaded=1"+a.location.hash,a.location.href=s):(s=s+c.replace("//","/")+a.location.search+a.location.hash,a.location.reload(!0))}else;},this.getStatus=function(e){var t=("; "+r.cookie).split("; cookie_notice_accepted=");if(2!==t.length)return null;var n=t.pop().split(";").shift();return e?"true"===n:n},this.showCookieNotice=function(){var t=this,e=new CustomEvent("showCookieNotice",{detail:{data:cnArgs}});r.dispatchEvent(e),this.noticeContainer.classList.remove("cookie-notice-hidden"),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.add("cookie-notice-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.removeEventListener("animationend",e),t.noticeContainer.classList.remove("cn-animated")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.removeEventListener("webkitAnimationEnd",e),t.noticeContainer.classList.remove("cn-animated")})},this.hideCookieNotice=function(){var t=this,e=new CustomEvent("hideCookieNotice",{detail:{data:cnArgs}});r.dispatchEvent(e),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.remove("cookie-notice-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.removeEventListener("animationend",e),t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-notice-hidden")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.removeEventListener("webkitAnimationEnd",e),t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-notice-hidden")})},this.showRevokeNotice=function(){var t=this,e=new CustomEvent("showRevokeNotice",{detail:{data:cnArgs}});r.dispatchEvent(e),this.noticeContainer.classList.remove("cookie-revoke-hidden"),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.add("cookie-revoke-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.removeEventListener("animationend",e),t.noticeContainer.classList.remove("cn-animated")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.removeEventListener("webkitAnimationEnd",e),t.noticeContainer.classList.remove("cn-animated")})},this.hideRevokeNotice=function(){var t=this,e=new CustomEvent("hideRevokeNotice",{detail:{data:cnArgs}});r.dispatchEvent(e),this.noticeContainer.classList.add("cn-animated"),this.noticeContainer.classList.remove("cookie-revoke-visible"),this.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.removeEventListener("animationend",e),t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-revoke-hidden")}),this.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.removeEventListener("webkitAnimationEnd",e),t.noticeContainer.classList.remove("cn-animated"),t.noticeContainer.classList.add("cookie-revoke-hidden")})},this.setBodyClass=function(e){r.body.classList.remove("cookies-revoke"),r.body.classList.remove("cookies-accepted"),r.body.classList.remove("cookies-refused"),r.body.classList.remove("cookies-set"),r.body.classList.remove("cookies-not-set");for(var t=0;t<e.length;t++)r.body.classList.add(e[t])},this.handleScroll=function(){(a.pageYOffset||(r.documentElement||r.body.parentNode||r.body).scrollTop)>parseInt(cnArgs.onScrollOffset)&&this.setStatus("accept")},this.getClosest=function(e,t){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n});e&&e!==r;e=e.parentNode)if(e.matches(t))return e;return null},this.init=function(){var t=this;this.cookiesAccepted=this.getStatus(!0),this.noticeContainer=r.getElementById("cookie-notice");var e=r.getElementsByClassName("cn-set-cookie"),n=r.getElementsByClassName("cn-revoke-cookie");this.noticeContainer.classList.add("cn-effect-"+cnArgs.hideEffect),null===this.cookiesAccepted?("yes"===cnArgs.onScroll&&a.addEventListener("scroll",function(e){t.handleScroll()}),"yes"===cnArgs.onClick&&a.addEventListener("click",function(e){null===t.getClosest(e.target,"#cookie-notice")&&t.setStatus("accept")},!0),this.setBodyClass(["cookies-not-set"]),this.showCookieNotice()):(this.setBodyClass(["cookies-set",!0===this.cookiesAccepted?"cookies-accepted":"cookies-refused"]),1==cnArgs.revoke_cookies&&"automatic"===cnArgs.revoke_cookies_opt&&this.showRevokeNotice());for(var i=0;i<e.length;i++)e[i].addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),t.setStatus(this.dataset.cookieSet)});for(i=0;i<n.length;i++)n[i].addEventListener("click",function(e){e.preventDefault(),t.noticeContainer.classList.contains("cookie-revoke-visible")?(t.hideRevokeNotice(),t.noticeContainer.addEventListener("animationend",function e(){t.noticeContainer.removeEventListener("animationend",e),t.showCookieNotice()}),t.noticeContainer.addEventListener("webkitAnimationEnd",function e(){t.noticeContainer.removeEventListener("webkitAnimationEnd",e),t.showCookieNotice()})):t.noticeContainer.classList.contains("cookie-notice-hidden")&&t.noticeContainer.classList.contains("cookie-revoke-hidden")&&t.showCookieNotice()})}};a.addEventListener("load",function(){e.init()},!1)}(window,document);
readme.txt CHANGED
@@ -5,15 +5,15 @@ Tags: gdpr, ccpa, cookie, cookies, notice, notification, notify, cookie, cookie
5
  Requires at least: 3.3
6
  Requires PHP: 5.2.4
7
  Tested up to: 5.3.2
8
- Stable tag: 1.2.49
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
12
- Cookie Notice allows you to elegantly inform users that your site uses cookies and to comply with the EU GDPR cookie law and CCPA regulations.
13
 
14
  == Description ==
15
 
16
- [Cookie Notice](http://www.dfactory.eu/plugins/cookie-notice/) allows you to elegantly inform users that your site uses cookies and to comply with the EU GDPR cookie law and CCPA regulations.
17
 
18
  For more information, check out plugin page at [dFactory](http://www.dfactory.eu/) or plugin [support forum](http://www.dfactory.eu/support/forum/cookie-notice/).
19
 
@@ -68,6 +68,11 @@ No questions yet.
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
71
  = 1.2.49 =
72
  * New: Option to accept the notice with any page click
73
  * Tweak: Remove jQuery dependency
@@ -279,5 +284,5 @@ Initial release
279
 
280
  == Upgrade Notice ==
281
 
282
- = 1.2.49 =
283
- * New: Option to accept the notice with any page click
5
  Requires at least: 3.3
6
  Requires PHP: 5.2.4
7
  Tested up to: 5.3.2
8
+ Stable tag: 1.2.50
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
12
+ Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with the EU GDPR cookie law and CCPA regulations.
13
 
14
  == Description ==
15
 
16
+ [Cookie Notice](http://www.dfactory.eu/plugins/cookie-notice/) allows you to elegantly inform users that your site uses cookies and helps you comply with the EU GDPR cookie law and CCPA regulations.
17
 
18
  For more information, check out plugin page at [dFactory](http://www.dfactory.eu/) or plugin [support forum](http://www.dfactory.eu/support/forum/cookie-notice/).
19
 
68
 
69
  == Changelog ==
70
 
71
+ = 1.2.50 =
72
+ * Fix: The body css class always set to "cookies-refused"
73
+ * Tweak: Improve IE & Safari CustomEvent and ClassList support
74
+ * Tweak: Change the plugin js init event
75
+
76
  = 1.2.49 =
77
  * New: Option to accept the notice with any page click
78
  * Tweak: Remove jQuery dependency
284
 
285
  == Upgrade Notice ==
286
 
287
+ = 1.2.50 =
288
+ * Fix: The body css class always set to "cookies-refused"