single-file-core 1.5.46 → 1.5.47
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/infobar.js +7 -8
- package/package.json +2 -2
package/core/infobar.js
CHANGED
|
@@ -245,10 +245,9 @@ function appendInfobar(doc, options, useShadowRoot) {
|
|
|
245
245
|
infobarContainer.appendChild(shadowRootContent);
|
|
246
246
|
} else {
|
|
247
247
|
const scriptElement = doc.createElement("script");
|
|
248
|
-
let scriptContent = refreshInfobarInfo.toString();
|
|
249
|
-
scriptContent +=
|
|
250
|
-
scriptContent +=
|
|
251
|
-
scriptContent += "(" + initInfobar.toString() + ")(document)";
|
|
248
|
+
let scriptContent = refreshInfobarInfo.toString() + ";";
|
|
249
|
+
scriptContent += extractInfobarData.toString() + ";";
|
|
250
|
+
scriptContent += "(" + initInfobar.toString() + ")(document, " + JSON.stringify(options) + ");";
|
|
252
251
|
scriptElement.textContent = scriptContent;
|
|
253
252
|
shadowRootContent.appendChild(scriptElement);
|
|
254
253
|
infobarContainer.innerHTML = shadowRootContent.outerHTML;
|
|
@@ -256,10 +255,10 @@ function appendInfobar(doc, options, useShadowRoot) {
|
|
|
256
255
|
}
|
|
257
256
|
}
|
|
258
257
|
|
|
259
|
-
function extractInfobarData(doc) {
|
|
258
|
+
function extractInfobarData(doc, signature = SINGLE_FILE_SIGNATURE) {
|
|
260
259
|
const result = doc.evaluate("//comment()", doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
|
|
261
260
|
let singleFileComment = result && result.singleNodeValue;
|
|
262
|
-
if (singleFileComment && singleFileComment.nodeType == Node.COMMENT_NODE && singleFileComment.textContent.includes(
|
|
261
|
+
if (singleFileComment && singleFileComment.nodeType == Node.COMMENT_NODE && singleFileComment.textContent.includes(signature)) {
|
|
263
262
|
const info = singleFileComment.textContent.split("\n");
|
|
264
263
|
const [, , urlData, ...optionalData] = info;
|
|
265
264
|
const urlMatch = urlData.match(/^ url: (.*) ?$/);
|
|
@@ -310,8 +309,8 @@ function displayIcon(doc, useShadowRoot, options = {}) {
|
|
|
310
309
|
}
|
|
311
310
|
}
|
|
312
311
|
|
|
313
|
-
function initInfobar(doc) {
|
|
314
|
-
const infoData = extractInfobarData(doc);
|
|
312
|
+
function initInfobar(doc, signature) {
|
|
313
|
+
const infoData = extractInfobarData(doc, signature);
|
|
315
314
|
if (infoData && infoData.saveUrl) {
|
|
316
315
|
refreshInfobarInfo(doc, infoData);
|
|
317
316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "single-file-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.47",
|
|
4
4
|
"description": "SingleFile Core",
|
|
5
5
|
"author": "Gildas Lormeau",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "https://github.com/gildas-lormeau/single-file-core/issues"
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/gildas-lormeau/single-file-core#readme",
|
|
18
|
-
"
|
|
18
|
+
"devDependencies": {
|
|
19
19
|
"eslint": "^9.20.1"
|
|
20
20
|
}
|
|
21
21
|
}
|