IMDb 30nama Link

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 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);
        }
    }
})();