Browse Source

Merge pull request #3573 from Rob--W/crx-view-local-files

[CRX] Fixes to view local files again
Yury Delendik 12 years ago
parent
commit
bde863a8ac
  1. 4
      extensions/chrome/pdfHandler.js
  2. 8
      web/viewer.js

4
extensions/chrome/pdfHandler.js

@ -31,8 +31,8 @@ function isPdfDownloadable(details) {
// if the file is displayed in the main frame. // if the file is displayed in the main frame.
if (details.type == 'main_frame') if (details.type == 'main_frame')
return false; return false;
var cdHeader = getHeaderFromHeaders(details.responseHeaders, var cdHeader = details.responseHeaders &&
'content-disposition'); getHeaderFromHeaders(details.responseHeaders, 'content-disposition');
return cdHeader && /^attachment/i.test(cdHeader.value); return cdHeader && /^attachment/i.test(cdHeader.value);
} }

8
web/viewer.js

@ -2293,13 +2293,19 @@ var DocumentOutlineView = function documentOutlineView(outline) {
document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) { document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
PDFView.initialize(); PDFView.initialize();
//#if !(FIREFOX || MOZCENTRAL || CHROME) //#if !(FIREFOX || MOZCENTRAL)
var params = PDFView.parseQueryString(document.location.search.substring(1)); var params = PDFView.parseQueryString(document.location.search.substring(1));
var file = params.file || DEFAULT_URL; var file = params.file || DEFAULT_URL;
//#else //#else
//var file = window.location.href.split('#')[0]; //var file = window.location.href.split('#')[0];
//#endif //#endif
//#if CHROME
//if (location.protocol !== 'chrome-extension:') {
// file = location.href.split('#')[0];
//}
//#endif
//#if !(FIREFOX || MOZCENTRAL || CHROME) //#if !(FIREFOX || MOZCENTRAL || CHROME)
var fileInput = document.createElement('input'); var fileInput = document.createElement('input');
fileInput.id = 'fileInput'; fileInput.id = 'fileInput';

Loading…
Cancel
Save