Ultimate Video & Image Quality Enhancer (No Lag, Best Previews)

Forces the highest quality playback for videos and images on all sites. Enhances thumbnails and video previews instantly without lag, pausing, or freezing.

  1. // ==UserScript==
  2. // @name Ultimate Video & Image Quality Enhancer (No Lag, Best Previews)
  3. // @namespace https://gf.qytechs.cn/shannonturner
  4. // @version 1.3
  5. // @description Forces the highest quality playback for videos and images on all sites. Enhances thumbnails and video previews instantly without lag, pausing, or freezing.
  6. // @author tae
  7. // @match *://*/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. console.log("✅ Ultimate Video & Image Quality Enhancer is now active!");
  16.  
  17. function enhanceMedia() {
  18. document.querySelectorAll('img:not([data-enhanced])').forEach(img => {
  19. if (!img.closest('iframe') && !img.closest('[class*="ad"], [id*="ad"]')) {
  20. enhanceImage(img);
  21. }
  22. });
  23.  
  24. document.querySelectorAll('video:not([data-enhanced])').forEach(video => {
  25. enhanceVideo(video);
  26. });
  27. }
  28.  
  29. function enhanceImage(img) {
  30. if (!img.src || img.hasAttribute('data-enhanced')) return;
  31.  
  32. try {
  33. // Ensure full-resolution thumbnails
  34. if (img.src.includes("=s") || img.src.includes("w=") || img.src.includes("h=")) {
  35. img.src = img.src.replace(/=s\d+/g, '=s4096').replace(/w=\d+/g, 'w=4096').replace(/h=\d+/g, 'h=4096');
  36. }
  37. img.style.imageRendering = 'crisp-edges'; // Prioritizes high clarity
  38. img.style.filter = "none"; // Removes blurriness
  39. img.setAttribute('data-enhanced', 'true');
  40. } catch (e) {
  41. console.error('❌ Failed to enhance image:', e);
  42. }
  43. }
  44.  
  45. function enhanceVideo(video) {
  46. if (video.hasAttribute('data-enhanced')) return;
  47.  
  48. video.setAttribute('data-enhanced', 'true');
  49. video.preload = 'auto';
  50. video.playsInline = true;
  51. video.autobuffer = true;
  52. video.style.filter = "none"; // Removes any compression blur
  53.  
  54. // Force highest available video quality
  55. let qualityLevels = video.getAvailableQualityLevels?.();
  56. if (qualityLevels && qualityLevels.length > 0) {
  57. let highestQuality = qualityLevels[0];
  58. video.setPlaybackQuality?.(highestQuality);
  59. }
  60.  
  61. video.load();
  62. }
  63.  
  64. // Observe the page for dynamically loaded media
  65. const observer = new MutationObserver(() => {
  66. requestAnimationFrame(() => enhanceMedia());
  67. });
  68.  
  69. observer.observe(document.body, { childList: true, subtree: true });
  70.  
  71. setInterval(() => enhanceMedia(), 5000);
  72.  
  73. if (document.readyState === 'loading') {
  74. document.addEventListener('DOMContentLoaded', enhanceMedia);
  75. } else {
  76. enhanceMedia();
  77. }
  78. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址