Greasy Fork镜像 支持简体中文。

GTranslatePDF Helper

.

目前為 2018-02-04 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name GTranslatePDF Helper
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description .
  6. // @author els_angel
  7. // @match *://translate.google.com/*
  8. // @grant none
  9. // ==/UserScript==
  10. var source = document.getElementById('source');
  11. function handlePaste (e) {
  12. var clipboardData, pastedData;
  13.  
  14. e.stopPropagation();
  15. e.preventDefault();
  16.  
  17. clipboardData = e.clipboardData || window.clipboardData;
  18. pastedData = clipboardData.getData('Text');
  19. var out = pastedData.replace(/[\r\n]+/g," ");
  20. var start = source.selectionStart;
  21. var finish = source.selectionEnd;
  22. var str = source.value;
  23. var final = str.substring(0,start)+out+str.substring(finish,str.length);
  24. source.value=final;
  25. source.focus();
  26. source.selectionEnd = start + out.length;
  27. }
  28. (function() {
  29. 'use strict';
  30.  
  31. // Your code here...
  32. source.addEventListener('paste', handlePaste);
  33. })();
  34.  

QingJ © 2025

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