Derpibooru - Rating Info

Shows image's rating above its thumbnail on Derpibooru.

2015-10-02 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        Derpibooru - Rating Info
// @description Shows image's rating above its thumbnail on Derpibooru.
// @namespace   derpibooru_ratinginfo
// @include     http://derpiboo.ru/*
// @include     https://derpiboo.ru/*
// @include     http://derpibooru.org/*
// @include     https://derpibooru.org/*
// @include     http://www.trixiebooru.org/*
// @include     https://www.trixiebooru.org/*
// @version     5
// @grant       none
// ==/UserScript==
var css = document.createElement('style');
css.setAttribute('type', 'text/css');
css.innerHTML = '.RI_safe, .RI_questionable, .RI_suggestive, .RI_explicit, .RI_grimdark, .RI_semigrimdark, .RI_grotesque{padding-right: 3px; font-weight: bold}' +
'.RI_safe {color:#67AF2B}' +
'.RI_explicit {color:#CF0001}' +
'.RI_questionable {color:#C4B246}' +
'.RI_suggestive {color:#C4B246}' +
'.RI_grimdark {color:#5e0000}' +
'.RI_semigrimdark {color:#5e0000}' +
'.RI_grotesque {color:#000000}';
document.getElementsByTagName('head') [0].appendChild(css);
var imageinfos = document.getElementsByClassName('imageinfo');
function ratingElement(name, short) {
  var el = document.createElement('span');
  el.className = 'RI_' + name;
  el.innerHTML = short;
  return el;
}
for (var i = 0; i < imageinfos.length; i++) {
  var tags = imageinfos[i].parentElement.getElementsByClassName('image-container')[0].dataset.imageTagAliases.split(', ');
  var rating = document.createElement('span');
  rating.className = 'RI_rating';
  if (tags.indexOf('safe') > - 1) rating.appendChild(ratingElement('safe', 'S'));
  if (tags.indexOf('questionable') > - 1) rating.appendChild(ratingElement('questionable', 'Q'));
  if (tags.indexOf('suggestive') > - 1) rating.appendChild(ratingElement('suggestive', 'Sg'));
  if (tags.indexOf('explicit') > - 1) rating.appendChild(ratingElement('explicit', 'E'));
  if (tags.indexOf('grimdark') > - 1) rating.appendChild(ratingElement('grimdark', 'GD'));
  if (tags.indexOf('semi-grimdark') > - 1) rating.appendChild(ratingElement('semigrimdark', 'S-GD'));
  if (tags.indexOf('grotesque') > - 1) rating.appendChild(ratingElement('grotesque', 'Gr'));
  imageinfos[i].insertBefore(rating, imageinfos[i].firstChild);
}