| author | hamidouk |
| Thu, 10 Nov 2011 17:34:20 +0100 | |
| branch | slider-port |
| changeset 229 | 808768eb5930 |
| parent 226 | d1f0e604bd06 |
| child 230 | 9b86d3c52211 |
| permissions | -rw-r--r-- |
| 226 | 1 |
IriSP.SliderWidget = function(Popcorn, config, Serializer) { |
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
3 |
}; |
|
4 |
||
5 |
IriSP.SliderWidget.prototype = new IriSP.Widget(); |
|
6 |
||
7 |
IriSP.SliderWidget.prototype.draw = function() { |
|
8 |
var self = this; |
|
9 |
|
|
|
229
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
10 |
this.selector.append("<div class='sliderBackground'></div>"); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
11 |
this.sliderBackground = this.selector.children(".sliderBackground"); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
12 |
|
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
13 |
this.selector.append("<div class='sliderForeground' style='position: absolute; top: 0%; width: 0%;'></div>"); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
14 |
this.sliderForeground = this.selector.children(".sliderForeground"); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
15 |
|
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
16 |
this.selector.append(Mustache.to_html(IriSP.overlay_marker_template)); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
17 |
this.positionMarker = this.selector.children(".positionMarker"); |
| 226 | 18 |
|
19 |
this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater)); |
|
20 |
}; |
|
21 |
||
22 |
/* updates the slider as time passes */ |
|
23 |
IriSP.SliderWidget.prototype.sliderUpdater = function() { |
|
|
229
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
24 |
var time = this._Popcorn.currentTime(); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
25 |
|
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
26 |
var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000; |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
27 |
var percent = ((time / duration) * 100).toFixed(2); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
28 |
this.sliderForeground.css("width", percent + "%"); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
29 |
this.positionMarker.css("left", percent + "%"); |
|
808768eb5930
rewriting the slider-port to not use jquery ui slider.
hamidouk
parents:
226
diff
changeset
|
30 |
|
| 226 | 31 |
}; |