Netflix Bypass the "Activate extra member to watch now"

Bypass the "Activate extra member to watch now"

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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 });
};
 
 
 
})();