Sharty Mod Icons

Adds Mod Icons

  1. // ==UserScript==
  2. // @name Sharty Mod Icons
  3. // @namespace soyjak.party
  4. // @version 1.4
  5. // @license MIT
  6. // @description Adds Mod Icons
  7. // @author Chud
  8. // @match https://soyjak.party/*
  9. // @match https://soyjak.st/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Create a style element for CSS
  17. const style = document.createElement('style');
  18. style.textContent = `
  19. .mod-icon {
  20. background-image: url('https://files.catbox.moe/9u72hu.png');
  21. width: 20px; /* Set size for the icon */
  22. height: 20px; /* Set size for the icon */
  23. display: inline-block;
  24. vertical-align: middle;
  25. margin-left: 2px; /* Space between capcode and icon */
  26. margin-top: -2px; /* Move icon up by 2 pixels */
  27. background-size: contain; /* Scale the image to fit */
  28. background-repeat: no-repeat; /* Prevent image from repeating */
  29. background-position: center; /* Center the image */
  30. cursor: default; /* Change cursor to default */
  31. }
  32. .mod-icon-wrapper {
  33. display: inline-block; /* Make the wrapper inline */
  34. cursor: default; /* Change cursor to default */
  35. }
  36. .capcode {
  37. font-weight: bold; /* Make capcode font bold */
  38. }
  39. `;
  40. document.head.appendChild(style);
  41.  
  42. // Set to track processed posts
  43. const processedPosts = new Set();
  44.  
  45. // Function to add mod icons to posts
  46. function addModIcons() {
  47. document.querySelectorAll('.post').forEach(post => {
  48. if (processedPosts.has(post)) return; // Skip if already processed
  49.  
  50. const capcodeElement = post.querySelector('.capcode');
  51. const modIcon = post.querySelector('.mod-icon'); // Check if icon already exists
  52.  
  53. if (capcodeElement && !modIcon) {
  54. const capcodeText = capcodeElement.textContent.trim();
  55. console.log(`Capcode found: ${capcodeText}`); // Debug log
  56.  
  57. // Check for "## Mod", "## Admin", "## Froot", or "## Manager"
  58. if (capcodeText === '## Mod' || capcodeText === '## Admin' || capcodeText === '## Froot' || capcodeText === '## Thanos' || (capcodeText === '## Developer' && capcodeElement.style.color === 'rgb(255, 60, 154)') || (capcodeText === '## Manager' && capcodeElement.style.color === 'rgb(245, 205, 0)')) {
  59. const iconWrapper = document.createElement('span');
  60. iconWrapper.className = 'mod-icon-wrapper'; // Create a wrapper for the icon
  61. const newModIcon = document.createElement('span');
  62. newModIcon.className = 'mod-icon';
  63.  
  64. // Prevent click propagation
  65. newModIcon.addEventListener('click', function(event) {
  66. event.stopPropagation();
  67. });
  68.  
  69. if (capcodeText === '## Admin') {
  70. newModIcon.title = "This User does it for Free."; // Tooltip for Admin
  71. const nameElement = post.querySelector('.name'); // Find the name element
  72. if (nameElement && nameElement.textContent.includes('Chud')) {
  73. iconWrapper.appendChild(newModIcon);
  74. capcodeElement.appendChild(iconWrapper);
  75. }
  76. } else if (capcodeText === '## Mod') {
  77. newModIcon.title = "This User does it for Free."; // Tooltip for Mod
  78. iconWrapper.appendChild(newModIcon); // Append icon for "## Mod"
  79. capcodeElement.appendChild(iconWrapper);
  80. } else if (capcodeText === '## Froot') {
  81. newModIcon.style.backgroundImage = "url('https://files.catbox.moe/od3szi.png')"; // Set new icon for Froot
  82. newModIcon.title = "This User is Fruity."; // Tooltip for Froot
  83. iconWrapper.appendChild(newModIcon);
  84. capcodeElement.appendChild(iconWrapper);
  85. } else if (capcodeText === '## Thanos') {
  86. newModIcon.style.backgroundImage = "url('https://soyjak.st/static/thanos.png')";
  87. newModIcon.title = "This User is Thanos.";
  88. iconWrapper.appendChild(newModIcon);
  89. capcodeElement.appendChild(iconWrapper);
  90. } else if (capcodeText === '## Developer' && capcodeElement.style.color === 'rgb(255, 60, 154)') {
  91. newModIcon.style.backgroundImage = "url('https://files.catbox.moe/8v9ald.png')";
  92. newModIcon.title = "This User is Muddy.";
  93. iconWrapper.appendChild(newModIcon);
  94. capcodeElement.appendChild(iconWrapper);
  95. } else if (capcodeText === '## Manager' && capcodeElement.style.color === 'rgb(245, 205, 0)') {
  96. newModIcon.style.backgroundImage = "url('https://files.catbox.moe/aeih0d.png')"; // Set icon for Manager
  97. newModIcon.title = "This User is a Manager."; // Tooltip for Manager
  98. iconWrapper.appendChild(newModIcon);
  99. capcodeElement.appendChild(iconWrapper);
  100.  
  101. }
  102.  
  103. processedPosts.add(post); // Mark this post as processed
  104. }
  105. }
  106. });
  107. }
  108.  
  109. // Run the function on page load
  110. addModIcons();
  111.  
  112. // Set up a MutationObserver for dynamically loaded posts
  113. const observer = new MutationObserver(addModIcons);
  114. observer.observe(document.body, { childList: true, subtree: true });
  115. })();
  116.  
  117.  
  118.  
  119.  
  120.