您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows the duration of YouTube videos on mobile browsers.
- // ==UserScript==
- // @name YouTube Video Duration Checker
- // @namespace https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
- // @version 2
- // @description Shows the duration of YouTube videos on mobile browsers.
- // @author hacker09
- // @match https://*.youtube.com/embed/*
- // @icon https://www.youtube.com/s/desktop/03f86491/img/favicon.ico
- // @run-at document-end
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- document.querySelector(".notranslate").style.display = 'unset'; //Display the time
- document.querySelector('.video-stream').addEventListener('timeupdate', function() { //When the YT video is playing
- var currentSecs = Math.floor(document.querySelector('.video-stream').currentTime % 60); //Create a variable to hold the current secs
- var totalSecs = Math.floor(document.querySelector('.video-stream').duration % 60); //Create a variable to hold the total mins
- document.querySelector(".ytp-time-current").innerText = `${Math.floor(document.querySelector('.video-stream').currentTime / 60)}:${currentSecs < 10 ? '0' + currentSecs : currentSecs}`;
- document.querySelector(".ytp-time-duration").innerText = `${Math.floor(document.querySelector('.video-stream').duration / 60)}:${(/^\d$/.test(totalSecs)) ? '0' + totalSecs : totalSecs}`;
- }); //Update the content of the time display element
- })();