您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows Youtube video length in hours, minutes, and seconds
- // ==UserScript==
- // @name Show Youtube Video Length Time
- // @namespace Jefferson Scher
- // @icon https://cdn1.iconfinder.com/data/icons/iconsweets2/40/timer.png
- // @include *youtube.com*
- // @version 1.01
- // @description Shows Youtube video length in hours, minutes, and seconds
- // ==/UserScript==
- function ShowRunningTime(e){
- if (window.self != window.top) return;
- var emb = document.querySelector('#movie_player');
- if (!emb){
- window.setTimeout(ShowRunningTime, 250); // doesn't work??
- return;
- }
- var fvars = emb.getAttribute("flashvars");
- fvars = fvars.substr(fvars.indexOf("length_seconds=") + "length_seconds=".length);
- var trt = fvars.split("&")[0];
- var vidtitle = document.getElementById("watch-headline-title");
- if (trt > 0 && vidtitle){
- var min = Math.floor(parseInt(trt)/60);
- var sec = parseInt(trt) - (min * 60);
- vidtitle.appendChild(document.createTextNode(" (runtime: " + min + ":" + sec + ")"));
- }
- }
- ShowRunningTime();