Guest User

Morales Remover

a guest
Sep 12th, 2025
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Disemvowel User Comments on Pharyngula
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Finds comments by specific user classes (e.g., "comment-author-username") and removes vowels from their posts.
  6. // @author You
  7. // @match https://freethoughtblogs.com/pharyngula/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // --- Configuration ---
  15.  
  16. // IMPORTANT: Add the lowercase usernames from the class name here.
  17. // For "comment-author-yorickoid", you add "yorickoid".
  18. const usernamesToTarget = [
  19. 'yorickoid', // Original name of John Morales
  20. 'placeholder' // Add additional target users here. No comment following last entry in list, feel free to add me here if you like.
  21. ];
  22.  
  23. // This is the part of the class name that comes before the username.
  24. const commentAuthorClassPrefix = 'comment-author-';
  25.  
  26. // This is the selector for the part of the comment that contains the text.
  27. // This might still need checking with the Inspector tool. '.comment-content' is a common one.
  28. const contentSelector = '.comment-content';
  29.  
  30. // ---------------------
  31.  
  32. /**
  33. * Removes vowels from a given string.
  34. * @param {string} text - The input string.
  35. * @returns {string} The string with vowels removed.
  36. */
  37. function disemvowel(text) {
  38. return text.replace(/[aeiou]/gi, '');
  39. }
  40.  
  41. /**
  42. * Finds and modifies comments based on the user's class name.
  43. */
  44. function processCommentsByUserClass() {
  45. console.log("Pharyngula Disemvowel Script: Running...");
  46.  
  47. // Loop through each username you want to target.
  48. usernamesToTarget.forEach(username => {
  49. // Create the specific class selector for this user.
  50. // Example: ".comment-author-yorickoid"
  51. const userSelector = `.${commentAuthorClassPrefix}${username}`;
  52.  
  53. // Find all comment containers posted by this user.
  54. const userComments = document.querySelectorAll(userSelector);
  55.  
  56. if (userComments.length > 0) {
  57. console.log(`Found ${userComments.length} comments by ${username}.`);
  58. }
  59.  
  60. // Process each comment found.
  61. userComments.forEach(comment => {
  62. const contentElement = comment.querySelector(contentSelector);
  63.  
  64. if (contentElement) {
  65. const paragraphs = contentElement.querySelectorAll('p');
  66. paragraphs.forEach(p => {
  67. p.innerHTML = disemvowel(p.innerHTML);
  68. });
  69. }
  70. });
  71. });
  72. }
  73.  
  74. // Run the script once the window has fully loaded.
  75. window.addEventListener('load', function() {
  76. processCommentsByUserClass();
  77. });
  78.  
  79. })();
Advertisement
Add Comment
Please, Sign In to add comment