Bilibili Bangumi To UWP

Bangumi番剧/电影 添加 用UWP客户端打开按钮

当前为 2020-09-28 提交的版本,查看 最新版本

// ==UserScript==
// @name         Bilibili Bangumi To UWP
// @namespace    https://gf.qytechs.cn/zh-CN/users/6065-hatn
// @version      0.2
// @description  Bangumi番剧/电影 添加 用UWP客户端打开按钮
// @icon         http://www.gravatar.com/avatar/10670da5cbd7779dcb70c28594abbe56?r=PG&s=92&default=identicon
// @author       hatn
// @copyright	 2018, hatn
// @include      *.bilibili.com/bangumi/media/md*
// @include      *.bilibili.com/bangumi/play/ep*
// @include      *.bilibili.com/bangumi/play/ss*
// @include      *.bilibili.com/video/BV*
// @include      *.bilibili.com/video/av*
// @run-at     	 document-start
// @grant        none
// ==/UserScript==

let bangumiObj = {
	init () {
        let s = this, maxTimes = 100, i = 1;
        let timer = setInterval(() => {
            if (i >= maxTimes) return clearInterval(timer);
            ++i;
            if (typeof jQuery == 'undefined') return;
            clearInterval(timer);
            return s.work();
        }, 100);
    },
    work() {
        let cat = /(ep|ss|bv|av|md)(\w+)/gi.exec(location.href), av_code = '', av_type = 'b';
        //console.log(cat, location.href); // test
        if (cat == null) return console.log('bangumi to uwp log: av code not found');
        if (cat[1] == 'md') {
            av_code = window.__INITIAL_STATE__.mediaInfo.param.season_id ? window.__INITIAL_STATE__.mediaInfo.param.season_id : window.__INITIAL_STATE__.ssId;
            if (ac_code.length < 1) return console.log('bangumi to uwp log: av code not found');
        } else {
            av_code = cat[2];
            if (['BV', 'av'].includes(cat[1])) av_type = 'a';
            //console.log(av_type); // test
        }
        bc_html = av_type == 'a' ? `bilibili://video/${av_code}` : `bilibili://bangumi/season/${av_code}`;

        if (cat[1] == 'md') {
            $('#app .media-tab-nav .clearfix').append(`<li onclick="location.href = '${bc_html}'; return false;" >客户端观看</li>`);
        } else {
            if (av_type == 'a') {
                $('#arc_toolbar_report .ops').append(`<span onclick="location.href = '${bc_html}'; return false;" title="客户端观看" class="share"><i class="van-icon-videodetails_usemo"></i>客户端观看</span>`);
            } else {
                $('#toolbar_module').append(`<div class="mobile-info" onclick="location.href = '${bc_html}'" style="margin-left: 20px;"><i class="iconfont icon-play"></i><span>客户端观看</span></div>`);
            }
        }
        console.log('bangumi to uwp log: uwp btn done !');
    }
};

bangumiObj.init();

QingJ © 2025

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