diff --git a/chrome/content/TODO.txt b/chrome/content/TODO.txt index ef42423..3e9e19e 100644 --- a/chrome/content/TODO.txt +++ b/chrome/content/TODO.txt @@ -2,6 +2,5 @@ move to JSON data format -- done XBL -- done format JS/refactor JS/Use FUEL -- done caching, notifier-observer -- done -search? -new UI, icons, thumbnails +new UI, icons -- done put license diff --git a/chrome/content/diggsidebar.js b/chrome/content/diggsidebar.js index 744be75..d7515bf 100644 --- a/chrome/content/diggsidebar.js +++ b/chrome/content/diggsidebar.js @@ -63,73 +63,54 @@ var DiggSidebar = { populateMenu: function(e) { var XHR = e.target; var data = DiggSidebar.Utils.decodeJson(XHR.responseText); - var topics = data.topics; - var containers = new Array(); + var containers = data.containers; - DiggSidebar.Utils.removeAllChildren(DiggSidebar.UI.topicPopup); - - 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.UI.topicPopup.appendChild(menu); - - containers.push(topic.container); - }); - - DiggSidebar.Utils.removeAllChildren(DiggSidebar.UI.containerPopup); - - 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); - } - }); + var cmenu = document.createElement('menu'); + cmenu.setAttribute('id', container.short_name + 'Menu'); + cmenu.setAttribute('label', container.name); + cmenu.setAttribute('accesskey', container.name.charAt(0)); - for (var i=0; i - - - - - - - - - -