-
Notifications
You must be signed in to change notification settings - Fork 1
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
wata
committed
Nov 22, 2011
1 parent
637f947
commit f132a40
Showing
5 changed files
with
169 additions
and
81 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
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
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
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,123 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<style type="text/css"> | ||
html, body { margin:0; padding:0; } | ||
ul, ol { margin:0; padding:0; list-style:none; } | ||
li { margin:0; padding:0; } | ||
|
||
body { | ||
padding-right:20px; | ||
font-size:14px; | ||
line-height:1.4; | ||
font-family:"Helvetica Neue", "Lucida Grande", Arial, Helvetica, "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3", Meiryo, sans-serif; | ||
} | ||
|
||
#wrapper { width:400px; height:500px; } | ||
|
||
header { border:1px solid #CCC; background:#EAEEF3; overflow:hidden; clear:both; } | ||
header li { padding:7px 15px; float:left; color:#426DC9; cursor:pointer; text-shadow:white 0 1px 1px; } | ||
header .active { color:black; text-shadow:#BBCEE9 0 1px 1px; background:#BBCEE9; } | ||
|
||
#notifications { word-break:break-all; } | ||
#notifications li a { | ||
display:block; | ||
padding:10px; | ||
color:#666; | ||
text-decoration:none; | ||
text-shadow:white 0 1px 1px; | ||
border:1px solid #CCC; | ||
border-top-color:white; | ||
border-bottom-color:#BBB; | ||
background:-webkit-linear-gradient(#FAFAFA, #F4F4F4 40%, #E5E5E5); | ||
} | ||
#notifications li a:hover { | ||
color:#426DC9; | ||
-webkit-box-shadow:1px 0 3px rgba(0, 0, 0, 0.2); | ||
background:#EBEBEB -webkit-linear-gradient(#FEFEFE, #F8F8F8 40%, #E9E9E9); | ||
} | ||
|
||
.author { float:left; } | ||
.author img { width:32px; height:32px; border:1px solid #DDD; } | ||
.body { margin-left:40px; } | ||
</style> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | ||
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | ||
<script type="text/javascript"> | ||
google.load("feeds", "1"); | ||
function init(){ | ||
var settings = JSON.parse(localStorage.getItem('settings')); | ||
var feed = new google.feeds.Feed("http://frepan.org/feed/index.rss"); | ||
feed.setNumEntries(20); | ||
feed.load(function(result) { | ||
if (!result.error) { | ||
var public = $('<ul>'), watched = $('<ul>'), count = 0; | ||
for (var i = 0; i < result.feed.entries.length; i++) { | ||
var entry = result.feed.entries[i]; | ||
entry.content.match(/img src="([^"]+)"/); | ||
var img = RegExp.$1; | ||
var html = '<li><a href="' + entry.link + '" target="_blank">'; | ||
html += '<div class="author"><img src="' + img + '" width="32" height="32" /></div>'; | ||
html += '<div class="body"><strong>' + entry.title + '</strong><br />' | ||
+ entry.contentSnippet + '</div>'; | ||
html += '</a></li>'; | ||
|
||
//Fetch keywords | ||
if (settings.favorites.length) { | ||
for (var j= 0; j < settings.favorites.length; j++) { | ||
var re = new RegExp(settings.favorites[j], "i"); | ||
if (entry.title.match(re) != null) { | ||
watched.append(html); | ||
count++; | ||
} | ||
} | ||
} | ||
public.append(html); | ||
} | ||
|
||
$('#public').html(public); | ||
$('#watched').html(watched); | ||
$('#nav-watched b').html(count); | ||
} | ||
}); | ||
|
||
$('#nav-public, #nav-watched').click(function(){ | ||
$('header li').removeClass('active'); | ||
$(this).addClass('active'); | ||
$('#notifications > div').each(function(){ | ||
$(this).hide(); | ||
}); | ||
$('#notifications #' + $(this).attr('title')).show(); | ||
}); | ||
|
||
$('#nav-settings').click(function(){ | ||
chrome.tabs.create( | ||
{ url: 'settings.html'}, | ||
function(tab) { | ||
window.close(); | ||
} | ||
); | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init();"> | ||
<div id="wrapper"> | ||
<header> | ||
<ul> | ||
<li id="nav-public" class="active" title="public">Public</li> | ||
<li id="nav-watched" title="watched">Watched (<b></b>)</li> | ||
<li id="nav-settings">Settings</li> | ||
<li> | ||
<a href="https://metacpan.org/" target="_blank" style="color:#426DC9;text-decoration:none;">MetaCPAN</a> | ||
</li> | ||
</ul> | ||
</header> | ||
<div id="notifications"> | ||
<div id="public"></div> | ||
<div id="watched"></div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
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