Prime Video 移动版优化

优化 Prime Video 在移动版网页上的体验

目前为 2025-04-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Prime Video Mobile Optimize
  3. // @name:zh-CN Prime Video 移动版优化
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.0.1
  6. // @description Optimize the user experience of Prime Video on the mobile web
  7. // @description:zh-CN 优化 Prime Video 在移动版网页上的体验
  8. // @author TGSAN
  9. // @match *://*.primevideo.com/*
  10. // @include /https?:\/\/.*.?amazon\..+\/(.+\/)?gp\/video\/.*?/
  11. // @include /https?:\/\/.*.?amazon\..+\/(.+\/)?Amazon-Video\/.*?/
  12. // @icon https://www.google.com/s2/favicons?sz=64&domain=www.primevideo.com
  13. // @run-at document-start
  14. // @grant unsafeWindow
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. let windowCtx = self.window;
  21. if (self.unsafeWindow) {
  22. console.log("[Prime Video Mobile Optimize] use unsafeWindow mode");
  23. windowCtx = self.unsafeWindow;
  24. } else {
  25. console.log("[Prime Video Mobile Optimize] use window mode (your userscript extensions not support unsafeWindow)");
  26. }
  27.  
  28. function HookProperty(object, property, value)
  29. {
  30. Object.defineProperty(object, property, {
  31. value: value
  32. });
  33. }
  34.  
  35. HookProperty(windowCtx.navigator, "userAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0");
  36. HookProperty(windowCtx.navigator, "appVersion", "5.0 (Windows)");
  37. HookProperty(windowCtx.navigator, "platform", "Win32");
  38. HookProperty(windowCtx.navigator, "appName", "Netscape");
  39. HookProperty(windowCtx.navigator, "appCodeName", "Mozilla");
  40. HookProperty(windowCtx.navigator, "product", "Gecko");
  41. HookProperty(windowCtx.navigator, "vendor", "");
  42. HookProperty(windowCtx.navigator, "vendorSub", "");
  43. HookProperty(windowCtx.navigator, "maxTouchPoints", 0);
  44. HookProperty(windowCtx.navigator, "userAgentData", undefined);
  45.  
  46. windowCtx.document.addEventListener("fullscreenchange", (event) => {
  47. if (document.fullscreenElement) {
  48. windowCtx.screen?.orientation?.lock("landscape");
  49. windowCtx.screen?.lockOrientation("landscape");
  50. } else {
  51. windowCtx.screen?.orientation?.unlock();
  52. windowCtx.screen?.unlockOrientation();
  53. }
  54. });
  55. })();