Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2f61a3
Showing
8 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2011 Nikolai Warner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Jacopo: Get your streak on. | ||
|
||
Jacopo is a little reminder for your Seinfeld Calendar that lives in Chrome. | ||
|
||
|
||
## Usage | ||
|
||
* Install the extension! | ||
|
||
* Set your seinfeld calendar url in the Options. Perhaps go here first: http://calendaraboutnothing.com | ||
|
||
* Make some open source progress! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> | ||
<script> | ||
var seinfeld_chrome = { | ||
|
||
refresh_rate: 3600000, | ||
default_calendar_url: 'http://calendaraboutnothing.com/~', | ||
|
||
|
||
fetch_from_calendar_url: function() { | ||
var self = this; | ||
if (localStorage['calendar_url'] === undefined || localStorage['calendar_url'] === this.default_calendar_url) { | ||
localStorage['calendar_url'] = this.default_calendar_url; | ||
} else { | ||
$.ajax({ | ||
url: localStorage['calendar_url'], | ||
success: function(data) { | ||
self.calendar_data_response(data); | ||
} | ||
}); | ||
} | ||
}, | ||
|
||
|
||
calendar_data_response: function(data) { | ||
// Streak | ||
localStorage['current_streak'] = parseInt($(".current_streak span.num", data).html(), 10); | ||
|
||
// Get Progress Today | ||
if ($(".progressed.today", data).length > 0) { | ||
localStorage['progressed_today'] = 'true'; | ||
} else { | ||
localStorage['progressed_today'] = 'false'; | ||
} | ||
|
||
this.update_interface(); | ||
}, | ||
|
||
|
||
update_interface: function() { | ||
var self = this; | ||
|
||
// Update Badge | ||
if (localStorage['show_badge'] === 'true') { | ||
chrome.browserAction.setBadgeText({text: localStorage['current_streak']}); | ||
} else { | ||
chrome.browserAction.setBadgeText({text: ""}); | ||
} | ||
|
||
// Update Progress | ||
if (localStorage['progressed_today'] === 'true') { | ||
chrome.browserAction.setIcon({path: "icon_green.png"}); | ||
chrome.browserAction.setBadgeBackgroundColor({color:[0,255,0,255]}); | ||
} else { | ||
chrome.browserAction.setIcon({path: "icon.png"}); | ||
chrome.browserAction.setBadgeBackgroundColor({color:[255,0,0,255]}); | ||
} | ||
|
||
// Schedule Next Update | ||
setTimeout(function(){ | ||
this.update(); | ||
}, this.refresh_rate); | ||
}, | ||
|
||
|
||
|
||
update: function() { | ||
// 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(); | ||
} | ||
|
||
}; | ||
|
||
seinfeld_chrome.update(); | ||
|
||
// listen_for_storage_updates | ||
window.addEventListener("storage", function(event){ | ||
console.log('store') | ||
seinfeld_chrome.update(); | ||
}, false); | ||
|
||
</script> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Jacopo", | ||
"version": "1.0", | ||
"description": "A little reminder for your Seinfeld Calendar", | ||
"background_page": "background.html", | ||
"browser_action": { | ||
"default_icon": "icon.png", | ||
"popup": "options.html" | ||
}, | ||
"options_page": "options.html", | ||
"permissions": [ | ||
"http://*/" | ||
], | ||
"icons": { | ||
"16": "icon.png", | ||
"48": "icon.png", | ||
"128": "icon.png" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<html> | ||
<head><title>Options</title></head> | ||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> | ||
<script type="text/javascript"> | ||
|
||
function save_options() { | ||
|
||
localStorage["show_badge"] = $('#show_badge').is(':checked'); | ||
localStorage["calendar_url"] = $('#calendar_url').val(); | ||
|
||
// Update status to let user know options were saved. | ||
$("#status").html("Options Saved."); | ||
setTimeout(function() { | ||
$("#status").html(""); | ||
}, 4000); | ||
} | ||
|
||
|
||
function restore_options() { | ||
$('#show_badge').attr('checked', (localStorage["show_badge"] === "true")); | ||
$('#calendar_url').val(localStorage["calendar_url"]); | ||
} | ||
|
||
</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> | ||
|
||
<body onload="restore_options()"> | ||
|
||
<div id='status'></div> | ||
|
||
<h1> | ||
Options | ||
</h1> | ||
|
||
<div> | ||
Calendar URL: <input type="text" id="calendar_url" style='width:300px' /> | ||
</div> | ||
|
||
<div> | ||
<input type="checkbox" id="show_badge" value="true" /> Show Current Streak | ||
</div> | ||
|
||
|
||
<div> | ||
<button onclick="save_options()">Save</button> | ||
</div> | ||
|
||
</body> | ||
</html> |