mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 00:28:06 +02:00
Add fallback option for the extension.
This commit is contained in:
parent
80728f7acd
commit
982c7a0f7e
3 changed files with 51 additions and 3 deletions
|
@ -101,12 +101,14 @@
|
|||
<span data-l10n-id="print_label">Print</span>
|
||||
</button>
|
||||
-->
|
||||
|
||||
<button id="download" class="toolbarButton download" title="Download" onclick="PDFView.download();" tabindex="12" data-l10n-id="download">
|
||||
<button id="fallback" class="toolbarButton fallback" title="Open with System Default PDF Viewer" onclick="PDFView.fallback();" tabindex="12" data-l10n-id="fallback" hidden="true">F
|
||||
<span data-l10n-id="fallback_label">Open with System Default PDF Viewer</span>
|
||||
</button>
|
||||
<button id="download" class="toolbarButton download" title="Download" onclick="PDFView.download();" tabindex="13" data-l10n-id="download">
|
||||
<span data-l10n-id="download_label">Download</span>
|
||||
</button>
|
||||
<!-- <div class="toolbarButtonSpacer"></div> -->
|
||||
<a href="#" id="viewBookmark" class="toolbarButton bookmark" title="Current view (copy or open in new window)" tabindex="13" data-l10n-id="bookmark"><span data-l10n-id="bookmark_label">Current View</span></a>
|
||||
<a href="#" id="viewBookmark" class="toolbarButton bookmark" title="Current view (copy or open in new window)" tabindex="14" data-l10n-id="bookmark"><span data-l10n-id="bookmark_label">Current View</span></a>
|
||||
</div>
|
||||
<div class="outerCenter">
|
||||
<div class="innerCenter" id="toolbarViewerMiddle">
|
||||
|
|
|
@ -374,6 +374,13 @@ var PDFView = {
|
|||
}
|
||||
},
|
||||
|
||||
fallback: function pdfViewDownload() {
|
||||
if (!PDFJS.isFirefoxExtension)
|
||||
return; // can't do this with regular viewer
|
||||
var url = this.url.split('#')[0];
|
||||
FirefoxCom.request('fallback', url);
|
||||
},
|
||||
|
||||
navigateTo: function pdfViewNavigateTo(dest) {
|
||||
if (typeof dest === 'string')
|
||||
dest = this.destinations[dest];
|
||||
|
@ -1352,6 +1359,9 @@ window.addEventListener('load', function webViewerLoad(evt) {
|
|||
document.getElementById('fileInput').value = null;
|
||||
}
|
||||
|
||||
if (PDFJS.isFirefoxExtension)
|
||||
document.getElementById('fallback').removeAttribute('hidden');
|
||||
|
||||
// Special debugging flags in the hash section of the URL.
|
||||
var hash = document.location.hash.substring(1);
|
||||
var hashParams = PDFView.parseQueryString(hash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue