Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created March 8, 2017 12:11
Show Gist options
  • Save walterdavis/52aceb76933609f2dd2491759942f7a2 to your computer and use it in GitHub Desktop.
Save walterdavis/52aceb76933609f2dd2491759942f7a2 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
function setCookie(cname,cvalue,exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
document.cookie = cname + "=" + cvalue + ";" + "expires=" + d.toGMTString() + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var ca = decodeURIComponent(document.cookie).split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
document.addEventListener('DOMContentLoaded', function(){
var cook=getCookie("kiramek_patent_notice");
if (cook === "Show every 30 days") { //do nothing
} else { //close the overlay on click and set cookie
document.getElementById("legaleze").style.display = 'block';
document.getElementById('legaleze').onclick = function(){
document.getElementById("legaleze").style.display = 'none';
setCookie("kiramek_patent_notice", "Show every 30 days", 30);
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment