Youtube Video's Published Date

Show YouTube video's publishing date, best to have these 2 uBlock origin filters "www.youtube.com##span.yt-formatted-string.style-scope.bold:nth-of-type(3)" & "www.youtube.com###owner-sub-count"

安装此脚本
作者推荐脚本

您可能也喜欢YouTube Screenshot Frame

安装此脚本
  1. // ==UserScript==
  2. // @name Youtube Video's Published Date
  3. // @namespace https://tampermonkey.net/
  4. // @version 1.0
  5. // @description Show YouTube video's publishing date, best to have these 2 uBlock origin filters "www.youtube.com##span.yt-formatted-string.style-scope.bold:nth-of-type(3)" & "www.youtube.com###owner-sub-count"
  6. // @author dpi0
  7. // @include *://*youtube.com/*
  8. // @grant none
  9. // @homepageURL https://github.com/dpi0/scripts/blob/main/greasyfork/youtube-video-published-date.js
  10. // @originalhomepageURL https://greasyfork.org/en/scripts/423791-youtube-videos-publishing-date
  11. // @supportURL https://github.com/dpi0/scripts/issues
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. const observer = new MutationObserver(() => {
  19. const infoStrings = document.querySelector('#info-strings');
  20. const subCount = document.querySelector('#owner-sub-count');
  21. if (infoStrings && subCount) {
  22. observer.disconnect();
  23.  
  24. // Move the publishing date below the sub count
  25. infoStrings.remove();
  26. subCount.after(infoStrings);
  27.  
  28. // Remove extra spans and apply styles
  29. infoStrings.querySelectorAll('span').forEach(e => e.remove());
  30.  
  31. const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
  32. infoStrings.style.fontSize = '15px';
  33. infoStrings.style.fontWeight = '540';
  34. infoStrings.style.color = isDark ? '#f1f1f1' : '#0f0f0f';
  35. }
  36. });
  37.  
  38. observer.observe(document, { childList: true, subtree: true });
  39. })();