diff --git a/chrome/content/TODO.txt b/chrome/content/TODO.txt index 5de5e70..63efd1d 100644 --- a/chrome/content/TODO.txt +++ b/chrome/content/TODO.txt @@ -1,4 +1,4 @@ -move to JSON data format +move to JSON data format -- done XBL -> Templates format JS/refactor JS/Use FUEL caching/db diff --git a/chrome/content/diggsidebar.js b/chrome/content/diggsidebar.js index b7c40f3..ef65c2b 100644 --- a/chrome/content/diggsidebar.js +++ b/chrome/content/diggsidebar.js @@ -94,7 +94,7 @@ function populateMenu(e) { menupopup = document.createElement('menupopup'); menupopup.setAttribute('id', topic.short_name + 'Popup'); - ['All', 'Popular', 'Upcoming'].forEach( + ['All', 'Popular', 'Upcoming', 'Hot', 'Top'].forEach( function (label) { menuitem = document.createElement('menuitem'); menuitem.setAttribute('label', label); @@ -133,7 +133,7 @@ function populateMenu(e) { menupopup = document.createElement('menupopup'); menupopup.setAttribute('id', filteredContainers.short_name[i] + 'Popup'); - ['All', 'Popular', 'Upcoming'].forEach( + ['All', 'Popular', 'Upcoming', 'Hot', 'Top'].forEach( function (label) { menuitem = document.createElement('menuitem'); menuitem.setAttribute('label', label); @@ -162,7 +162,7 @@ function populateStoryList(e) { } var newStories = new Array(); - Application.console.log(stories.length); + //Application.console.log(stories.length); for (i=0; i b[date]) return -1; + else if (a[date] < b[date]) return 1; + return 0; + }); + for (i=0; i 0) { + previousUpdateInterval = prefs.get("updateinterval").value; + prefs.get("updateinterval").value = updateInterval; - if (previousUpdateInterval == updateInterval) - prefs.setIntPref("extensions.diggsidebar.updateintervaldecay", (updateIntervalDecay + 1)); - else - prefs.setIntPref("extensions.diggsidebar.updateintervaldecay", 0); + 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.getIntPref("extensions.diggsidebar.updateinterval") - updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay"); + updateInterval = prefs.get("updateinterval").value; + updateIntervalDecay = prefs.get("updateintervaldecay").value; timeout = Math.round(updateInterval*(Math.pow(1.5, updateIntervalDecay))); gsti = window.setTimeout(getStories, timeout); @@ -317,9 +324,8 @@ function populateDescription(e) { } function getStories() { - var prefs = Components.classes["@mozilla.org/preferences-service;1"]. - getService(Components.interfaces.nsIPrefBranch); - ep = prefs.getCharPref("extensions.diggsidebar.endpoint") || ''; + 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, '') + @@ -353,9 +359,8 @@ function openInTab(href) { } function setEndPoint(ep) { - var prefs = Components.classes["@mozilla.org/preferences-service;1"]. - getService(Components.interfaces.nsIPrefBranch); - prefs.setCharPref("extensions.diggsidebar.endpoint", ep); + var prefs = Application.extensions.get("diggsidebar@abhinavsarkar.net").prefs; + prefs.get("endpoint").value = ep; window.clearTimeout(gsti); //window.clearInterval(psi); getStories(); @@ -369,10 +374,9 @@ function togglePlayPause() { $ei('diggPlayPause').setAttribute("tooltiptext", "Click to Start autoupdate"); playing = false; } else { - var prefs = Components.classes["@mozilla.org/preferences-service;1"]. - getService(Components.interfaces.nsIPrefBranch); - updateInterval = prefs.getIntPref("extensions.diggsidebar.updateinterval") - updateIntervalDecay = prefs.getIntPref("extensions.diggsidebar.updateintervaldecay"); + 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); diff --git a/chrome/content/diggsidebar.xul b/chrome/content/diggsidebar.xul index f5ffa4a..073ba8c 100644 --- a/chrome/content/diggsidebar.xul +++ b/chrome/content/diggsidebar.xul @@ -18,6 +18,8 @@ + + @@ -38,8 +40,8 @@ - - + + digg @@ -52,32 +54,34 @@ - \ No newline at end of file + diff --git a/chrome/content/image/digg_this.png b/chrome/content/image/digg_this.png index 1e43ee3..33265b4 100644 Binary files a/chrome/content/image/digg_this.png and b/chrome/content/image/digg_this.png differ diff --git a/chrome/skin/diggsidebar.css b/chrome/skin/diggsidebar.css index 62cd781..5d13d9d 100644 --- a/chrome/skin/diggsidebar.css +++ b/chrome/skin/diggsidebar.css @@ -1,3 +1,11 @@ +a { + color: blue; + cursor: pointer; + padding: 1px; +} +a img { + border: none; +} .storyList { margin: 1px; border-style: solid !important; @@ -17,7 +25,6 @@ } .storyDetails > div { clear: both; - height: 15px; padding: 1px 0px; font-size: x-small; } @@ -26,31 +33,24 @@ font-size: x-small; font-weight: bold; } -.storyDate, .storyDate, .storyLink { - float: left; -} - -.storyStatus, .storyNew, .storyRead, .storyPopularity, .storyHref { +.storyNew, .storyRead, .storyPopularity { float: right; } - .storyNew, .storyRead { padding: 0px 2px; } +.storyHref { + font-weight: bold; + padding: 2px 3px; + vertical-align: middle; +} .storyDesc { height: auto!important; } - .storyHeader { cursor: pointer; } -a { - color: blue; - cursor: pointer; - padding: 1px; -} - -a:hover { +.storyHref:hover, .storyUserName:hover { color: white; background-color: blue; } @@ -60,7 +60,6 @@ richlistitem { padding-bottom: 3px; color: #000000!important; } - richlistitem > div{ width: 250px; } @@ -72,8 +71,8 @@ richlistitem[selected="true"] .storyDetails { border-top: 1px dashed black; background-color: #FFFBF0; } - + richlistitem .storyTitle:hover { background-color: green; color: white; -} \ No newline at end of file +} diff --git a/defaults/preferences/defaults.js b/defaults/preferences/defaults.js index 5c55325..d6d7bcd 100644 --- a/defaults/preferences/defaults.js +++ b/defaults/preferences/defaults.js @@ -1,3 +1,3 @@ -pref("extensions.diggsidebar.endpoint", ""); -pref("extensions.diggsidebar.updateinterval", 30000); -pref("extensions.diggsidebar.updateintervaldecay", 0); \ No newline at end of file +pref("extensions.diggsidebar@abhinavsarkar.net.endpoint", ""); +pref("extensions.diggsidebar@abhinavsarkar.net.updateinterval", 30000); +pref("extensions.diggsidebar@abhinavsarkar.net.updateintervaldecay", 0);