"use strict"; (function() { var moduleName = "views/songProgress"; var deps = []; deps.push("views/slider"); define(moduleName, deps, function() { var Slider = require("views/slider"); var SongProgress = Slider.inherit({ className: "SongProgress", constructor: function(controller, options) { var base = { minHeight: 10, maxHeight: 10 }; W.extend(base, options) Slider.fn.constructor.call(this, controller, base); this._f.on("load", this._onLoad, this); this._e.insertBefore(this._loadProgress, this._value); }, destructor: function() { this._f.off("load", this._onLoad, this); Slider.fn.destructor.call(this); }, _createBars: function() { Slider.fn._createBars.call(this); this._loadProgress = document.createElement("div"); this._loadProgress.style.backgroundColor = Slider.theme.secondaryColor || "#ffff00"; this._loadProgress.style.height = "100%"; this._loadProgress.style.width = "0"; this._loadProgress.style.position = "absolute"; this._loadProgress.style.top = "0"; this._loadProgress.style.left = "0"; }, _onData: function() { Slider.fn._onData.call(this); this._onLoad(this._f.load); }, _onLoad: function(load) { this._loadProgress.style.width = load * 100 + "%"; }, _onMouseDown: function(e) { if (e.which === 1) { this._f.trigger("seekingStart"); } Slider.fn._onMouseDown.call(this, e); }, _onMouseUp: function(e) { Slider.fn._onMouseUp.call(this, e); this._f.trigger("seekingEnd", this._f.value); }, _resetTheme: function() { Slider.fn._resetTheme.call(this); this._loadProgress.style.backgroundColor = Slider.theme.secondaryColor || "#ffff00" } }); return SongProgress; }) })();