changed the Digg API data format from XML to JSON.

git-svn-id: file:///tmp/snv/trunk@4 12951d8a-c33d-4b7c-b961-822215c816e1
master
Abhinav Sarkar 2008-11-20 09:18:46 +00:00
parent 5aaa7b03f8
commit a72ed0292c
2 changed files with 247 additions and 272 deletions

7
chrome/content/TODO.txt Normal file
View File

@ -0,0 +1,7 @@
move to JSON data format
XBL -> Templates
format JS/refactor JS/Use FUEL
caching/db
threading
new UI
JQuery

View File

@ -28,7 +28,7 @@ function $ec(className, parentNode) {
return elements[i]; return elements[i];
} }
} }
} }
//Xpath //Xpath
function $xp(aNode, aExpr) { function $xp(aNode, aExpr) {
@ -66,7 +66,7 @@ function fetchData(url, handler) {
request.open("GET", url, true); request.open("GET", url, true);
request.send(null); request.send(null);
//$ei('diggIndicator').style.display = ''; //$ei('diggIndicator').style.display = '';
} }
function handleError(e) { function handleError(e) {
@ -75,191 +75,165 @@ function handleError(e) {
} }
function populateMenu(e) { function populateMenu(e) {
XHR = e.target; XHR = e.target;
//myDump(XHR.responseText); data = decodeJson(XHR.responseText);
data = XHR.responseXML; topics = data.topics;
topics = $xp(data, "/topics/topic"); containers = new Array();
while ($ei('topicPopup').firstChild) {
$ei('topicPopup').removeChild($ei('topicPopup').firstChild); while ($ei('topicPopup').firstChild) {
$ei('topicPopup').removeChild($ei('topicPopup').firstChild);
}
for (i=0; i<topics.length; i++) {
topic = topics[i];
menu = document.createElement('menu');
menu.setAttribute('id', topic.short_name + 'Menu');
menu.setAttribute('label', topic.name);
menu.setAttribute('accesskey', topic.name.charAt(0));
menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', topic.short_name + 'Popup');
['All', 'Popular', 'Upcoming'].forEach(
function (label) {
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', label);
menuitem.setAttribute('value', '/topic/' + topic.short_name + '/' + label.toLowerCase());
menuitem.setAttribute('accesskey', label.charAt(0));
menuitem.setAttribute('oncommand', "setEndPoint(this.value)");
menupopup.appendChild(menuitem);
}
);
menu.appendChild(menupopup);
$ei('topicPopup').appendChild(menu);
containers.push(topic.container);
}
while ($ei('containerPopup').firstChild) {
$ei('containerPopup').removeChild($ei('containerPopup').firstChild);
}
filteredContainers = {name: [], short_name: []};
for (i=0; i<containers.length; i++) {
name = containers[i].name;
short_name = containers[i].short_name;
if (filteredContainers.name.indexOf(name) == -1) {
filteredContainers.name.push(name);
filteredContainers.short_name.push(short_name);
} }
}
for (i=0; i<topics.length; i++) {
menu = document.createElement('menu'); for (i=0; i<filteredContainers.name.length; i++) {
menu.setAttribute('id', $a(topics[i], 'short_name') + 'Menu'); menu = document.createElement('menu');
menu.setAttribute('label', $a(topics[i], 'name')); menu.setAttribute('id', filteredContainers.short_name[i] + 'Menu');
menu.setAttribute('accesskey', $a(topics[i], 'name').substring(0, 1)); menu.setAttribute('label', filteredContainers.name[i]);
menu.setAttribute('accesskey', filteredContainers.name[i].charAt(0));
menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', $a(topics[i], 'short_name') + 'Popup'); menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', filteredContainers.short_name[i] + 'Popup');
['All', 'Popular', 'Upcoming'].forEach(
function (label) {
menuitem = document.createElement('menuitem'); menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', 'All'); menuitem.setAttribute('label', label);
menuitem.setAttribute('value', '/topic/' + $a(topics[i], 'short_name') + '/all'); menuitem.setAttribute('value', '/container/' +
menuitem.setAttribute('accesskey', 'A'); filteredContainers.short_name[i] + '/' + label.toLowerCase());
menuitem.setAttribute('accesskey', label.charAt(0));
menuitem.setAttribute('oncommand', "setEndPoint(this.value)"); menuitem.setAttribute('oncommand', "setEndPoint(this.value)");
menupopup.appendChild(menuitem); menupopup.appendChild(menuitem);
}
menuitem = document.createElement('menuitem'); );
menuitem.setAttribute('label', 'Popular');
menuitem.setAttribute('value', '/topic/' + $a(topics[i], 'short_name') + '/popular'); menu.appendChild(menupopup);
menuitem.setAttribute('accesskey', 'P'); $ei('containerPopup').appendChild(menu);
menuitem.setAttribute('oncommand', "setEndPoint(this.value)"); }
menupopup.appendChild(menuitem); $ei('diggIndicator').style.display = 'none';
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', 'Upcoming');
menuitem.setAttribute('value', '/topic/' + $a(topics[i], 'short_name') + '/upcoming');
menuitem.setAttribute('accesskey', 'U');
menuitem.setAttribute('oncommand', "setEndPoint(this.value)");
menupopup.appendChild(menuitem);
menu.appendChild(menupopup);
//alert($a(topics[i], 'name'));
$ei('topicPopup').appendChild(menu);
}
containers = $xp(data, "/topics/topic/container");
while ($ei('containerPopup').firstChild) {
$ei('containerPopup').removeChild($ei('containerPopup').firstChild);
}
filteredContainers = {name: [], short_name: []};
for (i=0; i<containers.length; i++) {
name = $a(containers[i], 'name');
short_name = $a(containers[i], 'short_name');
if (filteredContainers.name.indexOf(name) == -1) {
filteredContainers.name.push(name);
filteredContainers.short_name.push(short_name);
}
}
//myDump(uneval(filteredContainers));
for (i=0; i<filteredContainers.name.length; i++) {
menu = document.createElement('menu');
menu.setAttribute('id', filteredContainers.short_name[i] + 'Menu');
menu.setAttribute('label', filteredContainers.name[i]);
menu.setAttribute('accesskey', filteredContainers.name[i].substring(0, 1));
menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', filteredContainers.short_name[i] + 'Popup');
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', 'All');
menuitem.setAttribute('value', '/container/' + filteredContainers.short_name[i] + '/all');
menuitem.setAttribute('accesskey', 'A');
menuitem.setAttribute('oncommand', "setEndPoint(this.value)");
menupopup.appendChild(menuitem);
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', 'Popular');
menuitem.setAttribute('value', '/container/' + filteredContainers.short_name[i] + '/popular');
menuitem.setAttribute('accesskey', 'P');
menuitem.setAttribute('oncommand', "setEndPoint(this.value)");
menupopup.appendChild(menuitem);
menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', 'Upcoming');
menuitem.setAttribute('value', '/container/' + filteredContainers.short_name[i] + '/upcoming');
menuitem.setAttribute('accesskey', 'U');
menuitem.setAttribute('oncommand', "setEndPoint(this.value)");
menupopup.appendChild(menuitem);
menu.appendChild(menupopup);
//alert($a(topics[i], 'name'));
$ei('containerPopup').appendChild(menu);
}
$ei('diggIndicator').style.display = 'none';
} }
function populateStoryList(e) { function populateStoryList(e) {
//alert("inside populateStoryList");
XHR = e.target; XHR = e.target;
//alert(XHR.responseText); //Application.console.log(XHR.responseText);
data = XHR.responseXML; data = decodeJson(XHR.responseText);
stories = $xp(data, "/stories/story"); stories = data.stories;
//alert(stories.length);
//dumpProperties(titles[0]);
//selectedItem = $ei('storyList').selectedItem;
while ($ei('storyList').firstChild) {
$ei('storyList').removeChild($ei('storyList').firstChild);
}
var newStories = new Array();
for (i=0; i<stories.length; i++) {
//alert(stories[i]);
title = $et('title', stories[i]).textContent;
id = $a(stories[i], 'id');
newStories.push(id);
//alert(title + " " + id);
listitem = $ei('storyList').appendChild(document.createElement('richlistitem'));
listitem.id = "story_" + id;
htmllistitem = listitem.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml","html:div"));
htmllistitem.innerHTML = $ei('storyTitleFormat').innerHTML;
storyTitle = listitem.getElementsByAttribute('class', 'storyTitle')[0];
storyTitle.appendChild(document.createTextNode(title));
htmllistitem.innerHTML += $ei('storyDetailsFormat').innerHTML;
storyNew= listitem.getElementsByAttribute('class', 'storyNew')[0];
if (currentStories.indexOf(id) != -1) {
storyNew.style.textDecoration = "line-through";
storyNew.style.backgroundColor = "black";
storyNew.style.color = "white";
storyNew.title = "Old";
}
}
currentStories = newStories;
//$ei('diggIndicator').style.display = 'none';
//Adaptive update interval code START
sum = 0;
weights = [0.4, 0.3, 0.2, 0.1]
for (i=0; i<4; i++) {
if ($a(stories[0], 'promote_date') != null)
diff = parseInt($a(stories[i], 'promote_date')) - parseInt($a(stories[i+1], 'promote_date'));
else
diff = parseInt($a(stories[i], 'submit_date')) - parseInt($a(stories[i+1], 'submit_date'));
sum += weights[i]*diff;
}
updateInterval = Math.round(sum*1000);
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
previousUpdateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval")
prefs.setIntPref("extensions.diggsidebar.updateinterval", updateInterval);
updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay");
if (previousUpdateInterval == updateInterval) while ($ei('storyList').firstChild) {
prefs.setIntPref("extensions.diggsidebar.updateintervaldecay", (updateIntervalDecay + 1)); $ei('storyList').removeChild($ei('storyList').firstChild);
}
var newStories = new Array();
Application.console.log(stories.length);
for (i=0; i<stories.length; i++) {
story = stories[i];
newStories.push(story.id);
//Application.console.log(i + " " + story.title + " " + story.id);
listitem = $ei('storyList').appendChild(document.createElement('richlistitem'));
listitem.id = "story_" + story.id;
htmllistitem = listitem.appendChild(
document.createElementNS("http://www.w3.org/1999/xhtml","html:div"));
htmllistitem.innerHTML = $ei('storyTitleFormat').innerHTML;
storyTitle = listitem.getElementsByAttribute('class', 'storyTitle')[0];
storyTitle.appendChild(document.createTextNode(story.title));
htmllistitem.innerHTML += $ei('storyDetailsFormat').innerHTML;
storyNew= listitem.getElementsByAttribute('class', 'storyNew')[0];
if (currentStories.indexOf(story.id) != -1) {
storyNew.style.textDecoration = "line-through";
storyNew.style.backgroundColor = "black";
storyNew.style.color = "white";
storyNew.title = "Old";
}
}
currentStories = newStories;
//Adaptive update interval code START
sum = 0;
weights = [0.4, 0.3, 0.2, 0.1]
for (i=0; i<4; i++) {
if (stories[0].promote_date != null)
diff = stories[i].promote_date - stories[i+1].promote_date;
else else
prefs.setIntPref("extensions.diggsidebar.updateintervaldecay", 0); diff = stories[i].submit_date - stories[i+1].submit_date;
window.clearTimeout(gsti); sum += weights[i]*diff;
}
updateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval") updateInterval = Math.round(sum*1000);
updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay");
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay))); getService(Components.interfaces.nsIPrefBranch);
gsti = window.setTimeout(getStories, timeout);
//Adaptive update interval code END previousUpdateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval")
prefs.setIntPref("extensions.diggsidebar.updateinterval", updateInterval);
$ei('diggIndicator').style.display = 'none';
updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay");
//prefs.setIntPref("extensions.diggsidebar.progress", 100);
//$ei("diggIndicator").setAttribute('mode', 'determined'); if (previousUpdateInterval == updateInterval)
//$ei("diggIndicator").setAttribute('value', 100); prefs.setIntPref("extensions.diggsidebar.updateintervaldecay", (updateIntervalDecay + 1));
//psi = window.setInterval(showProgress, Math.round(timeout/100)); else
//window.setTimeout("window.clearInterval(psi)", timeout); prefs.setIntPref("extensions.diggsidebar.updateintervaldecay", 0);
window.clearTimeout(gsti);
updateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval")
updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay");
timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay)));
gsti = window.setTimeout(getStories, timeout);
//Adaptive update interval code END
$ei('diggIndicator').style.display = 'none';
//prefs.setIntPref("extensions.diggsidebar.progress", 100);
//$ei("diggIndicator").setAttribute('mode', 'determined');
//$ei("diggIndicator").setAttribute('value', 100);
//psi = window.setInterval(showProgress, Math.round(timeout/100));
//window.setTimeout("window.clearInterval(psi)", timeout);
} }
//function showProgress() { //function showProgress() {
@ -267,108 +241,104 @@ function populateStoryList(e) {
// getService(Components.interfaces.nsIPrefBranch); // getService(Components.interfaces.nsIPrefBranch);
// progress = prefs.getIntPref("extensions.diggsidebar.progress"); // progress = prefs.getIntPref("extensions.diggsidebar.progress");
// prefs.setIntPref("extensions.diggsidebar.progress", (progress - 1)); // prefs.setIntPref("extensions.diggsidebar.progress", (progress - 1));
// //
// $ei("diggIndicator").setAttribute('value', (parseInt($ei("diggIndicator").getAttribute('value')) - 1)); // $ei("diggIndicator").setAttribute('value', (parseInt($ei("diggIndicator").getAttribute('value')) - 1));
//} //}
function populateDescription(e) { function populateDescription(e) {
XHR = e.target; XHR = e.target;
myDump(XHR.responseText); //Application.console.log(XHR.responseText);
data = XHR.responseXML; data = decodeJson(XHR.responseText);
story = $xp(data, "/stories/story")[0]; story = data.stories[0];
//alert(story);
now = new Date(); now = new Date();
if ($a(story, 'promote_date') != null) if (story.promote_date != null)
then = new Date(parseInt($a(story, 'promote_date').escapeEntities())*1000); then = new Date(story.promote_date*1000);
else else
then = new Date(parseInt($a(story, 'submit_date').escapeEntities())*1000); then = new Date(story.submit_date*1000);
diff = now - then; diff = Math.max(now - then, 0)
if (diff < 0) diff = 0;
hr = Math.floor(diff/(1000*3600));
hr = Math.floor(diff/(1000*3600)); min = Math.floor(diff/(1000*60)) - 60*hr;
min = Math.floor(diff/(1000*60)) - 60*hr;
listitems = document.getElementsByTagName('richlistitem');
listitems = document.getElementsByTagName('richlistitem'); for (i=0; i<listitems.length; i++) {
for (i=0; i<listitems.length; i++) { listitems[i].getElementsByAttribute('class', 'storyDetails')[0].style.display = 'none';
listitems[i].getElementsByAttribute('class', 'storyDetails')[0].style.display = 'none'; listitems[i].getElementsByAttribute('class', 'storyCEIcon')[0].src =
listitems[i].getElementsByAttribute('class', 'storyCEIcon')[0].src = "chrome://diggsidebar/content/image/up.jpg"; "chrome://diggsidebar/content/image/up.jpg";
} }
storyListItem = $ei('story_'+ $a(story, 'id')) storyListItem = $ei('story_'+ story.id)
storyDetails = storyListItem.getElementsByAttribute('class', 'storyDetails')[0]; storyDetails = storyListItem.getElementsByAttribute('class', 'storyDetails')[0];
storyDate = storyListItem.getElementsByAttribute('class', 'storyDate')[0]; storyDate = storyListItem.getElementsByAttribute('class', 'storyDate')[0];
storyStatus = storyListItem.getElementsByAttribute('class', 'storyStatus')[0]; storyStatus = storyListItem.getElementsByAttribute('class', 'storyStatus')[0];
storyContainer = storyListItem.getElementsByAttribute('class', 'storyContainer')[0]; storyContainer = storyListItem.getElementsByAttribute('class', 'storyContainer')[0];
storyTopic = storyListItem.getElementsByAttribute('class', 'storyTopic')[0]; storyTopic = storyListItem.getElementsByAttribute('class', 'storyTopic')[0];
storyUserName = storyListItem.getElementsByAttribute('class', 'storyUserName')[0]; storyUserName = storyListItem.getElementsByAttribute('class', 'storyUserName')[0];
storyDiggs = storyListItem.getElementsByAttribute('class', 'storyDiggs')[0]; storyDiggs = storyListItem.getElementsByAttribute('class', 'storyDiggs')[0];
storyComments = storyListItem.getElementsByAttribute('class', 'storyComments')[0]; storyComments = storyListItem.getElementsByAttribute('class', 'storyComments')[0];
storyDesc = storyListItem.getElementsByAttribute('class', 'storyDesc')[0]; storyDesc = storyListItem.getElementsByAttribute('class', 'storyDesc')[0];
storyLink = storyListItem.getElementsByAttribute('class', 'storyLink')[0]; storyLink = storyListItem.getElementsByAttribute('class', 'storyLink')[0];
storyHref = storyListItem.getElementsByAttribute('class', 'storyHref')[0]; storyHref = storyListItem.getElementsByAttribute('class', 'storyHref')[0];
storyCEIcon = storyListItem.getElementsByAttribute('class', 'storyCEIcon')[0]; storyCEIcon = storyListItem.getElementsByAttribute('class', 'storyCEIcon')[0];
storyRead = storyListItem.getElementsByAttribute('class', 'storyRead')[0]; storyRead = storyListItem.getElementsByAttribute('class', 'storyRead')[0];
storyDate.innerHTML = ((hr > 0) && (min > 0)) ? storyDate.innerHTML = ((hr > 0) && (min > 0)) ?
(hr + " hr " + min + " mins ago") : (hr + " hr " + min + " mins ago") :
((hr == 0) && (min > 0)) ? ((hr == 0) && (min > 0)) ?
(min + " mins ago") : (min + " mins ago") :
((hr == 0) && (min == 0)) ? ((hr == 0) && (min == 0)) ?
"just now" : ""; "just now" : "";
storyStatus.innerHTML = $a(story, 'status').escapeEntities(); storyStatus.innerHTML = story.status.escapeEntities();
//alert($a($et('container', story), 'name').escapeEntities()); storyContainer.innerHTML = story.container.name.escapeEntities();
storyContainer.innerHTML = $a($et('container', story), 'name').escapeEntities(); storyTopic.innerHTML = story.topic.name.escapeEntities();
storyTopic.innerHTML = $a($et('topic', story), 'name').escapeEntities(); storyUserName.href = "http://digg.com/users/" + story.user.name;
storyUserName.href = "http://digg.com/users/" + $a($et('user', story), 'name').escapeEntities(); storyUserName.innerHTML = story.user.name.escapeEntities();
storyUserName.innerHTML = $a($et('user', story), 'name').escapeEntities(); storyDiggs.innerHTML = story.diggs;
storyDiggs.innerHTML = $a(story, 'diggs').escapeEntities(); storyComments.innerHTML = story.comments;
storyComments.innerHTML = $a(story, 'comments').escapeEntities(); storyDesc.innerHTML = story.description.escapeEntities();
storyDesc.innerHTML = $et('description', story).textContent.escapeEntities(); storyLink.href = story.link;
storyLink.href = $a(story, 'link'); storyHref.href = story.href;
storyHref.href = $a(story, 'href');
storyCEIcon.src = "chrome://diggsidebar/content/image/down.jpg";
storyCEIcon.src = "chrome://diggsidebar/content/image/down.jpg"; storyRead.style.textDecoration = "line-through";
storyRead.style.textDecoration = "line-through"; storyRead.style.backgroundColor = "black";
storyRead.style.backgroundColor = "black"; storyRead.style.color = "white";
storyRead.style.color = "white"; storyRead.title = "Read";
storyRead.title = "Read"; storyNew.style.textDecoration = "line-through";
storyNew.style.textDecoration = "line-through"; storyNew.style.backgroundColor = "black";
storyNew.style.backgroundColor = "black"; storyNew.style.color = "white";
storyNew.style.color = "white"; storyNew.title = "Old";
storyNew.title = "Old";
storyDetails.style.display = 'block'; storyDetails.style.display = 'block';
$ei('diggIndicator').style.display = 'none'; $ei('diggIndicator').style.display = 'none';
} }
function getStories() { function getStories() {
//alert("inside getStories"); var prefs = Components.classes["@mozilla.org/preferences-service;1"].
var prefs = Components.classes["@mozilla.org/preferences-service;1"]. getService(Components.interfaces.nsIPrefBranch);
getService(Components.interfaces.nsIPrefBranch); ep = prefs.getCharPref("extensions.diggsidebar.endpoint") || '';
ep = prefs.getCharPref("extensions.diggsidebar.endpoint") || ''; $ei('diggEndPoint').value = "digg" + ep;
//alert(ep);
$ei('diggEndPoint').value = "digg" + ep; fetchData("http://services.digg.com/stories" + ep.replace(/\/all/g, '') +
"?count=30" + "&type=json" +
//ep ='';
fetchData("http://services.digg.com/stories" + ep.replace(/\/all/g, '') + "?count=30" +
"&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"), "&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
populateStoryList); populateStoryList);
//gsti = window.setTimeout(getStories, prefs.getIntPref("extensions.diggsidebar.updateinterval")); //gsti = window.setTimeout(getStories, prefs.getIntPref("extensions.diggsidebar.updateinterval"));
} }
function getDescription(storyId) { function getDescription(storyId) {
myDump(storyId); if (storyId == null) return;
if (storyId == null) return; fetchData("http://services.digg.com/story/" + storyId + "?type=json" +
fetchData("http://services.digg.com/story/" + storyId + "&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
"?appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
populateDescription); populateDescription);
} }
function createMenu() { function createMenu() {
fetchData("http://services.digg.com/topics" + fetchData("http://services.digg.com/topics" + "?type=json" +
"?appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"), "&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
populateMenu); populateMenu);
} }
@ -403,7 +373,7 @@ function togglePlayPause() {
getService(Components.interfaces.nsIPrefBranch); getService(Components.interfaces.nsIPrefBranch);
updateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval") updateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval")
updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay"); updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay");
timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay))); timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay)));
//newTimeout = Math.round(timeout*parseInt($ei("diggIndicator").getAttribute('value'))/100); //newTimeout = Math.round(timeout*parseInt($ei("diggIndicator").getAttribute('value'))/100);
gsti = window.setTimeout(getStories, timeout); gsti = window.setTimeout(getStories, timeout);
@ -415,13 +385,11 @@ function togglePlayPause() {
} }
} }
function decodeJson(string) {
function myDump(aMessage) { var json = Components.classes["@mozilla.org/dom/json;1"]
var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .createInstance(Components.interfaces.nsIJSON);
.getService(Components.interfaces.nsIConsoleService); return json.decode(string);
consoleService.logStringMessage("Diggsidebar: " + aMessage); };
}
/*TODO /*TODO
preferences preferences
@ -435,12 +403,12 @@ function myDump(aMessage) {
added error notification added error notification
added accesskeys added accesskeys
added new story notification added new story notification
v0.2.1 v0.2.1
adaptive polling interval adaptive polling interval
promote_date promote_date
pause/play pause/play
v0.5 v0.5
new ui new ui
*/ */