Google Chrome - Set New Tab

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

As of 28.03.2014. See апошняя версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @id              chrome-newtab@loucypher
// @name            Google Chrome - Set New Tab
// @namespace       https://github.com/LouCypher/userscripts
// @description     Set a specified URL as new tab page on Google Chrome.
// @version         1.0
// @author          LouCypher
// @license         MIT License
// @contributionURL http://loucypher.github.io/userscripts/donate.html?Google+Chrome+-+Set+New+Tab
// @homepageURL     https://greatest.deepsurf.us/scripts/217
// @supportURL      https://greatest.deepsurf.us/scripts/217/feedback
// @resource        CHANGELOG https://raw.github.com/LouCypher/userscripts/master/tampermonkey/set-new-tab/CHANGELOG.txt
// @resource        LICENSE https://raw.github.com/LouCypher/userscripts/master/tampermonkey/set-new-tab/LICENSE.txt
// @match           http://*/*
// @match           https://*/*
// @run-at          document-start
// @grant           GM_getValue
// @grant           GM_setValue
// @grant           GM_registerMenuCommand
// ==/UserScript==

if (/^https?:\/\/www.google.[a-z.]+\/\_\/chrome\/newtab.*/.test(location.href)) {
  document.documentElement.innerHTML = "<head></head><body></body>";
  location.replace(GM_getValue("newTabURL", "about:blank"));
}

GM_registerMenuCommand("Set new tab page", function() {
  var setCurrentPage = confirm("Use current page as new tab?\nPress 'Cancel' to enter URL");
  if (setCurrentPage)
    GM_setValue("newTabURL", location.href);
  else {
    var url = GM_getValue("newTabURL", "about:blank");
    var newTabURL = prompt("Enter URL as new tab.\nEnter 'about:blank' to use blank page", url);
    if (newTabURL)
      GM_setValue("newTabURL", newTabURL);
  }
});