src/widgets/Slider.js
changeset 1013 392ddcd212d7
parent 965 eadb7290c325
child 1021 7253d4d06f0d
equal deleted inserted replaced
1012:7e18d953a1f8 1013:392ddcd212d7
    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 =
    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     
    67 };
    67 };
    68 
    68 
    69 IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
    69 IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
    70     this.$slider.slider("value",_time);
    70     this.$slider.slider("value",_time);
    71     this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
    71     this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
    72 }
    72 };
    73 
    73 
    74 IriSP.Widgets.Slider.prototype.onMouseover = function() {
    74 IriSP.Widgets.Slider.prototype.onMouseover = function() {
    75     if (this.minimize_timeout) {
    75     if (this.minimize_timeout) {
    76         if (this.timeoutId) {
    76         if (this.timeoutId) {
    77             window.clearTimeout(this.timeoutId);
    77             window.clearTimeout(this.timeoutId);
    80         if (!this.maximized) {
    80         if (!this.maximized) {
    81            this.animateToHeight(this.maximized_height);
    81            this.animateToHeight(this.maximized_height);
    82            this.maximized = true;
    82            this.maximized = true;
    83         }
    83         }
    84     }
    84     }
    85 }
    85 };
    86 
    86 
    87 IriSP.Widgets.Slider.prototype.onMouseout = function() {
    87 IriSP.Widgets.Slider.prototype.onMouseout = function() {
    88     this.$time.hide();
    88     this.$time.hide();
    89     if (this.minimize_timeout) {
    89     if (this.minimize_timeout) {
    90         if (this.timeoutId) {
    90         if (this.timeoutId) {
    98                 _this.maximized = false;
    98                 _this.maximized = false;
    99             }
    99             }
   100             _this.timeoutId = false;
   100             _this.timeoutId = false;
   101         }, this.minimize_timeout);
   101         }, this.minimize_timeout);
   102     }
   102     }
   103 }
   103 };
   104 
   104 
   105 IriSP.Widgets.Slider.prototype.animateToHeight = function(_height) {
   105 IriSP.Widgets.Slider.prototype.animateToHeight = function(_height) {
   106     this.$slider.stop().animate(
   106     this.$slider.stop().animate(
   107         this.calculateSliderCss(_height),
   107         this.calculateSliderCss(_height),
   108         500,
   108         500,
   113         this.calculateHandleCss(_height),
   113         this.calculateHandleCss(_height),
   114         500,
   114         500,
   115         function() {
   115         function() {
   116             IriSP.jQuery(this).css("overflow","visible");
   116             IriSP.jQuery(this).css("overflow","visible");
   117         });
   117         });
   118 }
   118 };
   119 
   119 
   120 IriSP.Widgets.Slider.prototype.calculateSliderCss = function(_size) {
   120 IriSP.Widgets.Slider.prototype.calculateSliderCss = function(_size) {
   121     return {
   121     return {
   122         height: _size + "px",
   122         height: _size + "px",
   123         "margin-top": (this.minimized_height - _size) + "px"
   123         "margin-top": (this.minimized_height - _size) + "px"
   124     };
   124     };
   125 }
   125 };
   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 };