Skip to content

Instantly share code, notes, and snippets.

@peteee
Created May 28, 2018 20:11
Show Gist options
  • Save peteee/b5d81e38cff919675fb3de855dc36a76 to your computer and use it in GitHub Desktop.
Save peteee/b5d81e38cff919675fb3de855dc36a76 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function() {
// Customize your texts here:
var cCText = "Wir verwenden Cookies, um Ihnen die bestmögliche Erfahrung auf unserer Website zu bieten. Wenn Sie fortfahren, ohne Ihre Einstellungen zu ändern, gehen wir davon aus, dass Sie alle Cookies auf dieser Website akzeptieren.",
cCBtnText = "OK",
cCBtnText2 = "Datenschutzhinweise",
cCLink = "/de/datenschutz";
// Style overides to change colors. Leave blank for default:
var cCBGColor = "#4e4e4e",
cCTextColor = "#fff",
cCBtn1Color = "green",
cCBtn1TextColor = "#eee",
cCBtn2Color = "#da7614",
cCBtn2TextColor = "#eee";
/**
* Stop editing ################################################/
*/
window.COOKIE={create:function(e,t,n){if(n){var r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);var i="; expires="+r.toGMTString()}else i="";document.cookie=e+"="+t+i+"; path=/"},read:function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1,i.length);if(0==i.indexOf(t))return i.substring(t.length,i.length)}},erase:function(e){COOKIE.create(e,"",-1)}}
window.COOKIE.read("CConsentR")||(jQuery("head").append("<style>#cookie-consentr{position:fixed;bottom:0;left:0;width:100%;text-align:center;background:#4e4e4e;color:#fff;padding:10px 0;font-size:14px;z-index:9999}#cookie-consentr p, #cookie-consentr p a{color:#fff}.c-c-btn{padding:3px 10px;border-radius:10px;cursor:pointer;display:inline-block;}.c-c-btn:hover{opacity: 0.8}#c-c-ok{background:green}#c-c-link{background:green}</style>"),jQuery("body").append('<div id="cookie-consentr" style="background:'+cCBGColor+'"><p style="color:'+cCTextColor+'">'+cCText+' <a class="c-c-btn" id="c-c-ok" style="background:'+cCBtn1Color+";color:"+cCBtn1TextColor+'">'+cCBtnText+'</a> <a href="'+cCLink+'" target="_blank" class="c-c-btn" id="c-c-link" style="background:'+cCBtn2Color+";color:"+cCBtn2TextColor+'">'+cCBtnText2+"</a></p></div>"),jQuery("#c-c-ok").bind("click",function(o){o.stopPropagation(),o.preventDefault(),window.COOKIE.create("CConsentR",!0,1095),jQuery("#cookie-consentr").remove()}))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment