Redirect to Google Translator

Instead of using the small translator on https://google.com get redirected to https://translate.google.com

安装此脚本?
作者推荐脚本

您可能也喜欢Precise Time Converter on Google

安装此脚本
  1. // ==UserScript==
  2. // @name Redirect to Google Translator
  3. // @namespace GoogleTranslatorRedirector
  4. // @version 7
  5. // @description Instead of using the small translator on https://google.com get redirected to https://translate.google.com
  6. // @author hacker09
  7. // @include *://www.google.*
  8. // @icon https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://translate.google.com/&size=32
  9. // @run-at document-end
  10. // @grant none
  11. // @noframes
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. if (document.querySelector("#tw-main") !== null) // If the small translator widget exists on the page
  17. { //Starts the if conditon
  18. var Redirect = setTimeout(function() { //Starts the settimeout function
  19. window.open('https://translate.google.com', '_self'); //Redirect to google translate
  20. }, 3000); //Redirect to https://translate.google.com in 3 secs
  21.  
  22. document.body.insertAdjacentHTML('beforeend', '<div id="Redirect" style="width: 100vw; height: 100vh; z-index: 2147483647; background: rgb(0 0 0 / 36%); position: fixed; top: 0px; font-size: 50px; color: white;"><center>You\'ve 3 secs to click Anywhere if you don\'t want to be redirected</center></div>'); //Show an option to the user
  23.  
  24. document.querySelector("#Redirect").onclick = function() { //If anywhere is clicked
  25. clearTimeout(Redirect); //Stop the redirecting process
  26. document.querySelector("#Redirect").style.display = 'none'; //Hide the option
  27. } //Stop the redirection if the user clicks anywhere
  28. } //Finishes the if conditon
  29. })();