Stop bundling the openFile-buttons in the CHROME build

This is, for all intents and purposes, equivalent to PR 14833 and slightly reduces the size of the `gulp chromium` output.
This commit is contained in:
Jonas Jenwald 2022-05-07 22:05:39 +02:00
parent d1f13a6af3
commit 80910f44e5
6 changed files with 13 additions and 11 deletions

View File

@ -1334,6 +1334,11 @@ gulp.task(
const CHROME_BUILD_DIR = BUILD_DIR + "/chromium/",
CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + "/content/";
const CHROME_WEB_FILES = [
...COMMON_WEB_FILES,
"!web/images/toolbarButton-openFile.svg",
];
// Clear out everything in the chrome extension build directory
rimraf.sync(CHROME_BUILD_DIR);
@ -1353,7 +1358,7 @@ gulp.task(
gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")
),
gulp
.src(COMMON_WEB_FILES, { base: "web/" })
.src(CHROME_WEB_FILES, { base: "web/" })
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")),
gulp

View File

@ -2195,9 +2195,6 @@ function webViewerInitialized() {
fileInput: evt.dataTransfer,
});
});
} else if (!PDFJSDev.test("MOZCENTRAL")) {
appConfig.toolbar.openFile.hidden = true;
appConfig.secondaryToolbar.openFileButton.hidden = true;
}
if (!PDFViewerApplication.supportsDocumentFonts) {

View File

@ -135,7 +135,7 @@ class SecondaryToolbar {
close: true,
},
];
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
this.buttons.push({
element: options.openFileButton,
eventName: "openfile",

View File

@ -70,7 +70,7 @@ class Toolbar {
{ element: options.download, eventName: "download" },
{ element: options.viewBookmark, eventName: null },
];
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
this.buttons.push({ element: options.openFile, eventName: "openfile" });
}
this.items = {

View File

@ -153,7 +153,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<!--#if !MOZCENTRAL-->
<!--#if GENERIC-->
<button id="secondaryOpenFile" class="secondaryToolbarButton visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
@ -267,7 +267,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<!--#if !MOZCENTRAL-->
<!--#if GENERIC-->
<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
@ -453,7 +453,7 @@ See https://github.com/adobe-type-tools/cmap-resources
</div> <!-- outerContainer -->
<div id="printContainer"></div>
<!--#if GENERIC -->
<!--#if GENERIC-->
<input type="file" id="fileInput" class="hidden">
<!--#endif-->
</body>

View File

@ -89,7 +89,7 @@ function getViewerConfiguration() {
zoomOut: document.getElementById("zoomOut"),
viewFind: document.getElementById("viewFind"),
openFile:
typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
? document.getElementById("openFile")
: null,
print: document.getElementById("print"),
@ -104,7 +104,7 @@ function getViewerConfiguration() {
"secondaryPresentationMode"
),
openFileButton:
typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
? document.getElementById("secondaryOpenFile")
: null,
printButton: document.getElementById("secondaryPrint"),