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 14 years ago
parent 5b4693e621
commit 3d33406796
  1. 3
      chrome/content/TODO.txt
  2. 560
      chrome/content/diggsidebar.js
  3. 32
      chrome/content/diggsidebar.xul
  4. 10
      chrome/content/diggstory.xml
  5. 12
      chrome/skin/diggsidebar.css

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

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

@ -6,7 +6,7 @@
<page id="sbDiggSidebar" title="&diggsidebar.title;"
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" />
<hbox>
<toolbar flex="1">
@ -14,11 +14,16 @@
<menubar id="diggsidebarMenubar" flex="1" style="width: 100%">
<menu id="storiesMenu" label="Stories" accesskey="S">
<menupopup id="storiesPopup">
<menuitem label="All" value="/all" oncommand="setEndPoint(this.value)" accesskey="A" />
<menuitem label="Popular" value="/popular" oncommand="setEndPoint(this.value)" accesskey="P" />
<menuitem label="Upcoming" value="/upcoming" oncommand="setEndPoint(this.value)" accesskey="U" />
<menuitem label="Hot" value="/hot" oncommand="setEndPoint(this.value)" accesskey="H" />
<menuitem label="Top" value="/top" oncommand="setEndPoint(this.value)" accesskey="T" />
<menuitem label="All" value="/all"
oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="A" />
<menuitem label="Popular" value="/popular"
oncommand="DiggSidebar.setEndPoint(this.value)" accesskey="P" />
<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 />
<menu id="containerMenu" label="Containers" accesskey="C">
<menupopup id="containerPopup">
@ -34,13 +39,22 @@
</menu>
</menubar>
</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" />
<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>
</toolbar>
</hbox>
<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>

@ -24,12 +24,14 @@
</html:div>
<html:div>
<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:a>
</html:div>
<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
</html:a>
</html:div>
@ -41,7 +43,9 @@
<html:span xbl:inherits="xbl:text=comments" class="storyComments"></html:span>
</html:span>
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:div>
</html:div>

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

Loading…
Cancel
Save