Skip to content

Instantly share code, notes, and snippets.

@botsmack
Last active December 15, 2015 19:29
Show Gist options
  • Save botsmack/5311477 to your computer and use it in GitHub Desktop.
Save botsmack/5311477 to your computer and use it in GitHub Desktop.
Stop iTunes and Mac App Store from launching in Google Chrome while still maintaining the ability to manually launch with the button click. Modified the user script at http://userscripts.org/scripts/show/71794.
// ==UserScript==
// @name Stop iTunes and Mac App Store Auto-Launch
// @version 0.1.1
// @description Stop iTunes and the Mac App Store from automatically launching.
// @match *://itunes.apple.com/*
// @match *://phobos.apple.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
// Version 0.1 seemed to stop working reliably with the stable version of Chrome 29. I had this leftover code
// below I found online (I changed the function name), but I forget where. If you wrote this or know where
// it's from I will be happy to attribute it.
function StopAutoLaunch () {
window.onload = function () {};
}
addJS_Node (null, null, StopAutoLaunch);
//-- This is a standard-ish utility function:
function addJS_Node (text, s_URL, funcToRun, runOnLoad) {
var D = document;
var scriptNode = D.createElement ('script');
if (runOnLoad) {
scriptNode.addEventListener ("load", runOnLoad, false);
}
scriptNode.type = "text/javascript";
if (text) scriptNode.textContent = text;
if (s_URL) scriptNode.src = s_URL;
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
targ.appendChild (scriptNode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment