Skip to content

Instantly share code, notes, and snippets.

@n8
Last active June 27, 2018 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8/d41cc265f8420655612f6664c76f46b6 to your computer and use it in GitHub Desktop.
Save n8/d41cc265f8420655612f6664c76f46b6 to your computer and use it in GitHub Desktop.
<div id='myAlert' style="background: #000; font-size: 2rem; color: #fff; padding: 2rem; display:none; line-height: 2.5rem">
<a href="#" style="float: right; color: #fff; text-decoration: none" onclick="hideAlert()">&times;</a>
We'll be offline at 9:00PM Central June 22 for database maintance. It should take 60 minutes at most.
</div>
<script>
var alertVersion = '06212018.r7';
function hideAlert(){
var child = document.getElementById("myAlert");
child.parentNode.removeChild(child);
document.cookie = "sawNotice=" + alertVersion + ";path=/;expires=Fri, 31 Dec 9999 23:59:59 GMT";
}
if (document.cookie.split(';').filter(function(item) {
return item.indexOf("sawNotice=" + alertVersion) >= 0;
}).length == 0) {
document.getElementById("myAlert").style.display = "block";
}
</script>
var alertVersion = '06212018.r6';
function hideAlert(){
var child = document.getElementById("myAlert");
child.parentNode.removeChild(child);
document.cookie = "sawNotice=" + alertVersion + ";path=/;expires=Fri, 31 Dec 9999 23:59:59 GMT";
}
<a href="#" style="float: right; color: #fff; text-decoration: none" onclick="hideAlert()">&times;</a>
if (document.cookie.split(';').filter(function(item) {
return item.indexOf("sawNotice=" + alertVersion) >= 0;
}).length == 0) {
document.getElementById("myAlert").style.display = "block";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment