Derpibooru - Rating Info

Shows image's rating above its thumbnail on Derpibooru.

À partir de 2015-10-02. Voir la dernière version.

  1. // ==UserScript==
  2. // @name Derpibooru - Rating Info
  3. // @description Shows image's rating above its thumbnail on Derpibooru.
  4. // @namespace derpibooru_ratinginfo
  5. // @include http://derpiboo.ru/*
  6. // @include https://derpiboo.ru/*
  7. // @include http://derpibooru.org/*
  8. // @include https://derpibooru.org/*
  9. // @include http://www.trixiebooru.org/*
  10. // @include https://www.trixiebooru.org/*
  11. // @version 4
  12. // @grant none
  13. // ==/UserScript==
  14. var css = document.createElement('style');
  15. css.setAttribute('type', 'text/css');
  16. css.innerHTML = '.RI_safe, .RI_questionable, .RI_suggestive, .RI_explicit, .RI_grimdark, .RI_semigrimdark, .RI_grotesque{padding-right: 3px; font-weight: bold}' +
  17. '.RI_safe {color:#67AF2B}' +
  18. '.RI_explicit {color:#CF0001}' +
  19. '.RI_questionable {color:#C4B246}' +
  20. '.RI_suggestive {color:#C4B246}' +
  21. '.RI_grimdark {color:#5e0000}' +
  22. '.RI_semigrimdark {color:#5e0000}' +
  23. '.RI_grotesque {color:#000000}';
  24. document.getElementsByTagName('head') [0].appendChild(css);
  25. var image = document.getElementsByClassName('image-container');
  26. function ratingElement(name, short) {
  27. var el = document.createElement('span');
  28. el.className = 'RI_' + name;
  29. el.innerHTML = short;
  30. return el;
  31. }
  32. for (var i = 0; i < image.length; i++) {
  33. var tags = image[i].dataset.imageTagAliases.split(', ');
  34. var rating = document.createElement('span');
  35. rating.className = 'RI_rating';
  36. if (tags.indexOf('safe') > - 1) rating.appendChild(ratingElement('safe', 'S'));
  37. if (tags.indexOf('questionable') > - 1) rating.appendChild(ratingElement('questionable', 'Q'));
  38. if (tags.indexOf('suggestive') > - 1) rating.appendChild(ratingElement('suggestive', 'Sg'));
  39. if (tags.indexOf('explicit') > - 1) rating.appendChild(ratingElement('explicit', 'E'));
  40. if (tags.indexOf('grimdark') > - 1) rating.appendChild(ratingElement('grimdark', 'GD'));
  41. if (tags.indexOf('semi-grimdark') > - 1) rating.appendChild(ratingElement('semigrimdark', 'S-GD'));
  42. if (tags.indexOf('grotesque') > - 1) rating.appendChild(ratingElement('grotesque', 'Gr'));
  43. document.getElementsByClassName('imageinfo') [i].insertBefore(rating, document.getElementsByClassName('imageinfo') [i].firstChild);
  44. }