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/", const CHROME_BUILD_DIR = BUILD_DIR + "/chromium/",
CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + "/content/"; 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 // Clear out everything in the chrome extension build directory
rimraf.sync(CHROME_BUILD_DIR); rimraf.sync(CHROME_BUILD_DIR);
@ -1353,7 +1358,7 @@ gulp.task(
gulp.dest(CHROME_BUILD_CONTENT_DIR + "web") gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")
), ),
gulp gulp
.src(COMMON_WEB_FILES, { base: "web/" }) .src(CHROME_WEB_FILES, { base: "web/" })
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")), .pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")),
gulp gulp

View File

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

View File

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

View File

@ -70,7 +70,7 @@ class Toolbar {
{ element: options.download, eventName: "download" }, { element: options.download, eventName: "download" },
{ element: options.viewBookmark, eventName: null }, { 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.buttons.push({ element: options.openFile, eventName: "openfile" });
} }
this.items = { 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> <span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button> </button>
<!--#if !MOZCENTRAL--> <!--#if GENERIC-->
<button id="secondaryOpenFile" class="secondaryToolbarButton visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file"> <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> <span data-l10n-id="open_file_label">Open</span>
</button> </button>
@ -267,7 +267,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="presentation_mode_label">Presentation Mode</span> <span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button> </button>
<!--#if !MOZCENTRAL--> <!--#if GENERIC-->
<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file"> <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> <span data-l10n-id="open_file_label">Open</span>
</button> </button>
@ -453,7 +453,7 @@ See https://github.com/adobe-type-tools/cmap-resources
</div> <!-- outerContainer --> </div> <!-- outerContainer -->
<div id="printContainer"></div> <div id="printContainer"></div>
<!--#if GENERIC --> <!--#if GENERIC-->
<input type="file" id="fileInput" class="hidden"> <input type="file" id="fileInput" class="hidden">
<!--#endif--> <!--#endif-->
</body> </body>

View File

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