Netflix Video ID Display

netflix video ID in title details

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Netflix Video ID Display
// @description netflix video ID in title details
// @match       https://www.netflix.com/*
// @grant       none
// @version     1.1
// @author      SH3LL
// @namespace   https://greasyfork.org/users/762057
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// ==/UserScript==


function main(){
  let wait = false;
  let refreshId = setInterval(function() {
    
        if($('div.previewModal--detailsMetadata-right').length && $('div.ltr-79elbk').length && !wait){ //-> title details is open
            let add_favourite_link = document.getElementsByClassName("ltr-79elbk");
            let video_id = add_favourite_link[0].children[0].getAttribute("data-ui-tracking-context").split(",%22video_id%22:")[1].split(",")[0];
          
            let id_box= document.createElement("div");
            let label_id = document.createElement("label");
            let id = document.createElement("label");
          
          
          
            label_id.style.color="red";
            id.style.color="red";
            label_id.innerText="ID: ";
            id.style.fontWeight = 'bold';
            id.innerText = video_id;
            id_box.append(label_id);
            id_box.append(id);
          
            let hook = document.getElementsByClassName("previewModal--detailsMetadata detail-modal has-info-density has-smaller-buttons");
            if(hook.length===0) hook = document.getElementsByClassName("previewModal--detailsMetadata detail-modal has-smaller-buttons");
            hook[0].after(id_box);
          
            wait = true;
          
        }else if($('div.previewModal--detailsMetadata-right').length == 0) //-> title details is closed
            wait = false;
    }, 2000);
}

main();