-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.cookienote.min.js
1 lines (1 loc) · 2.73 KB
/
jquery.cookienote.min.js
1
(function(a){a.fn.cookieNote=function(b){var d=a(this);var c={width:100,height:80,backgroundColor:"#323232",insertionType:"overlay",animate:false,animationStyle:"slideDown",animationSpeed:"slow",position:"top",headingText:"Cookies on this website",explainationText:"We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the this website. However, if you would like to, you can change your cookie settings at any time.",confirmText:"Continue",setCookie:false,cookieExpiresIn:7,showPolicy:false,policyLink:"",policyText:"Cookie Policy"};var b=a.extend(c,b);return this.each(function(){a(this).css({display:"none"});if(c.insertionType==="insert"){a(this).css({width:c.width+"%",height:c.height+"px",backgroundColor:c.backgroundColor,position:"relative",color:"textColor"});if(c.position==="bottom"){a(this).css({bottom:"0"})}else{a(this).css({top:"0"})}}else{a(this).css({width:c.width+"%",height:c.height+"px","z-index":"1000",backgroundColor:c.backgroundColor,position:"absolute",color:"textColor"});if(c.position==="bottom"){a(this).css({bottom:"0"})}else{a(this).css({top:"0"})}}var j="<div id='cookienote-container'></div>";a(this).append(j);var e="<h2>"+c.headingText+"</h2>";a("#cookienote-container").append(e);var h="<p>"+c.explainationText+"</p>";a("#cookienote-container").append(h);var f='<ul id="continue-list"><li id="cookienote-continue"><button type="button" id="cookienote-continue-button">'+c.confirmText+"</button></li></ul>";a("#cookienote-container").append(f);if(c.showPolicy===true){var i='<li id="cookienote-policy"><a href="'+c.policyLink+'">'+c.policyText+"</a></li>";a("#continue-list").append(i)}else{}if(a.cookie&&a.cookie("cookieNotice")==="cookieNoticeAccepted"){a(this).css("display:none");a(this).remove()}else{if(c.animate===true&&c.animationStyle==="slideDown"){a(this).css({height:"0px"}).show();a(this).animate({height:c.height+"px",display:"block"},c.animationSpeed,function(){})}else{if(c.animate===true&&c.animationStyle==="fadeIn"){a(this).css({opacity:"0"}).show();a(this).animate({opacity:"1"},c.animationSpeed,function(){})}else{if(c.animate===false&&c.insertionType==="insert"){a(this).css({display:"block"})}else{a(this).css({display:"block"})}}}}a("#cookienote-continue-button").click(function(){if(c.setCookie===true){if(a.cookie){var k=g();a.cookie("cookieNotice","cookieNoticeAccepted",{expires:c.cookieExpiresIn,path:"/"});a(d).slideUp("slow")}else{a.error("The jQuery.cookie plugin was not found, install this and try again!")}}else{a(d).slideUp("slow")}});function g(){var k=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1)};return(k()+k()+"-"+k()+"-"+k()+"-"+k()+"-"+k()+k()+k())}})}})(jQuery);