Skip to content

Instantly share code, notes, and snippets.

@bartku
Created July 20, 2017 09:18
Show Gist options
  • Save bartku/59abc46e397f12b4d791313c00b34d8b to your computer and use it in GitHub Desktop.
Save bartku/59abc46e397f12b4d791313c00b34d8b to your computer and use it in GitHub Desktop.
Tampermonkey plugin for IITC to show last action on selected portal
// ==UserScript==
// @id iitc-plugin-action-time@eumir
// @name IITC plugin: show action time on portal
// @category Info
// @version 0.5.7.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Shows action time (recharged reso, captured portal, created link/field) on given portal
// @include https://*.ingress.com/intel*
// @include http://*.ingress.com/intel*
// @match https://*.ingress.com/intel*
// @match http://*.ingress.com/intel*
// @include https://*.ingress.com/mission/*
// @include http://*.ingress.com/mission/*
// @match https://*.ingress.com/mission/*
// @match http://*.ingress.com/mission/*
// @grant none
// ==/UserScript==
@@PLUGINSTART@@
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.actionTime = function() {};
window.plugin.actionTime.setupCallback = function() {
addHook('portalDetailsUpdated', window.plugin.actionTime.addActionTime);
}
window.plugin.actionTime.addActionTime = function(d) {
var guid = window.selectedPortal;
if (!window.portals[guid]) {
console.warn('[!] Failed to find portal details for guid ' + guid + ' - failed to show debug data');
return;
}
var details = portalDetail.get(guid);
if (!details) {
console.warn('[!] No details');
return;
}
var tt = 'Action time: ';
if (details.team === 'N' && details.health === 0) {
tt = 'Decayed at: ';
}
var ts = window.portals[window.selectedPortal].options.timestamp;
var HTMLcontent = '<div id=""action-time" style="text-align: center"><div>' + tt + '<i>' + window.unixTimeToDateTimeString(ts,true) +
'</i></div></div>';
$('#randdetails').after(HTMLcontent);
}
var setup = function () {
window.plugin.actionTime.setupCallback();
}
// PLUGIN END //////////////////////////////////////////////////////////
@@PLUGINEND@@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment