diff --git a/plugins/cache-portals-on-map.js b/plugins/cache-portals-on-map.js index 093e72130..acf2ad068 100644 --- a/plugins/cache-portals-on-map.js +++ b/plugins/cache-portals-on-map.js @@ -4,20 +4,23 @@ // @version 0.1.0 // @description Cache the details of recently viewed portals and use this to populate the map when possible - // use own namespace for plugin -window.plugin.cachePortalDetailsOnMap = function() {}; +window.plugin.cachePortalDetailsOnMap = function () {}; -window.plugin.cachePortalDetailsOnMap.MAX_AGE = 12*60*60; //12 hours max age for cached data +window.plugin.cachePortalDetailsOnMap.MAX_AGE = 12 * 60 * 60; //12 hours max age for cached data -window.plugin.cachePortalDetailsOnMap.portalDetailLoaded = function(data) { +window.plugin.cachePortalDetailsOnMap.portalDetailLoaded = function (data) { if (data.success) { - window.plugin.cachePortalDetailsOnMap.cache[data.guid] = { loadtime: Date.now(), ent: data.ent }; + window.plugin.cachePortalDetailsOnMap.cache[data.guid] = { + loadtime: Date.now(), + ent: data.ent, + }; } }; -window.plugin.cachePortalDetailsOnMap.entityInject = function(data) { - var maxAge = Date.now() - window.plugin.cachePortalDetailsOnMap.MAX_AGE*1000; +window.plugin.cachePortalDetailsOnMap.entityInject = function (data) { + var maxAge = + Date.now() - window.plugin.cachePortalDetailsOnMap.MAX_AGE * 1000; var ents = []; for (var guid in window.plugin.cachePortalDetailsOnMap.cache) { @@ -27,16 +30,20 @@ window.plugin.cachePortalDetailsOnMap.entityInject = function(data) { ents.push(window.plugin.cachePortalDetailsOnMap.cache[guid].ent); } } - data.callback(ents, 'detailed'); + data.callback(ents, "detailed"); }; - -window.plugin.cachePortalDetailsOnMap.setup = function() { - +window.plugin.cachePortalDetailsOnMap.setup = function () { window.plugin.cachePortalDetailsOnMap.cache = {}; - addHook('portalDetailLoaded', window.plugin.cachePortalDetailsOnMap.portalDetailLoaded); - addHook('mapDataEntityInject', window.plugin.cachePortalDetailsOnMap.entityInject); + addHook( + "portalDetailLoaded", + window.plugin.cachePortalDetailsOnMap.portalDetailLoaded + ); + addHook( + "mapDataEntityInject", + window.plugin.cachePortalDetailsOnMap.entityInject + ); }; -var setup = window.plugin.cachePortalDetailsOnMap.setup; +var setup = window.plugin.cachePortalDetailsOnMap.setup;