2012-09-01 07:48:21 +09:00
|
|
|
/* Copyright 2012 Mozilla Foundation
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2012-02-14 10:35:58 +09:00
|
|
|
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
"use strict";
|
2012-02-14 10:35:58 +09:00
|
|
|
|
2021-05-04 21:29:05 +09:00
|
|
|
// eslint-disable-next-line no-var
|
2012-02-14 10:35:58 +09:00
|
|
|
var FontInspector = (function FontInspectorClosure() {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let fonts;
|
|
|
|
let active = false;
|
|
|
|
const fontAttribute = "data-font-name";
|
2012-02-14 10:35:58 +09:00
|
|
|
function removeSelection() {
|
2019-12-27 08:22:32 +09:00
|
|
|
const divs = document.querySelectorAll(`span[${fontAttribute}]`);
|
|
|
|
for (const div of divs) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
div.className = "";
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function resetSelection() {
|
2019-12-27 08:22:32 +09:00
|
|
|
const divs = document.querySelectorAll(`span[${fontAttribute}]`);
|
|
|
|
for (const div of divs) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
div.className = "debuggerHideText";
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function selectFont(fontName, show) {
|
2019-12-27 08:22:32 +09:00
|
|
|
const divs = document.querySelectorAll(
|
|
|
|
`span[${fontAttribute}=${fontName}]`
|
|
|
|
);
|
|
|
|
for (const div of divs) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
div.className = show ? "debuggerShowText" : "debuggerHideText";
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function textLayerClick(e) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (
|
|
|
|
!e.target.dataset.fontName ||
|
|
|
|
e.target.tagName.toUpperCase() !== "SPAN"
|
|
|
|
) {
|
2012-02-14 10:35:58 +09:00
|
|
|
return;
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const fontName = e.target.dataset.fontName;
|
|
|
|
const selects = document.getElementsByTagName("input");
|
|
|
|
for (let i = 0; i < selects.length; ++i) {
|
|
|
|
const select = selects[i];
|
2014-08-01 05:01:54 +09:00
|
|
|
if (select.dataset.fontName !== fontName) {
|
2014-03-09 07:42:23 +09:00
|
|
|
continue;
|
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
select.checked = !select.checked;
|
|
|
|
selectFont(fontName, select.checked);
|
|
|
|
select.scrollIntoView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
2012-08-09 03:26:24 +09:00
|
|
|
// Properties/functions needed by PDFBug.
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
id: "FontInspector",
|
|
|
|
name: "Font Inspector",
|
2012-02-14 10:35:58 +09:00
|
|
|
panel: null,
|
|
|
|
manager: null,
|
2016-04-09 04:15:48 +09:00
|
|
|
init: function init(pdfjsLib) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const panel = this.panel;
|
|
|
|
const tmp = document.createElement("button");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
tmp.addEventListener("click", resetSelection);
|
|
|
|
tmp.textContent = "Refresh";
|
2012-02-14 10:35:58 +09:00
|
|
|
panel.appendChild(tmp);
|
|
|
|
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
fonts = document.createElement("div");
|
2012-02-14 10:35:58 +09:00
|
|
|
panel.appendChild(fonts);
|
|
|
|
},
|
2014-03-27 05:18:53 +09:00
|
|
|
cleanup: function cleanup() {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
fonts.textContent = "";
|
2014-03-27 05:18:53 +09:00
|
|
|
},
|
2012-02-14 10:35:58 +09:00
|
|
|
enabled: false,
|
|
|
|
get active() {
|
|
|
|
return active;
|
|
|
|
},
|
|
|
|
set active(value) {
|
|
|
|
active = value;
|
|
|
|
if (active) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
document.body.addEventListener("click", textLayerClick, true);
|
2012-02-14 10:35:58 +09:00
|
|
|
resetSelection();
|
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
document.body.removeEventListener("click", textLayerClick, true);
|
2012-02-14 10:35:58 +09:00
|
|
|
removeSelection();
|
|
|
|
}
|
|
|
|
},
|
2012-02-15 02:24:29 +09:00
|
|
|
// FontInspector specific functions.
|
2012-02-14 10:35:58 +09:00
|
|
|
fontAdded: function fontAdded(fontObj, url) {
|
|
|
|
function properties(obj, list) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const moreInfo = document.createElement("table");
|
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
|
const tr = document.createElement("tr");
|
|
|
|
const td1 = document.createElement("td");
|
2012-02-14 10:35:58 +09:00
|
|
|
td1.textContent = list[i];
|
|
|
|
tr.appendChild(td1);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const td2 = document.createElement("td");
|
2012-02-14 10:35:58 +09:00
|
|
|
td2.textContent = obj[list[i]].toString();
|
|
|
|
tr.appendChild(td2);
|
|
|
|
moreInfo.appendChild(tr);
|
|
|
|
}
|
|
|
|
return moreInfo;
|
|
|
|
}
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const moreInfo = properties(fontObj, ["name", "type"]);
|
2020-03-13 20:55:00 +09:00
|
|
|
const fontName = fontObj.loadedName;
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const font = document.createElement("div");
|
|
|
|
const name = document.createElement("span");
|
2012-02-14 10:35:58 +09:00
|
|
|
name.textContent = fontName;
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const download = document.createElement("a");
|
2014-10-01 04:24:31 +09:00
|
|
|
if (url) {
|
2020-11-07 20:59:53 +09:00
|
|
|
url = /url\(['"]?([^)"']+)/.exec(url);
|
2014-10-01 04:24:31 +09:00
|
|
|
download.href = url[1];
|
|
|
|
} else if (fontObj.data) {
|
2020-01-29 05:00:33 +09:00
|
|
|
download.href = URL.createObjectURL(
|
|
|
|
new Blob([fontObj.data], { type: fontObj.mimeType })
|
|
|
|
);
|
2014-10-01 04:24:31 +09:00
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
download.textContent = "Download";
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const logIt = document.createElement("a");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
logIt.href = "";
|
|
|
|
logIt.textContent = "Log";
|
2020-04-14 19:28:14 +09:00
|
|
|
logIt.addEventListener("click", function (event) {
|
2012-02-14 10:35:58 +09:00
|
|
|
event.preventDefault();
|
|
|
|
console.log(fontObj);
|
|
|
|
});
|
2020-03-13 20:55:00 +09:00
|
|
|
const select = document.createElement("input");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
select.setAttribute("type", "checkbox");
|
2012-02-14 10:35:58 +09:00
|
|
|
select.dataset.fontName = fontName;
|
2020-04-14 19:28:14 +09:00
|
|
|
select.addEventListener("click", function () {
|
2020-03-13 20:55:00 +09:00
|
|
|
selectFont(fontName, select.checked);
|
|
|
|
});
|
2012-02-14 10:35:58 +09:00
|
|
|
font.appendChild(select);
|
|
|
|
font.appendChild(name);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
font.appendChild(document.createTextNode(" "));
|
2012-02-14 10:35:58 +09:00
|
|
|
font.appendChild(download);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
font.appendChild(document.createTextNode(" "));
|
2012-02-14 10:35:58 +09:00
|
|
|
font.appendChild(logIt);
|
|
|
|
font.appendChild(moreInfo);
|
|
|
|
fonts.appendChild(font);
|
2012-02-15 02:24:29 +09:00
|
|
|
// Somewhat of a hack, should probably add a hook for when the text layer
|
2012-02-14 10:35:58 +09:00
|
|
|
// is done rendering.
|
2017-05-05 00:09:50 +09:00
|
|
|
setTimeout(() => {
|
2014-03-09 07:42:23 +09:00
|
|
|
if (this.active) {
|
2012-02-14 10:35:58 +09:00
|
|
|
resetSelection();
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2017-05-05 00:09:50 +09:00
|
|
|
}, 2000);
|
Fix inconsistent spacing and trailing commas in objects in `web/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js
index 002dbf29..1de4e530 100644
--- a/web/pdf_thumbnail_view.js
+++ b/web/pdf_thumbnail_view.js
@@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
this.pageLabel = (typeof label === 'string' ? label : null);
- this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}').
- then((msg) => {
+ this.l10n.get('thumb_page_title', { page: this.pageId, },
+ 'Page {{page}}').then((msg) => {
this.anchor.title = msg;
});
diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js
index 160e0410..6495fc5e 100644
--- a/web/secondary_toolbar.js
+++ b/web/secondary_toolbar.js
@@ -65,7 +65,8 @@ class SecondaryToolbar {
{ element: options.printButton, eventName: 'print', close: true, },
{ element: options.downloadButton, eventName: 'download', close: true, },
{ element: options.viewBookmarkButton, eventName: null, close: true, },
- { element: options.firstPageButton, eventName: 'firstpage', close: true, },
+ { element: options.firstPageButton, eventName: 'firstpage',
+ close: true, },
{ element: options.lastPageButton, eventName: 'lastpage', close: true, },
{ element: options.pageRotateCwButton, eventName: 'rotatecw',
close: false, },
@@ -76,7 +77,7 @@ class SecondaryToolbar {
{ element: options.cursorHandToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.HAND, }, close: true, },
{ element: options.documentPropertiesButton,
- eventName: 'documentproperties', close: true, }
+ eventName: 'documentproperties', close: true, },
];
this.items = {
firstPage: options.firstPageButton,
```
2017-06-01 19:46:12 +09:00
|
|
|
},
|
2012-02-14 10:35:58 +09:00
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let opMap;
|
2016-05-10 08:18:43 +09:00
|
|
|
|
2012-02-14 10:35:58 +09:00
|
|
|
// Manages all the page steppers.
|
2021-05-04 21:29:05 +09:00
|
|
|
//
|
|
|
|
// eslint-disable-next-line no-var
|
2012-02-16 07:12:58 +09:00
|
|
|
var StepperManager = (function StepperManagerClosure() {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let steppers = [];
|
|
|
|
let stepperDiv = null;
|
|
|
|
let stepperControls = null;
|
|
|
|
let stepperChooser = null;
|
|
|
|
let breakPoints = Object.create(null);
|
2012-02-14 10:35:58 +09:00
|
|
|
return {
|
2012-08-09 03:26:24 +09:00
|
|
|
// Properties/functions needed by PDFBug.
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
id: "Stepper",
|
|
|
|
name: "Stepper",
|
2012-02-14 10:35:58 +09:00
|
|
|
panel: null,
|
|
|
|
manager: null,
|
2016-05-10 08:18:43 +09:00
|
|
|
init: function init(pdfjsLib) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const self = this;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
stepperControls = document.createElement("div");
|
|
|
|
stepperChooser = document.createElement("select");
|
2020-04-14 19:28:14 +09:00
|
|
|
stepperChooser.addEventListener("change", function (event) {
|
2012-02-14 10:35:58 +09:00
|
|
|
self.selectStepper(this.value);
|
|
|
|
});
|
|
|
|
stepperControls.appendChild(stepperChooser);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
stepperDiv = document.createElement("div");
|
2012-02-14 10:35:58 +09:00
|
|
|
this.panel.appendChild(stepperControls);
|
|
|
|
this.panel.appendChild(stepperDiv);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (sessionStorage.getItem("pdfjsBreakPoints")) {
|
|
|
|
breakPoints = JSON.parse(sessionStorage.getItem("pdfjsBreakPoints"));
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2016-05-10 08:18:43 +09:00
|
|
|
|
|
|
|
opMap = Object.create(null);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (const key in pdfjsLib.OPS) {
|
2016-05-10 08:18:43 +09:00
|
|
|
opMap[pdfjsLib.OPS[key]] = key;
|
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
},
|
2014-03-27 05:18:53 +09:00
|
|
|
cleanup: function cleanup() {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
stepperChooser.textContent = "";
|
|
|
|
stepperDiv.textContent = "";
|
2014-03-27 05:18:53 +09:00
|
|
|
steppers = [];
|
|
|
|
},
|
2012-02-14 10:35:58 +09:00
|
|
|
enabled: false,
|
|
|
|
active: false,
|
2012-02-16 07:12:58 +09:00
|
|
|
// Stepper specific functions.
|
2012-04-13 06:02:47 +09:00
|
|
|
create: function create(pageIndex) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const debug = document.createElement("div");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
debug.id = "stepper" + pageIndex;
|
2021-02-08 08:21:49 +09:00
|
|
|
debug.hidden = true;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
debug.className = "stepper";
|
2012-02-14 10:35:58 +09:00
|
|
|
stepperDiv.appendChild(debug);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const b = document.createElement("option");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
b.textContent = "Page " + (pageIndex + 1);
|
2012-04-13 06:02:47 +09:00
|
|
|
b.value = pageIndex;
|
2012-02-14 10:35:58 +09:00
|
|
|
stepperChooser.appendChild(b);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const initBreakPoints = breakPoints[pageIndex] || [];
|
|
|
|
const stepper = new Stepper(debug, pageIndex, initBreakPoints);
|
2012-02-16 07:12:58 +09:00
|
|
|
steppers.push(stepper);
|
2014-03-09 07:42:23 +09:00
|
|
|
if (steppers.length === 1) {
|
2012-04-13 06:02:47 +09:00
|
|
|
this.selectStepper(pageIndex, false);
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2012-02-16 07:12:58 +09:00
|
|
|
return stepper;
|
2012-02-14 10:35:58 +09:00
|
|
|
},
|
2012-04-13 06:02:47 +09:00
|
|
|
selectStepper: function selectStepper(pageIndex, selectPanel) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let i;
|
2014-09-24 17:35:01 +09:00
|
|
|
pageIndex = pageIndex | 0;
|
2014-03-09 07:42:23 +09:00
|
|
|
if (selectPanel) {
|
2014-03-27 05:18:53 +09:00
|
|
|
this.manager.selectPanel(this);
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2014-04-08 05:34:03 +09:00
|
|
|
for (i = 0; i < steppers.length; ++i) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const stepper = steppers[i];
|
2021-02-08 08:21:49 +09:00
|
|
|
stepper.panel.hidden = stepper.pageIndex !== pageIndex;
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const options = stepperChooser.options;
|
2014-04-08 05:34:03 +09:00
|
|
|
for (i = 0; i < options.length; ++i) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const option = options[i];
|
2014-08-01 05:01:54 +09:00
|
|
|
option.selected = (option.value | 0) === pageIndex;
|
2012-02-22 06:37:22 +09:00
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
},
|
2012-04-13 06:02:47 +09:00
|
|
|
saveBreakPoints: function saveBreakPoints(pageIndex, bps) {
|
|
|
|
breakPoints[pageIndex] = bps;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
sessionStorage.setItem("pdfjsBreakPoints", JSON.stringify(breakPoints));
|
Fix inconsistent spacing and trailing commas in objects in `web/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js
index 002dbf29..1de4e530 100644
--- a/web/pdf_thumbnail_view.js
+++ b/web/pdf_thumbnail_view.js
@@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
this.pageLabel = (typeof label === 'string' ? label : null);
- this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}').
- then((msg) => {
+ this.l10n.get('thumb_page_title', { page: this.pageId, },
+ 'Page {{page}}').then((msg) => {
this.anchor.title = msg;
});
diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js
index 160e0410..6495fc5e 100644
--- a/web/secondary_toolbar.js
+++ b/web/secondary_toolbar.js
@@ -65,7 +65,8 @@ class SecondaryToolbar {
{ element: options.printButton, eventName: 'print', close: true, },
{ element: options.downloadButton, eventName: 'download', close: true, },
{ element: options.viewBookmarkButton, eventName: null, close: true, },
- { element: options.firstPageButton, eventName: 'firstpage', close: true, },
+ { element: options.firstPageButton, eventName: 'firstpage',
+ close: true, },
{ element: options.lastPageButton, eventName: 'lastpage', close: true, },
{ element: options.pageRotateCwButton, eventName: 'rotatecw',
close: false, },
@@ -76,7 +77,7 @@ class SecondaryToolbar {
{ element: options.cursorHandToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.HAND, }, close: true, },
{ element: options.documentPropertiesButton,
- eventName: 'documentproperties', close: true, }
+ eventName: 'documentproperties', close: true, },
];
this.items = {
firstPage: options.firstPageButton,
```
2017-06-01 19:46:12 +09:00
|
|
|
},
|
2012-02-14 10:35:58 +09:00
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
2021-05-04 21:29:05 +09:00
|
|
|
// The stepper for each page's operatorList.
|
|
|
|
const Stepper = (function StepperClosure() {
|
2013-08-01 03:17:36 +09:00
|
|
|
// Shorter way to create element and optionally set textContent.
|
|
|
|
function c(tag, textContent) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const d = document.createElement(tag);
|
2014-03-09 07:42:23 +09:00
|
|
|
if (textContent) {
|
2013-08-01 03:17:36 +09:00
|
|
|
d.textContent = textContent;
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2013-08-01 03:17:36 +09:00
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2014-03-27 05:18:53 +09:00
|
|
|
function simplifyArgs(args) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (typeof args === "string") {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const MAX_STRING_LENGTH = 75;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
return args.length <= MAX_STRING_LENGTH
|
|
|
|
? args
|
|
|
|
: args.substring(0, MAX_STRING_LENGTH) + "...";
|
2014-03-27 05:18:53 +09:00
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (typeof args !== "object" || args === null) {
|
2014-03-27 05:18:53 +09:00
|
|
|
return args;
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if ("length" in args) {
|
|
|
|
// array
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const MAX_ITEMS = 10,
|
|
|
|
simpleArgs = [];
|
|
|
|
let i, ii;
|
2014-03-27 05:18:53 +09:00
|
|
|
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
|
|
|
|
simpleArgs.push(simplifyArgs(args[i]));
|
|
|
|
}
|
|
|
|
if (i < args.length) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
simpleArgs.push("...");
|
2014-03-27 05:18:53 +09:00
|
|
|
}
|
|
|
|
return simpleArgs;
|
|
|
|
}
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const simpleObj = {};
|
|
|
|
for (const key in args) {
|
2014-03-27 05:18:53 +09:00
|
|
|
simpleObj[key] = simplifyArgs(args[key]);
|
|
|
|
}
|
|
|
|
return simpleObj;
|
|
|
|
}
|
|
|
|
|
2020-03-25 18:15:50 +09:00
|
|
|
// eslint-disable-next-line no-shadow
|
2021-05-04 21:29:05 +09:00
|
|
|
class Stepper {
|
|
|
|
constructor(panel, pageIndex, initialBreakPoints) {
|
|
|
|
this.panel = panel;
|
|
|
|
this.breakPoint = 0;
|
|
|
|
this.nextBreakPoint = null;
|
|
|
|
this.pageIndex = pageIndex;
|
|
|
|
this.breakPoints = initialBreakPoints;
|
|
|
|
this.currentIdx = -1;
|
|
|
|
this.operatorListIdx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
init(operatorList) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const panel = this.panel;
|
|
|
|
const content = c("div", "c=continue, s=step");
|
|
|
|
const table = c("table");
|
2012-02-14 10:35:58 +09:00
|
|
|
content.appendChild(table);
|
|
|
|
table.cellSpacing = 0;
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const headerRow = c("tr");
|
2012-02-14 10:35:58 +09:00
|
|
|
table.appendChild(headerRow);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
headerRow.appendChild(c("th", "Break"));
|
|
|
|
headerRow.appendChild(c("th", "Idx"));
|
|
|
|
headerRow.appendChild(c("th", "fn"));
|
|
|
|
headerRow.appendChild(c("th", "args"));
|
2013-08-01 03:17:36 +09:00
|
|
|
panel.appendChild(content);
|
|
|
|
this.table = table;
|
2016-05-10 08:18:43 +09:00
|
|
|
this.updateOperatorList(operatorList);
|
2021-05-04 21:29:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
updateOperatorList(operatorList) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const self = this;
|
2014-04-20 08:05:38 +09:00
|
|
|
|
2014-03-27 05:18:53 +09:00
|
|
|
function cboxOnClick() {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const x = +this.dataset.idx;
|
2014-03-27 05:18:53 +09:00
|
|
|
if (this.checked) {
|
|
|
|
self.breakPoints.push(x);
|
|
|
|
} else {
|
|
|
|
self.breakPoints.splice(self.breakPoints.indexOf(x), 1);
|
|
|
|
}
|
|
|
|
StepperManager.saveBreakPoints(self.pageIndex, self.breakPoints);
|
|
|
|
}
|
|
|
|
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const MAX_OPERATORS_COUNT = 15000;
|
2014-03-27 05:18:53 +09:00
|
|
|
if (this.operatorListIdx > MAX_OPERATORS_COUNT) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const chunk = document.createDocumentFragment();
|
|
|
|
const operatorsToDisplay = Math.min(
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
MAX_OPERATORS_COUNT,
|
|
|
|
operatorList.fnArray.length
|
|
|
|
);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (let i = this.operatorListIdx; i < operatorsToDisplay; i++) {
|
|
|
|
const line = c("tr");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
line.className = "line";
|
2012-02-22 06:37:22 +09:00
|
|
|
line.dataset.idx = i;
|
2014-03-27 05:18:53 +09:00
|
|
|
chunk.appendChild(line);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const checked = this.breakPoints.includes(i);
|
|
|
|
const args = operatorList.argsArray[i] || [];
|
2012-02-14 10:35:58 +09:00
|
|
|
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const breakCell = c("td");
|
|
|
|
const cbox = c("input");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cbox.type = "checkbox";
|
|
|
|
cbox.className = "points";
|
2012-02-14 10:35:58 +09:00
|
|
|
cbox.checked = checked;
|
2014-03-27 05:18:53 +09:00
|
|
|
cbox.dataset.idx = i;
|
|
|
|
cbox.onclick = cboxOnClick;
|
2012-02-14 10:35:58 +09:00
|
|
|
|
|
|
|
breakCell.appendChild(cbox);
|
|
|
|
line.appendChild(breakCell);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
line.appendChild(c("td", i.toString()));
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const fn = opMap[operatorList.fnArray[i]];
|
|
|
|
let decArgs = args;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (fn === "showText") {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const glyphs = args[0];
|
2021-06-05 01:48:30 +09:00
|
|
|
const charCodeRow = c("tr");
|
|
|
|
const fontCharRow = c("tr");
|
|
|
|
const unicodeRow = c("tr");
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (let j = 0; j < glyphs.length; j++) {
|
|
|
|
const glyph = glyphs[j];
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (typeof glyph === "object" && glyph !== null) {
|
2021-06-05 01:48:30 +09:00
|
|
|
charCodeRow.appendChild(c("td", glyph.originalCharCode));
|
|
|
|
fontCharRow.appendChild(c("td", glyph.fontChar));
|
|
|
|
unicodeRow.appendChild(c("td", glyph.unicode));
|
2014-05-24 03:36:54 +09:00
|
|
|
} else {
|
2021-06-05 01:48:30 +09:00
|
|
|
// null or number
|
|
|
|
const advanceEl = c("td", glyph);
|
|
|
|
advanceEl.classList.add("advance");
|
|
|
|
charCodeRow.appendChild(advanceEl);
|
|
|
|
fontCharRow.appendChild(c("td"));
|
|
|
|
unicodeRow.appendChild(c("td"));
|
2013-08-15 07:34:55 +09:00
|
|
|
}
|
|
|
|
}
|
2021-06-05 01:48:30 +09:00
|
|
|
decArgs = c("td");
|
|
|
|
const table = c("table");
|
|
|
|
table.classList.add("showText");
|
|
|
|
decArgs.appendChild(table);
|
|
|
|
table.appendChild(charCodeRow);
|
|
|
|
table.appendChild(fontCharRow);
|
|
|
|
table.appendChild(unicodeRow);
|
2013-08-15 07:34:55 +09:00
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
line.appendChild(c("td", fn));
|
2021-06-05 01:48:30 +09:00
|
|
|
if (decArgs instanceof HTMLElement) {
|
|
|
|
line.appendChild(decArgs);
|
|
|
|
} else {
|
|
|
|
line.appendChild(c("td", JSON.stringify(simplifyArgs(decArgs))));
|
|
|
|
}
|
2014-03-27 05:18:53 +09:00
|
|
|
}
|
|
|
|
if (operatorsToDisplay < operatorList.fnArray.length) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const lastCell = c("td", "...");
|
2014-03-27 05:18:53 +09:00
|
|
|
lastCell.colspan = 4;
|
|
|
|
chunk.appendChild(lastCell);
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
2014-03-27 05:18:53 +09:00
|
|
|
this.operatorListIdx = operatorList.fnArray.length;
|
|
|
|
this.table.appendChild(chunk);
|
2021-05-04 21:29:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
getNextBreakPoint() {
|
2020-04-14 19:28:14 +09:00
|
|
|
this.breakPoints.sort(function (a, b) {
|
2017-02-03 20:58:08 +09:00
|
|
|
return a - b;
|
|
|
|
});
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (let i = 0; i < this.breakPoints.length; i++) {
|
2014-03-09 07:42:23 +09:00
|
|
|
if (this.breakPoints[i] > this.currentIdx) {
|
2012-02-14 10:35:58 +09:00
|
|
|
return this.breakPoints[i];
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
|
|
|
return null;
|
2021-05-04 21:29:05 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
breakIt(idx, callback) {
|
2012-04-13 06:02:47 +09:00
|
|
|
StepperManager.selectStepper(this.pageIndex, true);
|
2021-05-04 21:29:05 +09:00
|
|
|
this.currentIdx = idx;
|
|
|
|
|
|
|
|
const listener = evt => {
|
|
|
|
switch (evt.keyCode) {
|
2012-02-14 10:35:58 +09:00
|
|
|
case 83: // step
|
2021-05-04 21:29:05 +09:00
|
|
|
document.removeEventListener("keydown", listener);
|
|
|
|
this.nextBreakPoint = this.currentIdx + 1;
|
|
|
|
this.goTo(-1);
|
2012-02-14 10:35:58 +09:00
|
|
|
callback();
|
|
|
|
break;
|
|
|
|
case 67: // continue
|
2021-05-04 21:29:05 +09:00
|
|
|
document.removeEventListener("keydown", listener);
|
|
|
|
this.nextBreakPoint = this.getNextBreakPoint();
|
|
|
|
this.goTo(-1);
|
2012-02-14 10:35:58 +09:00
|
|
|
callback();
|
|
|
|
break;
|
|
|
|
}
|
2012-08-09 03:26:24 +09:00
|
|
|
};
|
2021-05-04 21:29:05 +09:00
|
|
|
document.addEventListener("keydown", listener);
|
|
|
|
this.goTo(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
goTo(idx) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const allRows = this.panel.getElementsByClassName("line");
|
|
|
|
for (let x = 0, xx = allRows.length; x < xx; ++x) {
|
|
|
|
const row = allRows[x];
|
2014-09-24 17:35:01 +09:00
|
|
|
if ((row.dataset.idx | 0) === idx) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
row.style.backgroundColor = "rgb(251,250,207)";
|
2012-02-22 06:37:22 +09:00
|
|
|
row.scrollIntoView();
|
|
|
|
} else {
|
|
|
|
row.style.backgroundColor = null;
|
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
2021-05-04 21:29:05 +09:00
|
|
|
}
|
|
|
|
}
|
2012-02-16 07:12:58 +09:00
|
|
|
return Stepper;
|
2012-02-14 10:35:58 +09:00
|
|
|
})();
|
|
|
|
|
2021-05-04 21:29:05 +09:00
|
|
|
// eslint-disable-next-line no-var
|
2012-02-22 02:52:09 +09:00
|
|
|
var Stats = (function Stats() {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let stats = [];
|
2012-02-22 02:52:09 +09:00
|
|
|
function clear(node) {
|
2014-03-09 07:42:23 +09:00
|
|
|
while (node.hasChildNodes()) {
|
2012-02-22 02:52:09 +09:00
|
|
|
node.removeChild(node.lastChild);
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2012-02-22 02:52:09 +09:00
|
|
|
}
|
|
|
|
function getStatIndex(pageNumber) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (let i = 0, ii = stats.length; i < ii; ++i) {
|
2014-03-09 07:42:23 +09:00
|
|
|
if (stats[i].pageNumber === pageNumber) {
|
2012-02-22 02:52:09 +09:00
|
|
|
return i;
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
|
|
|
}
|
2012-02-22 02:52:09 +09:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return {
|
2012-08-09 03:26:24 +09:00
|
|
|
// Properties/functions needed by PDFBug.
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
id: "Stats",
|
|
|
|
name: "Stats",
|
2012-02-22 02:52:09 +09:00
|
|
|
panel: null,
|
|
|
|
manager: null,
|
2020-02-06 06:02:13 +09:00
|
|
|
init(pdfjsLib) {},
|
2012-02-22 02:52:09 +09:00
|
|
|
enabled: false,
|
|
|
|
active: false,
|
|
|
|
// Stats specific functions.
|
2017-04-28 19:02:42 +09:00
|
|
|
add(pageNumber, stat) {
|
2014-03-09 07:42:23 +09:00
|
|
|
if (!stat) {
|
2012-02-22 02:52:09 +09:00
|
|
|
return;
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const statsIndex = getStatIndex(pageNumber);
|
2012-02-22 02:52:09 +09:00
|
|
|
if (statsIndex !== false) {
|
2020-03-13 20:55:00 +09:00
|
|
|
const b = stats[statsIndex];
|
2012-02-22 02:52:09 +09:00
|
|
|
this.panel.removeChild(b.div);
|
|
|
|
stats.splice(statsIndex, 1);
|
|
|
|
}
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const wrapper = document.createElement("div");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
wrapper.className = "stats";
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const title = document.createElement("div");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
title.className = "title";
|
|
|
|
title.textContent = "Page: " + pageNumber;
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const statsDiv = document.createElement("div");
|
2012-02-22 02:52:09 +09:00
|
|
|
statsDiv.textContent = stat.toString();
|
|
|
|
wrapper.appendChild(title);
|
|
|
|
wrapper.appendChild(statsDiv);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
stats.push({ pageNumber, div: wrapper });
|
2020-04-14 19:28:14 +09:00
|
|
|
stats.sort(function (a, b) {
|
2017-02-03 20:58:08 +09:00
|
|
|
return a.pageNumber - b.pageNumber;
|
|
|
|
});
|
2012-02-22 02:52:09 +09:00
|
|
|
clear(this.panel);
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (let i = 0, ii = stats.length; i < ii; ++i) {
|
2012-02-22 02:52:09 +09:00
|
|
|
this.panel.appendChild(stats[i].div);
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2014-03-27 05:18:53 +09:00
|
|
|
},
|
2017-04-28 19:02:42 +09:00
|
|
|
cleanup() {
|
2014-03-27 05:18:53 +09:00
|
|
|
stats = [];
|
|
|
|
clear(this.panel);
|
Fix inconsistent spacing and trailing commas in objects in `web/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js
index 002dbf29..1de4e530 100644
--- a/web/pdf_thumbnail_view.js
+++ b/web/pdf_thumbnail_view.js
@@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
this.pageLabel = (typeof label === 'string' ? label : null);
- this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}').
- then((msg) => {
+ this.l10n.get('thumb_page_title', { page: this.pageId, },
+ 'Page {{page}}').then((msg) => {
this.anchor.title = msg;
});
diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js
index 160e0410..6495fc5e 100644
--- a/web/secondary_toolbar.js
+++ b/web/secondary_toolbar.js
@@ -65,7 +65,8 @@ class SecondaryToolbar {
{ element: options.printButton, eventName: 'print', close: true, },
{ element: options.downloadButton, eventName: 'download', close: true, },
{ element: options.viewBookmarkButton, eventName: null, close: true, },
- { element: options.firstPageButton, eventName: 'firstpage', close: true, },
+ { element: options.firstPageButton, eventName: 'firstpage',
+ close: true, },
{ element: options.lastPageButton, eventName: 'lastpage', close: true, },
{ element: options.pageRotateCwButton, eventName: 'rotatecw',
close: false, },
@@ -76,7 +77,7 @@ class SecondaryToolbar {
{ element: options.cursorHandToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.HAND, }, close: true, },
{ element: options.documentPropertiesButton,
- eventName: 'documentproperties', close: true, }
+ eventName: 'documentproperties', close: true, },
];
this.items = {
firstPage: options.firstPageButton,
```
2017-06-01 19:46:12 +09:00
|
|
|
},
|
2012-02-22 02:52:09 +09:00
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
2012-02-14 10:35:58 +09:00
|
|
|
// Manages all the debugging tools.
|
2017-03-06 23:42:48 +09:00
|
|
|
window.PDFBug = (function PDFBugClosure() {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const panelWidth = 300;
|
|
|
|
const buttons = [];
|
|
|
|
let activePanel = null;
|
2012-02-14 10:35:58 +09:00
|
|
|
|
|
|
|
return {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
tools: [FontInspector, StepperManager, Stats],
|
2017-04-28 19:02:42 +09:00
|
|
|
enable(ids) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const all = ids.length === 1 && ids[0] === "all";
|
|
|
|
const tools = this.tools;
|
|
|
|
for (let i = 0; i < tools.length; ++i) {
|
|
|
|
const tool = tools[i];
|
2018-02-11 01:06:03 +09:00
|
|
|
if (all || ids.includes(tool.id)) {
|
2012-02-22 02:52:09 +09:00
|
|
|
tool.enabled = true;
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2012-02-22 02:52:09 +09:00
|
|
|
}
|
|
|
|
if (!all) {
|
|
|
|
// Sort the tools by the order they are enabled.
|
2020-04-14 19:28:14 +09:00
|
|
|
tools.sort(function (a, b) {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let indexA = ids.indexOf(a.id);
|
2012-02-22 02:52:09 +09:00
|
|
|
indexA = indexA < 0 ? tools.length : indexA;
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
let indexB = ids.indexOf(b.id);
|
2012-02-22 02:52:09 +09:00
|
|
|
indexB = indexB < 0 ? tools.length : indexB;
|
|
|
|
return indexA - indexB;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2017-04-28 19:02:42 +09:00
|
|
|
init(pdfjsLib, container) {
|
2012-02-14 10:35:58 +09:00
|
|
|
/*
|
|
|
|
* Basic Layout:
|
2012-02-16 07:12:58 +09:00
|
|
|
* PDFBug
|
2012-02-14 10:35:58 +09:00
|
|
|
* Controls
|
|
|
|
* Panels
|
|
|
|
* Panel
|
|
|
|
* Panel
|
|
|
|
* ...
|
|
|
|
*/
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const ui = document.createElement("div");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
ui.id = "PDFBug";
|
2012-02-14 10:35:58 +09:00
|
|
|
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const controls = document.createElement("div");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
controls.setAttribute("class", "controls");
|
2012-02-14 10:35:58 +09:00
|
|
|
ui.appendChild(controls);
|
|
|
|
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const panels = document.createElement("div");
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
panels.setAttribute("class", "panels");
|
2012-02-14 10:35:58 +09:00
|
|
|
ui.appendChild(panels);
|
|
|
|
|
2012-04-27 04:35:52 +09:00
|
|
|
container.appendChild(ui);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
container.style.right = panelWidth + "px";
|
2012-02-14 10:35:58 +09:00
|
|
|
|
|
|
|
// Initialize all the debugging tools.
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const tools = this.tools;
|
|
|
|
const self = this;
|
|
|
|
for (let i = 0; i < tools.length; ++i) {
|
|
|
|
const tool = tools[i];
|
|
|
|
const panel = document.createElement("div");
|
|
|
|
const panelButton = document.createElement("button");
|
2012-02-14 10:35:58 +09:00
|
|
|
panelButton.textContent = tool.name;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
panelButton.addEventListener(
|
|
|
|
"click",
|
2020-04-14 19:28:14 +09:00
|
|
|
(function (selected) {
|
|
|
|
return function (event) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
event.preventDefault();
|
|
|
|
self.selectPanel(selected);
|
|
|
|
};
|
|
|
|
})(i)
|
|
|
|
);
|
2012-02-14 10:35:58 +09:00
|
|
|
controls.appendChild(panelButton);
|
|
|
|
panels.appendChild(panel);
|
|
|
|
tool.panel = panel;
|
|
|
|
tool.manager = this;
|
2014-03-09 07:42:23 +09:00
|
|
|
if (tool.enabled) {
|
2016-04-09 04:15:48 +09:00
|
|
|
tool.init(pdfjsLib);
|
2014-03-09 07:42:23 +09:00
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
panel.textContent =
|
|
|
|
tool.name +
|
|
|
|
" is disabled. To enable add " +
|
|
|
|
' "' +
|
|
|
|
tool.id +
|
|
|
|
'" to the pdfBug parameter ' +
|
|
|
|
"and refresh (separate multiple by commas).";
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
buttons.push(panelButton);
|
|
|
|
}
|
|
|
|
this.selectPanel(0);
|
|
|
|
},
|
2017-04-28 19:02:42 +09:00
|
|
|
cleanup() {
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
for (let i = 0, ii = this.tools.length; i < ii; i++) {
|
2014-03-27 05:18:53 +09:00
|
|
|
if (this.tools[i].enabled) {
|
|
|
|
this.tools[i].cleanup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2017-04-28 19:02:42 +09:00
|
|
|
selectPanel(index) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (typeof index !== "number") {
|
2014-03-27 05:18:53 +09:00
|
|
|
index = this.tools.indexOf(index);
|
|
|
|
}
|
2014-03-09 07:42:23 +09:00
|
|
|
if (index === activePanel) {
|
2012-02-14 10:35:58 +09:00
|
|
|
return;
|
2014-03-09 07:42:23 +09:00
|
|
|
}
|
2012-02-14 10:35:58 +09:00
|
|
|
activePanel = index;
|
[web/debugger.js] Enable the ESLint `no-var` rule
These changes were made *mostly* automatically, using `gulp lint --fix`, with the following manual changes:
```diff
diff --git a/web/debugger.js b/web/debugger.js
index 1cda4066e..6f8b4a9f0 100644
--- a/web/debugger.js
+++ b/web/debugger.js
@@ -264,10 +264,9 @@ const Stepper = (function StepperClosure() {
}
if ("length" in args) {
// array
- let simpleArgs = [],
- i,
- ii;
- const MAX_ITEMS = 10;
+ const MAX_ITEMS = 10,
+ simpleArgs = [];
+ let i, ii;
for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) {
simpleArgs.push(simplifyArgs(args[i]));
}
@@ -511,11 +510,8 @@ window.PDFBug = (function PDFBugClosure() {
return {
tools: [FontInspector, StepperManager, Stats],
enable(ids) {
- let all = false,
- tools = this.tools;
- if (ids.length === 1 && ids[0] === "all") {
- all = true;
- }
+ const all = ids.length === 1 && ids[0] === "all";
+ const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
if (all || ids.includes(tool.id)) {
```
2021-05-04 21:37:16 +09:00
|
|
|
const tools = this.tools;
|
|
|
|
for (let j = 0; j < tools.length; ++j) {
|
|
|
|
const isActive = j === index;
|
2021-02-08 08:21:49 +09:00
|
|
|
buttons[j].classList.toggle("active", isActive);
|
|
|
|
tools[j].active = isActive;
|
|
|
|
tools[j].panel.hidden = !isActive;
|
2012-02-14 10:35:58 +09:00
|
|
|
}
|
Fix inconsistent spacing and trailing commas in objects in `web/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js
index 002dbf29..1de4e530 100644
--- a/web/pdf_thumbnail_view.js
+++ b/web/pdf_thumbnail_view.js
@@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
this.pageLabel = (typeof label === 'string' ? label : null);
- this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}').
- then((msg) => {
+ this.l10n.get('thumb_page_title', { page: this.pageId, },
+ 'Page {{page}}').then((msg) => {
this.anchor.title = msg;
});
diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js
index 160e0410..6495fc5e 100644
--- a/web/secondary_toolbar.js
+++ b/web/secondary_toolbar.js
@@ -65,7 +65,8 @@ class SecondaryToolbar {
{ element: options.printButton, eventName: 'print', close: true, },
{ element: options.downloadButton, eventName: 'download', close: true, },
{ element: options.viewBookmarkButton, eventName: null, close: true, },
- { element: options.firstPageButton, eventName: 'firstpage', close: true, },
+ { element: options.firstPageButton, eventName: 'firstpage',
+ close: true, },
{ element: options.lastPageButton, eventName: 'lastpage', close: true, },
{ element: options.pageRotateCwButton, eventName: 'rotatecw',
close: false, },
@@ -76,7 +77,7 @@ class SecondaryToolbar {
{ element: options.cursorHandToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.HAND, }, close: true, },
{ element: options.documentPropertiesButton,
- eventName: 'documentproperties', close: true, }
+ eventName: 'documentproperties', close: true, },
];
this.items = {
firstPage: options.firstPageButton,
```
2017-06-01 19:46:12 +09:00
|
|
|
},
|
2012-02-14 10:35:58 +09:00
|
|
|
};
|
|
|
|
})();
|