-
Notifications
You must be signed in to change notification settings - Fork 6
/
cookie.debug.min.js
18 lines (18 loc) · 10.1 KB
/
cookie.debug.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(function(t,f){var e={},d,p,j,q,r,s,k,l;d={idle:0,level:0,message:"The cookie settings on this website are set to <strong>'allow all cookies'</strong> to give you the very best experience. If you continue without changing these settings you consent to this - but you can change your settings by clicking the <strong>Change settings</strong> link at any time.",cancel:"I agree",changeSettings:"Change settings",linkText:"Find out more about cookies",functionalList:{strict:{will:["Remember what is in your shopping basket",
"Remember cookie access level."],willnot:["Send information to other websites so that advertising is more relevant to you","Remember your log-in details","Improve overall performance of the website","Provide you with live, online chat support"]},functional:{will:["Remember what is in your shopping basket","Remember cookie access level.","Remember your log-in details","Make sure the website looks consistent","Offer live chat support"],willnot:["Allow you to share pages with social networks like Facebook",
"Allow you to comment on blogs","Send information to other websites so that advertising is more relevant to you"]},targeting:{will:"Remember what is in your shopping basket;Remember cookie access level.;Remember your log-in details;Make sure the website looks consistent;Offer live chat support;Send information to other websites so that advertising is more relevant to you".split(";"),willnot:[]}}};e.Utility={};e.Utility.extend=function(a,b){var c;if("object"===typeof a)for(c in b)b.hasOwnProperty(c)&&
(a[c]=b[c]);return a};e.Utility=e.Utility;e.Events={};e.Events.addEvent=function(a,b,c){null!==a&&(a.attachEvent?(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event)},a.attachEvent("on"+b,a[b+c])):a.addEventListener(b,c,!1))};e.Events.removeEvent=function(a,b,c){a.detachEvent?(a.detachEvent("on"+b,a[b+c]),a[b+c]=null):a.removeEventListener(b,c,!1)};e.Events=e.Events;var n=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])},m=function(){var a=document.getElementsByTagName("body")[0],
b=document.createElement("div");e.Cookie.hasSubscribed();var c=document.getElementById("huk_cookie_prefernce_panel"),u=g.expires||30;d.cookie=g.cookie_prefix&&g.optin_cookie_name?g.cookie_prefix+g.optin_cookie_name:"TMP_EU_Cookie";c||(b.id="huk_cookie_prefernce_panel",d.message+='<div class="huk_cookie_prefernce_toolbar"><input type="button" value="'+d.cancel+'" id="EU_OPIN_CANCEL"/><input type="button" value="'+d.changeSettings+'" id="EU_OPIN_SETTINGS"/></div><div class="huk_cookie_prefernce_link"><a href="'+
d.link+'" target="_blank">'+d.linkText+"</a></div>",b.innerHTML=d.message,"undefined"===typeof window.innerWidth&&!("undefined"!==typeof document.documentElement&&"undefined"!==typeof document.documentElement.clientWidth&&0!==document.documentElement.clientWidth)&&(document.getElementsByTagName("body"),document.getElementsByTagName("body")),n(b,{position:"fixed",zIndex:9999,backgroundColor:"#f5f5f5",width:"300px",height:"200px",padding:"20px 15px",textAlign:"center",right:"20px",bottom:"20px"}),a.appendChild(b),
f("#EU_OPIN_SETTINGS").bind("click",function(){l();j()}),f("#EU_OPIN_CANCEL").bind("click",function(){e.Cookie.set({name:d.cookie,value:"4",expires:u});j()}),f("#huk_cookie_prefernce_panel").bind("mouseenter",function(){clearTimeout(p)}));0!==d.idle&&(p=setTimeout(function(){s();j()},1E3*d.idle))},g;k=function(a){var b,c,e="<h3>This website will:</h3><ul>",f="<h3>This website will not:</h3><ul>";b=d.functionalList[a].will;c=d.functionalList[a].willnot;for(a=0;a<b.length;a+=1)e+="<li>"+b[a]+"</li>";
for(a=0;a<c.length;a+=1)f+="<li>"+c[a]+"</li>";f+="</ul>";document.getElementById("cookieWill").innerHTML=e+"</ul>";document.getElementById("cookieWillNot").innerHTML=f};s=function(){var a=d.expires||30;e.Cookie.hasSubscribed()||e.Cookie.set({name:d.cookie,value:"0",expires:a})};q=function(){var a=document.getElementById("huk_cookie_prefernce_panel");a?a.style.display="block":m()};j=function(){var a=document.getElementById("huk_cookie_prefernce_panel");a&&(a.style.display="none")};r=function(){var a=
document.getElementById("huk_cookie_prefernce_panel");a?a.style.display=""===a.style.display||"block"===a.style.display?"none":"block":m()};l=function(){var a=document.getElementById("huk_cookie_prefernce_panel_ex"),b=document.getElementById("ck-overlay");if(a)a.style.display=""===a.style.display||"block"===a.style.display?"none":"block",b.style.display=""===b.style.display||"block"===b.style.display?"none":"block";else{var b=document.getElementsByTagName("body")[0],a=document.createElement("div"),
c=document.createElement("div"),h=d.expires||30,m=document.getElementById("huk_cookie_prefernce_panel_ex");d.cookie=g.cookie_prefix&&g.optin_cookie_name?g.cookie_prefix+g.optin_cookie_name:"TMP_EU_Cookie";m||(c.id="ck-overlay",c.innerHTML=" ",a.id="huk_cookie_prefernce_panel_ex",a.innerHTML='<div id="cookie-ext-panel"><div id="cookie-info"><h1>Cookie Settings</h1><p>A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is a piece of data stored by a website within a browser, and then subsequently sent back to the same website by the browser.[1] Cookies were designed to be a reliable mechanism for websites to remember things that a browser had done there in the past, which can include having clicked particular buttons, logging in, or having read pages on that site months or years ago.</p><div id="cookie-selection"><h2>Select the level of cookie you want to allow.</h2><div id="cokkie-options"><label for="strict"><span>Strictly necessary & Performance</span><input type="checkbox" id="strict" name="cookie-opt" value="1"/></label><label for="functional"><span>Functional</span><input type="checkbox" id="functional" name="cookie-opt" value="2"/></label><label for="targeting"><span>Targeting</span><input type="checkbox" id="targeting" name="cookie-opt" value="3"/></label></div><div class="clearfix"> </div></div><div class="clearfix"> </div><div id="cookie-functionalList"><div id="cookieWill"></div><div id="cookieWillNot"></div></div><div class="clearfix"> </div><div id="c-toolbar"><input type="button" id="COOKIE_CANCEL" value="Cancel"/><input type="button" id="COOKIE_SAVE" value="Save & Close"/></div><div class="clearfix"> </div></div></div>',
b.appendChild(c),b.appendChild(a),"undefined"!==typeof window.innerWidth?(b=window.innerWidth,c=window.innerHeight):"undefined"!==typeof document.documentElement&&"undefined"!==typeof document.documentElement.clientWidth&&0!==document.documentElement.clientWidth?(b=document.documentElement.clientWidth,c=document.documentElement.clientHeight):(b=document.getElementsByTagName("body")[0].clientWidth,c=document.getElementsByTagName("body")[0].clientHeight),n(a,{position:"fixed",zIndex:9999,left:b/2-300+
"px",top:"30px"}),n(document.getElementById("ck-overlay"),{position:"fixed",zIndex:9998,width:b+"px",height:c+"px"}),null===e.Cookie.get(d.cookie)||"1"===e.Cookie.get(d.cookie)?(k("strict"),document.getElementById("strict").checked=!0,document.getElementById("functional").checked=!1,document.getElementById("targeting").checked=!1):"2"===e.Cookie.get(d.cookie)?(k("functional"),document.getElementById("functional").checked=!0,document.getElementById("strict").checked=!0,document.getElementById("targeting").checked=
!1):"3"===e.Cookie.get(d.cookie)&&(k("targeting"),document.getElementById("targeting").checked=!0,document.getElementById("functional").checked=!0,document.getElementById("strict").checked=!0));f("#strict, #functional, #targeting").bind("click",function(a){k(a.currentTarget.id);"strict"===a.currentTarget.id?"checked"!==f("#strict").attr("checked")&&f("#strict").attr("checked","checked"):"functional"===a.currentTarget.id?"checked"!==f("#functional").attr("checked")&&(f("#strict").attr("checked","checked"),
f("#functional").attr("checked",!1),f("#targeting").attr("checked",!1)):"targeting"===a.currentTarget.id&&"checked"===f("#targeting").attr("checked")&&(f("#strict").attr("checked","checked"),f("#functional").attr("checked","checked"),f("#targeting").attr("checked","checked"));j()});e.Events.addEvent(document.getElementById("COOKIE_SAVE"),"click",function(){document.getElementById("targeting").checked?(e.Cookie.set({name:d.cookie,value:"3",expires:h}),window.location.reload()):document.getElementById("functional").checked?
e.Cookie.set({name:d.cookie,value:"2",expires:h}):document.getElementById("strict").checked&&e.Cookie.set({name:d.cookie,value:"1",expires:h});j();l()});e.Events.addEvent(document.getElementById("COOKIE_CANCEL"),"click",function(){j();l()})}};e.CookiePreferenceUI={setup:function(a){g=a;e.Cookie.get(a.cookie_prefix+a.optin_cookie_name)||a&&!a.test&&m()},show:function(){q()},hide:function(){j()},toggle:function(){r()},toggleOptions:function(){l()}};var h=function(a){var b=document.cookie.indexOf(a+
"="),c=b+a.length+1;if(!b&&a!==document.cookie.substring(0,a.length)||-1===b)return null;a=document.cookie.indexOf(";",c);-1===a&&(a=document.cookie.length);return unescape(document.cookie.substring(c,a))};e.Cookie={init:function(){},hasSubscribed:function(){var a=h("EU_OPTIN");return null!==a&&"0"!==a?!0:!1},subscriptionLevel:function(){var a=h("EU_OPTIN");return null!==a&&"0"!==a?a:!1},setLevel:function(a){h("EU_OPTIN");var b=d.cookie_prefix+d.optin_cookie_name,c=d.expires||30;return a?e.Cookie.set({name:b,
value:a,expires:c}):!1},getLevel:function(){return h("EU_OPTIN")},unsubscribe:function(){},subscribe:function(){},set:function(a){var b=new Date;b.setTime(b.getTime());a.expires&&(a.expires*=864E5);b=new Date(b.getTime()+a.expires);b=a.name+"="+escape(a.value)+(a.expires?";expires="+b.toGMTString():"")+(a.path?";path="+a.path:"")+(a.domain?";domain="+a.domain:"")+(a.secure?";secure":"");document.cookie=b;return h(a.name)===a.value},get:function(a){return h(a)},trash:function(a){if("string"===typeof a)document.cookie=
a+"="+(d.path?";path="+d.path:"")+(d.domain?";domain="+d.domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT",a=!0;else if("array"===typeof a){var b=a.length,c;for(c=0;c<b;c+=1)document.cookie=a[c]+"="+(d.path?";path="+d.path:"")+(d.domain?";domain="+d.domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";a=!0}else a=!1;return a}};e.CookieManager={init:function(a){a=a||{};d=e.Utility.extend(d,a);e.CookiePreferenceUI.setup(a)}};t.EU=e})(window,jQuery);