AniDB Big Thumbnails on Search

Adds big thumbnails to the search results on AniDB

  1. // ==UserScript==
  2. // @name AniDB Big Thumbnails on Search
  3. // @namespace https://github.com/Alistair1231/my-userscripts/
  4. // @version 0.1.4
  5. // @description Adds big thumbnails to the search results on AniDB
  6. // @author Alistair1231
  7. // @match https://anidb.net/anime/?*
  8. // @icon https://icons.duckduckgo.com/ip2/anidb.net.ico
  9. // @require https://code.jquery.com/jquery-3.6.0.min.js
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. function addStyleAttribute($element, styleAttribute) {
  14. $element.attr('style', $element.attr('style') + '; ' + styleAttribute);
  15. }
  16.  
  17. var thumbnailContext = $($('.thumb.anime a picture'))
  18. var allThumbs = $("source,img", thumbnailContext)
  19.  
  20. for (i = 0; i < allThumbs.length ;i++) {
  21. if (allThumbs[i].flag != 1) {
  22. var bigImg = allThumbs[i].srcset;
  23. allThumbs[i].flag = 1;
  24. allThumbs[++i].src = bigImg;
  25. allThumbs[i].width *= 3;
  26. allThumbs[i].height *= 3;
  27. allThumbs[i].loading = "eager";
  28. addStyleAttribute($(allThumbs[i]), 'max-width: 18.5em !important');
  29. }
  30. }
  31.