Gildas 7 лет назад
Родитель
Сommit
85b5910f43
2 измененных файлов с 9 добавлено и 1 удалено
  1. 7 0
      extension/core/content/content.js
  2. 2 1
      lib/single-file/single-file-core.js

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

@@ -79,6 +79,9 @@ this.singlefile.top = this.singlefile.top || (() => {
 		if (options.shadowEnabled) {
 			singlefile.ui.init();
 		}
+		if (!options.removeFrames) {
+			removeWindowIdFrames(processor.WIN_ID_ATTRIBUTE_NAME);
+		}
 		await processor.preparePageData();
 		const page = processor.getPageData();
 		if (options.selected) {
@@ -135,6 +138,10 @@ this.singlefile.top = this.singlefile.top || (() => {
 		document.querySelectorAll("[" + REMOVED_CONTENT_ATTRIBUTE_NAME + "]").forEach(element => element.removeAttribute(REMOVED_CONTENT_ATTRIBUTE_NAME));
 	}
 
+	function removeWindowIdFrames(WIN_ID_ATTRIBUTE_NAME) {
+		document.querySelectorAll("[" + WIN_ID_ATTRIBUTE_NAME + "]").forEach(element => element.removeAttribute(WIN_ID_ATTRIBUTE_NAME));
+	}
+
 	function selectSelectedContent(SELECTED_CONTENT_ATTRIBUTE_NAME, SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME) {
 		const selection = getSelection();
 		const range = selection.rangeCount ? selection.getRangeAt(0) : null;

+ 2 - 1
lib/single-file/single-file-core.js

@@ -24,6 +24,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 	const SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME = "data-single-file-selected-content-root";
 	const REMOVED_CONTENT_ATTRIBUTE_NAME = "data-single-file-removed-content";
 	const PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME = "data-single-file-preserved-space-element";
+	const WIN_ID_ATTRIBUTE_NAME = "data-frame-tree-win-id";
 
 	let Download, DOM, URL;
 
@@ -36,6 +37,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 				this.REMOVED_CONTENT_ATTRIBUTE_NAME = REMOVED_CONTENT_ATTRIBUTE_NAME;
 				this.SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME = SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME;
 				this.PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME = PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME;
+				this.WIN_ID_ATTRIBUTE_NAME = WIN_ID_ATTRIBUTE_NAME;
 			}
 			async initialize() {
 				this.processor = new PageProcessor(this.options);
@@ -205,7 +207,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 	// ------------
 	const ESCAPED_FRAGMENT = "_escaped_fragment_=";
 	const EMPTY_DATA_URI = "data:base64,";
-	const WIN_ID_ATTRIBUTE_NAME = "data-frame-tree-win-id";
 
 	const batchRequest = new BatchRequest();