返回首頁 

Hide Non-English Userstyles on Userstyles.World

Hide userstyles containing non-English characters on userstyles.world


Install this script?
// ==UserScript==// @name         Hide Non-English Userstyles on Userstyles.World// @namespace    typpi.online// @version      1.10// @description  Hide userstyles containing non-English characters on userstyles.world// @author       Nick2bad4u// @license      UnLicense// @match        https://userstyles.world/*// @icon         https://www.google.com/s2/favicons?sz=64&domain=userstyles.world// @grant        none// @homepageURL  https://github.com/Nick2bad4u/UserStyles// ==/UserScript==(function () {'use strict';// Function to check if a string contains non-English charactersfunction containsNonEnglishCharacters(text) {// Allow English letters, digits, spaces, and common punctuationreturn /[^ -~\t\n\r]/.test(text);// Matches characters outside printable ASCII, tab, newline, and carriage return}// Find all card elements on the pagedocument.querySelectorAll('.card').forEach((card) => {// Get the text content from relevant child elementsconst title = card.querySelector('.name')?.textContent.trim() || '';// Get the title of the userstyleconst description =card.querySelector('.card-body')?.textContent.trim() || '';// Get the description of the userstyleconst ariaLabel =card.querySelector('.card-header.thumbnail')?.getAttribute('aria-label') || '';// Get the aria-label which may contain a description// Log the content being checkedconsole.log(`Checking card: Title="${title}", Description="${description}", Aria-Label="${ariaLabel}"`,);// Check if any of these contain non-English charactersif (containsNonEnglishCharacters(title) ||containsNonEnglishCharacters(description) ||containsNonEnglishCharacters(ariaLabel)) {// Hide the card if non-English characters are foundcard.style.display = 'none';console.log(`Hiding card: Title="${title}", Description="${description}", Aria-Label="${ariaLabel}"`,);}});})();