Skip to content

Instantly share code, notes, and snippets.

@McBen
Created February 25, 2024 09:27
Show Gist options
  • Save McBen/c1ea7abb46ce373103513990f29f227f to your computer and use it in GitHub Desktop.
Save McBen/c1ea7abb46ce373103513990f29f227f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @id google@test
// @name IITC plugin: google - test plugin
// @category Tweaks
// @version 0
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @match https://intel.ingress.com/*
// @grant none
// ==/UserScript==
function wrapper(plugin_info) {
if (typeof window.plugin !== 'function') window.plugin = function () { };
var setup = function () {
$("#toolbox").append(
$("<a>", {
text: "Google",
click: () => window.open("https://www.google.com")
})
);
$("#toolbox").append(
$("<a>", {
text: "Google_blank",
click: () => window.open("https://www.google.com", "_blank", "noopener")
})
);
$("#toolbox").append(
$("<a>", {
text: "Google map",
click: () => window.open("https://www.google.com/maps?layer=c&cbll=48.859139,2.293676")
})
);
$("#toolbox").append(
$("<a>", {
text: "Google map2",
click: () => window.open("https://maps.google.com/maps?layer=c&cbll=48.859139,2.293676", "_system")
})
);
}
// PLUGIN END //////////////////////////////////////////////////////////
setup.info = plugin_info; //add the script info data to the function as a property
if (!window.bootPlugins) window.bootPlugins = [];
window.bootPlugins.push(setup);
// if IITC has already booted, immediately run the 'setup' function
if (window.iitcLoaded && typeof setup === 'function') setup();
} // wrapper end
// inject code into site context
var script = document.createElement('script');
var info = {};
if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
script.appendChild(document.createTextNode('(' + wrapper + ')(' + JSON.stringify(info) + ');'));
(document.body document.head document.documentElement).appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment