Skip to content

Instantly share code, notes, and snippets.

@navarr
Created May 13, 2010 00:55
Show Gist options
  • Select an option

  • Save navarr/399351 to your computer and use it in GitHub Desktop.

Select an option

Save navarr/399351 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
html *
{
font-family: sans-serif;
}
body *
{
padding: 0;
margin: 0;
}
h1
{
padding: 0;
margin: 0;
font-size: 12pt;
font-weight: bold;
}
body
{
font-size: 10pt;
}
</style>
<script>
function changeLinks()
{
for(var i = 0;i < document.getElementsByTagName("a").length;i++)
{
ele = document.getElementsByTagName("a")[i]; ele.target = "_blank";
}
}
function detectClick(e)
{
var rightclick;
if(!e) var e = window.event;
if(e.which) rightclick = (e.which == 3);
else if (e.button) rightclick = (e.button == 2);
if(rightclick) { self.close(); }
}
</script>
</head>
<body onload="document.timeout = setTimeout(self.close,5000);changeLinks();" onmouseover="clearTimeout(document.timeout);" onmouseout="document.timeout = setTimeout(self.close,5000);" onmouseup="detectClick();">
<h1>Title</h1>
<p>Text</p>
</body>
</html>
@navarr

navarr commented May 13, 2010

Copy link
Copy Markdown
Author

This creates a notification that looks exactly like the default (non-HTML) notifications, with an added bonus. This notification disappears after five seconds (unless hovered over, at which point it disappears five seconds after the mouse is moved off of it or if it is right-clicked)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment