Просмотр исходного кода

replace non visible images with empty ones

Gildas 7 лет назад
Родитель
Сommit
7bc77dda85
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      lib/single-file/single-file-core.js

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

@@ -497,7 +497,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 				const dataAttributeName = DOM.imagesAttributeName(this.options.sessionId);
 				this.doc.querySelectorAll("img").forEach(imgElement => {
 					const imgData = this.options.imageData[Number(imgElement.getAttribute(dataAttributeName))];
-					if (imgData.currentSrc) {
+					if (this.options.removeHiddenElements && imgData.size && !imgData.size.pxWidth && !imgData.size.pxHeight) {
+						imgElement.setAttribute("src", EMPTY_IMAGE);
+					} else if (imgData.currentSrc) {
 						imgElement.setAttribute("src", imgData.currentSrc);
 					}
 				});