Greasy Fork

OSU-download-beatmap-in-bloodcat

you can download beatmap in bloodcat

当前为 2017-08-03 提交的版本,查看 最新版本

// ==UserScript==
// @name         OSU-download-beatmap-in-bloodcat
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  you can download beatmap in bloodcat
// @author       jacky2001114
// @include      *osu.ppy.sh/b/*
// @include      *ous.ppy.sh/s/*
// @include      *bloodcat.com/osu/*
// @include      http://bloodcat.com/osu/?q=*&c=b&s=&m=
// @match        http://bloodcat.com/osu/?q=*&c=b&s=&m=
// @match        *osu.ppy.sh/b/*
// @match        *osu.ppy.sh/s/*
// @match        *bloodcat.com/osu/*
// @grant        none
// ==/UserScript==

(function() {

    'use strict';

    var str=location.href;
    //是否osu官網
    var bool_cat = true;
    var bool_osu = true;


    var osu_b = str.indexOf("osu");
    var osu_c = str.indexOf(".sh");


    if(str.substring(osu_b,osu_c)!= "osu.ppy")
    {
        bool_osu=false;
    }
    else
    {
        bool_cat=false;
    }








    //開始運行本腳本

    if(bool_osu){
        var eee=str.indexOf("?");
        var beatmap_id = str.substring(21,eee);
        var add_html_start ="<button style='float:left;top:0;width:180px;height:43px;background-color:red;color:white;'onclick=window.open('http://bloodcat.com/osu/?q=";
        var add_html_end ="&c=b&s=&m=')>Blood Cat</button>";
        var div = document.createElement("div");
        div.innerHTML = add_html_start+beatmap_id+add_html_end;
        document.getElementsByClassName('paddingboth')[0].append(div);
    }


    if(bool_cat)
    {
        var set_num = document.getElementsByClassName('set').length;

        if(set_num==1)
        {
            document.getElementsByClassName('title')[1].click();
            setTimeout(function(){window.close();},3000);

        }
        else
        {
            alert("BloodCat have not this beatmap!");
        }

    }














})();