Chrome - No Google Translate Popup

Remove the original text popup when using Chrome's built in translation feature

目前為 2014-12-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name          Chrome - No Google Translate Popup
// @version       0.1
// @namespace     pk.qwerty12
// @description   Remove the original text popup when using Chrome's built in translation feature
// @include       http*
// @grant         GM_addStyle
// ==/UserScript==
function injectCSS() {
    // Taken from OBender: http://stackoverflow.com/a/8531408
    const css = ".goog-tooltip {  display: none !important;  } .goog-tooltip:hover { display: none !important; } .goog-text-highlight { background-color: transparent !important; border: none !important; box-shadow: none !important; }";
    GM_addStyle(css);
}

MutationObserver = window.MutationObserver || window.WebKitMutationObserver
if (MutationObserver) {
    var observer = new MutationObserver(function(mutations) {
      mutations.forEach(function(mutation) {
        for (var i = 0; i < mutation.addedNodes.length; ++i) {
            if (mutation.addedNodes[i].nodeType == 1 && mutation.addedNodes[i].id === "goog-gt-tt") {
                observer.disconnect();
                setTimeout(function() { injectCSS(); }, 100);
                return;
            }
        }
      });
    });
    setTimeout(function() {
        observer.observe(document.body, {
            childList: true
        })
    }, 100);
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址