src/widgets/Slider.js
changeset 965 eadb7290c325
parent 960 9a278b9e3b05
child 1013 392ddcd212d7
equal deleted inserted replaced
964:d7d56ea2d0a6 965:eadb7290c325
    13     maximized_height : 10,
    13     maximized_height : 10,
    14     minimize_timeout : 1500 /*  time before minimizing slider after mouseout,
    14     minimize_timeout : 1500 /*  time before minimizing slider after mouseout,
    15                                 set to zero for fixed slider */
    15                                 set to zero for fixed slider */
    16 };
    16 };
    17 
    17 
       
    18 IriSP.Widgets.Slider.prototype.template =
       
    19     '<div class="Ldt-Slider"></div><div class="Ldt-Slider-Time">00:00</div>'
       
    20 
    18 IriSP.Widgets.Slider.prototype.draw = function() {
    21 IriSP.Widgets.Slider.prototype.draw = function() {
    19     
    22     
    20     this.$slider = IriSP.jQuery('<div>')
    23     this.renderTemplate();
    21         .addClass("Ldt-Slider");
       
    22     
    24     
    23     this.$.append(this.$slider);
    25     this.$time = this.$.find(".Ldt-Slider-Time");
       
    26     
       
    27     this.$slider = this.$.find(".Ldt-Slider");
    24     
    28     
    25     var _this = this;
    29     var _this = this;
    26     
    30     
    27     this.$slider.slider({
    31     this.$slider.slider({
    28         range: "min",
    32         range: "min",
    43     
    47     
    44     if (this.minimize_timeout) {
    48     if (this.minimize_timeout) {
    45         this.$slider.css(this.calculateSliderCss(this.minimized_height));
    49         this.$slider.css(this.calculateSliderCss(this.minimized_height));
    46         this.$handle.css(this.calculateHandleCss(this.minimized_height));
    50         this.$handle.css(this.calculateHandleCss(this.minimized_height));
    47         
    51         
    48         this.$
       
    49             .mouseover(this.functionWrapper("onMouseover"))
       
    50             .mouseout(this.functionWrapper("onMouseout"));
       
    51         
       
    52         this.maximized = false;
    52         this.maximized = false;
    53         this.timeoutId = false;
    53         this.timeoutId = false;
    54     }
    54     }
       
    55     
       
    56     this.$
       
    57         .mouseover(function() {
       
    58             _this.$time.show();
       
    59             _this.onMouseover();
       
    60         })
       
    61         .mouseout(this.functionWrapper("onMouseout"))
       
    62         .mousemove(function(_e) {
       
    63             var _x = _e.pageX - _this.$.offset().left,
       
    64                 _t = new IriSP.Model.Time(_this.media.duration * _x / _this.width);
       
    65             _this.$time.text(_t.toString()).css("left",_x);
       
    66         });
    55 };
    67 };
    56 
    68 
    57 IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
    69 IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
    58     this.$slider.slider("value",_time);
    70     this.$slider.slider("value",_time);
    59     this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
    71     this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
    71         }
    83         }
    72     }
    84     }
    73 }
    85 }
    74 
    86 
    75 IriSP.Widgets.Slider.prototype.onMouseout = function() {
    87 IriSP.Widgets.Slider.prototype.onMouseout = function() {
       
    88     this.$time.hide();
    76     if (this.minimize_timeout) {
    89     if (this.minimize_timeout) {
    77         if (this.timeoutId) {
    90         if (this.timeoutId) {
    78             window.clearTimeout(this.timeoutId);
    91             window.clearTimeout(this.timeoutId);
    79             this.timeoutId = false;
    92             this.timeoutId = false;
    80         }
    93         }