From d0e6b2add77bd7edeaf7843b880a473044625806 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 4 May 2011 12:12:54 +0900 Subject: 関数化 --- readitlater.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'readitlater.js') diff --git a/readitlater.js b/readitlater.js index 46a78ee..fa8e732 100644 --- a/readitlater.js +++ b/readitlater.js @@ -95,7 +95,7 @@ let PLUGIN_INFO = new Command(["get","g"], "Retrieve a user's reading list", function (args) { - ListCache.update(true, function(data) echo([1 for (_ in Iterator(data.list))].length + " found.")); + ListCache.update(true, function(data) echo(countObjectValues(data.list) + " found.")); },{ options : [ //[["num"],commands.OPTION_INT], @@ -147,6 +147,7 @@ let PLUGIN_INFO = const CacheStore = storage.newMap("readitlater",{store:true}); + // Cache {{{ function Cache ({updater, name, limit}) { this.limit = limit || 10 * 1000 * 60; this.name = name; @@ -186,6 +187,7 @@ let PLUGIN_INFO = get isExpired() (!this.lastUpdated || (new Date().getTime() > (this.lastUpdated + this.limit))) }; + // }}} let ReadItLater = { api_key : (liberator.globalVariables.readitlater_api_key) ? liberator.globalVariables.readitlater_api_key : "966T6ahYgb081icU10d44byL31p5bF20" , @@ -499,6 +501,10 @@ let PLUGIN_INFO = return map } // }}} + function countObjectValues(obj){ // {{{ + return [1 for (_ in Iterator(obj))].length; + } // }}} + // for debug {{{ function e(v,c){ if(c) util.copyToClipboard(v); -- cgit v1.2.3