|
|
@ -36,29 +36,24 @@ var ProgressBar = (function ProgressBarClosure() { |
|
|
|
function ProgressBar(id, opts) { |
|
|
|
function ProgressBar(id, opts) { |
|
|
|
|
|
|
|
|
|
|
|
// Fetch the sub-elements for later
|
|
|
|
// Fetch the sub-elements for later
|
|
|
|
this.progressDiv = document.querySelector(id + ' .progress'); |
|
|
|
this.div = document.querySelector(id + ' .progress'); |
|
|
|
this.remainingDiv = document.querySelector(id + ' .remaining'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get options, with sensible defaults
|
|
|
|
// Get options, with sensible defaults
|
|
|
|
this.height = opts.height || 1; |
|
|
|
this.height = opts.height || 100; |
|
|
|
this.width = opts.width || 15; |
|
|
|
this.width = opts.width || 100; |
|
|
|
this.units = opts.units || 'em'; |
|
|
|
this.units = opts.units || '%'; |
|
|
|
this.percent = opts.percent || 0; |
|
|
|
this.percent = opts.percent || 0; |
|
|
|
|
|
|
|
|
|
|
|
// Initialize heights
|
|
|
|
// Initialize heights
|
|
|
|
this.progressDiv.style.height = this.height + this.units; |
|
|
|
this.div.style.height = this.height + this.units; |
|
|
|
this.remainingDiv.style.height = this.height + this.units; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ProgressBar.prototype = { |
|
|
|
ProgressBar.prototype = { |
|
|
|
constructor: ProgressBar, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateBar: function ProgressBar_updateBar() { |
|
|
|
updateBar: function ProgressBar_updateBar() { |
|
|
|
var progressSize = this.width * this._percent / 100; |
|
|
|
var progressSize = this.width * this._percent / 100; |
|
|
|
var remainingSize = (this.width - progressSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.progressDiv.style.width = progressSize + this.units; |
|
|
|
this.div.style.width = progressSize + this.units; |
|
|
|
this.remainingDiv.style.width = remainingSize + this.units; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
get percent() { |
|
|
|
get percent() { |
|
|
@ -307,10 +302,8 @@ var PDFView = { |
|
|
|
open: function pdfViewOpen(url, scale) { |
|
|
|
open: function pdfViewOpen(url, scale) { |
|
|
|
document.title = this.url = url; |
|
|
|
document.title = this.url = url; |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Probably needs a better place to get initialized
|
|
|
|
|
|
|
|
if (!PDFView.loadingBar) { |
|
|
|
if (!PDFView.loadingBar) { |
|
|
|
PDFView.loadingBar = new ProgressBar('#loadingBar', { |
|
|
|
PDFView.loadingBar = new ProgressBar('#loadingBar', {}); |
|
|
|
width: 15, height: 1.5, units: 'em'}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|