|
|
@@ -35,7 +35,6 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
class SingleFileClass {
|
|
|
constructor(options) {
|
|
|
this.options = options;
|
|
|
- options.insertFaviconLink = true;
|
|
|
if (options.sessionId === undefined) {
|
|
|
options.sessionId = sessionId;
|
|
|
sessionId++;
|
|
|
@@ -96,7 +95,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
{ action: "preProcessPage" },
|
|
|
{ action: "replaceStyleContents" },
|
|
|
{ action: "resetCharsetMeta" },
|
|
|
- { option: "insertFaviconLink", action: "insertFaviconLink" },
|
|
|
+ { option: "saveFavicon", action: "saveFavicon" },
|
|
|
{ action: "replaceCanvasElements" },
|
|
|
{ action: "insertFonts" },
|
|
|
{ action: "insertShadowRootContents" },
|
|
|
@@ -700,6 +699,9 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
if (this.options.compressHTML) {
|
|
|
this.doc.querySelectorAll("input[type=hidden]").forEach(element => element.remove());
|
|
|
}
|
|
|
+ if (!this.options.saveFavicon) {
|
|
|
+ this.doc.querySelectorAll("link[rel*=\"icon\"]").forEach(element => element.remove());
|
|
|
+ }
|
|
|
this.doc.querySelectorAll("a[ping]").forEach(element => element.removeAttribute("ping"));
|
|
|
}
|
|
|
|
|
|
@@ -749,7 +751,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- insertFaviconLink() {
|
|
|
+ saveFavicon() {
|
|
|
let faviconElement = this.doc.querySelector("link[href][rel=\"icon\"]");
|
|
|
if (!faviconElement) {
|
|
|
faviconElement = this.doc.querySelector("link[href][rel=\"shortcut icon\"]");
|
|
|
@@ -956,7 +958,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
|
|
|
async function initializeProcessor(frameData, frameElement, frameWindowId, batchRequest, options) {
|
|
|
options.insertSingleFileComment = false;
|
|
|
- options.insertFaviconLink = false;
|
|
|
+ options.saveFavicon = false;
|
|
|
options.doc = null;
|
|
|
options.win = null;
|
|
|
options.url = frameData.baseURI;
|
|
|
@@ -1043,7 +1045,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
linkElement.removeAttribute("href");
|
|
|
const options = Object.create(this.options);
|
|
|
options.insertSingleFileComment = false;
|
|
|
- options.insertFaviconLink = false;
|
|
|
+ options.saveFavicon = false;
|
|
|
options.removeUnusedStyles = false;
|
|
|
options.removeAlternativeMedias = false;
|
|
|
options.removeUnusedFonts = false;
|
|
|
@@ -1132,7 +1134,9 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
resourcePromises.push(ProcessorHelper.processAttribute(this.doc.querySelectorAll("video[src], video > source[src]"), "src", this.baseURI, this.options, this.cssVariables, this.styles, this.batchRequest));
|
|
|
}
|
|
|
await Promise.all(resourcePromises);
|
|
|
- ProcessorHelper.processShortcutIcons(this.doc);
|
|
|
+ if (this.options.saveFavicon) {
|
|
|
+ ProcessorHelper.processShortcutIcons(this.doc);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
async processScripts() {
|