forked from cdwharton/cookieCuttr
-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.cookiecuttr.min.js
12 lines (12 loc) · 5.66 KB
/
jquery.cookiecuttr.min.js
1
2
3
4
5
6
7
8
9
10
11
12
(function(b){var k={cookieCutter:!1,cookieCutterDeclineOnly:!1,cookieAnalytics:!0,cookieDeclineButton:!1,cookieAcceptButton:!0,cookieResetButton:!1,cookieOverlayEnabled:!1,cookiePolicyLink:"/privacy-policy/",cookieMessage:'We use cookies on this website, you can <a href="{{cookiePolicyLink}}" title="read about our cookies">read about them here</a>. To use the website as intended please...',cookieAnalyticsMessage:"We use cookies, just to track visits to our website, we store no personal details.",
cookieErrorMessage:"We're sorry, this feature places cookies in your browser and has been disabled. <br>To continue using this functionality, please",cookieWhatAreTheyLink:"http://www.allaboutcookies.org/",cookieDisable:"",cookieExpires:365,cookieAcceptButtonText:"ACCEPT COOKIES",cookieDeclineButtonText:"DECLINE COOKIES",cookieResetButtonText:"RESET COOKIES FOR THIS WEBSITE",cookieWhatAreLinkText:"What are cookies?",cookieNotificationLocationBottom:!1,cookiePolicyPage:!1,cookiePolicyPageMessage:"Please read the information below and then choose from the following options",
cookieDiscreetLink:!1,cookieDiscreetReset:!1,cookieDiscreetLinkText:"Cookies?",cookieDiscreetPosition:"topleft",cookieNoMessage:!1,cookieDomain:"",cookieAcceptName:"cc_cookie_accept",cookieAcceptValue:"cc_cookie_accept",cookieDeclineName:"cc_cookie_decline",cookieDeclineValue:"cc_cookie_decline",cookieClickableOverlay:!1,cookieClickableDiv:"",cookieClickAnyLink:!1,cookieCuttrCompatible:!0};b.cuttACookie=function(d){var a=b.extend({},k,d),e=b.cookie(a.cookieAcceptName)==a.cookieAcceptValue,f=b.cookie(a.cookieDeclineName)==
a.cookieDeclineValue,h=d="",g="",j=function(c){a.cookieClickAnyLink||c.preventDefault();b.cookie(a.cookieAcceptName,a.cookieAcceptValue,{expires:a.cookieExpires,path:"/"});b.cookie("cc_cookie_decline",null,{path:"/"});location.reload()};a.cookieMessage=a.cookieMessage.replace("{{cookiePolicyLink}}",a.cookiePolicyLink);b.cookieAccepted=function(){return e};b.cookieDeclined=function(){return f};a.cookieAcceptButton&&(d=' <a href="#accept" class="cc-cookie-accept">'+a.cookieAcceptButtonText+"</a> ");
a.cookieDeclineButton&&(h=' <a href="#decline" class="cc-cookie-decline">'+a.cookieDeclineButtonText+"</a> ");a.cookieOverlayEnabled&&(g=" cc-overlay");var l=function(){"topleft"==a.cookieDiscreetPosition&&(b("div.cc-cookies").css("top","0"),b("div.cc-cookies").css("left","0"));"topright"==a.cookieDiscreetPosition&&(b("div.cc-cookies").css("top","0"),b("div.cc-cookies").css("right","0"));"bottomleft"==a.cookieDiscreetPosition&&(b("div.cc-cookies").css("bottom","0"),b("div.cc-cookies").css("left",
"0"));"bottomright"==a.cookieDiscreetPosition&&(b("div.cc-cookies").css("bottom","0"),b("div.cc-cookies").css("right","0"))},c=a.cookieNotificationLocationBottom||"bottomright"==a.cookieDiscreetPosition||"bottomleft"==a.cookieDiscreetPosition?"append":"prepend";if(!a.cookieNoMessage||a.cookiePolicyPage)if(e||f)if(a.cookieResetButton&&a.cookieDiscreetReset)b("body")[c]('<div class="cc-cookies cc-discreet"><a href="#" class="cc-cookie-reset">'+a.cookieResetButtonText+"</a></div>"),l();else{if(a.cookieResetButton)b("body")[c]('<div class="cc-cookies"><a href="#" class="cc-cookie-reset">'+
a.cookieResetButtonText+"</a></div>")}else if(a.cookieDiscreetLink&&!a.cookiePolicyPage)b("body")[c]('<div class="cc-cookies cc-discreet"><a href="'+a.cookiePolicyLink+'" title="'+a.cookieDiscreetLinkText+'">'+a.cookieDiscreetLinkText+"</a></div>"),l();else if(a.cookieAnalytics)b("body")[c]('<div class="cc-cookies'+g+'">'+a.cookieAnalyticsMessage+d+h+'<a rel="external" href="'+a.cookieWhatAreTheyLink+'">'+a.cookieWhatAreLinkText+"</a></div>");else if(a.cookiePolicyPage)b("body")[c]('<div class="cc-cookies'+
g+'">'+a.cookiePolicyPageMessage+' <a href="#accept" class="cc-cookie-accept">'+a.cookieAcceptButtonText+'</a> <a href="#decline" class="cc-cookie-decline">'+a.cookieDeclineButtonText+"</a> </div>");else if(!a.cookieAnalytics&&!a.cookieDiscreetLink)b("body")[c]('<div class="cc-cookies'+g+'">'+a.cookieMessage+d+h+"</div>");(a.cookieCutter&&!a.cookieCutterDeclineOnly&&(f||!e)||a.cookieCutter&&a.cookieCutterDeclineOnly&&f)&&b(a.cookieDisable).html('<div class="cc-cookies-error">'+a.cookieErrorMessage+
' <a href="#accept" class="cc-cookie-accept">'+a.cookieAcceptButtonText+"</a> </div>");(a.cookieNotificationLocationBottom&&!a.cookieDiscreetLink||a.cookieNotificationLocationBottom&&a.cookieDiscreetLink&&a.cookiePolicyPage)&&b("div.cc-cookies").css({top:"auto",bottom:0});if(a.cookieClickableOverlay&&(!e||f))""===a.cookieClickableDiv&&(a.cookieClickableDiv="cc-cookies-bodywrapper",b("body").innerWrap("<div class='"+a.cookieClickableDiv+"'/>")),b("."+a.cookieClickableDiv).click(j);a.cookieClickAnyLink&&
!e&&b("a").click(j);b(".cc-cookie-accept, .cc-cookie-decline").click(function(c){c.preventDefault();b(this).is("[href$=#decline]")?(b.cookie(a.cookieAcceptName,null,{path:"/"}),b.cookie(a.cookieDeclineName,a.cookieDeclineValue,{expires:a.cookieExpires,path:"/"}),a.cookieDomain&&(b.cookie("__utma",null,{domain:"."+a.cookieDomain,path:"/"}),b.cookie("__utmb",null,{domain:"."+a.cookieDomain,path:"/"}),b.cookie("__utmc",null,{domain:"."+a.cookieDomain,path:"/"}),b.cookie("__utmz",null,{domain:"."+a.cookieDomain,
path:"/"}))):(b.cookie(a.cookieDeclineName,null,{path:"/"}),b.cookie(a.cookieAcceptName,a.cookieAcceptValue,{expires:a.cookieExpires,path:"/"}));b(".cc-cookies").fadeOut(function(){location.reload()})});b("a.cc-cookie-reset").click(function(c){c.preventDefault();b.cookie(a.cookieAcceptName,null,{path:"/"});b.cookie(a.cookieDeclineName,null,{path:"/"});b(".cc-cookies").fadeOut(function(){location.reload()})});b(".cc-cookies-error a.cc-cookie-accept").click(j)};k.cookieCuttrCompatible&&!b.cookieCuttr&&
(b.cookieCuttr=b.cuttACookie)})(jQuery);