Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Hide Romanization in Google Translate
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Hide the romanization text in Google Translate
- // @author You
- // @match https://translate.google.com/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function to hide romanization by targeting the element
- function hideRomanization() {
- const romanizedTextElements = document.querySelectorAll('.kO6q6e'); // Adjust this if needed
- romanizedTextElements.forEach((element) => {
- element.style.display = 'none'; // Hides the element
- });
- }
- // Ensure the page is fully loaded before applying
- window.addEventListener('load', function() {
- hideRomanization(); // Hide romanization once the page is loaded
- });
- // Set up an observer to handle dynamic content added after the initial load
- const observer = new MutationObserver(function() {
- hideRomanization(); // Re-run the function if new romanized text appears
- });
- // Observe changes in the entire document body to catch dynamic content
- observer.observe(document.body, {
- childList: true, // Watch for added/removed child elements
- subtree: true // Look deeper in the tree (not just direct children)
- });
- // Run the function on a delayed interval to catch late loading elements
- setInterval(hideRomanization, 500); // Check every 500ms for the element
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement