电影天堂跳转豆瓣搜索

在电影天堂、阳光电影等网站搜到的影片,可以快捷的跳转到豆瓣搜索页面。查看评分、评论、演员信息等

当前为 2021-06-18 提交的版本,查看 最新版本

 // ==UserScript==
    // @name         电影天堂跳转豆瓣搜索
    // @match        *://www.dytt8.net/*
    // @match        *://www.ygdy8.com/*
    // @match        *://www.dydytt.net/*
    // @namespace    https://mdkml.gitee.io/
    // @version      0.1
    // @description  在电影天堂、阳光电影等网站搜到的影片,可以快捷的跳转到豆瓣搜索页面。查看评分、评论、演员信息等
    // @author       MDKML
    // @icon         https://mdkml.gitee.io/img/favicon.ico
    // @grant        none
    // ==/UserScript==

    (function () {
        'use strict';

        var h = document.getElementsByTagName("H1")
        var name = h[0].innerText;
        name = name.split("《")[1]
        name = name.split("》")[0]
        name = name.split("/")[0]
        let a = document.createElement('a')
        a.innerText = "豆瓣搜索"
        var style = "padding-top: 10px; padding-bottom: 10px; font-size: 18px; font-weight: bold;cursor:pointer;border-radius: 25px;"
        a.style = style
        // 鼠标移入移除效果,相当于hover
        a.onmouseenter = function () {
            this.style = style + "color: #ffffff; background-color: #0084ff;";
        }
        a.onmouseleave = function () {
            this.style = style + "color: #333333;";
        }
        a.onclick = function () {
            window.open("https://search.douban.com/movie/subject_search?search_text=" + encodeURI(name));
        }
        h[0].appendChild(a)
        // Your code here...
    })();