refactored Javascript and make related changes in other files

git-svn-id: file:///tmp/snv/trunk@8 12951d8a-c33d-4b7c-b961-822215c816e1
master
Abhinav Sarkar 2008-12-02 17:41:31 +00:00
parent 5b4693e621
commit 3d33406796
5 changed files with 300 additions and 295 deletions

View File

@ -1,7 +1,6 @@
move to JSON data format -- done move to JSON data format -- done
XBL -- done XBL -- done
externalize strings format JS/refactor JS/Use FUEL -- done
format JS/refactor JS/Use FUEL
put license put license
caching/db, threading, XUL templates caching/db, threading, XUL templates
new UI new UI

View File

@ -1,125 +1,108 @@
var gsti; var DiggSidebar = {
var currentStories = new Array(); prefs: Application.extensions.get("diggsidebar@abhinavsarkar.net").prefs,
var playing = true; categories: ['All', 'Popular', 'Upcoming', 'Hot', 'Top'],
timerId : null,
currentStories : new Array(),
playing : true,
//getElementById fetchData: function(url, handler) {
function $ei(id, parentNode) { DiggSidebar.diggIndicator.style.display = '';
parentNode = parentNode || document;
return parentNode.getElementById(id);
}
function fetchData(url, handler) { var request = new XMLHttpRequest();
//alert("inside fetchData"); request.onerror = DiggSidebar.errorHandler;
$ei('diggIndicator').style.display = ''; request.onload = handler;
$ei("diggIndicator").setAttribute('mode', 'undetermined');
var request = Components.
classes["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance();
// QI the object to nsIDOMEventTarget to set event handlers on it:
request.QueryInterface(Components.interfaces.nsIDOMEventTarget);
request.addEventListener("load", handler, false);
request.addEventListener("error", handleError, false);
// QI it to nsIXMLHttpRequest to open and send the request:
request.QueryInterface(Components.interfaces.nsIXMLHttpRequest);
request.open("GET", url, true); request.open("GET", url, true);
request.send(null); request.send(null);
//$ei('diggIndicator').style.display = ''; },
} errorHandler: function(e) {
window.alert("Error in accessing data from Digg");
},
function handleError(e) { populateMenu: function(e) {
$ei('storyList').appendItem("!! Error accessing Digg !!"); var XHR = e.target;
//$ei('diggIndicator').style.display = 'none'; var data = DiggSidebar.Utils.decodeJson(XHR.responseText);
} var topics = data.topics;
var containers = new Array();
function populateMenu(e) { while (DiggSidebar.topicPopup.firstChild) {
XHR = e.target; DiggSidebar.topicPopup.removeChild(DiggSidebar.topicPopup.firstChild);
data = decodeJson(XHR.responseText);
topics = data.topics;
containers = new Array();
while ($ei('topicPopup').firstChild) {
$ei('topicPopup').removeChild($ei('topicPopup').firstChild);
} }
topics.forEach(function (topic) { topics.forEach(function (topic) {
menu = document.createElement('menu'); var menu = document.createElement('menu');
menu.setAttribute('id', topic.short_name + 'Menu'); menu.setAttribute('id', topic.short_name + 'Menu');
menu.setAttribute('label', topic.name); menu.setAttribute('label', topic.name);
menu.setAttribute('accesskey', topic.name.charAt(0)); menu.setAttribute('accesskey', topic.name.charAt(0));
menupopup = document.createElement('menupopup'); var menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', topic.short_name + 'Popup'); menupopup.setAttribute('id', topic.short_name + 'Popup');
['All', 'Popular', 'Upcoming', 'Hot', 'Top'].forEach( DiggSidebar.categories.forEach(
function (label) { function (label) {
menuitem = document.createElement('menuitem'); var menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', label); menuitem.setAttribute('label', label);
menuitem.setAttribute('value', '/topic/' + topic.short_name + '/' + label.toLowerCase()); menuitem.setAttribute('value', '/topic/' + topic.short_name + '/' + label.toLowerCase());
menuitem.setAttribute('accesskey', label.charAt(0)); menuitem.setAttribute('accesskey', label.charAt(0));
menuitem.setAttribute('oncommand', "setEndPoint(this.value)"); menuitem.setAttribute('oncommand', "DiggSidebar.setEndPoint(this.value)");
menupopup.appendChild(menuitem); menupopup.appendChild(menuitem);
} }
); );
menu.appendChild(menupopup); menu.appendChild(menupopup);
$ei('topicPopup').appendChild(menu); DiggSidebar.topicPopup.appendChild(menu);
containers.push(topic.container); containers.push(topic.container);
}); });
while ($ei('containerPopup').firstChild) { while (DiggSidebar.containerPopup.firstChild) {
$ei('containerPopup').removeChild($ei('containerPopup').firstChild); DiggSidebar.containerPopup.removeChild(DiggSidebar.containerPopup.firstChild);
} }
filteredContainers = {name: [], short_name: []}; var filteredContainers = {name: [], short_name: []};
containers.forEach(function (container) { containers.forEach(function (container) {
name = container.name; var name = container.name;
short_name = container.short_name; var short_name = container.short_name;
if (filteredContainers.name.indexOf(name) == -1) { if (filteredContainers.name.indexOf(name) == -1) {
filteredContainers.name.push(name); filteredContainers.name.push(name);
filteredContainers.short_name.push(short_name); filteredContainers.short_name.push(short_name);
} }
}); });
for (i=0; i<filteredContainers.name.length; i++) { for (var i=0; i<filteredContainers.name.length; i++) {
menu = document.createElement('menu'); var menu = document.createElement('menu');
menu.setAttribute('id', filteredContainers.short_name[i] + 'Menu'); menu.setAttribute('id', filteredContainers.short_name[i] + 'Menu');
menu.setAttribute('label', filteredContainers.name[i]); menu.setAttribute('label', filteredContainers.name[i]);
menu.setAttribute('accesskey', filteredContainers.name[i].charAt(0)); menu.setAttribute('accesskey', filteredContainers.name[i].charAt(0));
menupopup = document.createElement('menupopup'); var menupopup = document.createElement('menupopup');
menupopup.setAttribute('id', filteredContainers.short_name[i] + 'Popup'); menupopup.setAttribute('id', filteredContainers.short_name[i] + 'Popup');
['All', 'Popular', 'Upcoming', 'Hot', 'Top'].forEach( DiggSidebar.categories.forEach(
function (label) { function (label) {
menuitem = document.createElement('menuitem'); var menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', label); menuitem.setAttribute('label', label);
menuitem.setAttribute('value', '/container/' + menuitem.setAttribute('value', '/container/' +
filteredContainers.short_name[i] + '/' + label.toLowerCase()); filteredContainers.short_name[i] + '/' + label.toLowerCase());
menuitem.setAttribute('accesskey', label.charAt(0)); menuitem.setAttribute('accesskey', label.charAt(0));
menuitem.setAttribute('oncommand', "setEndPoint(this.value)"); menuitem.setAttribute('oncommand', "DiggSidebar.setEndPoint(this.value)");
menupopup.appendChild(menuitem); menupopup.appendChild(menuitem);
} }
); );
menu.appendChild(menupopup); menu.appendChild(menupopup);
$ei('containerPopup').appendChild(menu); DiggSidebar.containerPopup.appendChild(menu);
}
$ei('diggIndicator').style.display = 'none';
} }
DiggSidebar.diggIndicator.style.display = 'none';
},
function populateStoryList(e) { populateStoryList: function(e) {
XHR = e.target; var XHR = e.target;
//Application.console.log(XHR.responseText); //Application.console.log(XHR.responseText);
data = decodeJson(XHR.responseText); var data = DiggSidebar.Utils.decodeJson(XHR.responseText);
stories = data.stories; var stories = data.stories;
while ($ei('storyList').firstChild) { while (DiggSidebar.storyList.firstChild) {
$ei('storyList').removeChild($ei('storyList').firstChild); DiggSidebar.storyList.removeChild(DiggSidebar.storyList.firstChild);
} }
var newStories = new Array(); var newStories = new Array();
@ -129,89 +112,47 @@ function populateStoryList(e) {
newStories.push(story.id); newStories.push(story.id);
//Application.console.log(i + " " + story.title + " " + story.id); //Application.console.log(i + " " + story.title + " " + story.id);
listitem = $ei('storyList').appendChild(document.createElement('richlistitem')); var listitem = DiggSidebar.storyList.appendChild(document.createElement('richlistitem'));
listitem.id = "story_" + story.id; listitem.id = "story_" + story.id;
listitem.setAttribute('title', story.title); listitem.setAttribute('title', story.title);
if (currentStories.indexOf(story.id) != -1) listitem.new = false; if (DiggSidebar.currentStories.indexOf(story.id) != -1) listitem.new = false;
}); });
currentStories = newStories; DiggSidebar.currentStories = newStories;
DiggSidebar.setUpdateInterval(stories);
DiggSidebar.diggIndicator.style.display = 'none';
},
//Adaptive update interval code START populateDescription: function(e) {
sum = 0; var XHR = e.target;
weights = [4, 3, 2, 1]
date = (stories[0].promote_date != null) ? 'promote_date' : 'submit_date';
stories.sort(function (a, b) {
if (a[date] > b[date]) return -1;
else if (a[date] < b[date]) return 1;
return 0;
});
for (i=0; i<Math.min(4, stories.length-1); i++) {
diff = stories[i][date] - stories[i+1][date];
sum += weights[i]*diff;
}
updateInterval = Math.round(
sum*1000/weights
.splice(0,Math.min(4, stories.length-1))
.reduce(function(a, b){return a + b;})
);
//Application.console.log(updateInterval);
var prefs = Application.extensions.get("diggsidebar@abhinavsarkar.net").prefs;
if (updateInterval > 0) {
previousUpdateInterval = prefs.get("updateinterval").value;
prefs.get("updateinterval").value = updateInterval;
updateIntervalDecay = prefs.get("updateintervaldecay").value;
if (previousUpdateInterval == updateInterval)
prefs.get("updateintervaldecay").value = updateIntervalDecay + 1;
else
prefs.get("updateintervaldecay").value = 0;
}
window.clearTimeout(gsti);
updateInterval = prefs.get("updateinterval").value;
updateIntervalDecay = prefs.get("updateintervaldecay").value;
timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay)));
gsti = window.setTimeout(getStories, timeout);
//Adaptive update interval code END
$ei('diggIndicator').style.display = 'none';
}
function populateDescription(e) {
XHR = e.target;
//Application.console.log(XHR.responseText); //Application.console.log(XHR.responseText);
data = decodeJson(XHR.responseText); var data = DiggSidebar.Utils.decodeJson(XHR.responseText);
story = data.stories[0]; var story = data.stories[0];
now = new Date(); var now = new Date();
if (story.promote_date != null) if (story.promote_date != null)
then = new Date(story.promote_date*1000); var then = new Date(story.promote_date*1000);
else else
then = new Date(story.submit_date*1000); var then = new Date(story.submit_date*1000);
diff = Math.max(now - then, 0) var diff = Math.max(now - then, 0)
hr = Math.floor(diff/(1000*3600)); var hr = Math.floor(diff/(1000*3600));
min = Math.floor(diff/(1000*60)) - 60*hr; var min = Math.floor(diff/(1000*60)) - 60*hr;
listitems = document.getElementsByTagName('richlistitem'); var listitems = document.getElementsByTagName('richlistitem');
for (i=0; i<listitems.length; i++) { for (var i=0; i<listitems.length; i++) {
listitems[i].hideDesc(); listitems[i].hideDesc();
} }
li = $ei('story_'+ story.id) var li = document.getElementById('story_'+ story.id)
storyDate = ((hr > 0) && (min > 0)) ? var relativeTime = ((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" : "";
li.setAttribute('date', storyDate); li.setAttribute('date', relativeTime);
li.setAttribute('status', story.status); li.setAttribute('status', story.status);
li.setAttribute('container', story.container.name); li.setAttribute('container', story.container.name);
li.setAttribute('topic', story.topic.name); li.setAttribute('topic', story.topic.name);
@ -227,81 +168,128 @@ function populateDescription(e) {
li.new = false; li.new = false;
li.showDesc() li.showDesc()
$ei('diggIndicator').style.display = 'none'; DiggSidebar.diggIndicator.style.display = 'none';
} },
function getStories() { getStories: function() {
var prefs = Application.extensions.get("diggsidebar@abhinavsarkar.net").prefs; var ep = DiggSidebar.prefs.get("endpoint").value || '';
ep = prefs.get("endpoint").value || ''; DiggSidebar.diggEndPoint.value = "digg" + ep;
$ei('diggEndPoint').value = "digg" + ep;
fetchData("http://services.digg.com/stories" + ep.replace(/\/all/g, '') + DiggSidebar.fetchData("http://services.digg.com/stories" + ep.replace(/\/all/g, '') +
"?count=30" + "&type=json" + "?count=30" + "&type=json" +
"&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"), "&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
populateStoryList); DiggSidebar.populateStoryList);
//gsti = window.setTimeout(getStories, prefs.getIntPref("extensions.diggsidebar.updateinterval")); },
}
function getDescription(storyId) { getDescription: function(storyId) {
if (storyId == null) return; if (storyId == null) return;
fetchData("http://services.digg.com/story/" + storyId + "?type=json" + DiggSidebar.fetchData("http://services.digg.com/story/" + storyId + "?type=json" +
"&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"), "&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
populateDescription); DiggSidebar.populateDescription);
} },
function createMenu() { createMenu: function() {
fetchData("http://services.digg.com/topics" + "?type=json" + DiggSidebar.fetchData("http://services.digg.com/topics" + "?type=json" +
"&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"), "&appkey=" + encodeURIComponent("http://diggsidebar.googlepages.com"),
populateMenu); DiggSidebar.populateMenu);
} },
function openInTab(href) { setUpdateInterval: function(stories) {
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) //Adaptive update interval code START
.getInterface(Components.interfaces.nsIWebNavigation) var sum = 0;
.QueryInterface(Components.interfaces.nsIDocShellTreeItem) var weights = [4, 3, 2, 1]
.rootTreeItem var date = (stories[0].promote_date != null) ? 'promote_date' : 'submit_date';
.QueryInterface(Components.interfaces.nsIInterfaceRequestor) stories.sort(function (a, b) {
.getInterface(Components.interfaces.nsIDOMWindow); if (a[date] > b[date]) return -1;
mainWindow.getBrowser().selectedTab = mainWindow.getBrowser().addTab(href); else if (a[date] < b[date]) return 1;
return 0;
});
for (var i=0; i<Math.min(4, stories.length-1); i++) {
var diff = stories[i][date] - stories[i+1][date];
sum += weights[i]*diff;
} }
var updateInterval = Math.round(
sum*1000/weights
.splice(0,Math.min(4, stories.length-1))
.reduce(function(a, b){return a + b;})
);
//Application.console.log(updateInterval);
function setEndPoint(ep) { if (updateInterval > 0) {
var prefs = Application.extensions.get("diggsidebar@abhinavsarkar.net").prefs; var previousUpdateInterval = DiggSidebar.prefs.get("updateinterval").value;
prefs.get("endpoint").value = ep; DiggSidebar.prefs.get("updateinterval").value = updateInterval;
window.clearTimeout(gsti);
//window.clearInterval(psi); var updateIntervalDecay = DiggSidebar.prefs.get("updateintervaldecay").value;
getStories();
if (previousUpdateInterval == updateInterval)
DiggSidebar.prefs.get("updateintervaldecay").value = updateIntervalDecay + 1;
else
DiggSidebar.prefs.get("updateintervaldecay").value = 0;
} }
window.clearTimeout(DiggSidebar.timerId);
function togglePlayPause() { var updateInterval = DiggSidebar.prefs.get("updateinterval").value;
if (playing) { var updateIntervalDecay = DiggSidebar.prefs.get("updateintervaldecay").value;
window.clearTimeout(gsti);
//window.clearInterval(psi); var timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay)));
$ei('diggPlayPause').image = "chrome://diggsidebar/content/image/Play.png"; DiggSidebar.timerId = window.setTimeout(DiggSidebar.getStories, timeout);
$ei('diggPlayPause').setAttribute("tooltiptext", "Click to Start autoupdate"); //Adaptive update interval code END
playing = false; },
setEndPoint: function(ep) {
DiggSidebar.prefs.get("endpoint").value = ep;
window.clearTimeout(DiggSidebar.timerId);
DiggSidebar.getStories();
},
togglePlayPause: function() {
if (DiggSidebar.playing) {
window.clearTimeout(DiggSidebar.timerId);
DiggSidebar.diggPlayPause.image = "chrome://diggsidebar/content/image/Play.png";
DiggSidebar.diggPlayPause.setAttribute("tooltiptext", "Click to Start autoupdate");
DiggSidebar.playing = false;
} else { } else {
var prefs = Application.extensions.get("diggsidebar@abhinavsarkar.net").prefs; var updateInterval = DiggSidebar.prefs.get("updateinterval").value;
updateInterval = prefs.get("extensions.diggsidebar.updateinterval").value; var updateIntervalDecay = DiggSidebar.prefs.get("updateintervaldecay").value;
updateIntervalDecay = prefs.get("extensions.diggsidebar.updateintervaldecay").value;
timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay))); var timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay)));
//newTimeout = Math.round(timeout*parseInt($ei("diggIndicator").getAttribute('value'))/100); DiggSidebar.timerId = window.setTimeout(DiggSidebar.getStories, timeout);
gsti = window.setTimeout(getStories, timeout); DiggSidebar.diggPlayPause.image = "chrome://diggsidebar/content/image/Pause.png";
//psi = window.setInterval(showProgress, Math.round(timeout/100)); DiggSidebar.diggPlayPause.setAttribute("tooltiptext", "Click to Pause autoupdate");
//window.setTimeout("window.clearInterval(psi)", newTimeout); DiggSidebar.playing = true;
$ei('diggPlayPause').image = "chrome://diggsidebar/content/image/Pause.png";
$ei('diggPlayPause').setAttribute("tooltiptext", "Click to Pause autoupdate");
playing = true;
}
} }
},
function decodeJson(string) { initialize: function(){
var $ = function(id) {return document.getElementById(id)};
DiggSidebar.diggIndicator = $('diggIndicator');
DiggSidebar.topicPopup = $('topicPopup');
DiggSidebar.containerPopup = $('containerPopup');
DiggSidebar.storyList = $('storyList');
DiggSidebar.diggEndPoint = $('diggEndPoint');
DiggSidebar.diggPlayPause = $('diggPlayPause');
DiggSidebar.createMenu();
DiggSidebar.getStories();
}
};
DiggSidebar.Utils = {
url: function(spec) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ios.newURI(spec, null, null);
},
openUrlInTab: function(url) {
Application.activeWindow.open(DiggSidebar.Utils.url(url));
},
decodeJson: function(string) {
var json = Components.classes["@mozilla.org/dom/json;1"] var json = Components.classes["@mozilla.org/dom/json;1"]
.createInstance(Components.interfaces.nsIJSON); .createInstance(Components.interfaces.nsIJSON);
return json.decode(string); return json.decode(string);
}; }
}
/*TODO /*TODO
preferences preferences
toolbar button toolbar button

View File

@ -6,7 +6,7 @@
<page id="sbDiggSidebar" title="&diggsidebar.title;" <page id="sbDiggSidebar" title="&diggsidebar.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="createMenu();getStories()"> onload="DiggSidebar.initialize()">
<script src="chrome://diggsidebar/content/diggsidebar.js" type="application/x-javascript" /> <script src="chrome://diggsidebar/content/diggsidebar.js" type="application/x-javascript" />
<hbox> <hbox>
<toolbar flex="1"> <toolbar flex="1">
@ -14,11 +14,16 @@
<menubar id="diggsidebarMenubar" flex="1" style="width: 100%"> <menubar id="diggsidebarMenubar" flex="1" style="width: 100%">
<menu id="storiesMenu" label="Stories" accesskey="S"> <menu id="storiesMenu" label="Stories" accesskey="S">
<menupopup id="storiesPopup"> <menupopup id="storiesPopup">
<menuitem label="All" value="/all" oncommand="setEndPoint(this.value)" accesskey="A" /> <menuitem label="All" value="/all"
<menuitem label="Popular" value="/popular" oncommand="setEndPoint(this.value)" accesskey="P" /> oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="A" />
<menuitem label="Upcoming" value="/upcoming" oncommand="setEndPoint(this.value)" accesskey="U" /> <menuitem label="Popular" value="/popular"
<menuitem label="Hot" value="/hot" oncommand="setEndPoint(this.value)" accesskey="H" /> oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="P" />
<menuitem label="Top" value="/top" oncommand="setEndPoint(this.value)" accesskey="T" /> <menuitem label="Upcoming" value="/upcoming"
oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="U" />
<menuitem label="Hot" value="/hot"
oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="H" />
<menuitem label="Top" value="/top"
oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="T" />
<menuseparator /> <menuseparator />
<menu id="containerMenu" label="Containers" accesskey="C"> <menu id="containerMenu" label="Containers" accesskey="C">
<menupopup id="containerPopup"> <menupopup id="containerPopup">
@ -34,13 +39,22 @@
</menu> </menu>
</menubar> </menubar>
</toolbaritem> </toolbaritem>
<toolbarbutton id="diggPlayPause" image="chrome://diggsidebar/content/image/Pause.png" tooltiptext="Click to Pause autoupdate" oncommand="togglePlayPause()" /> <toolbarbutton id="diggPlayPause"
image="chrome://diggsidebar/content/image/Pause.png"
tooltiptext="Click to Pause autoupdate"
oncommand="DiggSidebar.togglePlayPause()" />
<toolbarspacer flex="5" /> <toolbarspacer flex="5" />
<toolbaritem> <toolbaritem>
<progressmeter flex="1" width="5" mode="undetermined" id="diggIndicator" style="height: 85% !important; width: 30% !important" /> <progressmeter flex="1"
width="5"
mode="undetermined"
id="diggIndicator"
style="height: 85% !important; width: 30% !important" />
</toolbaritem> </toolbaritem>
</toolbar> </toolbar>
</hbox> </hbox>
<description id="diggEndPoint">digg</description> <description id="diggEndPoint">digg</description>
<richlistbox flex="1" id="storyList" onselect="getDescription(this.selectedItem.id.substr(6))"></richlistbox> <richlistbox flex="1"
id="storyList"
onselect="DiggSidebar.getDescription(this.selectedItem.id.substr(6))" />
</page> </page>

View File

@ -24,12 +24,14 @@
</html:div> </html:div>
<html:div> <html:div>
<html:span xbl:inherits="xbl:text=desc" class="storyDesc"></html:span> <html:span xbl:inherits="xbl:text=desc" class="storyDesc"></html:span>
<html:a xbl:inherits="href=link" class="storyLink" onclick="openInTab(this.href); return false"> <html:a xbl:inherits="href=link" class="storyLink"
onclick="DiggSidebar.Utils.openUrlInTab(this.href); return false">
<html:img src="chrome://diggsidebar/content/image/external.png" /> <html:img src="chrome://diggsidebar/content/image/external.png" />
</html:a> </html:a>
</html:div> </html:div>
<html:div style="text-align:center;"> <html:div style="text-align:center;">
<html:a xbl:inherits="href=href" class="storyHref" onclick="openInTab(this.href); return false"> <html:a xbl:inherits="href=href" class="storyHref"
onclick="DiggSidebar.Utils.openUrlInTab(this.href); return false">
Digg This Digg This
</html:a> </html:a>
</html:div> </html:div>
@ -41,7 +43,9 @@
<html:span xbl:inherits="xbl:text=comments" class="storyComments"></html:span> <html:span xbl:inherits="xbl:text=comments" class="storyComments"></html:span>
</html:span> </html:span>
by by
<html:a xbl:inherits="href=userlink,xbl:text=username" class="storyUserLink" onclick="openInTab(this.href); return false"></html:a> <html:a xbl:inherits="href=userlink,xbl:text=username"
class="storyUserLink"
onclick="DiggSidebar.Utils.openUrlInTab(this.href); return false"></html:a>
<html:span xbl:inherits="xbl:text=date" class="storyDate"></html:span> <html:span xbl:inherits="xbl:text=date" class="storyDate"></html:span>
</html:div> </html:div>
</html:div> </html:div>

View File

@ -17,7 +17,9 @@ a img {
display: none; display: none;
background-color: #ffffff; background-color: #ffffff;
clear: both; clear: both;
border-top: 1px dashed black; border: 1px dashed black;
margin: 0px 8px 8px 8px;
width: 230px;
} }
.storyDetails > div { .storyDetails > div {
clear: both; clear: both;
@ -46,22 +48,20 @@ a img {
} }
.storyHeader { .storyHeader {
cursor: pointer; cursor: pointer;
padding: 2px;
width: 250px;
} }
.storyHref:hover, .storyUserName:hover { .storyHref:hover, .storyUserLink:hover {
color: white; color: white;
background-color: blue; background-color: blue;
} }
#storyList richlistitem{ #storyList richlistitem{
border-bottom: 1px solid black; border-bottom: 1px solid black;
padding-bottom: 3px;
color: #000000!important; color: #000000!important;
-moz-binding: url("chrome://diggsidebar/content/diggstory.xml#diggstoryitem"); -moz-binding: url("chrome://diggsidebar/content/diggstory.xml#diggstoryitem");
} }
richlistitem > vbox > div{
width: 250px;
}
richlistitem[selected="true"] { richlistitem[selected="true"] {
background-color: #FFEBF0; background-color: #FFEBF0;
color: inherit; color: inherit;