|
|
@@ -105,6 +105,7 @@ const STAGES = [{
|
|
|
{ option: "removeScripts", action: "removeScripts" },
|
|
|
{ option: "selected", action: "removeUnselectedElements" },
|
|
|
{ option: "removeVideoSrc", action: "insertVideoPosters" },
|
|
|
+ { option: "removeVideoSrc", action: "insertVideoLinks" },
|
|
|
{ option: "removeFrames", action: "removeFrames" },
|
|
|
{ option: "removeVideoSrc", action: "removeVideoSources" },
|
|
|
{ option: "removeAudioSrc", action: "removeAudioSources" },
|
|
|
@@ -681,6 +682,38 @@ class Processor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ insertVideoLinks() {
|
|
|
+ const LINK_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8H+DhhoQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJJJREFUOI3t070NRCEMA2CnYAOyDyPwpHj/Va7hJ3FzV7zy3ET5JIwoAF6Jk4wzAJAkzxAYG9YRTgB+24wBgKmfrGAKTcEfAY4KRlRoIeBTgKOCERVaCPgU4Khge2GqKOBTgKOCERVaAEC/4PNcnyoSWHpjqkhwKxbcig0Q6AorXYF/+A6eIYD1lVbwG/jdA6/kA2THRAURVubcAAAAAElFTkSuQmCC";
|
|
|
+ const ICON_SIZE = "16px";
|
|
|
+ this.doc.querySelectorAll("video").forEach(videoElement => {
|
|
|
+ if (videoElement && videoElement.currentSrc) {
|
|
|
+ const linkElement = this.doc.createElement("a");
|
|
|
+ const imgElement = this.doc.createElement("img");
|
|
|
+ linkElement.href = videoElement.currentSrc;
|
|
|
+ linkElement.target = "_blank";
|
|
|
+ linkElement.style.setProperty("z-index", 2147483647, "important");
|
|
|
+ linkElement.style.setProperty("position", "absolute", "important");
|
|
|
+ linkElement.style.setProperty("top", "8px", "important");
|
|
|
+ linkElement.style.setProperty("right", "8px", "important");
|
|
|
+ linkElement.style.setProperty("width", ICON_SIZE, "important");
|
|
|
+ linkElement.style.setProperty("height", ICON_SIZE, "important");
|
|
|
+ linkElement.style.setProperty("min-width", ICON_SIZE, "important");
|
|
|
+ linkElement.style.setProperty("min-height", ICON_SIZE, "important");
|
|
|
+ linkElement.style.setProperty("max-width", ICON_SIZE, "important");
|
|
|
+ linkElement.style.setProperty("max-height", ICON_SIZE, "important");
|
|
|
+ imgElement.src = LINK_ICON;
|
|
|
+ imgElement.style.setProperty("width", ICON_SIZE, "important");
|
|
|
+ imgElement.style.setProperty("height", ICON_SIZE, "important");
|
|
|
+ imgElement.style.setProperty("min-width", ICON_SIZE, "important");
|
|
|
+ imgElement.style.setProperty("min-height", ICON_SIZE, "important");
|
|
|
+ imgElement.style.setProperty("max-width", ICON_SIZE, "important");
|
|
|
+ imgElement.style.setProperty("max-height", ICON_SIZE, "important");
|
|
|
+ linkElement.appendChild(imgElement);
|
|
|
+ videoElement.insertAdjacentElement("afterend", linkElement);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
removeFrames() {
|
|
|
const frameElements = this.doc.querySelectorAll("iframe, frame, object[type=\"text/html\"][data]");
|
|
|
this.stats.set("discarded", "frames", frameElements.length);
|