Gildas 7 лет назад
Родитель
Сommit
1b45cbee7f

+ 0 - 1
extension/core/content/content.js

@@ -85,7 +85,6 @@ this.singlefile.top = this.singlefile.top || (() => {
 		const processor = new (SingleFile.getClass())(options);
 		options.insertSingleFileComment = true;
 		options.insertFaviconLink = true;
-		options.jsEnabled = true;
 		if (!options.removeFrames && this.frameTree) {
 			options.framesData = await frameTree.getAsync(options);
 		}

+ 1 - 1
lib/single-file/doc-helper.js

@@ -35,7 +35,7 @@ this.docHelper = this.docHelper || (() => {
 
 	function preProcessDoc(doc, win, options) {
 		doc.querySelectorAll("script").forEach(element => element.textContent = element.textContent.replace(/<\/script>/gi, "<\\/script>"));
-		doc.head.querySelectorAll("noscript").forEach(element => {
+		doc.querySelectorAll("noscript").forEach(element => {
 			const disabledNoscriptElement = doc.createElement("disabled-noscript");
 			Array.from(element.childNodes).forEach(node => disabledNoscriptElement.appendChild(node));
 			disabledNoscriptElement.hidden = true;

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

@@ -92,9 +92,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			this.onprogress(new ProgressEvent(RESOURCES_INITIALIZING, { pageURL: this.options.url }));
 			this.processor.removeUIElements();
 			this.processor.replaceStyleContents();
-			if (!this.options.jsEnabled || (this.options.saveRawPage && this.options.removeScripts)) {
-				this.processor.insertNoscriptContents();
-			}
 			if (this.options.removeFrames) {
 				this.processor.removeFrames();
 			}
@@ -305,23 +302,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			};
 		}
 
-		insertNoscriptContents() {
-			const DOMParser = DOM.getParser();
-			if (DOMParser) {
-				this.doc.querySelectorAll("noscript").forEach(element => {
-					const fragment = this.doc.createDocumentFragment();
-					Array.from(element.childNodes).forEach(node => {
-						const parsedNode = new DOMParser().parseFromString(node.nodeValue, "text/html");
-						Array.from(parsedNode.head.childNodes).concat(Array.from(parsedNode.body.childNodes)).forEach(node => {
-							this.doc.importNode(node);
-							fragment.appendChild(node);
-						});
-					});
-					element.parentElement.replaceChild(fragment, element);
-				});
-			}
-		}
-
 		lazyLoadImages() {
 			DOM.lazyLoader(this.doc);
 		}