Cookie Notice by dFactory - Version 1.2.41

Version Description

  • Fix: Infinite redirection loop with scroll enabled
Download this release

Release Info

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

Code changes from version 1.2.40 to 1.2.41

Files changed (4) hide show
  1. cookie-notice.php +3 -3
  2. js/front.js +27 -16
  3. js/front.min.js +1 -1
  4. readme.txt +7 -6
cookie-notice.php CHANGED
@@ -2,7 +2,7 @@
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 cookie law regulations.
5
- Version: 1.2.40
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
@@ -34,7 +34,7 @@ include_once( plugin_dir_path( __FILE__ ) . 'includes/upgrade.php' );
34
  * Cookie Notice class.
35
  *
36
  * @class Cookie_Notice
37
- * @version 1.2.40
38
  */
39
  class Cookie_Notice {
40
 
@@ -71,7 +71,7 @@ class Cookie_Notice {
71
  'translate' => true,
72
  'deactivation_delete' => 'no'
73
  ),
74
- 'version' => '1.2.40'
75
  );
76
  private $positions = array();
77
  private $styles = array();
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 cookie law regulations.
5
+ Version: 1.2.41
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
34
  * Cookie Notice class.
35
  *
36
  * @class Cookie_Notice
37
+ * @version 1.2.41
38
  */
39
  class Cookie_Notice {
40
 
71
  'translate' => true,
72
  'deactivation_delete' => 'no'
73
  ),
74
+ 'version' => '1.2.41'
75
  );
76
  private $positions = array();
77
  private $styles = array();
js/front.js CHANGED
@@ -2,6 +2,10 @@
2
 
3
  // set Cookie Notice
4
  $.fn.setCookieNotice = function ( cookie_value ) {
 
 
 
 
5
  var cnTime = new Date(),
6
  cnLater = new Date(),
7
  cnDomNode = $( '#cookie-notice' ),
@@ -16,7 +20,7 @@
16
 
17
  // trigger custom event
18
  $.event.trigger( {
19
- type: "setCookieNotice",
20
  value: cookie_value,
21
  time: cnTime,
22
  expires: cnLater
@@ -60,31 +64,37 @@
60
  };
61
 
62
  $( document ).ready( function () {
63
-
64
  var cnDomNode = $( '#cookie-notice' );
65
 
66
- // handle set-cookie button click
67
- $( document ).on( 'click', '.cn-set-cookie', function ( e ) {
68
- e.preventDefault();
69
- $( this ).setCookieNotice( $( this ).data( 'cookie-set' ) );
70
- } );
71
-
72
  // handle on scroll
73
- if ( cnArgs.onScroll == 'yes' ) {
74
- var cnHandleScroll = function () {
75
  var win = $( this );
 
76
  if ( win.scrollTop() > parseInt( cnArgs.onScrollOffset ) ) {
77
- // If user scrolls at least 100 pixels
78
  win.setCookieNotice( 'accept' );
79
- win.off( 'scroll', cnHandleScroll ); //remove itself after cookie accept
 
 
80
  }
81
  };
82
-
83
- $( window ).on( 'scroll', cnHandleScroll );
84
  }
85
 
 
 
 
 
 
 
 
86
  // display cookie notice
87
  if ( document.cookie.indexOf( 'cookie_notice_accepted' ) === -1 ) {
 
 
 
 
 
88
  if ( cnArgs.hideEffect === 'fade' ) {
89
  cnDomNode.fadeIn( 300 );
90
  } else if ( cnArgs.hideEffect === 'slide' ) {
@@ -92,10 +102,11 @@
92
  } else {
93
  cnDomNode.show();
94
  }
 
95
  $( 'body' ).addClass( 'cookies-not-accepted' );
96
  } else {
97
  cnDomNode.removeCookieNotice();
98
  }
 
99
 
100
- } )
101
- } )( jQuery );
2
 
3
  // set Cookie Notice
