电影天堂跳转豆瓣搜索

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

目前為 2024-06-14 提交的版本,檢視 最新版本

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

(function () {
    'use strict';


    var div = document.createElement('div')
    div.id = 'search-app-box'
    div.style = "position: fixed; top: 120px; left: 20px; font-size: 12px;z-index: 999;"
    document.body.insertAdjacentElement("afterBegin", div);

    var h = document.getElementsByTagName("H1")
    if (!h || !h[0]) {
        return;
    }
    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 = "display: block;padding:10px;font-size: 18px; font-weight: bold;color:#072;cursor:pointer;border-radius: 25px;text-decoration:none;"
    a.style = style
    // 鼠标移入移除效果,相当于hover
    a.onmouseenter = function () {
        this.style = style + "color: #ffffff; background-color: #0084ff;box-shadow:0 0 0 10000px rgba(0,0,0,0.3);";
    }
    a.onmouseleave = function () {
        this.style = style + "color: #072;";
    }
    a.onclick = function () {
        window.open("https://search.douban.com/movie/subject_search?search_text=" + encodeURI(name));
    }
    div.appendChild(a)

    h[0].appendChild(div);
    // Your code here...
})();