|
|
@ -111,12 +111,14 @@ var PDFView = { |
|
|
|
xhr.open('GET', url); |
|
|
|
xhr.open('GET', url); |
|
|
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; |
|
|
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; |
|
|
|
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200; |
|
|
|
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200; |
|
|
|
|
|
|
|
xhr.onprogress=PDFView.progressLevel; |
|
|
|
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function() { |
|
|
|
xhr.onreadystatechange = function() { |
|
|
|
if (xhr.readyState === 4 && xhr.status === xhr.expected) { |
|
|
|
if (xhr.readyState === 4 && xhr.status === xhr.expected) { |
|
|
|
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse || |
|
|
|
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse || |
|
|
|
xhr.responseArrayBuffer || xhr.response); |
|
|
|
xhr.responseArrayBuffer || xhr.response); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById('loading').style.display="none"; |
|
|
|
PDFView.load(data, scale); |
|
|
|
PDFView.load(data, scale); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -124,6 +126,11 @@ var PDFView = { |
|
|
|
xhr.send(null); |
|
|
|
xhr.send(null); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
progressLevel: function(evt) { |
|
|
|
|
|
|
|
var p=Math.round((evt.loaded / evt.total)*100); |
|
|
|
|
|
|
|
document.getElementById('loading').innerHTML = 'Loading... '+p+'%'; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
navigateTo: function(dest) { |
|
|
|
navigateTo: function(dest) { |
|
|
|
if (typeof dest === 'string') |
|
|
|
if (typeof dest === 'string') |
|
|
|
dest = this.destinations[dest]; |
|
|
|
dest = this.destinations[dest]; |
|
|
|