Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Disemvowel User Comments on Pharyngula
- // @namespace http://tampermonkey.net/
- // @version 1.2
- // @description Finds comments by specific user classes (e.g., "comment-author-username") and removes vowels from their posts.
- // @author You
- // @match https://freethoughtblogs.com/pharyngula/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // --- Configuration ---
- // IMPORTANT: Add the lowercase usernames from the class name here.
- // For "comment-author-yorickoid", you add "yorickoid".
- const usernamesToTarget = [
- 'yorickoid', // Original name of John Morales
- 'placeholder' // Add additional target users here. No comment following last entry in list, feel free to add me here if you like.
- ];
- // This is the part of the class name that comes before the username.
- const commentAuthorClassPrefix = 'comment-author-';
- // This is the selector for the part of the comment that contains the text.
- // This might still need checking with the Inspector tool. '.comment-content' is a common one.
- const contentSelector = '.comment-content';
- // ---------------------
- /**
- * Removes vowels from a given string.
- * @param {string} text - The input string.
- * @returns {string} The string with vowels removed.
- */
- function disemvowel(text) {
- return text.replace(/[aeiou]/gi, '');
- }
- /**
- * Finds and modifies comments based on the user's class name.
- */
- function processCommentsByUserClass() {
- console.log("Pharyngula Disemvowel Script: Running...");
- // Loop through each username you want to target.
- usernamesToTarget.forEach(username => {
- // Create the specific class selector for this user.
- // Example: ".comment-author-yorickoid"
- const userSelector = `.${commentAuthorClassPrefix}${username}`;
- // Find all comment containers posted by this user.
- const userComments = document.querySelectorAll(userSelector);
- if (userComments.length > 0) {
- console.log(`Found ${userComments.length} comments by ${username}.`);
- }
- // Process each comment found.
- userComments.forEach(comment => {
- const contentElement = comment.querySelector(contentSelector);
- if (contentElement) {
- const paragraphs = contentElement.querySelectorAll('p');
- paragraphs.forEach(p => {
- p.innerHTML = disemvowel(p.innerHTML);
- });
- }
- });
- });
- }
- // Run the script once the window has fully loaded.
- window.addEventListener('load', function() {
- processCommentsByUserClass();
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment