|
|
@@ -26,7 +26,6 @@ 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;
|
|
|
|
|
|
@@ -141,9 +140,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
|
if (this.options.doc) {
|
|
|
DOM.postProcessDoc(this.options.doc, this.options);
|
|
|
- if (!this.options.removeFrames) {
|
|
|
- this.processor.removeWindowIdFrames();
|
|
|
- }
|
|
|
this.options.doc = null;
|
|
|
this.options.win = null;
|
|
|
}
|
|
|
@@ -320,10 +316,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- removeWindowIdFrames() {
|
|
|
- this.options.doc.querySelectorAll("[" + WIN_ID_ATTRIBUTE_NAME + "]").forEach(element => element.removeAttribute(WIN_ID_ATTRIBUTE_NAME));
|
|
|
- }
|
|
|
-
|
|
|
enableDisabledNoscriptTags(noscriptTags) {
|
|
|
noscriptTags.forEach(element => {
|
|
|
const noscriptElement = this.options.doc.createElement("noscript");
|
|
|
@@ -573,7 +565,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
await Promise.all(frameElements.map(async frameElement => {
|
|
|
DomProcessorHelper.setFrameEmptySrc(frameElement);
|
|
|
frameElement.setAttribute("sandbox", "");
|
|
|
- const frameWindowId = frameElement.getAttribute(WIN_ID_ATTRIBUTE_NAME);
|
|
|
+ const frameWindowId = frameElement.getAttribute(DOM.winIdAttributeName());
|
|
|
if (frameWindowId) {
|
|
|
const frameData = this.options.framesData.find(frame => frame.windowId == frameWindowId);
|
|
|
if (frameData) {
|
|
|
@@ -599,7 +591,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
|
await frameData.processor.preparePageData();
|
|
|
const pageData = await frameData.processor.getPageData();
|
|
|
- frameElement.removeAttribute(WIN_ID_ATTRIBUTE_NAME);
|
|
|
+ frameElement.removeAttribute(DOM.winIdAttributeName());
|
|
|
DomProcessorHelper.setFrameContent(frameElement, pageData.content);
|
|
|
if (this.options.displayStats) {
|
|
|
Object.keys(this.stats.discarded).forEach(key => this.stats.discarded[key] += (pageData.stats.discarded[key] || 0));
|