ZIMUZU.TV 下载资源链接 ZIMUZU.TV DIRECT DOWNLOAD LINK

Bring download link back on resource detail page, plz login before go to download page.

目前為 2018-12-03 提交的版本,檢視 最新版本

// ==UserScript==
// @name         ZIMUZU.TV 下载资源链接 ZIMUZU.TV DIRECT DOWNLOAD LINK
// @namespace    http://tampermonkey.net/
// @version      0.6.2
// @description  Bring download link back on resource detail page, plz login before go to download page.
// @author       Al Cheung
// @match        http*://www.zimuzu.tv/resource/*
// @match        http*://www.zimuzu.io/resource/*
// @grant        none
// ==/UserScript==

(function () {
    const { $ } = window;
    const resId = location.href.split('/').pop();
    const download = `
<a
id="res-download-link"
class="__before-scroll"
href="${location.protocol}//${location.host}/resource/list/${resId}">
下载资源
</a>
`;
    const styleTag = `<style>
#res-download-link {
text-align: center;
font-size: 16px;
font-weight: 700;
font-family: -webkit-body;
color: #fff;
line-height: 2em;
z-index: 99;
background: #155b88;
}

.__before-scroll {
position: absolute;
border-radius: 0.5em;
width: 5em;
height: 2em;
top: 10px;
right: 20px;
}
.__after-scroll {
position: fixed;
border-radius: unset;
writing-mode: vertical-rl;
height: 5em;
width: 2em;
right: 0;
top: calc(50% - 20px);
transition: top 0.2s linear;
}
.__my-link {
color: #37a;
}
.__douban-link {
color: #072;
}
.__end {
text-align: end;
}
</style>`;

    $(styleTag).appendTo('head');
    const baseBar = $('.res-view-top');

    function handleStyle(_baseBar) {
        const offsetTop = _baseBar[0].getBoundingClientRect().top;
        if (offsetTop <= 0) {
            $('.resource-tit').css('position', 'static');
            $("#res-download-link").removeClass('__before-scroll').addClass('__after-scroll');
        } else {
            $('.resource-tit').css('position', 'relative');
            $("#res-download-link").removeClass('__after-scroll').addClass('__before-scroll');
        }
    }

    // init
    handleStyle(baseBar);

    $('.resource-tit').css({
        'position': 'relative',
    });
    $('.resource-tit').append(download);

    $(download).addClass('__before-scroll');

    $(window).scroll(function () {
        handleStyle(baseBar);
    });

    const resNameNode = $('.fl-info > ul > li:nth-child(1) > strong');
    const resName = (resNameNode && resNameNode.text() || '').trim();
    //console.log('name', resName);
    const doubanQ = `https://api.douban.com/v2/movie/search?q=${resName}&start=0&count=5`;
    $.ajax({
        url: doubanQ,
        type: "GET",
        dataType: "jsonp",
        success: function(data) {
            //console.log(data);
            const { subjects, title } = data;
            if(!subjects.length) return;

            const lis = subjects.map((item) => {
                return `<li><a class="__my-link" href="${item.alt}">${item.title} (${item.year})</a></li>`;
            });
            const searchLink = `https://movie.douban.com/subject_search?search_text=${resName}`;
            const list = `<div class="__my-block"><h2 class="__douban-link">豆瓣${title}: </h2><ul class="__douban-search-result">${lis.join('')}<li class="__end"><a class="__my-link" href="${searchLink}">更多...</a></li></ul></div>`;
            $('.fr.view-right').append(list);
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址