src/widgets/Slider.js
changeset 1068 7623f9af9272
parent 1021 7253d4d06f0d
child 1072 ac1eacb3aa33
equal deleted inserted replaced
1067:539c9bee5372 1068:7623f9af9272
    17 
    17 
    18 IriSP.Widgets.Slider.prototype.template =
    18 IriSP.Widgets.Slider.prototype.template =
    19     '<div class="Ldt-Slider"></div><div class="Ldt-Slider-Time">00:00</div>';
    19     '<div class="Ldt-Slider"></div><div class="Ldt-Slider-Time">00:00</div>';
    20 
    20 
    21 IriSP.Widgets.Slider.prototype.draw = function() {
    21 IriSP.Widgets.Slider.prototype.draw = function() {
    22     
    22 
    23     this.renderTemplate();
    23     this.renderTemplate();
    24     
    24 
    25     this.$time = this.$.find(".Ldt-Slider-Time");
    25     this.$time = this.$.find(".Ldt-Slider-Time");
    26     
    26 
    27     this.$slider = this.$.find(".Ldt-Slider");
    27     this.$slider = this.$.find(".Ldt-Slider");
    28     
    28 
    29     var _this = this;
    29     var _this = this;
    30     
    30 
    31     this.$slider.slider({
    31     this.$slider.slider({
    32         range: "min",
    32         range: "min",
    33         value: 0,
    33         value: 0,
    34         min: 0,
    34         min: 0,
    35         max: this.source.getDuration().milliseconds,
    35         max: this.source.getDuration().milliseconds,
    36         slide: function(event, ui) {
    36         slide: function(event, ui) {
    37             _this.media.setCurrentTime(ui.value);
    37             _this.media.setCurrentTime(ui.value);
    38             _this.player.trigger("Mediafragment.setHashToTime");
    38             _this.player.trigger("Mediafragment.setHashToTime");
    39         }
    39         }
    40     });
    40     });
    41     
    41 
    42     this.$handle = this.$slider.find('.ui-slider-handle');
    42     this.$handle = this.$slider.find('.ui-slider-handle');
    43     
    43 
    44     this.onMediaEvent("timeupdate","onTimeupdate");
    44     this.onMediaEvent("timeupdate","onTimeupdate");
    45     this.onMdpEvent("Player.MouseOver","onMouseover");
    45     this.onMdpEvent("Player.MouseOver","onMouseover");
    46     this.onMdpEvent("Player.MouseOut","onMouseout");
    46     this.onMdpEvent("Player.MouseOut","onMouseout");
    47     
    47 
    48     if (this.minimize_timeout) {
    48     if (this.minimize_timeout) {
    49         this.$slider.css(this.calculateSliderCss(this.minimized_height));
    49         this.$slider.css(this.calculateSliderCss(this.minimized_height));
    50         this.$handle.css(this.calculateHandleCss(this.minimized_height));
    50         this.$handle.css(this.calculateHandleCss(this.minimized_height));
    51         
    51 
    52         this.maximized = false;
    52         this.maximized = false;
    53         this.timeoutId = false;
    53         this.timeoutId = false;
    54     }
    54     }
    55     
    55 
    56     this.$
    56     this.$slider
    57         .mouseover(function() {
    57         .mouseover(function() {
    58             _this.$time.show();
    58             _this.$time.show();
    59             _this.onMouseover();
    59             _this.onMouseover();
    60         })
    60         })
    61         .mouseout(this.functionWrapper("onMouseout"))
    61         .mouseout(this.functionWrapper("onMouseout"))
   126 
   126 
   127 IriSP.Widgets.Slider.prototype.calculateHandleCss = function(_size) {
   127 IriSP.Widgets.Slider.prototype.calculateHandleCss = function(_size) {
   128     return {
   128     return {
   129         height: (2 + _size) + "px",
   129         height: (2 + _size) + "px",
   130         width: (2 + _size) + "px",
   130         width: (2 + _size) + "px",
   131         "margin-left": -Math.ceil(2 + _size / 2) + "px" 
   131         "margin-left": -Math.ceil(2 + _size / 2) + "px"
   132     };
   132     };
   133 };
   133 };