single-file-core 1.5.44 → 1.5.45
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/index.js +1 -2
- package/core/infobar.js +25 -4
- package/core/lib/processor-helper-inline.js +3 -1
- package/core/lib/processor-helper.js +3 -1
- package/modules/html-serializer.js +2 -2
- package/modules/template-formatter.js +2 -0
- package/package.json +1 -1
- package/single-file-infobar.js +5 -0
package/core/index.js
CHANGED
|
@@ -1653,14 +1653,13 @@ function normalizeURL(url) {
|
|
|
1653
1653
|
}
|
|
1654
1654
|
|
|
1655
1655
|
function getOnEventAttributeNames(doc) {
|
|
1656
|
-
const element = doc.createElement("div");
|
|
1656
|
+
const element = doc.body || doc.createElement("div");
|
|
1657
1657
|
const attributeNames = [];
|
|
1658
1658
|
for (const propertyName in element) {
|
|
1659
1659
|
if (propertyName.startsWith("on")) {
|
|
1660
1660
|
attributeNames.push(propertyName);
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
|
-
attributeNames.push("onunload");
|
|
1664
1663
|
return attributeNames;
|
|
1665
1664
|
}
|
|
1666
1665
|
|
package/core/infobar.js
CHANGED
|
@@ -103,7 +103,6 @@ const INFOBAR_STYLES = `
|
|
|
103
103
|
white-space: pre-wrap;
|
|
104
104
|
margin-inline: 4px;
|
|
105
105
|
margin-block: 4px;
|
|
106
|
-
padding-inline: 24px;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
.infobar .infobar-icon,
|
|
@@ -116,7 +115,6 @@ const INFOBAR_STYLES = `
|
|
|
116
115
|
|
|
117
116
|
.infobar .infobar-close-icon,
|
|
118
117
|
.infobar .infobar-link-icon {
|
|
119
|
-
position: fixed;
|
|
120
118
|
align-self: flex-start;
|
|
121
119
|
}
|
|
122
120
|
|
|
@@ -153,7 +151,7 @@ const INFOBAR_STYLES = `
|
|
|
153
151
|
}
|
|
154
152
|
|
|
155
153
|
.infobar .infobar-link-icon {
|
|
156
|
-
right:
|
|
154
|
+
right: 4px;
|
|
157
155
|
background-size: 60%;
|
|
158
156
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8H+DhhoQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJJJREFUOI3t070NRCEMA2CnYAOyDyPwpHj/Va7hJ3FzV7zy3ET5JIwoAF6Jk4wzAJAkzxAYG9YRTgB+24wBgKmfrGAKTcEfAY4KRlRoIeBTgKOCERVaCPgU4Khge2GqKOBTgKOCERVaAEC/4PNcnyoSWHpjqkhwKxbcig0Q6AorXYF/+A6eIYD1lVbwG/jdA6/kA2THRAURVubcAAAAAElFTkSuQmCC);
|
|
159
157
|
}
|
|
@@ -189,7 +187,25 @@ function appendInfobar(doc, options, useShadowRoot) {
|
|
|
189
187
|
}
|
|
190
188
|
const shadowRootContent = doc.createElement("div");
|
|
191
189
|
const styleElement = doc.createElement("style");
|
|
192
|
-
styleElement.textContent = INFOBAR_STYLES
|
|
190
|
+
styleElement.textContent = INFOBAR_STYLES;
|
|
191
|
+
if (options.infobarPositionAbsolute) {
|
|
192
|
+
styleElement.textContent += `.infobar { position: absolute; }`;
|
|
193
|
+
const parentElementStyle = getComputedStyle(parentElement);
|
|
194
|
+
if (parentElementStyle.position == "static") {
|
|
195
|
+
parentElement.style.setProperty("position", "relative", "important");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (options.infobarPositionTop) {
|
|
199
|
+
styleElement.textContent += `.infobar { top: ${options.infobarPositionTop}; bottom: auto; }`;
|
|
200
|
+
} else if (options.infobarPositionBottom) {
|
|
201
|
+
styleElement.textContent += `.infobar { bottom: ${options.infobarPositionBottom}; top: auto; }`;
|
|
202
|
+
}
|
|
203
|
+
if (options.infobarPositionRight) {
|
|
204
|
+
styleElement.textContent += `.infobar { right: ${options.infobarPositionRight}; left: auto; }`;
|
|
205
|
+
} else if (options.infobarPositionLeft) {
|
|
206
|
+
styleElement.textContent += `.infobar { left: ${options.infobarPositionLeft}; right: auto; }`;
|
|
207
|
+
}
|
|
208
|
+
styleElement.textContent = styleElement.textContent
|
|
193
209
|
.replace(/ {2}/g, "")
|
|
194
210
|
.replace(/\n/g, "")
|
|
195
211
|
.replace(/: /g, ":")
|
|
@@ -284,6 +300,11 @@ function displayIcon(doc, useShadowRoot, options = {}) {
|
|
|
284
300
|
const infoData = extractInfobarData(doc);
|
|
285
301
|
if (infoData.saveUrl) {
|
|
286
302
|
infoData.openInfobar = options.openInfobar;
|
|
303
|
+
infoData.infobarPositionAbsolute = options.infobarPositionAbsolute;
|
|
304
|
+
infoData.infobarPositionTop = options.infobarPositionTop;
|
|
305
|
+
infoData.infobarPositionRight = options.infobarPositionRight;
|
|
306
|
+
infoData.infobarPositionBottom = options.infobarPositionBottom;
|
|
307
|
+
infoData.infobarPositionLeft = options.infobarPositionLeft;
|
|
287
308
|
appendInfobar(doc, infoData, useShadowRoot);
|
|
288
309
|
refreshInfobarInfo(doc, infoData);
|
|
289
310
|
}
|
|
@@ -416,7 +416,9 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
416
416
|
if (forbiddenPrefixFound) {
|
|
417
417
|
return "";
|
|
418
418
|
}
|
|
419
|
-
return content + (srcsetValue.w ? " " + srcsetValue.w + "w" :
|
|
419
|
+
return content + (srcsetValue.w ? " " + srcsetValue.w + "w" :
|
|
420
|
+
srcsetValue.h ? " " + srcsetValue.h + "h" :
|
|
421
|
+
srcsetValue.d ? " " + srcsetValue.d + "x" : "");
|
|
420
422
|
}
|
|
421
423
|
|
|
422
424
|
testEmptyResource(resource) {
|
|
@@ -364,7 +364,9 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
364
364
|
const { content, indexResource, extension, contentType } = await batchRequest.addURL(resourceURL, { asBinary: true, expectedType: "image" });
|
|
365
365
|
const name = "images/" + indexResource + extension;
|
|
366
366
|
resources.images.set(indexResource, { name, content, extension, contentType, url: resourceURL });
|
|
367
|
-
return name + (srcsetValue.w ? " " + srcsetValue.w + "w" :
|
|
367
|
+
return name + (srcsetValue.w ? " " + srcsetValue.w + "w" :
|
|
368
|
+
srcsetValue.h ? " " + srcsetValue.h + "h" :
|
|
369
|
+
srcsetValue.d ? " " + srcsetValue.d + "x" : "");
|
|
368
370
|
}
|
|
369
371
|
|
|
370
372
|
testEmptyResource(resource) {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const VOID_TAG_NAMES = ["AREA", "BASE", "BASEFONT", "BGSOUND", "BR", "COL", "COMMAND", "EMBED", "FRAME", "HR", "IMG", "INPUT", "KEYGEN", "LINK", "META", "PARAM", "SOURCE", "TRACK", "WBR"];
|
|
25
25
|
|
|
26
26
|
const Node_ELEMENT_NODE = 1;
|
|
27
27
|
const Node_TEXT_NODE = 3;
|
|
@@ -122,7 +122,7 @@ function serializeElement(element, compressHTML, isSVG) {
|
|
|
122
122
|
Array.from(element.childNodes).forEach(childNode => content += serialize(childNode, compressHTML, isSVG || tagName == "svg"));
|
|
123
123
|
}
|
|
124
124
|
const omittedEndTag = compressHTML && OMITTED_END_TAGS.find(omittedEndTag => tagName == getTagName(omittedEndTag) && omittedEndTag.accept(element.nextSibling, element));
|
|
125
|
-
if (isSVG || (!omittedEndTag && !
|
|
125
|
+
if (isSVG || (!omittedEndTag && !VOID_TAG_NAMES.includes(tagName))) {
|
|
126
126
|
content += "</" + tagName.toLowerCase() + ">";
|
|
127
127
|
}
|
|
128
128
|
return content;
|
|
@@ -17017,6 +17017,8 @@ async function evalTemplate(template = "", options, content, doc, context = {})
|
|
|
17017
17017
|
return subdomains[subdomains.length - index - 1];
|
|
17018
17018
|
},
|
|
17019
17019
|
"stringify": value => { try { return JSON.stringify(value); } catch (error) { return value; } },
|
|
17020
|
+
"encode-base64": value => { try { return btoa(value); } catch (error) { return value; } },
|
|
17021
|
+
"decode-base64": value => { try { return atob(value); } catch (error) { return value; } },
|
|
17020
17022
|
"encode-uri": value => { try { return encodeURI(value); } catch (error) { return value; } },
|
|
17021
17023
|
"decode-uri": value => { try { return decodeURI(value); } catch (error) { return value; } },
|
|
17022
17024
|
"encode-uri-component": value => { try { return encodeURIComponent(value); } catch (error) { return value; } },
|
package/package.json
CHANGED
package/single-file-infobar.js
CHANGED
|
@@ -61,6 +61,11 @@ import { appendInfobar, refreshInfobarInfo, extractInfobarData } from "./core/in
|
|
|
61
61
|
}
|
|
62
62
|
if (options.displayInfobar) {
|
|
63
63
|
infoData.openInfobar = options.openInfobar;
|
|
64
|
+
infoData.infobarPositionAbsolute = options.infobarPositionAbsolute;
|
|
65
|
+
infoData.infobarPositionTop = options.infobarPositionTop;
|
|
66
|
+
infoData.infobarPositionRight = options.infobarPositionRight;
|
|
67
|
+
infoData.infobarPositionBottom = options.infobarPositionBottom;
|
|
68
|
+
infoData.infobarPositionLeft = options.infobarPositionLeft;
|
|
64
69
|
appendInfobar(document, infoData, true);
|
|
65
70
|
refreshInfobarInfo(document, infoData);
|
|
66
71
|
}
|