du00.bookcase

cleanup

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        du00.bookcase
// @namespace   zhang
// @include     http://www.du00.com/bookcase.php
// @version     1
// @grant       GM_log
// @description cleanup
// ==/UserScript==

var grid = document.querySelector('table.grid');
if (grid) {
    var rows = grid.getElementsByTagName('tr');
    for (var i = rows.length - 1; i > 0; i--) {
        var row = rows[i];
        var cells = row.getElementsByTagName('td');
        switch(cells.length) {
            case 6:
                var latest = cells[2].getElementsByTagName('a');
                var marked = cells[3].getElementsByTagName('a');
                if (latest.length == 1 && marked.length == 1 &&
                    latest[0].href == marked[0].href) {
                    cells[3].innerHTML = ' ';
                }
                break;
            case 0:
                if (row.getElementsByTagName('th').length == 6) {
                    //bookcase header
                    break;
                }
            case 1:
                if (cells[0].className == 'foot') {
                    //bookcase footer
                    break;
                }
            default:
                alert('invalid bookcase structure');
        }
    }
}