Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ubiquity google reader tool
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<title>Ubiquity Google reader tool</title>
</head>
<body>
<div id="google-reader" style="display: none;">
<small>${tipsMessage}</small>
<br/>
<small>Now Time: ${now}</small>
<br/>
<small>Last Update Time: ${time}</small>
<br/>
<small>Unread items: </small>${count}
<br/>
<br/>
{for result in results}
<div class="gresult">
<div>
${jQuery('title',result).get(0).innerHTML}
</div>
</div>
{/for}
</div>
<script class="commands"><![CDATA[
/* Google reader */
CmdUtils.CreateCommand({
names: ["gr"],
icon: "http://www.google.com/reader/ui/favicon.ico",
description: "Go to google reader.",
help: "Press ge and then enter to the google reader",
author: {name: "Wang Pengcheng", email: "wpc0000@gmail.com"},
license: "GPL",
homepage: "http://labs.mozilla.com/",
preview: function preview(pblock, args) {
var params = {};
//var url = "http://www.google.com/reader/atom/";
var url = "http://www.google.com/reader/atom/user/YOURUSERIDGOESHERE/state/com.google/reading-list?&xt=user/YOURUSERIDGOESHERE/state/com.google/read";
CmdUtils.previewGet( pblock, url, params, function(data) {
data = data.replace(/<\?[^>]*>/, '');
var results = jQuery("entry",data).get();
var count = results.length;
var numToDisplay = 10;
if(results!=undefined){
results = results.splice(0,numToDisplay);
}else{
results = {};
}
var tipsMessage = _("Tip: You can press enter to the google reader.");
var timeFormat = /(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)Z/;
var time = (jQuery("updated",data).get(0).innerHTML.replace(timeFormat,"$2 $3,$1 $4:$5:$6"));
pblock.innerHTML = CmdUtils.renderTemplate(
jQuery("#google-reader", feed.dom).html(),
{ results:results,
tipsMessage:tipsMessage,
time:(new Date(time)).toLocaleString(),
now:(new Date()).toLocaleString(),
count:count,
});
}, "text");
},
execute: function execute(args) {
Utils.openUrlInBrowser("http://www.google.com/reader/view/", "") ;
}
});
]]></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.