YouTube - put upload date and views in title heading (in description)

If you're zoomed in above 100%, YouTube hides the upload date and amount of views. Fuck YouTube. 9/4/2022, 10:03:31 AM

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        YouTube - put upload date and views in title heading (in description)
// @namespace   Violentmonkey Scripts
// @match       https://www.youtube.com/watch
// @grant       none
// @version     1.0
// @author      -
// @description If you're zoomed in above 100%, YouTube hides the upload date and amount of views. Fuck YouTube. 9/4/2022, 10:03:31 AM
// ==/UserScript==

siId = setInterval(function () {
  const dateElement = document.querySelector("div#info-strings yt-formatted-string.ytd-video-primary-info-renderer");
  const viewsElement = document.querySelector("span.view-count");
  var titleElement = document.querySelector("h1.title.style-scope.ytd-video-primary-info-renderer yt-formatted-string.style-scope.ytd-video-primary-info-renderer");
  if((dateElement !== null) && (viewsElement !== null) && (titleElement !== null)) {
    date = dateElement.innerText.trim();
    views = viewsElement.innerText.trim();
    title = titleElement.innerText.trim();
    if( (date != "") && (views != "") && (title != "")) {
      const newTitle = title + " - " + date + " - " + views;
      titleElement.innerText = newTitle;
      clearInterval(siId);
    }
  }
}, 500)