Netflix Bypass the "Activate extra member to watch now"

Bypass the "Activate extra member to watch now"

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Netflix Bypass the "Activate extra member to watch now"
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Bypass the "Activate extra member to watch now"
// @author       CodePer
// @match        *://*.netflix.com/*
// @icon         https://www.netflix.com/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==
 
(function() {
    'use strict';
 
// Function to execute when the element is found
function runWhenModalAppears() {
  const modal = document.querySelector('.nf-modal.uma-modal.two-section-uma');
  if (modal) {
    console.log('Modal appeared! Hiding modal to avoid focus-trap errors...');
 
    // Set focus back to a valid element to prevent focus-trap error
    const body = document.querySelector('body');
    if (body) {
      body.focus(); // Move focus to body or any other element
    }
 
      document.querySelectorAll('.nf-modal.uma-modal.two-section-uma').forEach(function(element) {
        console.log('Removing modal element:', element);
        element.remove(); // Safely remove the modal
      });
  }
}
 
// Create a MutationObserver to watch for changes in the DOM
const observer = new MutationObserver(function(mutationsList, observer) {
  // Check if the modal appears on the page
  if (document.querySelector('.nf-modal.uma-modal.two-section-uma')) {
    runWhenModalAppears();
    observer.disconnect(); // Stop observing after the element is found
  }
});
 
// Start observing the entire document for child list changes (subtree)
observer.observe(document.body, { childList: true, subtree: true });
 
window.onpopstate = function(event) {
    // Function to execute when the element is found
function runWhenModalAppears() {
  const modal = document.querySelector('.nf-modal.uma-modal.two-section-uma');
  if (modal) {
    console.log('Modal appeared! Hiding modal to avoid focus-trap errors...');
 
    // Set focus back to a valid element to prevent focus-trap error
    const body = document.querySelector('body');
    if (body) {
      body.focus(); // Move focus to body or any other element
    }
 
      document.querySelectorAll('.nf-modal.uma-modal.two-section-uma').forEach(function(element) {
        console.log('Removing modal element:', element);
        element.remove(); // Safely remove the modal
      });
  }
}
 
// Create a MutationObserver to watch for changes in the DOM
const observer = new MutationObserver(function(mutationsList, observer) {
  // Check if the modal appears on the page
  if (document.querySelector('.nf-modal.uma-modal.two-section-uma')) {
    runWhenModalAppears();
    observer.disconnect(); // Stop observing after the element is found
  }
});
 
// Start observing the entire document for child list changes (subtree)
observer.observe(document.body, { childList: true, subtree: true });
};
 
 
 
})();