Greasy Fork

Greasy Fork is available in English.

查看 bangumi 马赛克瓷砖

查看 bangumi 马赛克瓷砖,配合 http://bangumi.tv/group/topic/344198 使用

当前为 2017-11-22 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         查看 bangumi 马赛克瓷砖
// @namespace    http://tampermonkey.net/
// @author       鈴宮華緋
// @description  查看 bangumi 马赛克瓷砖,配合 http://bangumi.tv/group/topic/344198 使用
// @version      2.02
// @include      /https?:\/\/(bgm\.tv|bangumi\.tv|chii\.in)\/(user)\/.*/
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    var url = window.location.href;
    var userid = url.match(/user\/(.*)/)[1];
    var type_name = "进度";
    var type = "progress";
    if (localStorage.getItem("type_name") === null) {
        localStorage.setItem("type_name",type_name);
    } else {
        type_name = localStorage.getItem("type_name");
    }
    if (localStorage.getItem("type") === null) {
        localStorage.setItem("type",type);
    } else {
        type = localStorage.getItem("type");
    }
    var type_list = {"吐槽":"say","收藏":"subject","进度":"progress","日志":"blog","人物":"mono","好友":"relation","小组":"group","维基":"wiki","目录":"index","天窗":"doujin"};
    $("ul.network_service").before("<div class='app_box' style='position:relative;'><div class='mosaic_box' style='text-align:center;margin-top:10px;color:rgb(150,150,150);'></div></div>");
    $("div.app_box").prepend("<ul class='tab_btn_list'></ul>");
    for(var key in type_list) {
        $("ul.tab_btn_list").append("<li class='tab_btn' target='" + type_list[key] + "'>" + key + "</li>");
    }
    $("li[target=" + type + "]").css({"background":"#ddd"}).addClass("clicked");
    $("ul.tab_btn_list").css({"position":"absolute","left":"-50px","top":"-10px","box-shadow":"0 0 3px 0 #666","-moz-box-shadow":"0 0 3px 0 #666","-webkit-box-shadow":"0 0 3px 0 #666","border-radius":"5px","overflow":"hidden"});
    $("li.tab_btn").css({"padding":"3px 6px","border-bottom":"solid 1px #ddd","cursor":"pointer"}).last().css({"border":"none"});
    $("li.tab_btn").hover(function(){
        if(!$(this).hasClass("clicked")) {
            $(this).css({"background":"#ddd"});
        }
    },function() {
        if(!$(this).hasClass("clicked")) {
            $(this).css({"background":"#fff"});
        }
    }).click(function(){
        $("li.tab_btn").css({"background":"#fff"}).removeClass("clicked");
        $(this).css({"background":"#ddd"}).addClass("clicked");
        type_name = $(this).text();
        type = $(this).attr("target");
        localStorage.setItem("type_name",type_name);
        localStorage.setItem("type",type);
        get_mosaic();
    });
    get_mosaic();
    function get_mosaic() {
        $.ajax({
            url : "https://bangumi-mosaic-tile.herokuapp.com/users/" + userid + "/timelines/progress.svg",
            success : function(){
                $.get("https://bangumi-mosaic-tile.herokuapp.com/users/" + userid);
                $("div.mosaic_box").html("bangumi " + type_name + "马赛克瓷砖</br><a target='_blank' href='https://bangumi-mosaic-tile.herokuapp.com/users/" + userid + "'><img src='https://bangumi-mosaic-tile.herokuapp.com/users/" + userid + "/timelines/" + type + ".svg' style='margin-top:10px;'></img></a>");
            },
            error : function(){
                $("div.mosaic_box").html("该用户无马赛克瓷砖");
            }
        });
    }
})();