Flickr Likes Styler - 10 Levels

This script adjusts Flickr photo like counts by changing font size and background color.

  1. // ==UserScript==
  2. // @name Flickr Likes Styler - 10 Levels
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.71
  5. // @description This script adjusts Flickr photo like counts by changing font size and background color.
  6. // @description It uses 10 proportional levels, making likes more visually distinct as they increase.
  7.  
  8. // @author fapek GPT
  9. // @match https://*.flickr.com/photos/*/albums/*
  10. // @match https://*.flickr.com/photos/*/galleries/*/
  11. // @license MIT
  12.  
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. // The function that changes the style based on the number of likes.
  20. function stylizeLikes() {
  21. let likeElements = document.querySelectorAll('span.engagement-count');
  22.  
  23. likeElements.forEach(function(likeElement) {
  24. let likeCount = parseInt(likeElement.innerText.trim());
  25.  
  26. if (!isNaN(likeCount)) {
  27. // Style change depending on amount
  28. if (likeCount >= 0 && likeCount <= 10) {
  29. likeElement.style.color = 'darkgray';
  30. likeElement.style.fontWeight = 'bold';
  31. } else if (likeCount >= 11 && likeCount <= 20) {
  32. likeElement.style.color = 'lightgray';
  33. likeElement.style.fontWeight = 'bold';
  34. likeElement.style.fontSize = '1.2em';
  35. } else if (likeCount >= 21 && likeCount <= 30) {
  36. likeElement.style.color = 'brown';
  37. likeElement.style.fontWeight = 'bold';
  38. likeElement.style.fontSize = '1.3em';
  39. } else if (likeCount >= 31 && likeCount <= 40) {
  40. likeElement.style.color = 'orange';
  41. likeElement.style.fontWeight = 'bold';
  42. likeElement.style.fontSize = '1.4em';
  43. } else if (likeCount >= 41 && likeCount <= 50) {
  44. likeElement.style.color = 'darkviolet';
  45. likeElement.style.fontWeight = 'bold';
  46. likeElement.style.fontSize = '1.5em';
  47. } else if (likeCount >= 51 && likeCount <= 75) {
  48. likeElement.style.color = 'blue';
  49. likeElement.style.fontWeight = 'bold';
  50. likeElement.style.fontSize = '1.6em';
  51. } else if (likeCount >= 76 && likeCount <= 100) {
  52. likeElement.style.color = 'green';
  53. likeElement.style.fontWeight = 'bold';
  54. likeElement.style.fontSize = '1.7em';
  55. } else if (likeCount >= 101 && likeCount <= 150) {
  56. likeElement.style.color = 'darkred';
  57. likeElement.style.fontWeight = 'bold';
  58. likeElement.style.fontSize = '1.8em';
  59. } else if (likeCount >= 151 && likeCount <= 250) {
  60. likeElement.style.color = 'darkgreen';
  61. likeElement.style.fontWeight = 'bold';
  62. likeElement.style.fontSize = '1.9em';
  63. } else if (likeCount > 250) {
  64. likeElement.style.color = 'maroon';
  65. likeElement.style.fontWeight = 'bold';
  66. likeElement.style.fontSize = '1.99em';
  67. }
  68. }
  69. });
  70. }
  71.  
  72. // Mutation observer, listens for changes in the DOM.
  73. const observer = new MutationObserver(function(mutations) {
  74. mutations.forEach(function(mutation) {
  75. if (mutation.addedNodes.length || mutation.removedNodes.length) {
  76. stylizeLikes();
  77. }
  78. });
  79. });
  80.  
  81. // Mutation configuration
  82. observer.observe(document.body, {
  83. childList: true,
  84. subtree: true
  85. });
  86.  
  87. // Initial run after the page loads.
  88. window.addEventListener('load', stylizeLikes);
  89. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址