From 5b4693e621491f1b6e86f95346a70ac007249335 Mon Sep 17 00:00:00 2001 From: abhin4v Date: Tue, 2 Dec 2008 11:43:47 +0000 Subject: [PATCH] moved html template to xbl component git-svn-id: file:///tmp/snv/trunk@7 12951d8a-c33d-4b7c-b961-822215c816e1 --- chrome/content/TODO.txt | 7 +- chrome/content/diggsidebar.js | 147 ++++++--------------------------- chrome/content/diggsidebar.xul | 41 --------- chrome/content/diggstory.xml | 107 ++++++++++++++++++++++++ chrome/skin/diggsidebar.css | 22 ++--- install.rdf | 6 +- 6 files changed, 149 insertions(+), 181 deletions(-) create mode 100644 chrome/content/diggstory.xml diff --git a/chrome/content/TODO.txt b/chrome/content/TODO.txt index 63efd1d..aba38dc 100644 --- a/chrome/content/TODO.txt +++ b/chrome/content/TODO.txt @@ -1,7 +1,8 @@ move to JSON data format -- done -XBL -> Templates +XBL -- done +externalize strings format JS/refactor JS/Use FUEL -caching/db -threading +put license +caching/db, threading, XUL templates new UI JQuery diff --git a/chrome/content/diggsidebar.js b/chrome/content/diggsidebar.js index ef65c2b..3ecf037 100644 --- a/chrome/content/diggsidebar.js +++ b/chrome/content/diggsidebar.js @@ -8,44 +8,6 @@ function $ei(id, parentNode) { return parentNode.getElementById(id); } -//getAttribute -function $a(parentNode, att) { - return parentNode.getAttribute(att); -} - -//getElementByTagName -function $et(tagName, parentNode) { - parentNode = parentNode || document; - return parentNode.getElementsByTagName(tagName)[0]; -} - -//getElementByClassName -function $ec(className, parentNode) { - parentNode = parentNode || document; - elements = parentNode.getElementsByTagName("*"); - for (i=0; i/g, ">").replace(/"/g, """); -} - function fetchData(url, handler) { //alert("inside fetchData"); $ei('diggIndicator').style.display = ''; @@ -84,8 +46,7 @@ function populateMenu(e) { $ei('topicPopup').removeChild($ei('topicPopup').firstChild); } - for (i=0; i 0) && (min > 0)) ? + storyDate = ((hr > 0) && (min > 0)) ? (hr + " hr " + min + " mins ago") : ((hr == 0) && (min > 0)) ? (min + " mins ago") : ((hr == 0) && (min == 0)) ? "just now" : ""; - storyStatus.innerHTML = story.status.escapeEntities(); - storyContainer.innerHTML = story.container.name.escapeEntities(); - storyTopic.innerHTML = story.topic.name.escapeEntities(); - storyUserName.href = "http://digg.com/users/" + story.user.name; - storyUserName.innerHTML = story.user.name.escapeEntities(); - storyDiggs.innerHTML = story.diggs; - storyComments.innerHTML = story.comments; - storyDesc.innerHTML = story.description.escapeEntities(); - storyLink.href = story.link; - storyHref.href = story.href; + 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); - storyCEIcon.src = "chrome://diggsidebar/content/image/down.jpg"; - storyRead.style.textDecoration = "line-through"; - storyRead.style.backgroundColor = "black"; - storyRead.style.color = "white"; - storyRead.title = "Read"; - storyNew.style.textDecoration = "line-through"; - storyNew.style.backgroundColor = "black"; - storyNew.style.color = "white"; - storyNew.title = "Old"; - - storyDetails.style.display = 'block'; + li.read = true; + li.new = false; + li.showDesc() $ei('diggIndicator').style.display = 'none'; } diff --git a/chrome/content/diggsidebar.xul b/chrome/content/diggsidebar.xul index 073ba8c..7cc97c8 100644 --- a/chrome/content/diggsidebar.xul +++ b/chrome/content/diggsidebar.xul @@ -6,7 +6,6 @@