Fandom Category Image Scaler

Let's you scale up thumbnails in Category section of Fandom. Change the WIDTH const to change it from new default 200px.

  1. // ==UserScript==
  2. // @name Fandom Category Image Scaler
  3. // @namespace https://github.com/Artemis-chan
  4. // @version 1.0
  5. // @description Let's you scale up thumbnails in Category section of Fandom. Change the WIDTH const to change it from new default 200px.
  6. // @author Artemis
  7. // @match https://*.fandom.com/wiki/Category:*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=fandom.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. const WIDTH = 200;
  17.  
  18. var ths = document.querySelectorAll('img.category-page__member-thumbnail');
  19. const regex = /\/smart\/width\/\d*\/height\/30/gm;
  20.  
  21. for (var i = 0; i < ths.length; i++) {
  22. var th = ths[i];
  23. th.src = th.src.replace(regex, '');
  24. }
  25.  
  26. var memberPad = WIDTH / 4;
  27. var linkPad = WIDTH / 2;
  28.  
  29. var cssString = `#content .category-page__member-thumbnail { width: ${WIDTH}px; height: auto } `
  30. + `#content .category-page__member { padding-left: ${memberPad}px }`
  31. + `#content .category-page__member-link { padding-left: ${linkPad}px }`;
  32.  
  33. var styleElement = document.createElement('style');
  34. styleElement.innerHTML = cssString;
  35. document.head.appendChild(styleElement);
  36. })();