4
  $.fn.setCookieNotice = function ( cookie_value ) {
5
+ if ( cnArgs.onScroll === 'yes' ) {
6
+ $( window ).off( 'scroll', cnHandleScroll );
7
+ }
8
+
9
  var cnTime = new Date(),
10
  cnLater = new Date(),
11
  cnDomNode = $( '#cookie-notice' ),
20
 
21
  // trigger custom event
22
  $.event.trigger( {
23
+ type: 'setCookieNotice',
24
  value: cookie_value,
25
  time: cnTime,
26
  expires: cnLater
64
  };
65
 
66
  $( document ).ready( function () {
 
67
  var cnDomNode = $( '#cookie-notice' );
68
 
 
 
 
 
 
 
69
  // handle on scroll
70
+ if ( cnArgs.onScroll === 'yes' ) {
71
+ cnHandleScroll = function () {
72
  var win = $( this );
73
+
74
  if ( win.scrollTop() > parseInt( cnArgs.onScrollOffset ) ) {
75
+ // accept cookie
76
  win.setCookieNotice( 'accept' );
77
+
78
+ // remove itself after cookie accept
79
+ win.off( 'scroll', cnHandleScroll );
80
  }
81
  };
 
 
82
  }
83
 
84
+ // handle set-cookie button click
85
+ $( document ).on( 'click', '.cn-set-cookie', function ( e ) {
86
+ e.preventDefault();
87
+
88
+ $( this ).setCookieNotice( $( this ).data( 'cookie-set' ) );
89
+ } );
90
+
91
  // display cookie notice
92
  if ( document.cookie.indexOf( 'cookie_notice_accepted' ) === -1 ) {
93
+ // handle on scroll
94
+ if ( cnArgs.onScroll === 'yes' ) {
95
+ $( window ).on( 'scroll', cnHandleScroll );
96
+ }
97
+
98
  if ( cnArgs.hideEffect === 'fade' ) {
99
  cnDomNode.fadeIn( 300 );
100
  } else if ( cnArgs.hideEffect === 'slide' ) {
102
  } else {
103
  cnDomNode.show();
104
  }
105
+
106
  $( 'body' ).addClass( 'cookies-not-accepted' );
107
  } else {
108
  cnDomNode.removeCookieNotice();
109
  }
110
+ } );
111
 
112
+ } )( jQuery );
 
js/front.min.js CHANGED
@@ -1 +1 @@
1
- !function(o){o.fn.setCookieNotice=function(e){var c=new Date,i=new Date,n=o("#cookie-notice"),t=this;if(i.setTime(parseInt(c.getTime())+1e3*parseInt(cnArgs.cookieTime)),e="accept"===e,document.cookie=cnArgs.cookieName+"="+e+";expires="+i.toGMTString()+";"+(void 0!==cnArgs.cookieDomain&&""!==cnArgs.cookieDomain?"domain="+cnArgs.cookieDomain+";":"")+(void 0!==cnArgs.cookiePath&&""!==cnArgs.cookiePath?"path="+cnArgs.cookiePath+";":""),o.event.trigger({type:"setCookieNotice",value:e,time:c,expires:i}),"fade"===cnArgs.hideEffect?n.fadeOut(300,function(){t.removeCookieNotice()}):"slide"===cnArgs.hideEffect?n.slideUp(300,function(){t.removeCookieNotice()}):t.removeCookieNotice(),e&&"1"===cnArgs.redirection){var a=window.location.protocol+"//",r=window.location.host+"/"+window.location.pathname;"1"===cnArgs.cache?(a=a+r.replace("//","/")+(""===window.location.search?"?":window.location.search+"&")+"cn-reloaded=1"+window.location.hash,window.location.href=a):(a=a+r.replace("//","/")+window.location.search+window.location.hash,window.location.reload(!0))}else;},o.fn.removeCookieNotice=function(e){o("#cookie-notice").remove(),o("body").removeClass("cookies-not-accepted")},o(document).ready(function(){var e=o("#cookie-notice");if(o(document).on("click",".cn-set-cookie",function(e){e.preventDefault(),o(this).setCookieNotice(o(this).data("cookie-set"))}),"yes"==cnArgs.onScroll){var c=function(){var e=o(this);e.scrollTop()>parseInt(cnArgs.onScrollOffset)&&(e.setCookieNotice("accept"),e.off("scroll",c))};o(window).on("scroll",c)}-1===document.cookie.indexOf("cookie_notice_accepted")?("fade"===cnArgs.hideEffect?e.fadeIn(300):"slide"===cnArgs.hideEffect?e.slideDown(300):e.show(),o("body").addClass("cookies-not-accepted")):e.removeCookieNotice()})}(jQuery);
1
+ !function(o){o.fn.setCookieNotice=function(e){"yes"===cnArgs.onScroll&&o(window).off("scroll",cnHandleScroll);var c=new Date,i=new Date,n=o("#cookie-notice"),t=this;if(i.setTime(parseInt(c.getTime())+1e3*parseInt(cnArgs.cookieTime)),e="accept"===e,document.cookie=cnArgs.cookieName+"="+e+";expires="+i.toGMTString()+";"+(void 0!==cnArgs.cookieDomain&&""!==cnArgs.cookieDomain?"domain="+cnArgs.cookieDomain+";":"")+(void 0!==cnArgs.cookiePath&&""!==cnArgs.cookiePath?"path="+cnArgs.cookiePath+";":""),o.event.trigger({type:"setCookieNotice",value:e,time:c,expires:i}),"fade"===cnArgs.hideEffect?n.fadeOut(300,function(){t.removeCookieNotice()}):"slide"===cnArgs.hideEffect?n.slideUp(300,function(){t.removeCookieNotice()}):t.removeCookieNotice(),e&&"1"===cnArgs.redirection){var r=window.location.protocol+"//",a=window.location.host+"/"+window.location.pathname;"1"===cnArgs.cache?(r=r+a.replace("//","/")+(""===window.location.search?"?":window.location.search+"&")+"cn-reloaded=1"+window.location.hash,window.location.href=r):(r=r+a.replace("//","/")+window.location.search+window.location.hash,window.location.reload(!0))}else;},o.fn.removeCookieNotice=function(e){o("#cookie-notice").remove(),o("body").removeClass("cookies-not-accepted")},o(document).ready(function(){var e=o("#cookie-notice");"yes"===cnArgs.onScroll&&(cnHandleScroll=function(){var e=o(this);e.scrollTop()>parseInt(cnArgs.onScrollOffset)&&(e.setCookieNotice("accept"),e.off("scroll",cnHandleScroll))}),o(document).on("click",".cn-set-cookie",function(e){e.preventDefault(),o(this).setCookieNotice(o(this).data("cookie-set"))}),-1===document.cookie.indexOf("cookie_notice_accepted")?("yes"===cnArgs.onScroll&&o(window).on("scroll",cnHandleScroll),"fade"===cnArgs.hideEffect?e.fadeIn(300):"slide"===cnArgs.hideEffect?e.slideDown(300):e.show(),o("body").addClass("cookies-not-accepted")):e.removeCookieNotice()})}(jQuery);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: cookie, cookies, notice, notification, notify, cookie, cookie compliance, cookie law, eu cookie, privacy, privacy directive, consent, Bootstrap
5
  Requires at least: 3.3
6
- Tested up to: 4.8.3
7
- Stable tag: 1.2.40
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -62,6 +62,9 @@ No questions yet.
62
 
63
  == Changelog ==
64
 
 
 
 
65
  = 1.2.40 =
66
  * Fix: Div align center on some themes
67
  * Tweak: Extended list of allowed HTML tags in refuse code
@@ -231,7 +234,5 @@ Initial release
231
 
232
  == Upgrade Notice ==
233
 
234
- = 1.2.40 =
235
- * Fix: Div align center on some themes
236
- * Tweak: Extended list of allowed HTML tags in refuse code
237
- * Tweak: Minified CSS and JS
3
  Donate link: http://www.dfactory.eu/
4
  Tags: cookie, cookies, notice, notification, notify, cookie, cookie compliance, cookie law, eu cookie, privacy, privacy directive, consent, Bootstrap
5
  Requires at least: 3.3
6
+ Tested up to: 4.9.2
7
+ Stable tag: 1.2.41
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
62
 
63
  == Changelog ==
64
 
65
+ = 1.2.41 =
66
+ * Fix: Infinite redirection loop with scroll enabled
67
+
68
  = 1.2.40 =
69
  * Fix: Div align center on some themes
70
  * Tweak: Extended list of allowed HTML tags in refuse code
234
 
235
  == Upgrade Notice ==
236
 
237
+ = 1.2.41 =
238
+ * Fix: Infinite redirection loop with scroll enabled