// ==UserScript== // @author EisFrei // @id portalHistoryFlags@EisFrei // @name Portal History Flags // @category Layer // @version 0.0.10 // @namespace https://github.com/EisFrei/IngressPortalHistoryFlags // @downloadURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/EisFrei/portalHistoryFlags.user.js // @updateURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/EisFrei/portalHistoryFlags.meta.js // @homepageURL https://github.com/EisFrei/IngressPortalHistoryFlags // @description Shows Visited/Captured/Scouted status above portal markers // @issueTracker https://github.com/EisFrei/IngressPortalHistoryFlags/issues // @include https://intel.ingress.com/* // @match https://intel.ingress.com/* // @grant none // ==/UserScript== function wrapper(plugin_info) { // Make sure that window.plugin exists. IITC defines it as a no-op function, // and other plugins assume the same. if (typeof window.plugin !== "function") window.plugin = function () {}; const KEY_SETTINGS = "plugin-portal-history-flags"; window.plugin.PortalHistoryFlags = function () {}; const thisPlugin = window.plugin.PortalHistoryFlags; // Name of the IITC build for first-party plugins plugin_info.buildName = "PortalHistoryFlags"; // Datetime-derived version of the plugin plugin_info.dateTimeVersion = "202102070043"; // ID/name of the plugin plugin_info.pluginId = "portalhistoryflags"; function svgToIcon(str, s) { const url = ("data:image/svg+xml," + encodeURIComponent(str)).replace(/#/g, '%23'); return new L.Icon({ iconUrl: url, iconSize: [s, s], iconAnchor: [s / 2, s / 2], className: 'no-pointer-events', //allows users to click on portal under the unique marker }) } thisPlugin.removePortalFromMap = function (data) { if (!data.portal._historyLayer) { return; } thisPlugin.layerGroup.removeLayer(data.portal._historyLayer); } thisPlugin.addToPortalMap = function (data) { if (data.portal.options.ent.length === 3 && data.portal.options.ent[2].length >= 19 && data.portal.options.ent[2][18] > 0) { data.portal.options.data.agentVisited = (data.portal.options.ent[2][18] & 0b1) === 1; data.portal.options.data.agentCaptured = (data.portal.options.ent[2][18] & 0b10) === 2; data.portal.options.data.agentScouted = (data.portal.options.ent[2][18] & 0b100) === 4; } //IITC.me support: getCurrentZoomTileParameters is iitc.app only; iitc.me function is: getMapZoomTileParameters var tileParams = window.getCurrentZoomTileParameters ? window.getCurrentZoomTileParameters() : window.getMapZoomTileParameters(); if (tileParams.level === 0) { drawPortalFlags(data.portal); } else { thisPlugin.removePortalFromMap(data); } } thisPlugin.toggleDisplayMode = function () { dialog({ html: `