single-file-core 1.1.78 → 1.2.0
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/constants.js +3 -1
- package/core/helper.js +9 -2
- package/core/index.js +61 -751
- package/core/infobar.js +1 -1
- package/core/lib/processor-helper-common.js +323 -0
- package/core/lib/processor-helper-inline.js +876 -0
- package/core/lib/processor-helper.js +801 -0
- package/core/processor-helper.js +34 -0
- package/core/util.js +48 -13
- package/modules/css-fonts-minifier.js +41 -18
- package/modules/index.js +0 -2
- package/package.json +1 -1
- package/processors/compression/compression-display.js +74 -0
- package/processors/compression/compression-extract.js +151 -0
- package/processors/compression/compression.js +305 -0
- package/processors/hooks/content/content-hooks-frames.js +4 -3
- package/processors/index.js +2 -0
- package/single-file-infobar.js +1 -0
- package/single-file.js +24 -2
- package/vendor/index.js +2 -2
- package/vendor/zip/z-worker.js +1 -0
- package/vendor/zip/zip.js +4955 -0
- package/vendor/zip/zip.min.js +1 -0
- package/modules/css-fonts-alt-minifier.js +0 -343
package/core/constants.js
CHANGED
|
@@ -3,11 +3,13 @@ const COMMENT_HEADER = "Page saved with SingleFile";
|
|
|
3
3
|
const SINGLE_FILE_SIGNATURE = "SingleFile";
|
|
4
4
|
const WAIT_FOR_USERSCRIPT_PROPERTY_NAME = "_singleFile_waitForUserScript";
|
|
5
5
|
const MESSAGE_PREFIX = "__frameTree__::";
|
|
6
|
+
const NO_SCRIPT_PROPERTY_NAME = "singleFileDisabledNoscript";
|
|
6
7
|
|
|
7
8
|
export {
|
|
8
9
|
SINGLE_FILE_PREFIX,
|
|
9
10
|
COMMENT_HEADER,
|
|
10
11
|
SINGLE_FILE_SIGNATURE,
|
|
11
12
|
WAIT_FOR_USERSCRIPT_PROPERTY_NAME,
|
|
12
|
-
MESSAGE_PREFIX
|
|
13
|
+
MESSAGE_PREFIX,
|
|
14
|
+
NO_SCRIPT_PROPERTY_NAME
|
|
13
15
|
};
|
package/core/helper.js
CHANGED
|
@@ -30,7 +30,8 @@ import {
|
|
|
30
30
|
SINGLE_FILE_PREFIX,
|
|
31
31
|
COMMENT_HEADER,
|
|
32
32
|
WAIT_FOR_USERSCRIPT_PROPERTY_NAME,
|
|
33
|
-
MESSAGE_PREFIX
|
|
33
|
+
MESSAGE_PREFIX,
|
|
34
|
+
NO_SCRIPT_PROPERTY_NAME
|
|
34
35
|
} from "./constants.js";
|
|
35
36
|
|
|
36
37
|
const ON_BEFORE_CAPTURE_EVENT_NAME = SINGLE_FILE_PREFIX + "on-before-capture";
|
|
@@ -114,7 +115,8 @@ export {
|
|
|
114
115
|
EMPTY_RESOURCE,
|
|
115
116
|
INFOBAR_TAGNAME,
|
|
116
117
|
WAIT_FOR_USERSCRIPT_PROPERTY_NAME,
|
|
117
|
-
MESSAGE_PREFIX
|
|
118
|
+
MESSAGE_PREFIX,
|
|
119
|
+
NO_SCRIPT_PROPERTY_NAME
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
function initUserScriptHandler() {
|
|
@@ -451,6 +453,11 @@ function postProcessDoc(doc, markedElements, invalidElements) {
|
|
|
451
453
|
doc.querySelectorAll("[" + DISABLED_NOSCRIPT_ATTRIBUTE_NAME + "]").forEach(element => {
|
|
452
454
|
element.textContent = element.getAttribute(DISABLED_NOSCRIPT_ATTRIBUTE_NAME);
|
|
453
455
|
element.removeAttribute(DISABLED_NOSCRIPT_ATTRIBUTE_NAME);
|
|
456
|
+
if (doc.body.firstChild) {
|
|
457
|
+
doc.body.insertBefore(element, doc.body.firstChild);
|
|
458
|
+
} else {
|
|
459
|
+
doc.body.appendChild(element);
|
|
460
|
+
}
|
|
454
461
|
});
|
|
455
462
|
doc.querySelectorAll("meta[disabled-http-equiv]").forEach(element => {
|
|
456
463
|
element.setAttribute("http-equiv", element.getAttribute("disabled-http-equiv"));
|