|
|
@ -349,11 +349,13 @@ var PDFView = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
function getDocumentError(message, exception) { |
|
|
|
function getDocumentError(message, exception) { |
|
|
|
var loadingIndicator = document.getElementById('loading'); |
|
|
|
var loadingIndicator = document.getElementById('loading'); |
|
|
|
loadingIndicator.textContent = mozL10n.get('loading_error_indicator'); |
|
|
|
loadingIndicator.textContent = mozL10n.get('loading_error_indicator', |
|
|
|
|
|
|
|
null, 'Error'); |
|
|
|
var moreInfo = { |
|
|
|
var moreInfo = { |
|
|
|
message: message |
|
|
|
message: message |
|
|
|
}; |
|
|
|
}; |
|
|
|
self.error(mozL10n.get('loading_error'), moreInfo); |
|
|
|
self.error(mozL10n.get('loading_error', null, |
|
|
|
|
|
|
|
'An error occurred while loading the PDF.'), moreInfo); |
|
|
|
self.loading = false; |
|
|
|
self.loading = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
function getDocumentProgress(progressData) { |
|
|
|
function getDocumentProgress(progressData) { |
|
|
@ -461,22 +463,27 @@ var PDFView = { |
|
|
|
moreInfoButton.removeAttribute('hidden'); |
|
|
|
moreInfoButton.removeAttribute('hidden'); |
|
|
|
lessInfoButton.setAttribute('hidden', 'true'); |
|
|
|
lessInfoButton.setAttribute('hidden', 'true'); |
|
|
|
errorMoreInfo.value = |
|
|
|
errorMoreInfo.value = |
|
|
|
mozL10n.get('error_build', {build: PDFJS.build}) + '\n'; |
|
|
|
mozL10n.get('error_build', {build: PDFJS.build}, |
|
|
|
|
|
|
|
'PDF.JS Build: {{build}}') + '\n'; |
|
|
|
|
|
|
|
|
|
|
|
if (moreInfo) { |
|
|
|
if (moreInfo) { |
|
|
|
errorMoreInfo.value += |
|
|
|
errorMoreInfo.value += |
|
|
|
mozL10n.get('error_message', {message: moreInfo.message}); |
|
|
|
mozL10n.get('error_message', {message: moreInfo.message}, |
|
|
|
|
|
|
|
'Message: {{message}}'); |
|
|
|
if (moreInfo.stack) { |
|
|
|
if (moreInfo.stack) { |
|
|
|
errorMoreInfo.value += '\n' + |
|
|
|
errorMoreInfo.value += '\n' + |
|
|
|
mozL10n.get('error_stack', {stack: moreInfo.stack}); |
|
|
|
mozL10n.get('error_stack', {stack: moreInfo.stack}, |
|
|
|
|
|
|
|
'Stack: {{stack}}'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (moreInfo.filename) { |
|
|
|
if (moreInfo.filename) { |
|
|
|
errorMoreInfo.value += '\n' + |
|
|
|
errorMoreInfo.value += '\n' + |
|
|
|
mozL10n.get('error_file', {file: moreInfo.filename}); |
|
|
|
mozL10n.get('error_file', {file: moreInfo.filename}, |
|
|
|
|
|
|
|
'File: {{file}}'); |
|
|
|
} |
|
|
|
} |
|
|
|
if (moreInfo.lineNumber) { |
|
|
|
if (moreInfo.lineNumber) { |
|
|
|
errorMoreInfo.value += '\n' + |
|
|
|
errorMoreInfo.value += '\n' + |
|
|
|
mozL10n.get('error_line', {line: moreInfo.lineNumber}); |
|
|
|
mozL10n.get('error_line', {line: moreInfo.lineNumber}, |
|
|
|
|
|
|
|
'Line: {{line}}'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -486,7 +493,8 @@ var PDFView = { |
|
|
|
progress: function pdfViewProgress(level) { |
|
|
|
progress: function pdfViewProgress(level) { |
|
|
|
var percent = Math.round(level * 100); |
|
|
|
var percent = Math.round(level * 100); |
|
|
|
var loadingIndicator = document.getElementById('loading'); |
|
|
|
var loadingIndicator = document.getElementById('loading'); |
|
|
|
loadingIndicator.textContent = mozL10n.get('loading', {percent: percent}); |
|
|
|
loadingIndicator.textContent = mozL10n.get('loading', {percent: percent}, |
|
|
|
|
|
|
|
'Loading... {{percent}}%'); |
|
|
|
|
|
|
|
|
|
|
|
PDFView.loadingBar.percent = percent; |
|
|
|
PDFView.loadingBar.percent = percent; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -523,7 +531,7 @@ var PDFView = { |
|
|
|
var id = pdfDocument.fingerprint; |
|
|
|
var id = pdfDocument.fingerprint; |
|
|
|
var storedHash = null; |
|
|
|
var storedHash = null; |
|
|
|
document.getElementById('numPages').textContent = |
|
|
|
document.getElementById('numPages').textContent = |
|
|
|
mozL10n.get('page_of', {pageCount: pagesCount}); |
|
|
|
mozL10n.get('page_of', {pageCount: pagesCount}, 'of {{pageCount}}'); |
|
|
|
document.getElementById('pageNumber').max = pagesCount; |
|
|
|
document.getElementById('pageNumber').max = pagesCount; |
|
|
|
PDFView.documentFingerprint = id; |
|
|
|
PDFView.documentFingerprint = id; |
|
|
|
var store = PDFView.store = new Settings(id); |
|
|
|
var store = PDFView.store = new Settings(id); |
|
|
@ -837,7 +845,8 @@ var PageView = function pageView(container, pdfPage, id, scale, |
|
|
|
var rect = viewport.convertToViewportRectangle(item.rect); |
|
|
|
var rect = viewport.convertToViewportRectangle(item.rect); |
|
|
|
rect = PDFJS.Util.normalizeRect(rect); |
|
|
|
rect = PDFJS.Util.normalizeRect(rect); |
|
|
|
image.src = kImageDirectory + 'annotation-' + type.toLowerCase() + '.svg'; |
|
|
|
image.src = kImageDirectory + 'annotation-' + type.toLowerCase() + '.svg'; |
|
|
|
image.alt = mozL10n.get('text_annotation_type', {type: type}); |
|
|
|
image.alt = mozL10n.get('text_annotation_type', {type: type}, |
|
|
|
|
|
|
|
'[{{type}} Annotation]'); |
|
|
|
var content = document.createElement('div'); |
|
|
|
var content = document.createElement('div'); |
|
|
|
content.setAttribute('hidden', true); |
|
|
|
content.setAttribute('hidden', true); |
|
|
|
var title = document.createElement('h1'); |
|
|
|
var title = document.createElement('h1'); |
|
|
@ -1018,8 +1027,10 @@ var PageView = function pageView(container, pdfPage, id, scale, |
|
|
|
delete self.loadingIconDiv; |
|
|
|
delete self.loadingIconDiv; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (error) |
|
|
|
if (error) { |
|
|
|
PDFView.error(mozL10n.get('rendering_error'), error); |
|
|
|
PDFView.error(mozL10n.get('rendering_error', null, |
|
|
|
|
|
|
|
'An error occurred while rendering the page.'), error); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self.stats = pdfPage.stats; |
|
|
|
self.stats = pdfPage.stats; |
|
|
|
self.updateStats(); |
|
|
|
self.updateStats(); |
|
|
@ -1163,7 +1174,8 @@ var DocumentOutlineView = function documentOutlineView(outline) { |
|
|
|
if (!outline) { |
|
|
|
if (!outline) { |
|
|
|
var noOutline = document.createElement('div'); |
|
|
|
var noOutline = document.createElement('div'); |
|
|
|
noOutline.classList.add('noOutline'); |
|
|
|
noOutline.classList.add('noOutline'); |
|
|
|
noOutline.textContent = mozL10n.get('no_outline'); |
|
|
|
noOutline.textContent = mozL10n.get('no_outline', null, |
|
|
|
|
|
|
|
'No Outline Available'); |
|
|
|
outlineView.appendChild(noOutline); |
|
|
|
outlineView.appendChild(noOutline); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|