1jQuery(document).ready(function(){ 2 3 // COOKIE UTILS 4 var kl_redirect_cookie_utils = { 5 cookieBtnExists: function( btn ){ 6 return btn.length; 7 }, 8 setRedirectCookie: function( name = 'klhpc_redirect_url_cookie', minutes = 30 ){ 9 var date = new Date(); 10 var currentPageURL = window.location.href; 11 date.setTime( date.getTime() + ( minutes * 60 * 1000 ) ); 12 document.cookie = name + '='+ currentPageURL +'; expires=' + date.toGMTString() + '; path=/'; 13 }, 14 deleteRedirectCookie: function( name = 'klhpc_redirect_url_cookie' ){ 15 document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; 16 } 17 }; 18 19 // COOKIE BUTTONS ARRAY 20 var kl_cookie_btns = [ 21 { 22 behaviour : 'klhpc_redirect_url_cookie', 23 btnCallback : kl_redirect_cookie_utils.setRedirectCookie 24 }, 25 { 26 behaviour : 'klhpc_delete_redirect_url_cookie', 27 btnCallback : kl_redirect_cookie_utils.deleteRedirectCookie 28 } 29 ]; 30 31 32 // LOOP THROUGH THE COOKIE BUTTONS 33 kl_cookie_btns.forEach( function( btn ){ 34 var $cookie_btn = jQuery("[data-behaviour~="+ btn.behaviour +"]"); 35 // CHECK IF THE BUTTON EXISTS 36 if( kl_redirect_cookie_utils.cookieBtnExists( $cookie_btn ) ){ 37 $cookie_btn.on('click',function(e){ 38 // e.preventDefault(); 39 btn.btnCallback(); // SET CALLBACK 40 }); 41 } 42 }); 43 44});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.