Google Chrome - Set New Tab

Set a specified URL as new tab page on Google Chrome.

目前为 2014-03-28 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @id chrome-newtab@loucypher
  3. // @name Google Chrome - Set New Tab
  4. // @namespace https://github.com/LouCypher/userscripts
  5. // @description Set a specified URL as new tab page on Google Chrome.
  6. // @version 1.0
  7. // @author LouCypher
  8. // @license MIT License
  9. // @contributionURL http://loucypher.github.io/userscripts/donate.html?Google+Chrome+-+Set+New+Tab
  10. // @homepageURL https://gf.qytechs.cn/scripts/217
  11. // @supportURL https://gf.qytechs.cn/scripts/217/feedback
  12. // @resource CHANGELOG https://raw.github.com/LouCypher/userscripts/master/tampermonkey/set-new-tab/CHANGELOG.txt
  13. // @resource LICENSE https://raw.github.com/LouCypher/userscripts/master/tampermonkey/set-new-tab/LICENSE.txt
  14. // @match http://*/*
  15. // @match https://*/*
  16. // @run-at document-start
  17. // @grant GM_getValue
  18. // @grant GM_setValue
  19. // @grant GM_registerMenuCommand
  20. // ==/UserScript==
  21.  
  22. if (/^https?:\/\/www.google.[a-z.]+\/\_\/chrome\/newtab.*/.test(location.href)) {
  23. document.documentElement.innerHTML = "<head></head><body></body>";
  24. location.replace(GM_getValue("newTabURL", "about:blank"));
  25. }
  26.  
  27. GM_registerMenuCommand("Set new tab page", function() {
  28. var setCurrentPage = confirm("Use current page as new tab?\nPress 'Cancel' to enter URL");
  29. if (setCurrentPage)
  30. GM_setValue("newTabURL", location.href);
  31. else {
  32. var url = GM_getValue("newTabURL", "about:blank");
  33. var newTabURL = prompt("Enter URL as new tab.\nEnter 'about:blank' to use blank page", url);
  34. if (newTabURL)
  35. GM_setValue("newTabURL", newTabURL);
  36. }
  37. });

QingJ © 2025

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