Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

notifications should remove themselves

  • Loading branch information...
commit 83b7866d4f337f5c39688cc89b845c9d93ce3ad6 1 parent f8d0bbf
@nikolaiwarner authored
View
18 background.html
@@ -1,2 +1,18 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
-<script src="jacopo.js" type="text/javascript"></script>
+<script src="jacopo.js" type="text/javascript"></script>
+
+<script>
+$(document).ready(function(){
+ jacopo.init();
+
+ // listen_for_storage_updates
+ window.addEventListener("storage", function(event){
+ if (event.key === 'calendar_url') {
+ jacopo.schedule_refresh();
+ jacopo.update();
+ } else {
+ jacopo.update_interface();
+ }
+ }, false);
+});
+</script>
View
29 jacopo.js
@@ -34,15 +34,7 @@ var jacopo = {
// Show notification
if (localStorage['show_notification'] === 'true' && localStorage['progressed_today'] === 'false') {
- var current_time = new Date();
- var time_left_hours = 24 - current_time.getHours();
- //var time_left_minutes = 60 - current_time.getMinutes();
-
- var notification = webkitNotifications.createNotification(
- 'icon.png',
- "Don't break your streak.",
- 'You have not completed your contribution to open source today. You have less than ' + time_left_hours + ' hours remaining.'
- );
+ var notification = webkitNotifications.createHTMLNotification('notification.html');
notification.show();
}
@@ -81,8 +73,6 @@ var jacopo = {
update: function() {
- console.log("UPDATED AT: "+(Math.round(new Date().getTime() / 1000)));
-
// A simple scrape of the page will do for now.
// We'll authenticate to github for faster results in the future.
this.fetch_from_calendar_url();
@@ -92,19 +82,4 @@ var jacopo = {
this.schedule_refresh();
this.update();
}
-};
-
-
-$(document).ready(function(){
- jacopo.init();
-
- // listen_for_storage_updates
- window.addEventListener("storage", function(event){
- if (event.key === 'calendar_url') {
- jacopo.schedule_refresh();
- jacopo.update();
- } else {
- jacopo.update_interface();
- }
- }, false);
-});
+};
View
2  manifest.json
@@ -1,6 +1,6 @@
{
"name": "Jacopo",
- "version": "1.2.0",
+ "version": "1.2.2",
"description": "A little reminder for your Seinfeld Calendar",
"background_page": "background.html",
"browser_action": {
View
31 notification.html
@@ -0,0 +1,31 @@
+<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
+
+<p>
+ <img src='icon.png' style='float:left; padding: 5px;' />
+
+ <h1>Don't break your streak.</h1>
+ <br/>
+ You have not completed your contribution to open source today.
+ <br/>
+ <span id='time_left'></span>
+</p>
+
+
+
+
+
+<script src="jacopo.js" type="text/javascript"></script>
+
+<script>
+ // remove before the next refresh
+ setTimeout(function(){
+ window.close();
+ }, jacopo.refresh_rate);
+
+ // set the time remaining text
+ var current_time = new Date();
+ var time_left_hours = 24 - current_time.getHours();
+ var time_left_text = "Less than " + time_left_hours + " hour";
+ time_left_text = (time_left_hours === 1) ? time_left_text + "s remain." : time_left_text + " remains.";
+ document.getElementById('time_left').innerHTML = time_left_text;
+</script>
View
22 options.html
@@ -1,5 +1,7 @@
<html>
-<head><title>Options</title></head>
+<head><title>Options</title>
+<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
@@ -25,23 +27,7 @@
</script>
-<style>
- h1, div {
- font-family: Helvetica;
- font-size: 15px;
- padding-bottom: 10px;
- }
-
- h1 {
- border-bottom: 1px solid #ddd;
- }
-
- #status{
- text-align: center;
- color: #999;
- }
-</style>
-
+</head>
<body onload="restore_options()">
<div id='status'></div>
View
14 stylesheet.css
@@ -0,0 +1,14 @@
+h1, div {
+ font-family: Helvetica;
+ font-size: 15px;
+ padding-bottom: 10px;
+}
+
+h1 {
+ border-bottom: 1px solid #ddd;
+}
+
+#status{
+ text-align: center;
+ color: #999;
+}

0 comments on commit 83b7866

Please sign in to comment.
Something went wrong with that request. Please try again.