|
@@ -24,8 +24,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
|
|
|
|
|
const SELECTED_CONTENT_ATTRIBUTE_NAME = "data-single-file-selected-content";
|
|
const SELECTED_CONTENT_ATTRIBUTE_NAME = "data-single-file-selected-content";
|
|
|
const SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME = "data-single-file-selected-content-root";
|
|
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";
|
|
|
|
|
|
|
|
|
|
let Download, DOM, URL;
|
|
let Download, DOM, URL;
|
|
|
|
|
|
|
@@ -288,6 +286,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getPageData() {
|
|
getPageData() {
|
|
|
|
|
+ DOM.postProcessDoc(this.doc, this.options);
|
|
|
if (this.options.selected) {
|
|
if (this.options.selected) {
|
|
|
const rootElement = this.doc.querySelector("[" + SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME + "]");
|
|
const rootElement = this.doc.querySelector("[" + SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME + "]");
|
|
|
if (rootElement) {
|
|
if (rootElement) {
|
|
@@ -442,7 +441,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
removeHiddenElements() {
|
|
removeHiddenElements() {
|
|
|
- const hiddenElements = this.doc.querySelectorAll("[" + REMOVED_CONTENT_ATTRIBUTE_NAME + "]");
|
|
|
|
|
|
|
+ const hiddenElements = this.doc.querySelectorAll("[" + DOM.removedContentAttributeName() + "]");
|
|
|
if (this.options.displayStats) {
|
|
if (this.options.displayStats) {
|
|
|
this.stats.discarded.hiddenElements = hiddenElements.length;
|
|
this.stats.discarded.hiddenElements = hiddenElements.length;
|
|
|
}
|
|
}
|
|
@@ -464,11 +463,10 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
if (this.options.displayStats) {
|
|
if (this.options.displayStats) {
|
|
|
size = new Blob([this.doc.documentElement.outerHTML]).size;
|
|
size = new Blob([this.doc.documentElement.outerHTML]).size;
|
|
|
}
|
|
}
|
|
|
- DOM.htmlminiProcess(this.doc, { preservedSpaceAttributeName: PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME });
|
|
|
|
|
|
|
+ DOM.htmlminiProcess(this.doc, { preservedSpaceAttributeName: DOM.preservedSpaceAttributeName() });
|
|
|
if (this.options.displayStats) {
|
|
if (this.options.displayStats) {
|
|
|
this.stats.discarded.htmlBytes += size - (new Blob([this.doc.documentElement.outerHTML]).size);
|
|
this.stats.discarded.htmlBytes += size - (new Blob([this.doc.documentElement.outerHTML]).size);
|
|
|
}
|
|
}
|
|
|
- this.doc.querySelectorAll("[" + PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME + "]").forEach(element => element.removeAttribute(PRESERVED_SPACE_ELEMENT_ATTRIBUTE_NAME));
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|