記事一覧はこちら

animetick.netのユーザーページで使えるtampermonkey

こうなる imgTemp-2015-07-18-17-52-29 Tampermonkey - the most popular userscript manager for Blink-based browsersのソース

// ==UserScript==
// @name       animetickの各ユーザー画面に色々追加
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @description  enter something useful
// @match      http://animetick.net/users/*
// @copyright  2012+, You
// @grant GM_addStyle
// ==/UserScript==

//プログレスバーを見やすく変更
GM_addStyle("ul.animations li.animation div.icon div.progress{  -webkit-border-radius: 0;  opacity: 1;  width: 85px;  height: 10px;  top: 48px;  left: 7px;  background: #0FF;}");
GM_addStyle("ul.animations li.animation div.icon div.progress div.progress-bar{height: 10px;  -webkit-border-radius: 0;background: #F00;  opacity: 1;}");
GM_addStyle("div#body{width:100%;}");
GM_addStyle("ul.animations li.animation{float:left;  margin-left: 0px;padding:0;}");
GM_addStyle(".user_info{display: none;}");
GM_addStyle("div.user_anime{overflow: hidden;}");
GM_addStyle("#body>h2{display: none;}");
GM_addStyle("div.beforeCool>ul.animations>li.animation.fullWatch{display: none;}");
window.addEventListener("DOMContentLoaded", function(){
    var f=false;
    jQuery("#body>div.user_anime").each(function(){
        var target=$(this);
        if(f){
            target.addClass("beforeCool");
        }else{
            f=true;
        }
    });
    jQuery(".animation").each(updateOneAnimationNode);
}, false);
function updateOneAnimationNode(){
    var styleString=$(this).find(".progress-bar").attr("style");
    if(styleString=="width: 0.0%;"){
        $(this).css({ opacity: 0.3 });
    }else if(styleString=="width: 100.0%;"){
        $(this).css({ opacity: 0.3 ,backgroundColor: "rgba(0, 0, 0, 0.05)"});
    }
    var rate=$(this).attr("data-watched-rate");
    $(this).find(".progress").before($("<div>").text(rate).css({position: "absolute","width": "85px",height:"10px",top:"35px",right:"-11px",color:"black",fontWeight:"bold",textShadow:"0px 2px 1px white,0px 1px 1px white,1px 1px 1px white,1px 0px 1px white,2px 0px 1px white,1px -1px 1px white,1px -2px 1px white,0px -2px 1px white,-1px -2px 1px white,-2px -2px 1px white,-2px -1px 1px white,-2px 0px 1px white,-2px 1px 1px white,-1px 1px 1px white"}));
    //非表示にするかもクラスを追加する
    if( styleString=="width: 100.0%;" /*&& rate.match(/\d\d/)*/){
        $(this).addClass("fullWatch");
    }
}

作者さんにリクエスト出してdata属性入れてもらえました。ありがとー! フシハラさんはTwitterを使っています: "@KAZZONE 今のメーターですと、全10話で1話だけ見てないのか、全100話で10話見てないのかの区別がつかないので、なんらかのデータをhtmlに入れて頂きたいです。ものすごく狭い要望で申し訳ありません。ご検討の程よろしくお願いします。(終" imgTemp-2015-07-18-17-58-15