1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-02 06:32:07 +02:00

Updated volume display to automically set itself.

This commit is contained in:
Steve Heffernan 2011-12-08 17:33:44 -08:00
parent d1fb95ecbf
commit 6945be3d6e
3 changed files with 22 additions and 5 deletions

View File

@ -45,7 +45,18 @@ $(function(){
if (result === null) result = "<span class='undefined'>null</span>";
if (result === undefined) result = "<span class='undefined'>undefined</span>";
if (typeof result.start == "function") {
result = (result.length > 0) ? "s:"+result.start(0)+" e:"+result.end(0) : "-";
var newResult = "", i;
if (result.length > 0) {
for (i=0;i<result.length;i++) {
newResult += "l:"+result.length+" s:"+result.start(i)+" e:"+result.end(i);
}
} else {
newResult = "-";
}
result = newResult;
// result = result.toString();
// result = (result.length > 0) ? "s:"+result.start(0)+" e:"+result.end(0) : "-";
}
} catch(e) {
result = "<span class='na'>N/A</span>";

View File

@ -176,6 +176,11 @@ _V_.Component = _V_.Class.extend({
for (var attrname in obj) {
if (obj.hasOwnProperty(attrname)) { this[attrname]=obj[attrname]; }
}
},
// More easily attach 'this' to functions
proxy: function(fn){
return _V_.proxy(this, fn);
}
});

9
src/controls.js vendored
View File

@ -323,6 +323,11 @@ _V_.Slider = _V_.Component.extend({
this.addEvent("mousedown", this.onMouseDown);
this.addEvent("focus", this.onFocus);
this.addEvent("blur", this.onBlur);
// Update Display
// Need to wait for styles to be loaded.
// TODO - replace setTimeout with stylesReady function.
setTimeout(this.proxy(this.update), 0);
},
createElement: function(type, attrs) {
@ -399,8 +404,6 @@ _V_.Slider = _V_.Component.extend({
boxW = box.offsetWidth,
handle = this.handle;
// _V_.log(box.offsetLeft, box.offsetLeft)
if (handle) {
var handleW = handle.el.offsetWidth;
@ -409,8 +412,6 @@ _V_.Slider = _V_.Component.extend({
boxW = boxW - handleW;
}
// _V_.log(event.pageX, boxX, boxW);
// Percent that the click is through the adjusted area
return Math.max(0, Math.min(1, (event.pageX - boxX) / boxW));
},