single-file-core 1.2.40 → 1.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/helper.js +2 -1
- package/core/index.js +28 -29
- package/package.json +1 -1
- package/vendor/zip/zip.js +2 -2
package/core/helper.js
CHANGED
|
@@ -61,6 +61,7 @@ const INVALID_ELEMENT_ATTRIBUTE_NAME = "data-" + SINGLE_FILE_PREFIX + "invalid-e
|
|
|
61
61
|
const ASYNC_SCRIPT_ATTRIBUTE_NAME = "data-" + SINGLE_FILE_PREFIX + "async-script";
|
|
62
62
|
const FLOW_ELEMENTS_SELECTOR = "*:not(base):not(link):not(meta):not(noscript):not(script):not(style):not(template):not(title)";
|
|
63
63
|
const KEPT_TAG_NAMES = ["NOSCRIPT", "DISABLED-NOSCRIPT", "META", "LINK", "STYLE", "TITLE", "TEMPLATE", "SOURCE", "OBJECT", "SCRIPT", "HEAD", "BODY"];
|
|
64
|
+
const IGNORED_TAG_NAMES = ["SCRIPT", "NOSCRIPT", "META", "LINK", "TEMPLATE"];
|
|
64
65
|
const REGEXP_SIMPLE_QUOTES_STRING = /^'(.*?)'$/;
|
|
65
66
|
const REGEXP_DOUBLE_QUOTES_STRING = /^"(.*?)"$/;
|
|
66
67
|
const FONT_WEIGHTS = {
|
|
@@ -219,7 +220,7 @@ function getElementsInfo(win, doc, element, options, data = { usedFonts: new Map
|
|
|
219
220
|
elementKept = ((ascendantHidden || element.closest("html > head")) && KEPT_TAG_NAMES.includes(element.tagName.toUpperCase())) || element.closest("details");
|
|
220
221
|
if (!elementKept) {
|
|
221
222
|
elementHidden = ascendantHidden || testHiddenElement(element, computedStyle);
|
|
222
|
-
if (elementHidden) {
|
|
223
|
+
if (elementHidden && !IGNORED_TAG_NAMES.includes(element.tagName.toUpperCase())) {
|
|
223
224
|
element.setAttribute(HIDDEN_CONTENT_ATTRIBUTE_NAME, "");
|
|
224
225
|
data.markedElements.push(element);
|
|
225
226
|
}
|
package/core/index.js
CHANGED
|
@@ -503,7 +503,7 @@ class Processor {
|
|
|
503
503
|
const info = this.doc.documentElement.firstChild.textContent.split("\n");
|
|
504
504
|
try {
|
|
505
505
|
const [, , url, saveDate] = info;
|
|
506
|
-
infobarURL = url.split("url: ")[1];
|
|
506
|
+
infobarURL = url.split("url: ")[1].trim();
|
|
507
507
|
infobarSaveDate = saveDate.split("saved date: ")[1];
|
|
508
508
|
firstComment.remove();
|
|
509
509
|
} catch (error) {
|
|
@@ -651,34 +651,33 @@ class Processor {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
saveFilenameTemplateData() {
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
this.doc.body.appendChild(optionsElement);
|
|
654
|
+
const optionsElement = this.doc.querySelector("script[" + SCRIPT_OPTIONS + "][type=\"application/json\"]");
|
|
655
|
+
if (!optionsElement) {
|
|
656
|
+
const optionsElement = this.doc.createElement("script");
|
|
657
|
+
optionsElement.type = "application/json";
|
|
658
|
+
optionsElement.setAttribute(SCRIPT_OPTIONS, "");
|
|
659
|
+
optionsElement.textContent = JSON.stringify({
|
|
660
|
+
saveUrl: this.options.url,
|
|
661
|
+
saveDate: this.options.saveDate.getTime(),
|
|
662
|
+
visitDate: this.options.visitDate.getTime(),
|
|
663
|
+
filenameTemplate: this.options.filenameTemplate,
|
|
664
|
+
filenameReplacedCharacters: this.options.filenameReplacedCharacters,
|
|
665
|
+
filenameReplacementCharacter: this.options.filenameReplacementCharacter,
|
|
666
|
+
filenameMaxLengthUnit: this.options.filenameMaxLengthUnit,
|
|
667
|
+
filenameMaxLength: this.options.filenameMaxLength,
|
|
668
|
+
replaceEmojisInFilename: this.options.replaceEmojisInFilename,
|
|
669
|
+
compressContent: this.options.compressContent,
|
|
670
|
+
selfExtractingArchive: this.options.selfExtractingArchive,
|
|
671
|
+
extractDataFromPage: this.options.extractDataFromPage,
|
|
672
|
+
referrer: this.options.referrer,
|
|
673
|
+
title: this.options.title,
|
|
674
|
+
info: this.options.info
|
|
675
|
+
});
|
|
676
|
+
if (this.doc.body.firstChild) {
|
|
677
|
+
this.doc.body.insertBefore(optionsElement, this.doc.body.firstChild);
|
|
678
|
+
} else {
|
|
679
|
+
this.doc.body.appendChild(optionsElement);
|
|
680
|
+
}
|
|
682
681
|
}
|
|
683
682
|
}
|
|
684
683
|
|
package/package.json
CHANGED
package/vendor/zip/zip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder,
|
|
1
|
+
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = globalThis;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
@@ -4940,7 +4940,7 @@ function getLength(...arrayLikes) {
|
|
|
4940
4940
|
derived from this software without specific prior written permission.
|
|
4941
4941
|
|
|
4942
4942
|
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4943
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
4943
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WA RRANTIES OF MERCHANTABILITY AND
|
|
4944
4944
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4945
4945
|
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4946
4946
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|