1function cli_show_cookiebar(p) { 2 3 var Cookie = { 4 set: function(name,value,days) { 5 if (days) { 6 var date = new Date(); 7 date.setTime(date.getTime()+(days*24*60*60*1000)); 8 var expires = "; expires="+date.toGMTString(); 9 } 10 else var expires = ""; 11 document.cookie = name+"="+value+expires+"; path=/"; 12 }, 13 read: function(name) { 14 var nameEQ = name + "="; 15 var ca = document.cookie.split(';'); 16 for(var i=0;i < ca.length;i++) { 17 var c = ca[i]; 18 while (c.charAt(0)==' ') { 19 c = c.substring(1,c.length); 20 } 21 if (c.indexOf(nameEQ) === 0) { 22 return c.substring(nameEQ.length,c.length); 23 } 24 } 25 return null; 26 }, 27 erase: function(name) { 28 this.set(name,"",-1); 29 }, 30 exists: function(name) { 31 return (this.read(name) !== null); 32 } 33 }; 34 35 var ACCEPT_COOKIE_NAME = 'viewed_cookie_policy', 36 ACCEPT_COOKIE_EXPIRE = 365, 37 html = p.html, 38 json_payload = p.settings; 39 40 if (typeof JSON.parse !== "function") { 41 console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it"); 42 return; 43 } 44 var settings = JSON.parse(json_payload); 45 jQuery('body').prepend(html); 46 47 48 var cached_header = jQuery(settings.notify_div_id), 49 cached_showagain_tab = jQuery(settings.showagain_div_id), 50 btn_accept = jQuery('#cookie_hdr_accept'), 51 btn_decline = jQuery('#cookie_hdr_decline'), 52 btn_moreinfo = jQuery('#cookie_hdr_moreinfo'), 53 btn_settings = jQuery('#cookie_hdr_settings'); 54 55 cached_header.hide(); 56 if ( !settings.showagain_tab ) { 57 cached_showagain_tab.hide(); 58 } 59 60 var hdr_args = { 61 'background-color': settings.background, 62 'color': settings.text, 63 'font-family': settings.font_family 64 }; 65 var showagain_args = { 66 'background-color': settings.background, 67 'color': l1hs(settings.text), 68 'position': 'fixed', 69 'font-family': settings.font_family 70 }; 71 if ( settings.border_on ) { 72 var border_to_hide = 'border-' + settings.notify_position_vertical; 73 showagain_args['border'] = '1px solid ' + l1hs(settings.border); 74 showagain_args[border_to_hide] = 'none'; 75 } 76 if ( settings.notify_position_vertical == "top" ) { 77 if ( settings.border_on ) { 78 hdr_args['border-bottom'] = '4px solid ' + l1hs(settings.border); 79 } 80 showagain_args.top = '0'; 81 } 82 else if ( settings.notify_position_vertical == "bottom" ) { 83 if ( settings.border_on ) { 84 hdr_args['border-top'] = '4px solid ' + l1hs(settings.border); 85 } 86 hdr_args['position'] = 'fixed'; 87 hdr_args['bottom'] = '0'; 88 showagain_args.bottom = '0'; 89 } 90 if ( settings.notify_position_horizontal == "left" ) { 91 showagain_args.left = settings.showagain_x_position; 92 } 93 else if ( settings.notify_position_horizontal == "right" ) { 94 showagain_args.right = settings.showagain_x_position; 95 } 96 cached_header.css( hdr_args ); 97 cached_showagain_tab.css( showagain_args ); 98 99 if (!Cookie.exists(ACCEPT_COOKIE_NAME)) { 100 displayHeader(); 101 } 102 else { 103 cached_header.hide(); 104 } 105 106 // Show once code: 107 if ( settings.show_once_yn ) { 108 setTimeout(close_header, settings.show_once); 109 } 110 function close_header() { 111 Cookie.set(ACCEPT_COOKIE_NAME, 'yes', ACCEPT_COOKIE_EXPIRE); 112 hideHeader(); 113 } 114 115 var main_button = jQuery('.cli-plugin-main-button'); 116 main_button.css( 'color', settings.button_1_link_colour ); 117 118 if ( settings.button_1_as_button ) { 119 main_button.css('background-color', settings.button_1_button_colour); 120 121 main_button.hover(function() { 122 jQuery(this).css('background-color', settings.button_1_button_hover); 123 }, 124 function() { 125 jQuery(this).css('background-color', settings.button_1_button_colour); 126 }); 127 } 128 var main_link = jQuery('.cli-plugin-main-link'); 129 main_link.css( 'color', settings.button_2_link_colour ); 130 131 if ( settings.button_2_as_button ) { 132 main_link.css('background-color', settings.button_2_button_colour); 133 134 main_link.hover(function() { 135 jQuery(this).css('background-color', settings.button_2_button_hover); 136 }, 137 function() { 138 jQuery(this).css('background-color', settings.button_2_button_colour); 139 }); 140 } 141 142 // Action event listener for "show header" event: 143 cached_showagain_tab.click(function() { 144 cached_showagain_tab.slideUp(settings.animate_speed_hide, function slideShow() { 145 cached_header.slideDown(settings.animate_speed_show); 146 }); 147 }); 148 149 // Action event listener to capture delete cookies shortcode click. This simply deletes the viewed_cookie_policy cookie. To use: 150 // <a href='#' id='cookielawinfo-cookie-delete' class='cookie_hdr_btn'>Delete Cookies</a> 151 jQuery("#cookielawinfo-cookie-delete").click(function() { 152 Cookie.erase(ACCEPT_COOKIE_NAME); 153 return false;
154 }); 155 156 // Action event listener for debug cookies value link. To use: 157 // <a href='#' id='cookielawinfo-debug-cookie'>Show Cookie Value</a> 158 jQuery("#cookielawinfo-debug-cookie").click(function() { 159 alert("Cookie value: " + Cookie.read(ACCEPT_COOKIE_NAME)); 160 return false; 161 }); 162 163 // action event listeners to capture "accept/continue" events: 164 jQuery("#cookie_action_close_header").click(function() { 165 // Set cookie then hide header: 166 Cookie.set(ACCEPT_COOKIE_NAME, 'yes', ACCEPT_COOKIE_EXPIRE); 167 168 if (settings.notify_animate_hide) { 169 cached_header.slideUp(settings.animate_speed_hide); 170 } 171 else { 172 cached_header.hide(); 173 } 174 cached_showagain_tab.slideDown(settings.animate_speed_show); 175 return false; 176 }); 177 178 function displayHeader() { 179 if (settings.notify_animate_show) { 180 cached_header.slideDown(settings.animate_speed_show); 181 } 182 else { 183 cached_header.show(); 184 } 185 cached_showagain_tab.hide(); 186 } 187 function hideHeader() { 188 if (settings.notify_animate_show) { 189 cached_showagain_tab.slideDown(settings.animate_speed_show); 190 } 191 else { 192 cached_showagain_tab.show(); 193 } 194 cached_header.slideUp(settings.animate_speed_show); 195 } 196}; 197function l1hs(str){if(str.charAt(0)=="#"){str=str.substring(1,str.length);}else{return "#"+str;}return l1hs(str);}
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.