Explorar o código

display shadow sooner

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
c83e65b1d5
Modificáronse 2 ficheiros con 7 adicións e 7 borrados
  1. 4 4
      extension/core/content/content.js
  2. 3 3
      lib/single-file/single-file-core.js

+ 4 - 4
extension/core/content/content.js

@@ -51,15 +51,15 @@ this.singlefile.top = this.singlefile.top || (() => {
 	}
 
 	async function processPage(options) {
+		if (options.shadowEnabled) {
+			singlefile.ui.init();
+		}
 		options = await getOptions(options);
 		const processor = new (SingleFile.getClass())(options);
 		if (options.selected) {
 			markSelectedContent(processor.SELECTED_CONTENT_ATTRIBUTE_NAME, processor.SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME);
 		}
-		await processor.initialize();
-		if (options.shadowEnabled) {
-			singlefile.ui.init();
-		}
+		await processor.initialize();		
 		await processor.preparePageData();
 		const page = processor.getPageData();
 		if (options.selected) {

+ 3 - 3
lib/single-file/single-file-core.js

@@ -93,7 +93,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 
 		async initialize() {
 			this.onprogress(new ProgressEvent(RESOURCES_INITIALIZING, { pageURL: this.options.url }));
-			this.processor.removeInfoToolbar();
+			this.processor.removeUIElements();
 			this.processor.enableDisabledNoscriptTags(this.processor.doc.head.querySelectorAll("disabled-noscript"));
 			this.processor.replaceEmptyStyles();
 			if (!this.options.jsEnabled || (this.options.saveRawPage && this.options.removeScripts)) {
@@ -384,8 +384,8 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			}
 		}
 
-		removeInfoToolbar() {
-			this.doc.querySelectorAll("singlefile-infobar").forEach(element => element.remove());
+		removeUIElements() {
+			this.doc.querySelectorAll("singlefile-infobar, singlefile-mask").forEach(element => element.remove());
 		}
 
 		removeScripts() {