mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Highly improved Chrome extension
Full list feature changes in this commit: - Support for iframes - Switched to content-type (MIME) detection instead of hard-coding a case-sensitive check for the .PDF extension - The PDF's original URL is visible in the omnibox - Support for incognito mode Note: PDF viewer is disabled for the file:// + incognito combination, because it's currently impossible to get the combination to work. See https://github.com/mozilla/pdf.js/pull/3017#issuecomment-15693432
This commit is contained in:
parent
9c76ed0a35
commit
e181a3c902
7 changed files with 314 additions and 21 deletions
17
make.js
17
make.js
|
@ -591,6 +591,7 @@ target.chrome = function() {
|
|||
[['extensions/chrome/*.json',
|
||||
'extensions/chrome/*.html',
|
||||
'extensions/chrome/*.js',
|
||||
'extensions/chrome/*.css',
|
||||
'extensions/chrome/icon*.png',],
|
||||
CHROME_BUILD_DIR],
|
||||
['external/webL10n/l10n.js', CHROME_BUILD_CONTENT_DIR + '/web'],
|
||||
|
@ -607,6 +608,22 @@ target.chrome = function() {
|
|||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
||||
CHROME_BUILD_DIR + '/manifest.json');
|
||||
|
||||
// Allow PDF.js resources to be loaded by adding the files to
|
||||
// the "web_accessible_resources" section.
|
||||
var file_list = ls('-RA', CHROME_BUILD_CONTENT_DIR);
|
||||
var public_chrome_files = file_list.reduce(function(war, file) {
|
||||
// Exclude directories (naive: Exclude paths without dot)
|
||||
if (file.indexOf('.') !== -1) {
|
||||
// Only add a comma after the first file
|
||||
if (war)
|
||||
war += ',\n';
|
||||
war += JSON.stringify('content/' + file);
|
||||
}
|
||||
return war;
|
||||
}, '');
|
||||
sed('-i', /"content\/\*"/, public_chrome_files,
|
||||
CHROME_BUILD_DIR + '/manifest.json');
|
||||
|
||||
// Bundle the files to a Chrome extension file .crx if path to key is set
|
||||
var pem = env['PDFJS_CHROME_KEY'];
|
||||
if (!pem) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue