Skip to content

Instantly share code, notes, and snippets.

@johnd0e
Last active December 14, 2021 19:49
Show Gist options
  • Save johnd0e/fb21bbfa9c52e52935995e44f08547fa to your computer and use it in GitHub Desktop.
Save johnd0e/fb21bbfa9c52e52935995e44f08547fa to your computer and use it in GitHub Desktop.
// ==UserScript==
// @id custom-linked-portals-show
// @name IITC plugin: Customize Linked portals
// @description Auto-request missing details
// @category Custom
// @version 0.2
// @author jd
// @namespace https://gist.github.com/johnd0e
// @homepageURL https://gist.github.com/johnd0e/fb21bbfa9c52e52935995e44f08547fa
// @supportURL https://gist.github.com/johnd0e/fb21bbfa9c52e52935995e44f08547fa#new_comment_field
// @downloadURL https://gist.github.com/johnd0e/fb21bbfa9c52e52935995e44f08547fa/raw/custom-linked-portals-show.user.js
// @include https://intel.ingress.com/*
// @grant none
// ==/UserScript==
function wrapper(plugin_info) {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') window.plugin = function() {};
// PLUGIN START ////////////////////////////////////////////////////////
function setup () {
if (plugin.showLinkedPortal && plugin.showLinkedPortal.makePortalLinkContent) {
(function (makePortalLinkInfo) {
plugin.showLinkedPortal.makePortalLinkInfo = function ($div) {
makePortalLinkInfo.apply(this, arguments);
if ($div.hasClass('outOfRange')) {
plugin.showLinkedPortal.requestPortalData.call($div[0]);
}
}
})(plugin.showLinkedPortal.makePortalLinkInfo);
} else {
alert('custom-linked-portals-show:\n"Show linked portals" is not active or outdated (1.4.0@iitc-ce required)');
}
}
// 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