mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge with upstream
This commit is contained in:
commit
132ee01bc0
7 changed files with 128 additions and 105 deletions
|
@ -107,26 +107,18 @@ var PDFView = {
|
|||
|
||||
document.title = url;
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url);
|
||||
xhr.mozResponseType = xhr.responseType = 'arraybuffer';
|
||||
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200;
|
||||
xhr.onprogress = function updateProgress(evt) {
|
||||
if (evt.lengthComputable)
|
||||
PDFView.progress(evt.loaded / evt.total);
|
||||
};
|
||||
|
||||
xhr.onerror = PDFView.error;
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === xhr.expected) {
|
||||
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
|
||||
xhr.responseArrayBuffer || xhr.response);
|
||||
getPdf(
|
||||
{
|
||||
url: url,
|
||||
progress: function getPdfProgress(evt) {
|
||||
if (evt.lengthComputable)
|
||||
PDFView.progress(evt.loaded / evt.total);
|
||||
},
|
||||
error: PDFView.error
|
||||
},
|
||||
function getPdfLoad(data) {
|
||||
PDFView.load(data, scale);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
});
|
||||
},
|
||||
|
||||
navigateTo: function(dest) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue