Переглянути джерело

insert SingleFile comment

Gildas 7 роки тому
батько
коміт
1a59e210ed
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      lib/single-file/single-file-core.js

+ 6 - 0
lib/single-file/single-file-core.js

@@ -65,6 +65,7 @@ const SingleFileCore = (() => {
 			this.processor.resetCharsetMeta();
 			this.processor.insertFaviconLink();
 			this.processor.resolveHrefs();
+			this.processor.insertSingleFileCommentNode();
 			await Promise.all([this.processor.inlineStylesheets(true), this.processor.linkStylesheets()], this.processor.attributeStyles(true));
 			this.pendingPromises = Promise.all([this.processor.inlineStylesheets(), this.processor.attributeStyles(), this.processor.pageResources()]);
 			if (this.onprogress) {
@@ -285,6 +286,11 @@ const SingleFileCore = (() => {
 			});
 		}
 
+		insertSingleFileCommentNode() {
+			const commentNode = this.doc.createComment("\n Archive processed by SingleFile \n url: " + this.baseURI + " \n saved date: " + new Date() + " \n");
+			this.doc.documentElement.insertBefore(commentNode, this.doc.documentElement.firstChild);
+		}
+
 		async pageResources() {
 			await Promise.all([
 				DomProcessorHelper.processAttribute(this.doc.querySelectorAll("link[href][rel*=\"icon\"]"), "href", this.baseURI),