1( function ( $ ) { 2 /** 3 * bind 4 */ 5 $( document ).ready( function () { 6 var value; 7 8 $( ub_cookie_notice.id + '-wrap' ).show(); 9 10 $( ub_cookie_notice.id + ' .ub-cn-set-cookie' ).on( 'click', function ( e ) { 11 e.preventDefault(); 12 $( this ).setUBCookieNotice(); 13 } ); 14 /** 15 * it ws already shown 16 */ 17 value = $.fn.BrandaGetCookieValue( ub_cookie_notice.cookie.name + '_close' ); 18 if ( 'hide' === value ) { 19 $( ub_cookie_notice.id ).hide(); 20 } else { 21 $( ub_cookie_notice.id ).show(); 22 } 23 } ); 24 25 /** 26 * get cookie value 27 */ 28 $.fn.BrandaGetCookieValue = function( cname ) { 29 var name = cname + "="; 30 var decodedCookie = decodeURIComponent(document.cookie); 31 var ca = decodedCookie.split(';'); 32 for(var i = 0; i <ca.length; i++) { 33 var c = ca[i]; 34 while (c.charAt(0) == ' ') { 35 c = c.substring(1); 36 } 37 if (c.indexOf(name) == 0) { 38 return c.substring(name.length, c.length); 39 } 40 } 41 return ""; 42 } 43 44 /** 45 * set Cookie Notice 46 */ 47 $.fn.setUBCookieNotice = function () { 48 var notice = $( ub_cookie_notice.id ); 49 var expires = new Date(); 50 var value = parseInt( expires.getTime() ); 51 var cookie = ''; 52 /** 53 * set time 54 */ 55 value = parseInt( expires.getTime() ); 56 /** 57 * add time 58 */ 59 value += parseInt( ub_cookie_notice.cookie.value ) * 1000; 60 /** 61 * add time zone 62 */ 63 value += parseInt( ub_cookie_notice.cookie.timezone ) * 1000; 64 /** 65 * set time 66 */ 67 expires.setTime( value ); 68 /** 69 * add cookie timestamp 70 */ 71 cookie = ub_cookie_notice.cookie.name + '=' + value/1000 + ';'; 72 cookie += ' expires=' + expires.toUTCString() + ';'; 73 if ( ub_cookie_notice.cookie.domain ) { 74 cookie += ' domain=' + ub_cookie_notice.cookie.domain + ';'; 75 } 76 /** 77 * Add cookie now (fix cache issue) 78 */ 79 cookie += ' path=' + ub_cookie_notice.cookie.path + ';'; 80 if ( 'on' === ub_cookie_notice.cookie.secure ) { 81 cookie += ' secure;' 82 } 83 document.cookie = cookie; 84 cookie = ub_cookie_notice.cookie.name + '_close=hide;'; 85 cookie += ' expires=;'; 86 if ( ub_cookie_notice.cookie.domain ) { 87 cookie += ' domain=' + ub_cookie_notice.cookie.domain + ';'; 88 } 89 cookie += ' path=' + ub_cookie_notice.cookie.path + ';'; 90 if ( 'on' === ub_cookie_notice.cookie.secure ) { 91 cookie += ' secure;' 92 } 93 document.cookie = cookie; 94 /** 95 * set user meta 96 */ 97 if ( undefined !== ub_cookie_notice.logged && 'yes' === ub_cookie_notice.logged ) { 98 var data = { 99 'action': 'ub_cookie_notice', 100 'user_id': ub_cookie_notice.user_id, 101 'nonce': ub_cookie_notice.nonce 102 }; 103 $.post( ub_cookie_notice.ajaxurl, data ); 104 } else { 105 // Dimiss the notice for visitor. 106 var data = { 107 'action': 'ub_dismiss_visitor_notice', 108 'nonce': ub_cookie_notice.nonce 109 }; 110 $.post( ub_cookie_notice.ajaxurl, data ); 111 } 112 /** 113 * reload 114 */ 115 if ( undefined !== ub_cookie_notice.reloading && 'on' === ub_cookie_notice.reloading ) { 116 document.location.reload( true ); 117 return; 118 } 119 /** 120 * hide 121 */ 122 var animation = undefined !== ub_cookie_notice.animation? ub_cookie_notice.animation:'none'; 123 switch( animation ) { 124 case 'fade': 125 notice.fadeOut( 400 ); 126 break; 127 case 'slide': 128 notice.slideUp( 400 ); 129 break; 130 default: 131 notice.hide(); 132 } 133 }; 134 135} )( jQuery );
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.