single-file-core 1.5.11 → 1.5.13
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
CHANGED
|
@@ -75,11 +75,11 @@ const INFOBAR_STYLES = `
|
|
|
75
75
|
animation-iteration-count: 2;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.infobar:valid, .infobar:not(:focus-within) .infobar-content {
|
|
78
|
+
.infobar:valid, .infobar:not(:focus-within):not(.infobar-focus) .infobar-content {
|
|
79
79
|
display: none;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.infobar:focus-within {
|
|
82
|
+
.infobar:focus-within, .infobar.infobar-focus {
|
|
83
83
|
background-color: #f9f9f9;
|
|
84
84
|
border-color: #878787;
|
|
85
85
|
border-radius: 8px;
|
|
@@ -135,9 +135,10 @@ const INFOBAR_STYLES = `
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.infobar:focus-within .infobar-icon {
|
|
138
|
+
.infobar:focus-within .infobar-icon, .infobar.infobar-focus .infobar-icon {
|
|
139
139
|
z-index: -1;
|
|
140
140
|
background-image: none;
|
|
141
|
+
margin: 4px;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
.infobar .infobar-close-icon {
|
|
@@ -196,6 +197,9 @@ function appendInfobar(doc, options, useShadowRoot) {
|
|
|
196
197
|
shadowRootContent.appendChild(styleElement);
|
|
197
198
|
const infobarContent = doc.createElement("form");
|
|
198
199
|
infobarContent.classList.add("infobar");
|
|
200
|
+
if (options.openInfobar) {
|
|
201
|
+
infobarContent.classList.add("infobar-focus");
|
|
202
|
+
}
|
|
199
203
|
shadowRootContent.appendChild(infobarContent);
|
|
200
204
|
const iconElement = doc.createElement("span");
|
|
201
205
|
iconElement.tabIndex = -1;
|
|
@@ -276,9 +280,10 @@ function refreshInfobarInfo(doc, { saveUrl, infobarContent, saveDate }) {
|
|
|
276
280
|
}
|
|
277
281
|
}
|
|
278
282
|
|
|
279
|
-
function displayIcon(doc, useShadowRoot) {
|
|
283
|
+
function displayIcon(doc, useShadowRoot, options = {}) {
|
|
280
284
|
const infoData = extractInfobarData(doc);
|
|
281
285
|
if (infoData.saveUrl) {
|
|
286
|
+
infoData.openInfobar = options.openInfobar;
|
|
282
287
|
appendInfobar(doc, infoData, useShadowRoot);
|
|
283
288
|
refreshInfobarInfo(doc, infoData);
|
|
284
289
|
}
|
|
@@ -72,7 +72,7 @@ function matchesMediaType(mediaText) {
|
|
|
72
72
|
const foundMediaTypes = helper.flatten(mediaQueryParser.parseMediaList(mediaText).map(node => getMediaTypes(node)));
|
|
73
73
|
return foundMediaTypes.find(mediaTypeInfo =>
|
|
74
74
|
(!mediaTypeInfo.not && (mediaTypeInfo.value == MEDIA_SCREEN || mediaTypeInfo.value == MEDIA_ALL)) ||
|
|
75
|
-
(mediaTypeInfo.not && (mediaTypeInfo.value != MEDIA_SCREEN
|
|
75
|
+
(mediaTypeInfo.not && (mediaTypeInfo.value != MEDIA_SCREEN)));
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
function getMediaTypes(parentNode, mediaTypes = []) {
|
|
@@ -94,7 +94,7 @@ function serializeTextNode(textNode) {
|
|
|
94
94
|
parentTagName = getTagName(parentNode);
|
|
95
95
|
}
|
|
96
96
|
if (!parentTagName || TEXT_NODE_TAGS.includes(parentTagName)) {
|
|
97
|
-
if (parentTagName == "SCRIPT" || parentTagName == "STYLE") {
|
|
97
|
+
if ((parentTagName == "SCRIPT" && (!parentNode.type || parentNode.type == "text/javascript")) || parentTagName == "STYLE") {
|
|
98
98
|
return textNode.textContent.replace(/<\//gi, "<\\/").replace(/\/>/gi, "\\/>");
|
|
99
99
|
}
|
|
100
100
|
return textNode.textContent;
|
|
@@ -180,5 +180,5 @@ function startsWithSpaceChar(textContent) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
function getTagName(element) {
|
|
183
|
-
return
|
|
183
|
+
return element.tagName && element.tagName.toUpperCase();
|
|
184
184
|
}
|
package/package.json
CHANGED
|
@@ -43,8 +43,8 @@ const helper = {
|
|
|
43
43
|
extractInfobarData(doc) {
|
|
44
44
|
return infobar.extractInfobarData(doc);
|
|
45
45
|
},
|
|
46
|
-
displayIcon(doc, useShadowRoot) {
|
|
47
|
-
return infobar.displayIcon(doc, useShadowRoot);
|
|
46
|
+
displayIcon(doc, useShadowRoot, options = {}) {
|
|
47
|
+
return infobar.displayIcon(doc, useShadowRoot, options);
|
|
48
48
|
},
|
|
49
49
|
zip,
|
|
50
50
|
extract,
|
package/single-file-infobar.js
CHANGED
|
@@ -60,6 +60,7 @@ import { appendInfobar, refreshInfobarInfo, extractInfobarData } from "./core/in
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
if (options.displayInfobar) {
|
|
63
|
+
infoData.openInfobar = options.openInfobar;
|
|
63
64
|
appendInfobar(document, infoData, true);
|
|
64
65
|
refreshInfobarInfo(document, infoData);
|
|
65
66
|
}
|