| author | veltr |
| Tue, 01 Oct 2013 15:41:46 +0200 | |
| changeset 1013 | 392ddcd212d7 |
| parent 965 | eadb7290c325 |
| child 1021 | 7253d4d06f0d |
| permissions | -rw-r--r-- |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
1 |
/* |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
2 |
The Slider Widget fits right under the video |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
3 |
*/ |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
4 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
5 |
IriSP.Widgets.Slider = function(player, config) { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
6 |
IriSP.Widgets.Widget.call(this, player, config); |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
7 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
8 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
9 |
IriSP.Widgets.Slider.prototype = new IriSP.Widgets.Widget(); |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
10 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
11 |
IriSP.Widgets.Slider.prototype.defaults = { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
12 |
minimized_height : 4, |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
13 |
maximized_height : 10, |
| 909 | 14 |
minimize_timeout : 1500 /* time before minimizing slider after mouseout, |
15 |
set to zero for fixed slider */ |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
16 |
}; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
17 |
|
| 965 | 18 |
IriSP.Widgets.Slider.prototype.template = |
| 1013 | 19 |
'<div class="Ldt-Slider"></div><div class="Ldt-Slider-Time">00:00</div>'; |
| 965 | 20 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
21 |
IriSP.Widgets.Slider.prototype.draw = function() { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
22 |
|
| 965 | 23 |
this.renderTemplate(); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
24 |
|
| 965 | 25 |
this.$time = this.$.find(".Ldt-Slider-Time"); |
26 |
|
|
27 |
this.$slider = this.$.find(".Ldt-Slider"); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
28 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
29 |
var _this = this; |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
30 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
31 |
this.$slider.slider({ |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
32 |
range: "min", |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
33 |
value: 0, |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
34 |
min: 0, |
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
881
diff
changeset
|
35 |
max: this.source.getDuration().milliseconds, |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
36 |
slide: function(event, ui) { |
| 957 | 37 |
_this.media.setCurrentTime(ui.value); |
38 |
_this.player.trigger("Mediafragment.setHashToTime"); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
39 |
} |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
40 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
41 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
42 |
this.$handle = this.$slider.find('.ui-slider-handle'); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
43 |
|
| 957 | 44 |
this.onMediaEvent("timeupdate","onTimeupdate"); |
| 960 | 45 |
this.onMdpEvent("Player.MouseOver","onMouseover"); |
46 |
this.onMdpEvent("Player.MouseOut","onMouseout"); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
47 |
|
| 909 | 48 |
if (this.minimize_timeout) { |
49 |
this.$slider.css(this.calculateSliderCss(this.minimized_height)); |
|
50 |
this.$handle.css(this.calculateHandleCss(this.minimized_height)); |
|
51 |
|
|
52 |
this.maximized = false; |
|
53 |
this.timeoutId = false; |
|
54 |
} |
|
| 965 | 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 |
}); |
|
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
67 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
68 |
|
| 957 | 69 |
IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) { |
| 880 | 70 |
this.$slider.slider("value",_time); |
| 957 | 71 |
this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time}); |
| 1013 | 72 |
}; |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
73 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
74 |
IriSP.Widgets.Slider.prototype.onMouseover = function() { |
| 909 | 75 |
if (this.minimize_timeout) { |
76 |
if (this.timeoutId) { |
|
77 |
window.clearTimeout(this.timeoutId); |
|
78 |
this.timeoutId = false; |
|
79 |
} |
|
80 |
if (!this.maximized) { |
|
81 |
this.animateToHeight(this.maximized_height); |
|
82 |
this.maximized = true; |
|
83 |
} |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
84 |
} |
| 1013 | 85 |
}; |
| 347 | 86 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
87 |
IriSP.Widgets.Slider.prototype.onMouseout = function() { |
| 965 | 88 |
this.$time.hide(); |
| 909 | 89 |
if (this.minimize_timeout) { |
90 |
if (this.timeoutId) { |
|
91 |
window.clearTimeout(this.timeoutId); |
|
92 |
this.timeoutId = false; |
|
93 |
} |
|
94 |
var _this = this; |
|
95 |
this.timeoutId = window.setTimeout(function() { |
|
96 |
if (_this.maximized) { |
|
97 |
_this.animateToHeight(_this.minimized_height); |
|
98 |
_this.maximized = false; |
|
99 |
} |
|
100 |
_this.timeoutId = false; |
|
101 |
}, this.minimize_timeout); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
102 |
} |
| 1013 | 103 |
}; |
| 347 | 104 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
105 |
IriSP.Widgets.Slider.prototype.animateToHeight = function(_height) { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
106 |
this.$slider.stop().animate( |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
107 |
this.calculateSliderCss(_height), |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
108 |
500, |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
109 |
function() { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
110 |
IriSP.jQuery(this).css("overflow","visible"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
111 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
112 |
this.$handle.stop().animate( |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
113 |
this.calculateHandleCss(_height), |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
114 |
500, |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
115 |
function() { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
116 |
IriSP.jQuery(this).css("overflow","visible"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
117 |
}); |
| 1013 | 118 |
}; |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
260
diff
changeset
|
119 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
120 |
IriSP.Widgets.Slider.prototype.calculateSliderCss = function(_size) { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
121 |
return { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
122 |
height: _size + "px", |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
123 |
"margin-top": (this.minimized_height - _size) + "px" |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
124 |
}; |
| 1013 | 125 |
}; |
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
820
diff
changeset
|
126 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
127 |
IriSP.Widgets.Slider.prototype.calculateHandleCss = function(_size) { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
128 |
return { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
129 |
height: (2 + _size) + "px", |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
130 |
width: (2 + _size) + "px", |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
131 |
"margin-left": -Math.ceil(2 + _size / 2) + "px" |
| 1013 | 132 |
}; |
133 |
}; |