Xyanide / Anisearch Modification Date

// ==UserScript==
// @name        Anisearch Modification Date
// @namespace   anisearch
// @description Show modification date of anime entries in list view.
// @author      Xyanide
// @include     http://www.anisearch.de/usercp/list/anime*
// @version     1.0
// @grant       none
// ==/UserScript==

var clcTime = function calcTime(time, disp) {
    if ((time <= 0 || typeof(time) === "undefined") || disp.length != 6) return "";

    var k, n = 0, h = 0, d = 0, p = 0;
    k = new Date(1000 * time);
    n = 10 > k.getDate() ? "0" + k.getDate() : k.getDate();
    h = 10 > k.getMonth() + 1 ? "0" + (k.getMonth() + 1) : k.getMonth() + 1;
    d = k.getFullYear();
    p = 10 > k.getHours() ? "0" + k.getHours() : k.getHours();
    k = 10 > k.getMinutes() ? "0" + k.getMinutes() : k.getMinutes();

    if (disp[5]) d -= 2000;

    var dt = "";
    if (disp[0]) dt += n;
    if (disp[1] && disp[0]) dt += "." + h;
    else if (disp[1]) dt += h;
    if ((disp[0] || disp[1]) && disp[2]) dt += "." + d;
    else if (disp[2]) dt += d;
    if ((disp[3] || disp[4]) && (disp[0] || disp[1] || disp[2])) dt += ",";
    if (disp[3]) dt += p;
    if (disp[3] && disp[4]) dt += ":";
    if (disp[4]) dt += k;

    return dt;
};


var main = function() {

    //check if any other view than listview
    //could just check for responsive-table instead
    var gal = $("#content .gallery").length;
    var cov = $("#content .covers").length;
    var tmb = $("#content .thumbs").length;
    if ((gal + cov + tmb) > 0) return;

    var intitle = false;
    // 0day - 1month - 2year : 3hour - 4minute 5year-as-2digit
    var disp = [true, true, true, false, false, false];

    if (!intitle)
        if (!disp[3] || !disp[4]) $(".responsive-table thead .stars").css({
            "min-width": "207px",
            "width": "207px"
        });
        else $(".responsive-table thead .stars").css({
            "min-width": "246px",
            "width": "246px"
        });

    $(".responsive-table tbody tr").each(function() {
        var b = $(this).find(".quick");
        var d = $.parseJSON(b.attr("data-rating"));
        var t = d[14];
        d = calcTime(t, disp);

        if (intitle) $(this).find("th").append('<p style="font-size: .8em; margin-top: 2px;">' + d + "</p>");
        else {

            if (!disp[3] || !disp[4]) $(this).find(".rating").css({
                "text-align": "right",
                "min-width": "207px"
            });
            else $(this).find(".rating").css({
                "text-align": "right",
                "min-width": "246px"
            });


            $(this).find(".rating").prepend('<div style="font-size: 1.0em; position:relative; display: inline-flex; margin-right: 8px; vertical-align:middle;">' + d + "</div>");
            $(this).find(".rating .hcenter").css({
                "display": "inline-flex",
                "margin-right": "8px",
                "vertical-align": "middle"
            });
            $(this).find(".rating .quick").css({
                "display": "inline-flex",
                "position": "relative",
                "vertical-align": "middle"
            });


            if ($(this).find(".rating .rating0").length) {
                $(this).find(".rating .rating0 ").css({
                    "margin-right": "20px",
                    "right": "8px",
                    "display": ""
                });

            }


        }
    });
};


var asDate = document.createElement("script");
asDate.type = "text/javascript";
asDate.textContent = clcTime.toString() + "\n" + "(" + main.toString() + ")();";
document.body.appendChild(asDate);