Jelajahi Sumber

added constant

Gildas 7 tahun lalu
induk
melakukan
8fc3506755
1 mengubah file dengan 4 tambahan dan 3 penghapusan
  1. 4 3
      lib/single-file/doc-helper.js

+ 4 - 3
lib/single-file/doc-helper.js

@@ -32,7 +32,8 @@ this.docHelper = this.docHelper || (() => {
 	const SHEET_ATTRIBUTE_NAME = "data-single-file-sheet";
 	const IGNORED_REMOVED_TAG_NAMES = ["NOSCRIPT", "DISABLED-NOSCRIPT", "META", "LINK", "STYLE", "TITLE", "TEMPLATE", "SOURCE", "OBJECT"];
 	const MASK_TAGNAME = "singlefile-mask";
-	const BACKDROP_THRESHOLD = .95;
+	const BACKDROP_THRESHOLD_SIZE = .95;
+	const BACKDROP_THRESHOLD_ZINDEX = 999
 
 	return {
 		preProcessDoc,
@@ -93,14 +94,14 @@ this.docHelper = this.docHelper || (() => {
 	}
 
 	function markBackdropBackground(doc, win, markerRemovedContent) {
-		const threshold = BACKDROP_THRESHOLD;
+		const threshold = BACKDROP_THRESHOLD_SIZE;
 		let elements = getCandidateElements();
 		let fullScreen = true;
 		while (elements.length > 1 && fullScreen) {
 			elements = getCandidateElements();
 			const element = elements[0];
 			const style = win.getComputedStyle(element);
-			fullScreen = (element.clientWidth >= win.innerWidth * threshold) && (element.clientHeight >= win.innerHeight * threshold) && (style && style.getPropertyValue("z-index") >= 999);
+			fullScreen = (element.clientWidth >= win.innerWidth * threshold) && (element.clientHeight >= win.innerHeight * threshold) && (style && style.getPropertyValue("z-index") >= BACKDROP_THRESHOLD_ZINDEX);
 			if (fullScreen) {
 				element.setAttribute(markerRemovedContent, "");
 			}