Merge pull request #3 from breunigs/gh-pages

Rebase from bruenigs/ingress-intel-total-conversion
This commit is contained in:
Hollow011 2013-02-19 23:05:07 -08:00
commit caa3295a32
2 changed files with 9 additions and 2 deletions

View File

@ -30,11 +30,16 @@
// yet been displayed. The data hash contains both the un- // yet been displayed. The data hash contains both the un-
// processed raw ajax response as well as the processed // processed raw ajax response as well as the processed
// chat data that is going to be used for display. // chat data that is going to be used for display.
// portalDataLoaded: callback is passed the argument of
// {portals : [portal, portal, ...]} where "portal" is the
// data element and not the leaflet object. "portal" is an
// array [GUID, time, details]. Plugin can manipulate the
// array to change order or add additional values to the
// details of a portal.
window._hooks = {} window._hooks = {}
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated', window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
'publicChatDataAvailable']; 'publicChatDataAvailable', 'portalDataLoaded'];
window.runHooks = function(event, data) { window.runHooks = function(event, data) {
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event); if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);

View File

@ -127,6 +127,8 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
// Preserve and restore "selectedPortal" between portal re-render // Preserve and restore "selectedPortal" between portal re-render
if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal; if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal;
runHooks('portalDataLoaded', {portals : ppp});
$.each(ppp, function(ind, portal) { renderPortal(portal); }); $.each(ppp, function(ind, portal) { renderPortal(portal); });
var selectedPortalLayer = portals[oldSelectedPortal]; var selectedPortalLayer = portals[oldSelectedPortal];