1function cli_show_cookiebar(p) { 2 3var 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 35var ACCEPT_COOKIE_NAME = 'viewed_cookie_policy', 36 ACCEPT_COOKIE_EXPIRE = 365, 37 html = p.html, 38 json_payload = p.settings; 39 40// Edit 09/05: 41// Replaced eval with JSON.parse. See http://caniuse.com/json for support (sorry IE7 users but you're dinosaurs these days...) 42//var settings = eval('(' + json_payload +')'); 43 44if (typeof JSON.parse !== "function") { 45 console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it"); 46 return; 47} 48var settings = JSON.parse(json_payload); 49jQuery('body').prepend(html); 50 51 52var cached_header = jQuery(settings.notify_div_id), 53 cached_showagain_tab = jQuery(settings.showagain_div_id), 54 btn_accept = jQuery('#cookie_hdr_accept'), 55 btn_decline = jQuery('#cookie_hdr_decline'), 56 btn_moreinfo = jQuery('#cookie_hdr_moreinfo'), 57 btn_settings = jQuery('#cookie_hdr_settings'); 58 59cached_header.hide(); 60if (!settings.showagain_tab) { 61 cached_showagain_tab.hide(); 62} 63 64var hdr_args = { 65 'background-color': settings.background, 66 'color': settings.text, 67 'font-family': settings.font_family 68}; 69var showagain_args = { 70 'background-color': settings.background, 71 'color': l1hs(settings.text), 72 'position': 'fixed', 73 'font-family': settings.font_family 74}; 75if (settings.border_on) { 76 var border_to_hide = 'border-' + settings.notify_position_vertical; 77 showagain_args['border'] = '1px solid ' + l1hs(settings.border); 78 showagain_args[border_to_hide] = 'none'; 79} 80if (settings.notify_position_vertical == "top") { 81 if (settings.border_on) { 82 hdr_args['border-bottom'] = '4px solid ' + l1hs(settings.border); 83 } 84 showagain_args.top = '0'; 85} 86else if (settings.notify_position_vertical == "bottom") { 87 if (settings.border_on) { 88 hdr_args['border-top'] = '4px solid ' + l1hs(settings.border); 89 } 90 hdr_args['position'] = 'fixed'; 91 hdr_args['bottom'] = '0'; 92 showagain_args.bottom = '0'; 93} 94if (settings.notify_position_horizontal == "left") { 95 showagain_args.left = settings.showagain_x_position; 96} 97else if (settings.notify_position_horizontal == "right") { 98 showagain_args.right = settings.showagain_x_position; 99} 100cached_header.css(hdr_args); 101cached_showagain_tab.css(showagain_args); 102 103if (!Cookie.exists(ACCEPT_COOKIE_NAME)) { 104 displayHeader(); 105} 106else { 107 cached_header.hide(); 108} 109 110// Show once code: 111if (settings.show_once_yn) { 112 setTimeout(close_header, settings.show_once); 113} 114function close_header() { 115 Cookie.set(ACCEPT_COOKIE_NAME, 'yes', ACCEPT_COOKIE_EXPIRE); 116 hideHeader(); 117} 118 119var main_button = jQuery('.cli-plugin-main-button'); 120main_button.css('color', settings.button_1_link_colour); 121 122if (settings.button_1_as_button) { 123 main_button.css('background-color', settings.button_1_button_colour); 124 125 main_button.hover(function () { 126 jQuery(this).css('background-color', settings.button_1_button_hover); 127 }, 128 function () { 129 jQuery(this).css('background-color', settings.button_1_button_colour); 130 }); 131} 132var main_link = jQuery('.cli-plugin-main-link'); 133main_link.css('color', settings.button_2_link_colour); 134 135if (settings.button_2_as_button) { 136 main_link.css('background-color', settings.button_2_button_colour); 137 138 main_link.hover(function () { 139 jQuery(this).css('background-color', settings.button_2_button_hover); 140 }, 141 function () { 142 jQuery(this).css('background-color', settings.button_2_button_colour); 143 }); 144} 145 146// Action event listener for "show header" event: 147cached_showagain_tab.click(function () { 148 cached_showagain_tab.slideUp(settings.animate_speed_hide, function slideShow() { 149 cached_header.slideDown(settings.animate_speed_show); 150 }); 151}); 152 153// Action event listener to capture delete cookies shortcode click. This simply deletes the viewed_cookie_policy cookie. To use: 154// <a href='#' id='cookielawinfo-cookie-delete' class='cookie_hdr_btn'>Delete Cookies</a> 155jQuery("#cookielawinfo-cookie-delete").click(function () { 156 Cookie.erase(ACCEPT_COOKIE_NAME); 157 return false;
158}); 159 160// Action event listener for debug cookies value link. To use: 161// <a href='#' id='cookielawinfo-debug-cookie'>Show Cookie Value</a> 162jQuery("#cookielawinfo-debug-cookie").click(function () { 163 alert("Cookie value: " + Cookie.read(ACCEPT_COOKIE_NAME)); 164 return false; 165}); 166 167 168 169// action event listeners to capture "accept/continue" events: 170jQuery("#cookie_action_close_header").click(function () { 171 // Set cookie then hide header: 172 Cookie.set(ACCEPT_COOKIE_NAME, 'yes', ACCEPT_COOKIE_EXPIRE); 173 174 if (settings.notify_animate_hide) { 175 cached_header.slideUp(settings.animate_speed_hide); 176 } 177 else { 178 cached_header.hide(); 179 } 180 cached_showagain_tab.slideDown(settings.animate_speed_show); 181 return false; 182}); 183 184function displayHeader() { 185 if (settings.notify_animate_show) { 186 cached_header.slideDown(settings.animate_speed_show); 187 } 188 else { 189 cached_header.show(); 190 } 191 cached_showagain_tab.hide(); 192} 193function hideHeader() { 194 if (settings.notify_animate_show) { 195 cached_showagain_tab.slideDown(settings.animate_speed_show); 196 } 197 else { 198 cached_showagain_tab.show(); 199 } 200 cached_header.slideUp(settings.animate_speed_show); 201} 202jQuery("#go_mentions").click(function () { 203 window.open("/mentions-legales.html") 204}); 205 206}; 207function 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.