tdu_labo_grouping

配置希望状況を見やすくします

目前为 2014-09-23 提交的版本。查看 最新版本

// ==UserScript==
// @name        tdu_labo_grouping
// @namespace   tdu
// @include     /https?://www\.mlab\.im\.dendai\.ac\.jp/bthesis2015/StudentDeploy\.jsp/
// @include     /https?://www\.mlab\.im\.dendai\.ac\.jp/bthesis2015/StudentDeploy\.jsp\?displayOrder=0/
// @description 配置希望状況を見やすくします
// @version     1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @grant       none
// ==/UserScript==

$(function() {
    var $info = null;
    var curren_group = "";
    var num = 0;

    $trs = $('.entry_table tr');
    $trs.splice(0, 1);
    $trs.each(function() {
        var name = $(this).children(':nth-child(3)').html();
        // 切れ目
        if (curren_group != name) {
            if ($info) {
                $info.html(to_info_text(curren_group, num));
                $(this).prev().children('td').css("border-bottom", "dotted 2px");
            }
            $(this).before('<tr class="labo-title"><td colspan="4"></td></tr>');
            $info = $(this).prev();
            num = 0;
            curren_group = name;
        }
        num++;
    });
    $info.html(to_info_text(curren_group, num));
    $(this).prev().children('td').css("border-bottom", "dotted 2px");
});

function to_info_text(name, num) {
    num_max = "山田 柿崎 森本 森谷".indexOf(name) == -1 ? 12 : 2;
    return name + "研: (" + num + "/" + num_max + ")";
}


/*
山田 柿崎 森本 森谷
*/