TMDB影视资源直通车

添加在TDDB内便于用户快速找到影视资源的神器!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TMDB影视资源直通车
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  添加在TDDB内便于用户快速找到影视资源的神器!
// @author       破坏游戏的孩子
// @match        https://www.themoviedb.org/movie/*
// @match        https://www.themoviedb.org/tv/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 添加必要的CSS样式
    const style = document.createElement('style');
    style.textContent = `
        section.inner_content section.header ul.actions {
            margin-bottom: 20px;
            width: 100%;
            height: 68px;
            display: flex;
            align-items: center;
            justify-content: flex-start;
        }

        .tmdb-download-button {
            display: inline-block;
            background-color: transparent;
            color: #fff;
            padding: 8px 16px;
            border: 1px solid #01b4e4;
            border-radius: 4px;
            text-decoration: none;
            font-size: 14px;
            margin-right: 8px;
            transition: background-color 0.3s ease;
        }

        .tmdb-download-button:hover {
            background-color: #01b4e4;
        }
    `;
    document.head.appendChild(style);

    // 创建下载按钮元素
    const downloadButton = document.createElement('a');
    downloadButton.classList.add('tmdb-download-button');
    downloadButton.href = '#';
    downloadButton.textContent = '下载资源';

    // 将下载按钮添加到页面
    const actionButtons = document.querySelector('section.inner_content section.header ul.actions');
    if (actionButtons) {
        actionButtons.insertBefore(downloadButton, actionButtons.firstChild);
    } else {
        console.error('Could not find the action buttons container element.');
    }

    // 添加点击事件监听器
    downloadButton.addEventListener('click', () => {
        // 获取当前网页的URL
        const currentUrl = window.location.href;

        // 打开新的页面并传递当前网页的URL作为参数
        window.open(`https://example.com/download?url=${encodeURIComponent(currentUrl)}`, '_blank');
    });
})();