Browse Source

add hidden option `delayBeforeProcessing` (see #1378)

Gildas 2 năm trước cách đây
mục cha
commit
7e71fda220
2 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 1 0
      src/core/bg/config.js
  2. 4 1
      src/core/content/content.js

+ 1 - 0
src/core/bg/config.js

@@ -161,6 +161,7 @@ const DEFAULT_CONFIG = {
 	blockScripts: true,
 	blockVideos: true,
 	blockAudios: true,
+	delayBeforeProcessing: 0,
 	_migratedTemplateFormat: true
 };
 

+ 4 - 1
src/core/content/content.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, document, globalThis, location, URL, Blob, MouseEvent */
+/* global browser, document, globalThis, location, URL, Blob, MouseEvent, setTimeout */
 
 import * as download from "./../common/download.js";
 import { fetch, frameFetch } from "./../../lib/single-file/fetch/content/content-fetch.js";
@@ -150,6 +150,9 @@ async function processPage(options) {
 	const frames = singlefile.processors.frameTree;
 	let framesSessionId;
 	options.keepFilename = options.saveToGDrive || options.saveToGitHub || options.saveWithWebDAV || options.saveToDropbox;
+	if (options.delayBeforeProcessing) {
+		await new Promise(resolve => setTimeout(resolve, options.delayBeforeProcessing * 1000));
+	}
 	singlefile.helper.initDoc(document);
 	ui.onStartPage(options);
 	processor = new singlefile.SingleFile(options);