Enhance Media Content

Preset all thumbnails and images to 3D+HDR and videos to 1080p 144fps VP9+HDR

  1. // ==UserScript==
  2. // @name Enhance Media Content
  3. // @namespace http://tampermonkey.net/
  4. // @version 4.1
  5. // @description Preset all thumbnails and images to 3D+HDR and videos to 1080p 144fps VP9+HDR
  6. // @author Tae
  7. // @match *://*/*
  8. // @grant GM_addStyle
  9. // @grant GM_xmlhttpRequest
  10. // @grant GM_openInTab
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Apply styles to images and thumbnails for 3D+HDR effect
  17. function applyImageStyles() {
  18. const images = document.querySelectorAll('img:not([src*="ad"]), .thumbnail:not([src*="ad"])');
  19. images.forEach(img => {
  20. img.style.filter = 'brightness(1.1) contrast(1.1) saturate(0.5)';
  21. img.style.transform = 'perspective(1000px) rotateY(15deg)';
  22. });
  23. }
  24.  
  25. // Apply video settings for 144fps VP9+HDR
  26. function applyVideoSettings() {
  27. const videos = document.querySelectorAll('video:not([src*="ad"])');
  28. videos.forEach(video => {
  29. video.addEventListener('loadedmetadata', () => {
  30. try {
  31. video.playbackQuality = {
  32. resolution: '1080p',
  33. framerate: 144,
  34. codec: 'vp9',
  35. dynamicRange: 'hdr'
  36. };
  37. console.log('Applied 144fps VP9+HDR settings to video:', video);
  38. } catch (error) {
  39. console.error('Failed to apply video settings:', error);
  40. }
  41. });
  42. });
  43. }
  44.  
  45. // Observer to detect new images and videos added dynamically
  46. function observeMutations() {
  47. const observer = new MutationObserver(mutations => {
  48. mutations.forEach(mutation => {
  49. if (mutation.addedNodes.length) {
  50. applyImageStyles();
  51. applyVideoSettings();
  52. }
  53. });
  54. });
  55.  
  56. observer.observe(document.body, {
  57. childList: true,
  58. subtree: true
  59. });
  60. }
  61.  
  62. // Initial application of styles and settings
  63. applyImageStyles();
  64. applyVideoSettings();
  65. observeMutations();
  66. })();