src/js/widgets/tweetsView.js
branchcap-demo
changeset 411 d5d6e98a95d3
parent 406 0e9d82ea7271
equal deleted inserted replaced
410:de8fdd68930f 411:d5d6e98a95d3
    27     window.clearTimeout(this._timeoutId);
    27     window.clearTimeout(this._timeoutId);
    28   }
    28   }
    29 
    29 
    30   this.drawTweet(annotation);
    30   this.drawTweet(annotation);
    31 
    31 
    32   var time = this._Popcorn.currentTime();  
       
    33   this._timeoutId = window.setTimeout(IriSP.wrap(this, this.clearPanel), IriSP.widgetsDefaults.TweetsWidget.tweet_display_period);
       
    34 };
    32 };
    35 
    33 
    36 
       
    37 IriSP.TweetsView.prototype.clearPanel = function() {  
       
    38     this._displayingTweet = false;
       
    39     this._timeoutId = undefined;
       
    40     this.closePanel();
       
    41     
       
    42 };
       
    43 
       
    44 IriSP.TweetsView.prototype.closePanel = function() {
       
    45     if (this._timeoutId != undefined) {
       
    46       /* we're called from the "close window" link */
       
    47       /* cancel the timeout */
       
    48       window.clearTimeout(this._timeoutId);
       
    49       this._timeoutId = null;
       
    50     }
       
    51     
       
    52     this.selector.hide("blind", 400);
       
    53     
       
    54 };
       
    55 
       
    56 /* cancel the timeout if the user clicks on the keep panel open button */
       
    57 IriSP.TweetsView.prototype.keepPanel = function() {
       
    58     if (this._timeoutId != undefined) {
       
    59       /* we're called from the "close window" link */
       
    60       /* cancel the timeout */
       
    61       window.clearTimeout(this._timeoutId);
       
    62       this._timeoutId = null;
       
    63     }
       
    64 };
       
    65 
    34 
    66 IriSP.TweetsView.prototype.draw = function() {
    35 IriSP.TweetsView.prototype.draw = function() {
    67   var _this = this;
    36   var _this = this;
    68   
    37   
    69   this.selector.append(Mustache.to_html(IriSP.polemicAnnotationView_template, {}));
    38   this.selector.append(Mustache.to_html(IriSP.polemicAnnotationView_template, {}));
    70   this.selector.hide();
       
    71   this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler));
    39   this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler));
    72 };
    40 };
    73 
    41 
    74 IriSP.TweetsView.prototype.PolemicTweetClickHandler = function(tweet_id) {  
    42 IriSP.TweetsView.prototype.PolemicTweetClickHandler = function(tweet_id) {  
    75   var index, annotation;
    43   var index, annotation;