Просмотр исходного кода

hide frames present in the head before processing the page

Gildas 7 лет назад
Родитель
Сommit
77cdde54bf
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      extension/core/content/content.js

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

@@ -35,7 +35,12 @@
 			processing = true;
 			fixInlineScripts();
 			getOptions(message.options)
-				.then(options => SingleFile.initialize(options))
+				.then(options => {
+					if (!options.removeFrames) {
+						hideHeadFrames();
+					}
+					return SingleFile.initialize(options);
+				})
 				.then(process => {
 					if (message.options.shadowEnabled) {
 						singlefile.ui.init();
@@ -64,6 +69,10 @@
 		document.querySelectorAll("script").forEach(element => element.textContent = element.textContent.replace(/<\/script>/gi, "<\\/script>"));
 	}
 
+	function hideHeadFrames() {
+		document.head.querySelectorAll("iframe").forEach(element => element.hidden = true);
+	}
+
 	async function getOptions(options) {
 		options.url = document.location.href;
 		if (options.selected) {