Derpibooru - Rating Info

Shows image's rating above its thumbnail on Derpibooru.

اعتبارا من 08-09-2016. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        Derpibooru - Rating Info
// @description Shows image's rating above its thumbnail on Derpibooru.
// @namespace   derpibooru_ratinginfo
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js
// @include     /^https?:\/\/(www\.)?(derpiboo(ru\.org|\.ru)|trixiebooru\.org).*$/
// @version     20160908
// @grant       GM_addStyle
// ==/UserScript==
    GM_addStyle('.RI_rating > * {padding-right: 3px; font-weight: bold}');
    var conf = [
                   ['safe',             'S',       '#67AF2B'],
                   ['explicit',         'E',       '#CF0001'],
                   ['questionable',     'Q',       '#C4B246'],
                   ['suggestive',       'Sg',      '#C4B246'],
                   ['grimdark',         'GD',      '#5E0000'],
                   ['semi-grimdark',    'S-GD',    '#5E0000'],
                   ['grotesque',        'Gr',      '#000000']
               ];
    var tags = conf.map(function (value) {
        return value[0];
    });
    $.each(conf, function (index, value) {
        GM_addStyle('.RI_' + value[0] + ':after {content: "' + value[1] + '"; color:' + value[2] + '}');
    });
    $.each($('.media-box'), function (index, value) {
        var infoBoxEl = $(value).find('.media-box__header') [0];
        var imgTags = $(value).find('.image-container') [0].dataset.imageTagAliases.split(', ');
        var rTags = imgTags.filter(function (value) {
            return tags.indexOf(value) != - 1
        });
        var ratingNode = document.createElement('span');
        ratingNode.className = 'RI_rating';
        $.each(rTags, function (index, value) {
            var tagNode = document.createElement('span');
            tagNode.className = 'RI_' + value;
            ratingNode.appendChild(tagNode);
        });
        $(infoBoxEl).prepend(ratingNode);
    });