www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit c807d335e97efa7aae85660d202a2ae8971eb736
parent b65a56b4d9d980a414bf90df70a1804a6d23f695
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue,  6 Jun 2006 20:15:50 +0000

Changed Items.get() to return a regularly indexed array instead of one indexed by itemID--nothing actually used the keyed array, and this way it can be used for building trees directly (e.g. Scholar.Items.get(Scholar.Items.search('barnes')))


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 13+++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -795,7 +795,7 @@ Scholar.Items = new function(){ * Can be passed ids as individual parameters or as an array of ids, or both * * If only one argument and it's an id, return object directly; - * otherwise, return array indexed by itemID + * otherwise, return array */ function get(){ var toLoad = new Array(); @@ -828,7 +828,7 @@ Scholar.Items = new function(){ // Otherwise, build return array for (i=0; i<ids.length; i++){ - loaded[ids[i]] = _items[ids[i]]; + loaded.push(_items[ids[i]]); } return loaded; @@ -1828,12 +1828,5 @@ Scholar.getItems = function(parent){ return toReturn; } - // Items.get() returns an array indexed by itemID, - // so we have to turn it into a regular numeric array from 0 - var items = Scholar.Items.get(children) - for (var i=0, len=children.length; i<len; i++){ - toReturn.push(items[children[i]]); - } - - return toReturn; + return Scholar.Items.get(children) }