Skip to content

Instantly share code, notes, and snippets.

@ghstbny
Last active June 1, 2023 09:51
Show Gist options
  • Save ghstbny/7b1ea4c2515857fa43a580565c20c6b5 to your computer and use it in GitHub Desktop.
Save ghstbny/7b1ea4c2515857fa43a580565c20c6b5 to your computer and use it in GitHub Desktop.
Add video preview on anonfiles
// ==UserScript==
// @name video-preview
// @namespace https://github.com/ghstbny
// @match https://anonfiles.com/*
// @grant none
// @version 0.0.2
// @author ghstbny
// @description add video preview on anonfiles
// @downloadURL https://gist.github.com/ghstbny/7b1ea4c2515857fa43a580565c20c6b5/raw/video-preview.user.js
// ==/UserScript==
if (!document.getElementById("video-player")) {
const root = document.getElementById("footer");
const download = document.getElementById("download-url");
const video = document.createElement("video");
const source = document.createElement("source");
const width = root.clientWidth - 30;
video.style["margin-top"] = "15px";
video.setAttribute('width', width);
video.setAttribute('height', Math.round((width / 500) * 280));
video.setAttribute('controls', 'controls');
source.setAttribute('src', download.href);
source.setAttribute('type', 'video/mp4');
video.appendChild(source);
root.prepend(video);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment