Skip to content

Instantly share code, notes, and snippets.

@luckymancvp
Created November 9, 2012 09:19
Show Gist options
  • Select an option

  • Save luckymancvp/4044710 to your computer and use it in GitHub Desktop.

Select an option

Save luckymancvp/4044710 to your computer and use it in GitHub Desktop.
One Of Them APVN Count Down
<html>
<head>
<script src="jquery.min.js"></script>
<script src="notify.js"></script>
</head>
<body>
</body>
</html>
{
"name": "One Of Them APVN Count Down",
"version": "1.0",
"manifest_version": 2,
"description": "Count down extension for OOT APVN company.",
"icons": {
"16": "icon.png",
"48": "icon.png",
"128": "icon.png"
},
"browser_action": {
"default_icon": "icon.png"
},
"permissions": [
"notifications",
"http://oneofthemvn.tk/*"
],
"web_accessible_resources": [
"icon.png"
],
"background": {
"page": "background.html"
}
}
var content = "none";
function getNotify(){
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://oneofthemvn.tk/notify_center/get", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
// JSON.parse does not evaluate the attacker's scripts.
notify = JSON.parse(xhr.responseText);
if (!notify) return;
if (notify.content == content) return;
content = notify.content
var notification = webkitNotifications.createNotification(
'icon.png', // icon url - can be relative
notify.title,
notify.content
);
notification.show();
setTimeout(function(){
notification.cancel();
},8000);
}
}
xhr.send();
setTimeout(function(){ getNotify()}, 1000);
};
$(document).ready(function(){
getNotify();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment