您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds ability to take a screenshot from the current frame of a HTML5 video element and be saved to a file named "video_frame.jpg" or "video_frame.png" (image format is configurable). This script is intended to be used as a bookmarklet using this URL: javascript:hvfs_ujs()
- // ==UserScript==
- // @name HTML5 Video Frame Screenshot
- // @namespace https://greasyfork.org/en/users/85671-jcunews
- // @version 1.0.5
- // @license GNU AGPLv3
- // @description Adds ability to take a screenshot from the current frame of a HTML5 video element and be saved to a file named "video_frame.jpg" or "video_frame.png" (image format is configurable). This script is intended to be used as a bookmarklet using this URL: javascript:hvfs_ujs()
- // @author jcunews
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- (function() {
- //=== CONFIGURATION BEGIN ===
- var imageFormat = "jpeg"; //can be one of these: jpeg, png
- //=== CONFIGURATION END ===
- window.hvfs_ujs = function(ele, cv) {
- if (ele = document.querySelector("video")) {
- cv = document.createElement("CANVAS");
- if (cv.width = ele.videoWidth) {
- cv.height = ele.videoHeight;
- cv.getContext("2d").drawImage(ele, 0, 0);
- ele = document.createElement("A");
- ele.href = cv.toDataURL("image/" + imageFormat);
- ele.download = "video_frame." + (imageFormat === "jpeg" ? "jpg" : imageFormat);
- ele.style.visibility = "hidden";
- document.body.appendChild(ele).click();
- ele.remove();
- return;
- } else {
- alert("The HTML5 video media has not been loaded yet.");
- }
- } else {
- alert("There is no HTML5 video on this page.");
- }
- };
- })();