-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.cookieconsent.0.0.4.min.js
1 lines (1 loc) · 2.76 KB
/
jquery.cookieconsent.0.0.4.min.js
1
(function(a){a.cookieconsent=function(e){var h=a.extend({},a.cookieconsent.defaults,e),b,c,l,k,g,d,j,f,i;if(a.cookie){if(a.cookie("cookie_consent")){h.analyticsInject();h.analyticsInjected()}else{b=a("<div/>",{id:h.containerId});c=a("<p/>").appendTo(b);l=a("<"+h.messageContainer+"/>",{text:h.message}).addClass(h.messageClass).appendTo(c);k=a("<"+h.uiContainer+"/>").appendTo(c);g=a("<span/>",{text:h.questionText}).appendTo(k);d=a("<a/>",{id:h.confirmLinkId,text:h.confirmLinkText,href:"#",click:function(m){m.preventDefault();h.consented();h.analyticsInject();h.analyticsInjected();a.cookie("cookie_consent","consented",{expires:h.cookieExpiry,path:"/"});h.cookieSet();a("#"+h.containerId).remove()}}).appendTo(k);j=a("<a/>",{id:h.denyLinkId,text:h.denyLinkText,href:"#",click:function(m){m.preventDefault();h.denied();a("#"+h.containerId).remove()}}).appendTo(k);if(h.uiClass){k.addClass(h.uiClass)}if(h.questionClass){g.addClass(h.questionClass)}if(h.confirmLinkClass){d.addClass(h.confirmLinkClass)}if(h.denyLinkClass){j.addClass(h.denyLinkClass)}if(h.addReadMoreLink&&h.readMoreHref){f=a("<a/>",{href:h.readMoreHref,text:h.readMoreText});if(h.readMoreContainer){i=a("<"+h.readMoreContainer+">").appendTo(c);f.appendTo(i);if(h.readMoreContainerClass){i.addClass(h.readMoreContainerClass)}}else{f.appendTo(c)}if(h.readMoreClass){f.addClass(h.readMoreClass)}if(h.readMoreRel){f.attr("rel",h.readMoreRel)}}else{if(h.addReadMoreLink&&!h.readMoreHref){console.log("Configuration error: Please remember to set the href when adding a read more link")}}if(h.insertAtBeginning){b.prependTo(h.widgetContainer);h.displayed()}else{b.appendTo(h.widgetContainer);h.displayed()}}}else{console.log("Dependency error: Please ensure the cookie plugin is available")}};a.cookieconsent.defaults={containerId:"consentWidget",message:"This site wishes to use cookies in order to provide a better experience.",messageContainer:"span",messageClass:"message",addReadMoreLink:false,readMoreHref:"",readMoreClass:"read-more",readMoreText:"Find out more",readMoreRel:"",readMoreContainer:"",readMoreContainerClass:"",uiContainer:"fieldset",uiClass:"",questionText:"Do you consent?",questionClass:"",confirmLinkId:"yes",confirmLinkText:"Yes",confirmLinkClass:"",denyLinkId:"no",denyLinkText:"No",denyLinkClass:"",widgetContainer:"#form1",insertAtBeginning:true,cookieExpiry:3650,analyticsInject:function(){var c=document.createElement("script");c.type="text/javascript";c.async=true;c.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(c,b)},displayed:function(){},consented:function(){},denied:function(){},cookieSet:function(){},analyticsInjected:function(){}};a.fn.cookieconsent=function(b){a.cookieconsent(b)}}(jQuery));