Block Amazon Xray

Hide the Amazon Xray elements when playing Prime video.

  1. // ==UserScript==
  2. // @name Block Amazon Xray
  3. // @name:de Block Amazon Xray
  4. // @namespace https://github.com/xnivaxhzne/hide-prime-xray/
  5. // @author xnivaxhzne
  6. // @description Hide the Amazon Xray elements when playing Prime video.
  7. // @description:de Versteckt Amazon Xray Element bei Prime Video während der Pause.
  8. // @include https://*.amazon.tld/*
  9. // @license MIT
  10. // @version 0.31
  11. // ==/UserScript==
  12.  
  13. let hideXrayQuickViewExecuted = false;
  14.  
  15. function hideXrayQuickView() {
  16. if (!hideXrayQuickViewExecuted) {
  17. const styleElement = document.createElement("style");
  18. styleElement.type = "text/css";
  19. document.head.appendChild(styleElement);
  20.  
  21. const styleSheet = styleElement.sheet;
  22. const rule = ".xrayQuickView { visibility: hidden !important; }";
  23.  
  24. styleSheet.insertRule(rule, styleSheet.cssRules.length);
  25.  
  26. hideXrayQuickViewExecuted = true;
  27. }
  28. }
  29.  
  30. function observeDOM() {
  31. const targetNode = document.body;
  32.  
  33. const observer = new MutationObserver(function (mutations) {
  34. mutations.forEach(function (mutation) {
  35. if (mutation.addedNodes && mutation.addedNodes.length > 0) {
  36. const xrayQuickViewEl = document.querySelector(".xrayQuickView");
  37. if (xrayQuickViewEl) {
  38. hideXrayQuickView();
  39. observer.disconnect();
  40. }
  41. }
  42. });
  43. });
  44.  
  45. const config = { childList: true, subtree: true };
  46. observer.observe(targetNode, config);
  47. }
  48.  
  49. if (document.readyState === "loading") {
  50. document.addEventListener("DOMContentLoaded", afterLoaded);
  51. } else {
  52. afterLoaded();
  53. }
  54.  
  55. function afterLoaded() {
  56. observeDOM();
  57. }

QingJ © 2025

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