Greasy Fork is available in English.

今年一定島 爬格子

汲汲營營大報社

質問やレビューの投稿はこちらへ、スクリプトの通報はこちらへお寄せください。
// ==UserScript==
// @namespace    https://greasyfork.org/zh-TW/scripts/399634
// @name         今年一定島 爬格子
// @description  汲汲營營大報社
// @author       稻米
// @version      2020.04.06.0050.build16299
// @grant        none

// @include      *://*.komica.org/00/*
// @exclude      *://*.komica.org/00/src/*
// @exclude      *://*.komica.org/00/thumb/*
// @exclude      *.jpg
// @exclude      *.png
// @exclude      *.webm

// ==/UserScript==


try{}
catch(err){}
finally{}
//

$(document).ready(function(){
    var aa=$("div.thread");
    //console.log( aa );
    if( aa.length == 1 ){
        poi(); //回文模式才執行
    }
});

function poi(){
    poi200406a();
}

function poi200406a(){
    //console.log( 'poi' );
    //建立上方的列表區塊
    var aa=$("div#contents");
    //console.log( aa );
    aa.before("<div id='id200406'>id200406</div>");
    $('#id200406').css({
        'background':'rgb(200,200,200)',
        'color':'rgb(100,100,100)',
        'text-align':'initial',
        "width":"600px",
    });
    $('#id200406').html('爬格子');

    poi200406b();

}

function poi200406b(){
    var aa=$("div.post");
    //console.log( aa );
    var bb=0;
    var bb2=[];

    $.each(aa,function(index,item){
        //console.log( index,item );
        let aa2=$(item).find('span.now').text();
        //console.log( aa2 );
        let aa3=$(item).find('span.now').next().text();
        //console.log( aa3 );
        let aa4 = ''+ aa2 + aa3 +'GMT+8';
        //console.log( aa4 );
        let aa5 = Date.parse( aa4 );
        aa5=Math.floor( aa5/1000 ); //秒數
        //console.log( aa5 );

        let aa10=$(item).find('div.backquote');
        let aa11='';
        if(aa10.length > 0 ){
            aa11=aa10.find('a').length;
            //console.log( aa11 );
        }

        if(bb==0){
            bb=aa5;
        }else{
            bb=aa5-bb;
            bb2.push([bb,aa11]);
            bb=aa5;
        }





    });//each
    //console.log( bb2 );
    //
    poi200406c( bb2 );


}

function poi200406c(in1){
    var data=in1;
    var html='';
    $.each(data,function(index,item){
        //console.log( index,item );
        var [data_aa,data_bb]=item;
        //console.log( data_aa,data_bb );

        let FFF='';
        FFF='紅';
        if(data_aa> 60*1 ) { FFF='橘'; }//
        if(data_aa> 60*2 ) { FFF='黃'; }//
        if(data_aa> 60*3 ) { FFF='綠'; }//
        if(data_aa> 60*5 ) { FFF='藍'; }//
        if(data_aa> 60*10 ){ FFF='白'; }//
        if(data_aa> 60*15 ){ FFF='紫'; }//

        //console.log( FFF );
        switch( FFF ){
            case '紅':
                FFF='#ff0300';
                break;
            case '橘':
                FFF='#f09b02';
                break;
            case '黃':
                FFF='#fffe00';
                break;
            case '綠':
                FFF='#00fe00';
                break;
            case '藍':
                FFF='#443eff';
                break;
            case '白':
                FFF='#fff';
                break;
            case '紫':
                FFF='#d9e';
                break;
            default:

        }
        //console.log( FFF );


        html=html+'<span style=" background-color:'+FFF+';border:1px solid #000;">-</span>';
    });

    $('#id200406').html(html);


}


/*

color: #ff0300; background-color: #ff0300; 紅
color: #f09b02; background-color: #f09b02; 橘
color: #fffe00; background-color: #fffe00; 黃
color: #00fe00; background-color: #00fe00; 綠
color: #443eff; background-color: #443eff; 藍
color: #fff; background-color: #fff; 白
color: #d9e; background-color: #d9e; 紫

*/