mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Merge pull request #20699 from Snuffleupagus/scripting-shorter
Slightly shorten some code in the `src/scripting_api/` folder
This commit is contained in:
commit
b798fd8771
@ -152,13 +152,10 @@ class App extends PDFObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static _getLanguage(language) {
|
static _getLanguage(language) {
|
||||||
const [main, sub] = language.toLowerCase().split(/[-_]/);
|
const [main, sub] = language.toLowerCase().split(/[-_]/, 2);
|
||||||
switch (main) {
|
switch (main) {
|
||||||
case "zh":
|
case "zh":
|
||||||
if (sub === "cn" || sub === "sg") {
|
return sub === "cn" || sub === "sg" ? "CHS" : "CHT";
|
||||||
return "CHS";
|
|
||||||
}
|
|
||||||
return "CHT";
|
|
||||||
case "da":
|
case "da":
|
||||||
return "DAN";
|
return "DAN";
|
||||||
case "de":
|
case "de":
|
||||||
@ -178,10 +175,7 @@ class App extends PDFObject {
|
|||||||
case "no":
|
case "no":
|
||||||
return "NOR";
|
return "NOR";
|
||||||
case "pt":
|
case "pt":
|
||||||
if (sub === "br") {
|
return sub === "br" ? "PTB" : "ENU";
|
||||||
return "PTB";
|
|
||||||
}
|
|
||||||
return "ENU";
|
|
||||||
case "fi":
|
case "fi":
|
||||||
return "SUO";
|
return "SUO";
|
||||||
case "SV":
|
case "SV":
|
||||||
@ -249,13 +243,10 @@ class App extends PDFObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fs() {
|
get fs() {
|
||||||
if (this._fs === null) {
|
return (this._fs ??= new Proxy(
|
||||||
this._fs = new Proxy(
|
new FullScreen({ send: this._send }),
|
||||||
new FullScreen({ send: this._send }),
|
this._proxyHandler
|
||||||
this._proxyHandler
|
));
|
||||||
);
|
|
||||||
}
|
|
||||||
return this._fs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set fs(_) {
|
set fs(_) {
|
||||||
@ -356,13 +347,10 @@ class App extends PDFObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get thermometer() {
|
get thermometer() {
|
||||||
if (this._thermometer === null) {
|
return (this._thermometer ??= new Proxy(
|
||||||
this._thermometer = new Proxy(
|
new Thermometer({ send: this._send }),
|
||||||
new Thermometer({ send: this._send }),
|
this._proxyHandler
|
||||||
this._proxyHandler
|
));
|
||||||
);
|
|
||||||
}
|
|
||||||
return this._thermometer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set thermometer(_) {
|
set thermometer(_) {
|
||||||
|
|||||||
@ -453,11 +453,9 @@ class Field extends PDFObject {
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._children === null) {
|
return (this._children ??= this._document.obj._getTerminalChildren(
|
||||||
this._children = this._document.obj._getTerminalChildren(this._fieldPath);
|
this._fieldPath
|
||||||
}
|
));
|
||||||
|
|
||||||
return this._children;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLock() {
|
getLock() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user