Skip to content

Commit

Permalink
New script: tampermonkey/set-new-tab/
Browse files Browse the repository at this point in the history
  • Loading branch information
LouCypher committed Mar 28, 2014
1 parent 6dc7a87 commit 2f088f9
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions tampermonkey/set-new-tab/CHANGELOG.txt
@@ -0,0 +1 @@
1.0 - Initial release.
19 changes: 19 additions & 0 deletions tampermonkey/set-new-tab/LICENSE.txt
@@ -0,0 +1,19 @@
Copyright (c) 2014 LouCypher.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
39 changes: 39 additions & 0 deletions tampermonkey/set-new-tab/greasyfork-sync.tamper.js
@@ -0,0 +1,39 @@
// ==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://greasyfork.org/scripts/217
// @supportURL https://greasyfork.org/scripts/217/feedback
// @downloadURL https://greasyfork.org/scripts/217/code.user.js
// @updateURL https://greasyfork.org/scripts/217/code.user.js
// @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? Press '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);
}
});
39 changes: 39 additions & 0 deletions tampermonkey/set-new-tab/userscript.tamper.js
@@ -0,0 +1,39 @@
// ==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://github.com/LouCypher/userscripts
// @supportURL https://github.com/LouCypher/userscripts/issues
// @downloadURL https://raw.github.com/LouCypher/userscripts/master/tampermonkey/set-new-tab/userscript.tamper.js
// @updateURL https://raw.github.com/LouCypher/userscripts/master/tampermonkey/set-new-tab/userscript.tamper.js
// @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? Press '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);
}
});

0 comments on commit 2f088f9

Please sign in to comment.