VideoPreview: accept tooltip function

This commit is contained in:
rolux 2013-02-11 11:57:37 +05:30
parent 61ca7657b1
commit c567a80a44

View file

@ -69,18 +69,16 @@ Ox.VideoPreview = function(options, self) {
self.$interface = Ox.Element({
tooltip: function(event) {
// e.offsetX does not work in Firefox
var position = getPosition(event.clientX - that.offset().left);
var position = getPosition(event.clientX - that.offset().left),
tooltip = Ox.isFunction(self.options.tooltip)
? self.options.tooltip() : self.options.tooltip;
self.$frame.attr({src: getClosestFrame(position)});
self.timeout && clearTimeout(self.timeout);
self.timeout = setTimeout(function() {
self.$frame.attr({src: self.options.getFrame(position)});
}, 250);
return '<div style="text-align: center>"'
+ (self.options.tooltip ? (
Ox.isFunction(self.options.tooltip)
? self.options.tooltip()
: self.options.tooltip
) + '<br>' : '')
+ (tooltip ? tooltip + '<br>' : '')
+ Ox.formatDuration(position, 2)
+ '</div>';
}