Browse Source

fixed a bug in story filtering code

git-svn-id: file:///tmp/snv/trunk@11 12951d8a-c33d-4b7c-b961-822215c816
Abhinav Sarkar 13 years ago
parent
commit
4a260ec737
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      chrome/content/diggsidebar.js

+ 8
- 5
chrome/content/diggsidebar.js View File

@@ -133,17 +133,20 @@ var DiggSidebar = {
133 133
         Application.console.log("DiggSidebar.stories.length = " + DiggSidebar.stories.length);
134 134
 
135 135
         var jp = new JPath(DiggSidebar.stories);
136
-        var filtedStories = DiggSidebar.stories;
136
+        var filteredStories = jp.$(function(story){
137
+            return (story.$("category").json == DiggSidebar.endpoint.category) ;
138
+        }).json;
139
+        jp = new JPath(filteredStories);
137 140
         if (DiggSidebar.endpoint.topic)
138
-            filtedStories = jp.$(function(story){
139
-                return story.$("topic/short_name").json == DiggSidebar.endpoint.topic;
141
+            filteredStories = jp.$(function(story){
142
+                return (story.$("topic/short_name").json == DiggSidebar.endpoint.topic);
140 143
             }).json;
141 144
         if (DiggSidebar.endpoint.container)
142
-            filtedStories = jp.$(function(story){
145
+            filteredStories = jp.$(function(story){
143 146
                 return story.$("container/short_name").json == DiggSidebar.endpoint.container;
144 147
             }).json;
145 148
 
146
-        filtedStories.forEach(function (story, index) {
149
+        filteredStories.forEach(function (story, index) {
147 150
             if (index < DiggSidebar.shownStoriesCount) {
148 151
                 var now = new Date();
149 152
                 if (story.promote_date != null)

Loading…
Cancel
Save