Skip to content

Instantly share code, notes, and snippets.

@Dandu-Venkata-Ravi-Varma
Created July 17, 2012 07:48
Show Gist options
  • Save Dandu-Venkata-Ravi-Varma/3127857 to your computer and use it in GitHub Desktop.
Save Dandu-Venkata-Ravi-Varma/3127857 to your computer and use it in GitHub Desktop.
Developing a Chrome extension
<script type="text/JavaScript">
// Create a simple html notification:
setInterval(function() {
var notification = webkitNotifications.createHTMLNotification('notification.html');
notification.show();
}, 3600000);
</script>
{
"name": "Timely",
"description": "For every one hour a popup message will be appeard reminding another hour passed by.",
"version": "2.1",
"background_page": "background.html",
"browser_action": {
"default_popup": "popup.html"
},
"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"notifications",
"storage",
"webNavigation",
"contextMenus"
]
}
{
"name": "",
"description": "",
"version": "",
"background_page": "",
"browser_action": {},
"content_scripts": [
{}
],
"permissions": []
}
<html>
<head>
</head>
<body>
<h1>WhatsUp???</h1>
<form name="form" onsubmit="JavaScript:storage();return false;">
<b>Enter your status:</b>
<input type="text" name="status" id="status"/>
<input type="button" value="Submit" onclick="JavaScript:storage();return false;" />
</form>
</body>
<script>
function storage(){
var d = new Date();
var date = d.getDate();
var month = d.getMonth();
var year = d.getFullYear();
var hours = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();
var today = date+"/"+month+"/"+year;
var time = hours+":"+minutes+":"+seconds;
localStorage[today]=localStorage[today]||JSON.stringify({});
var store = JSON.parse(localStorage[today]);
store[time]=JSON.stringify(document.getElementById("status").value);
localStorage[today]=JSON.stringify(store);
console.log(localStorage,localStorage[today],store[time],document.getElementById("status").value);
window.close();
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment