aboutsummaryrefslogtreecommitdiffstats
path: root/twittperator.js
diff options
context:
space:
mode:
authorteramako2010-08-26 14:36:25 +0000
committerteramako2010-08-26 14:36:25 +0000
commit6a32d211a5aee6378cb544166fc0f20dc694e0fb (patch)
treed0df5838283689635cb16c1bcf3053e46df16731 /twittperator.js
parent32775cd9d1861ebb1564c56808308b4db4675aaa (diff)
downloadvimperator-plugins-6a32d211a5aee6378cb544166fc0f20dc694e0fb.tar.bz2
useChirp オフ時にも履歴を追記するようにした
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38362 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'twittperator.js')
-rwxr-xr-xtwittperator.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/twittperator.js b/twittperator.js
index f09d13a..dba631f 100755
--- a/twittperator.js
+++ b/twittperator.js
@@ -28,7 +28,7 @@ let PLUGIN_INFO =
<name>twittperator</name>
<description>Twitter Client using ChirpStream</description>
<description lang="ja">OAuth対応Twitterクライアント</description>
- <version>1.4.0</version>
+ <version>1.4.1</version>
<minVersion>2.3</minVersion>
<maxVersion>2.4</maxVersion>
<author mail="teramako@gmail.com" homepage="http://d.hatena.ne.jp/teramako/">teramako</author>
@@ -1406,11 +1406,20 @@ let PLUGIN_INFO =
tw.get(api, query, function(text) {
setRefresher();
- // TODO 履歴をちゃんと "追記" するようにするようにするべき
let result = JSON.parse(text).map(Utils.fixStatusObject);
- if (!target)
- history = result;
- onload(result);
+ if (!target) {
+ let lastHistory = history[0];
+ if (lastHistory) {
+ let lastDate = Date.parse(lastHistory.created_at);
+ for (let [,msg] in Iterator(result.reverse())) {
+ if (Date.parse(msg.created_at) > lastDate)
+ history.unshift(msg);
+ }
+ } else {
+ result.forEach(function(msg) history.push(msg));
+ }
+ }
+ onload(history);
});
}
}, // }}}