# HG changeset patch # User veltr # Date 1330078979 -3600 # Node ID c9378e7e853a561aefe403b5083515b9e90c9cd4 # Parent 7121bc4d05458598fc2a09a73ea12e186cf6e89d added Local Storage diff -r 7121bc4d0545 -r c9378e7e853a client/js/main.js --- a/client/js/main.js Thu Feb 23 20:13:27 2012 +0100 +++ b/client/js/main.js Fri Feb 24 11:22:59 2012 +0100 @@ -10,7 +10,7 @@ TWEETS_TO_DUMP_AT_ONCE = 10; function updateLastTweetList() { - var _filtered = myTweetSource.afterDate(startHour), + var _filtered = myTweetSource, //.afterDate(startHour), _txtFilter = $("#btv-cp-champ-filtre").val(), _reFilter = null; if (_txtFilter.length > 1) { @@ -43,6 +43,12 @@ ); } +function saveTweetSelection() { + if (window.localStorage) { + localStorage.setItem('listetweets', $("#btv-cp-liste-tweets-selection").html()); + } +} + function addTweetToSelection(tweetId) { var _t = myTweetSource.tweetById(tweetId); if (_t) { @@ -56,8 +62,9 @@ + ' ' + _t.text + '
' - + '' + + '' ); + saveTweetSelection(); } } @@ -245,4 +252,11 @@ $(this).removeClass("btv-cp-status-play"); } }); + + if (window.localStorage) { + var _tw = localStorage.getItem('listetweets'); + if (_tw) { + $("#btv-cp-liste-tweets-selection").html(_tw); + } + } }); \ No newline at end of file diff -r 7121bc4d0545 -r c9378e7e853a client/js/tweetsource.js --- a/client/js/tweetsource.js Thu Feb 23 20:13:27 2012 +0100 +++ b/client/js/tweetsource.js Fri Feb 24 11:22:59 2012 +0100 @@ -201,9 +201,10 @@ } Btv_TweetSource.prototype.retrieveNewTweets = function() { + var _last = this.lastTweet(); this.retrieveTweets({ "pages": 1, - "since_id": this.lastTweet().id_str + "since_id": _last ? _last.id_str : 0 }); }