IMDb 30nama Link

Adds a button to IMDb movie pages that links to the 30nama page of the movie.

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         IMDb 30nama Link
// @namespace    https://github.com/ar3h1d/letterboxd_30nama_link
// @version      0.1
// @description  Adds a button to IMDb movie pages that links to the 30nama page of the movie.
// @author       ar3h1d
// @match        https://www.imdb.com/title/*
// @match        https://m.imdb.com/title/*
// @grant        none
// @icon         https://raw.githubusercontent.com/ar3h1d/letterboxd_30nama_link/main/IMDb_30nama_icon.png
// @license      GPL3
// ==/UserScript==

(function() {
    'use strict';

    // Extract movie title from the URL
    let movieID = document.URL.split("/")[4];
    if (movieID) {
        // Create the 30nama link
        const cinamaLink = `https://30nama.com/search?q=${movieID}`;

        // Create the button element
        const cinamaButton = document.createElement('button');
        cinamaButton.className = 'ipc-responsive-button ipc-btn--theme-baseAlt ipc-responsive-button--transition-m ipc-btn--on-textPrimary ipc-responsive-button--single-padding';
        cinamaButton.href = cinamaLink;
        cinamaButton.textContent = '30nama';
        cinamaButton.target = '_blank';
        cinamaButton.style.marginLeft = '10px';
        cinamaButton.style.marginRight = '15px';
        cinamaButton.style.border = '1px solid';
        cinamaButton.style.color = '#d24040';

        // Add an onclick attribute that calls a function to redirect the user
        cinamaButton.onclick = function() {
            window.open(cinamaLink, '_blank');
        };

        // Find the TMDb button
        const reviewsButton = document.querySelector('button[aria-label="View all topics"]');
        if (reviewsButton) {
            // Insert the 30nama button after the All Topics button
            reviewsButton.parentNode.insertBefore(cinamaButton, reviewsButton.nextSibling);
        }
    }
})();