ソースを参照

move noscript tags out of the head tag before saving the page

Gildas 7 年 前
コミット
8d9fd00e7d
1 ファイル変更5 行追加0 行削除
  1. 5 0
      extension/core/content/content.js

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

@@ -35,6 +35,7 @@
 		if (message.processStart && !processing) {
 			processing = true;
 			fixInlineScripts();
+			fixHeadNoScripts();
 			getOptions(message.options)
 				.then(options => {
 					if (options.selected) {
@@ -90,6 +91,10 @@
 		document.head.querySelectorAll("iframe, frame, object[type=\"text/html\"][data]").forEach(element => element.hidden = true);
 	}
 
+	function fixHeadNoScripts() {
+		document.head.querySelectorAll("noscript").forEach(noscriptElement => document.body.insertBefore(noscriptElement, document.body.firstChild));
+	}
+
 	function selectRemovedElements() {
 		document.querySelectorAll("html > body *:not(style):not(script):not(link)").forEach(element => {
 			const style = getComputedStyle(element);