Merge branch 'gh-pages' into scoreboard

This commit is contained in:
vita10gy 2013-03-02 10:07:19 -06:00
commit 95c040eeec
17 changed files with 347 additions and 51 deletions

View File

@ -40,9 +40,7 @@ Current version is 0.7.8. [See NEWS.md for details](https://github.com/breunigs/
- Confirm once again.
- Reload page.
**NOTE: You still need to manually update IITC with Tampermonkey.** There is a bug in the current stable release. It has been fixed in Tampermonkeys development version. Until it is released, you need to manually update IITC.
*Note:* Tampermonkey is optional. However, it ~~offers auto-update~~, shows correct version numbers and installing user scripts is much easier. If you have installed the scripts directly into Chrome before, I recommend you switch to Tampermonkey. To do so, uninstall the IITC scripts and click each install link again. Follow the procedure explained above.
*Note:* Tampermonkey is optional. However, it offers auto-update, shows correct version numbers and installing user scripts is much easier. If you have installed the scripts directly into Chrome before, I recommend you switch to Tampermonkey. To do so, uninstall the IITC scripts and click each install link again. Follow the procedure explained above.
### Opera
- Download the script: [download](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/total-conversion-build.user.js)
@ -93,7 +91,8 @@ First of all, its very nice you want to help. There are several equally impor
[tpenner](https://github.com/tpenner),
[vita10gy](https://github.com/vita10gy),
[Xelio](https://github.com/Xelio),
[ZauberNerd](https://github.com/ZauberNerd)
[ZauberNerd](https://github.com/ZauberNerd),
[waynn](https://github.com/waynn)
Attribution & License

View File

@ -21,8 +21,8 @@ General Usage
-------------
- many things have more information in tooltips. Let your cursor rest over stuff to show the tooltip. *Hint:* your cursor changes into a question mark / help cursor if theres a tooltip available.
- single left click on portals to show details
- double left click on portals to zoom in to them
- single left click on portals to show details.
- double left click on portals to zoom in to them.
Chat
@ -37,7 +37,7 @@ The chat is split up into several categories. It usually only shows messages for
- faction: shows messages for own faction (e.g. only Resistance can read Resistance messages)
**Posting messages:**
- You can post in the faction and public categories only
- You can post in the faction and public categories only.
- Your message will be tagged with the coordinates in the center of the map.
- Your zoom level does not matter. Zooming out will not show your messages to more users.
@ -45,7 +45,10 @@ The chat is split up into several categories. It usually only shows messages for
Map Display
-----------
You can customize many aspects of how the map is rendered in the layer chooser. The layer chooser is available from the icon in the top right corner, left of the sidebar.
You can customize many aspects of how the map is rendered in the layer chooser.
**Layer Chooser:**
The layer chooser is available from the icon in the top right corner, left of the sidebar. The top entries are background maps and you can only have one of them active at a time. The entries on the bottom can be displayed in any combination you like. *Hint:* (NIGHLTY ONLY) Modifier-click an entry to quickly hide all other layers. The modifier may be either of these: shift, ctrl, alt, meta. Modifier-click the entry again to select all layers.
**Background / Street Map / Base Layer:**
All these refer to the same thing. The base layer is stored across sessions. The default one uses OpenStreetMap data with a style that resembles the default Ingress one. There are other styles available.
@ -62,7 +65,7 @@ Resonators are shown at their actual positions if you zoom in close enough. They
They are handled the same way portals are, see above.
**Other:**
When you select a portal its outer ring becomes red. Theres also a small yellow circle around it which depicts the hack range. You need to be in hack range to hack the portal or update its resonators or mods.
When you select a portal its outer ring becomes red. Theres also a small yellow circle around it which depicts the hack range. You need to be in hack range to hack the portal or upgrade its resonators or mods.
If you are zoomed out quite a bit, theres a larger red circle. This is the link range. Only portals within this link range can be linked while standing at the selected portal. [Click the range in the sidebar to zoom to link range for the selected portal](#random-details).
@ -72,7 +75,7 @@ If you are zoomed out quite a bit, theres a larger red circle. This is the li
Map Status / Updates
--------------------
It shows if there are currently operations pending. This includes chat updates as well as map data requests. Updates happen every 45s to 90s, depending on how far zoomed in you are. Zoom in closer for faster updates.
It shows if there are operations currently pending. This includes chat updates as well as map data requests. Updates happen every 45s to 90s, depending on how far zoomed in you are. Zoom in closer for faster updates.
It also shows which portals are being loaded/shown. Zoom in to see lower level portals. This is a limit of the server and not IITC. Portals levels that cannot be shown are also striked through in the layer chooser.
@ -88,18 +91,19 @@ Sidebar
The sidebar is mainly used to show game stats and portal details. However, it also allows you to perform certain actions.
### General usage:
- single click a portal to show details about it in the sidebar
- single click a portal to show details about it in the sidebar.
- the portal information is updated automatically, as long as the selected portal is kept in view and you do not zoom out too much.
- the sidebar may be collapsed. Click the triangle button that stands out at the left hand side.
- the sidebar **can be scrolled** if your screen is too small. Use your scroll wheel.
- almost anything has tooltips. See [General usage](#general-usage) above.
- almost everything has tooltips. See [General usage](#general-usage) above.
### Details:
Starting from the top, the sidebar shows this information:
#### logged in user, global MU, search
- Details about you, the logged in user. This is only updated if you reload the page. This is a limitation of Ingress, not IITC.
- it shows your current level followed by your nick
- it shows your current level followed by your nickname
- hovering over your nickname allows you to sign out (NIGHTLY ONLY)
- to the right, it shows to percentages. The upper one, e.g. “XM: 37%” tells you how much your XM bar is filled. The lower one, e.g. “level: 37%“ tells you that you have gathered 37% of the AP required for the next level. It shows “max level” if you have reached max level.
- the tooltip mainly shows you absolute numbers instead of percentages. It also shows how many invites you have.
- The next bar is a visual representation of global MindUnits (MU) per faction. It is updated every now and then. The tooltip shows the absolute MU count per faction.

View File

@ -23,6 +23,25 @@ window.setupLargeImagePreview = function() {
});
}
// adds listeners to the layer chooser such that a long press hides
// all custom layers except the long pressed one.
window.setupLayerChooserSelectOne = function() {
$('.leaflet-control-layers-overlays').on('click', 'label', function(e) {
if(!e || !(e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)) return;
var isChecked = $(this).find('input').is(':checked');
var checkSize = $('.leaflet-control-layers-overlays input:checked').length;
if((isChecked && checkSize === 1) || checkSize === 0) {
// if nothing is selected or the users long-clicks the only
// selected element, assume all boxes should be checked again
$('.leaflet-control-layers-overlays input:not(:checked)').click();
} else {
// uncheck all
$('.leaflet-control-layers-overlays input:checked').click();
$(this).find('input').click();
}
});
}
window.setupStyles = function() {
$('head').append('<style>' +
@ -167,13 +186,22 @@ window.setupPlayerStat = function() {
$('#playerstat').html(''
+ '<h2 title="'+t+'">'+level+'&nbsp;'
+ '<div id="name">'
+ '<span class="'+cls+'">'+PLAYER.nickname+'</span>'
+ '<div>'
+ '<a href="https://www.ingress.com/_ah/logout?continue=https://www.google.com/accounts/Logout%3Fcontinue%3Dhttps://appengine.google.com/_ah/logout%253Fcontinue%253Dhttps://www.ingress.com/intel%26service%3Dah" id="signout">sign out</a>'
+ '</div>'
+ '<div id="stats">'
+ '<sup>XM: '+xmRatio+'%</sup>'
+ '<sub>' + (level < 8 ? 'level: '+lvlApProg+'%' : 'max level') + '</sub>'
+ '</div>'
+ '</h2>'
);
$('#name').mouseenter(function() {
$('#signout').show();
}).mouseleave(function() {
$('#signout').hide();
});
}
window.setupSidebarToggle = function() {
@ -264,6 +292,7 @@ function boot() {
window.setupTooltips();
window.chat.setup();
window.setupQRLoadLib();
window.setupLayerChooserSelectOne();
// read here ONCE, so the URL is only evaluated one time after the
// necessary data has been loaded.
urlPortal = getURLParam('pguid');

View File

@ -279,8 +279,14 @@ window.chat.writeDataToHash = function(newData, storageHash, skipSecureMsgs) {
case 'PORTAL':
var latlng = [markup[1].latE6/1E6, markup[1].lngE6/1E6];
var js = 'window.zoomToAndShowPortal(\''+markup[1].guid+'\', ['+latlng[0]+', '+latlng[1]+'])';
msg += '<a onclick="'+js+'" title="'+markup[1].address+'" class="help">'+markup[1].name+'</a>';
var perma = 'https://ingress.com/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid;
var js = 'window.zoomToAndShowPortal(\''+markup[1].guid+'\', ['+latlng[0]+', '+latlng[1]+']);return false';
msg += '<a onclick="'+js+'"'
+ ' title="'+markup[1].address+'"'
+ ' href="'+perma+'" class="help">'
+ markup[1].name
+ '</a>';
break;
case 'SECURE':
@ -341,7 +347,7 @@ window.chat.renderMsg = function(msg, nick, time, team) {
var s = 'style="color:'+COLORS[team]+'"';
var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
var i = ['<span class="invisep">&lt;</span>', '<span class="invisep">&gt;</span>'];
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark '+s+'>'+nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" '+s+'>'+nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
}

View File

@ -43,25 +43,34 @@ window.requestData = function() {
}
}
// Reset previous result of Portal Render Limit handler
portalRenderLimit.init();
// finally send ajax requests
$.each(tiles, function(ind, tls) {
data = { minLevelOfDetail: -1 };
data.boundsParamsList = tls;
window.requests.add(window.postAjax('getThinnedEntitiesV2', data, window.handleDataResponse));
window.requests.add(window.postAjax('getThinnedEntitiesV2', data, window.handleDataResponse, window.handleFailedRequest));
});
}
// Handle failed map data request
window.handleFailedRequest = function() {
if(requests.isLastRequest('getThinnedEntitiesV2')) {
var leftOverPortals = portalRenderLimit.mergeLowLevelPortals(null);
handlePortalsRender(leftOverPortals);
}
}
// works on map data response and ensures entities are drawn/updated.
window.handleDataResponse = function(data, textStatus, jqXHR) {
// remove from active ajax queries list
if(!data || !data.result) {
window.failedRequestCount++;
console.warn(data);
handleFailedRequest();
return;
}
var portalUpdateAvailable = false;
var portalInUrlAvailable = false;
var m = data.result.map;
// defer rendering of portals because there is no z-index in SVG.
// this means that whats rendered last ends up on top. While the
@ -88,8 +97,6 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
// format for portals: { controllingTeam, turret }
if(ent[2].turret !== undefined) {
if(selectedPortal === ent[0]) portalUpdateAvailable = true;
if(urlPortal && ent[0] == urlPortal) portalInUrlAvailable = true;
var latlng = [ent[2].locationE6.latE6/1E6, ent[2].locationE6.lngE6/1E6];
if(!window.getPaddedBounds().contains(latlng)
@ -125,11 +132,28 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
}
});
// Process the portals with portal render limit handler first
// Low level portal will hold until last request
var newPpp = portalRenderLimit.splitOrMergeLowLevelPortals(ppp);
handlePortalsRender(newPpp);
resolvePlayerNames();
renderUpdateStatus();
}
window.handlePortalsRender = function(portals) {
var portalUpdateAvailable = false;
var portalInUrlAvailable = false;
// Preserve and restore "selectedPortal" between portal re-render
if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal;
runHooks('portalDataLoaded', {portals : ppp});
$.each(ppp, function(ind, portal) { renderPortal(portal); });
runHooks('portalDataLoaded', {portals : portals});
$.each(portals, function(ind, portal) {
if(selectedPortal === portal[0]) portalUpdateAvailable = true;
if(urlPortal && portal[0] == urlPortal) portalInUrlAvailable = true;
renderPortal(portal);
});
var selectedPortalLayer = portals[oldSelectedPortal];
if(portalUpdateAvailable && selectedPortalLayer) selectedPortal = oldSelectedPortal;
@ -146,7 +170,6 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
}
if(portalUpdateAvailable) renderPortalDetails(selectedPortal);
resolvePlayerNames();
}
// removes entities that are still handled by Leaflet, although they

View File

@ -24,6 +24,7 @@ window.renderPortalDetails = function(guid) {
var player = d.captured && d.captured.capturingPlayerId
? getPlayerName(d.captured.capturingPlayerId)
: null;
player = '<span class="nickname">'+player+'</span>';
var playerText = player ? ['owner', player] : null;
var time = d.captured
@ -45,12 +46,12 @@ window.renderPortalDetails = function(guid) {
setPortalIndicators(d);
var img = d.imageByUrl && d.imageByUrl.imageUrl
? d.imageByUrl.imageUrl.replace(/^http:/, 'https:')
? d.imageByUrl.imageUrl
: DEFAULT_PORTAL_IMG;
var lat = d.locationE6.latE6;
var lng = d.locationE6.lngE6;
var perma = 'http://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var perma = 'https://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var imgTitle = 'title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."';
var poslinks = 'window.showPortalPosLinks('+lat/1E6+','+lng/1E6+')';
var postcard = 'Send in a postcard. Will put it online after receiving. Address:\\n\\nStefan Breunig\\nINF 305 R045\\n69120 Heidelberg\\nGermany';

View File

@ -132,6 +132,7 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) {
var meter = '<span class="meter" title="'+inf+'">' + fill + lbar + '</span>';
}
nick = '<span class="nickname">'+nick+'</span>';
return [meter, nick || ''];
}

155
code/portal_render_limit.js Normal file
View File

@ -0,0 +1,155 @@
// PORTAL RENDER LIMIT HANDLER ///////////////////////////////////////
// Functions to handle hiding low level portal when portal render
// limit is reached.
//
// On initialization, previous minLevel will preserve to previousMinLevel
// with zoom level difference.
//
// After initialized and reset in window.requestData(), "processPortals"
// intercept all portals data in "handleDataResponse". Put the count of
// new portals to newPortalsPerLevel[portal level]. And split portals
// into two parts base on previousMinLevel. Portals with level >=
// previousMinLevel will return as result and continue to render.
// Others will save to portalsPreviousMinLevel. If there is no more
// active request of map data, portals will not split and
// portalsPreviousMinLevel will add back to result and render base on
// current minLevel.
//
// "handleFailRequest" is added to handle the case when the last request
// failed and "processPortals" didn't get called. It will get
// portalsPreviousMinLevel base on current minLevel and render them.
//
// "getMinLevel" will be called by "getMinPortalLevel" in utils_misc.js
// to determine min portal level to draw on map.
//
// "getMinLevel" will return minLevel and call "setMinLevel" if
// minLevel hasn't set yet.
//
// In "setMinLevel", it will loop through all portal level from
// high to low, and sum total portal count (old + new) to check
// minLevel.
//
// In each call of window.handleDataResponse(), it will call
// "resetCounting" to reset previous response data. But minLevel
// is preserved and only replaced when render limit reached in
// higher level, until next window.requestData() called and reset.
//
window.portalRenderLimit = function() {}
window.portalRenderLimit.initialized = false;
window.portalRenderLimit.minLevelSet = false;
window.portalRenderLimit.minLevel = -1;
window.portalRenderLimit.previousMinLevel = -1;
window.portalRenderLimit.previousZoomLevel;
window.portalRenderLimit.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL + 1);
window.portalRenderLimit.portalsPreviousMinLevel = new Array(MAX_PORTAL_LEVEL + 1);
window.portalRenderLimit.init = function () {
var currentZoomLevel = map.getZoom();
portalRenderLimit.previousZoomLevel = portalRenderLimit.previousZoomLevel || currentZoomLevel;
// If there is a minLevel set in previous run, calculate previousMinLevel with it.
if(portalRenderLimit.minLevelSet) {
var zoomDiff = currentZoomLevel - portalRenderLimit.previousZoomLevel;
portalRenderLimit.previousMinLevel = Math.max(portalRenderLimit.minLevel - zoomDiff, -1);
portalRenderLimit.previousMinLevel = Math.min(portalRenderLimit.previousMinLevel, MAX_PORTAL_LEVEL);
}
portalRenderLimit.previousZoomLevel = currentZoomLevel;
portalRenderLimit.initialized = true;
portalRenderLimit.minLevel = -1;
portalRenderLimit.resetCounting();
portalRenderLimit.resetPortalsPreviousMinLevel();
}
window.portalRenderLimit.resetCounting = function() {
portalRenderLimit.minLevelSet = false;
for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
portalRenderLimit.newPortalsPerLevel[i] = 0;
}
}
window.portalRenderLimit.resetPortalsPreviousMinLevel = function() {
for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
portalRenderLimit.portalsPreviousMinLevel[i] = new Array();
}
}
window.portalRenderLimit.splitOrMergeLowLevelPortals = function(originPortals) {
portalRenderLimit.resetCounting();
portalRenderLimit.countingPortals(originPortals);
var resultPortals = requests.isLastRequest('getThinnedEntitiesV2')
? portalRenderLimit.mergeLowLevelPortals(originPortals)
: portalRenderLimit.splitLowLevelPortals(originPortals);
return resultPortals;
}
window.portalRenderLimit.countingPortals = function(portals) {
$.each(portals, function(ind, portal) {
var portalGuid = portal[0];
var portalLevel = parseInt(getPortalLevel(portal[2]));
var layerGroup = portalsLayers[portalLevel];
if(findEntityInLeaflet(layerGroup, window.portals, portalGuid)) return true;
portalRenderLimit.newPortalsPerLevel[portalLevel]++;
});
}
window.portalRenderLimit.splitLowLevelPortals = function(portals) {
var resultPortals = new Array();
$.each(portals, function(ind, portal) {
var portalLevel = parseInt(getPortalLevel(portal[2]));
if(portalLevel < portalRenderLimit.previousMinLevel) {
portalRenderLimit.portalsPreviousMinLevel[portalLevel].push(portal);
}else{
resultPortals.push(portal);
}
});
return resultPortals;
}
window.portalRenderLimit.mergeLowLevelPortals = function(appendTo) {
var resultPortals = appendTo ? appendTo : new Array();
for(var i = portalRenderLimit.getMinLevel();
i < portalRenderLimit.previousMinLevel;
i++) {
$.merge(resultPortals, portalRenderLimit.portalsPreviousMinLevel[i]);
}
// Reset portalsPreviousMinLevel, ensure they return only once
portalRenderLimit.resetPortalsPreviousMinLevel();
return resultPortals;
}
window.portalRenderLimit.getMinLevel = function() {
if(!portalRenderLimit.initialized) return -1;
if(!portalRenderLimit.minLevelSet) portalRenderLimit.setMinLevel();
return portalRenderLimit.minLevel;
}
window.portalRenderLimit.setMinLevel = function() {
var totalPortalsCount = 0;
var newMinLevel = MAX_PORTAL_LEVEL + 1;
// Find the min portal level under render limit
while(newMinLevel > 0) {
var oldPortalCount = layerGroupLength(portalsLayers[newMinLevel - 1]);
var newPortalCount = portalRenderLimit.newPortalsPerLevel[newMinLevel - 1];
totalPortalsCount += oldPortalCount + newPortalCount;
if(totalPortalsCount >= MAX_DRAWN_PORTALS)
break;
newMinLevel--;
}
// If render limit reached at max portal level, still let portal at max level render
newMinLevel = Math.min(newMinLevel, MAX_PORTAL_LEVEL);
portalRenderLimit.minLevel = Math.max(newMinLevel, portalRenderLimit.minLevel);
portalRenderLimit.minLevelSet = true;
}

View File

@ -111,3 +111,14 @@ window.requests._callOnRefreshFunctions = function() {
window.requests.addRefreshFunction = function(f) {
window.requests._onRefreshFunctions.push(f);
}
window.requests.isLastRequest = function(action) {
var result = true;
$.each(window.activeRequests, function(ind, req) {
if(req.action === action) {
result = false;
return false;
}
});
return result;
}

View File

@ -2,6 +2,14 @@
// UTILS + MISC ///////////////////////////////////////////////////////
window.layerGroupLength = function(layerGroup) {
var layersCount = 0;
var layers = layerGroup._layers;
if (layers)
layersCount = Object.keys(layers).length;
return layersCount;
}
// retrieves parameter from the URL?query=string.
window.getURLParam = function(param) {
var v = document.URL;
@ -50,7 +58,7 @@ window.postAjax = function(action, data, success, error) {
data = JSON.stringify($.extend({method: 'dashboard.'+action}, data));
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
return $.ajax({
var result = $.ajax({
// use full URL to avoid issues depending on how people set their
// slash. See:
// https://github.com/breunigs/ingress-intel-total-conversion/issues/56
@ -65,6 +73,8 @@ window.postAjax = function(action, data, success, error) {
req.setRequestHeader('X-CSRFToken', readCookie('csrftoken'));
}
});
result.action = action;
return result;
}
// converts unix timestamps to HH:mm:ss format if it was today;
@ -152,7 +162,11 @@ window.getMinPortalLevel = function() {
var z = map.getZoom();
if(z >= 16) return 0;
var conv = ['impossible', 8,7,7,6,6,5,5,4,4,3,3,2,2,1,1];
return conv[z];
var minLevelByRenderLimit = portalRenderLimit.getMinLevel();
var result = minLevelByRenderLimit > conv[z]
? minLevelByRenderLimit
: conv[z];
return result;
}
// returns number of pixels left to scroll down before reaching the

View File

@ -92,6 +92,7 @@ L.Google = L.Class.extend({
var map = new google.maps.Map(this._container, {
center: this._google_center,
zoom: 0,
tilt: 0,
styles: this._styles,
mapTypeId: this._type,
disableDefaultUI: true,
@ -138,8 +139,8 @@ L.Google = L.Class.extend({
_resize: function() {
var size = this._map.getSize();
if (this._container.style.width == size.x &&
this._container.style.height == size.y)
if (parseInt(this._container.style.width) == size.x &&
parseInt(this._container.style.height) == size.y)
return;
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';

4
dist/style.0.7.css vendored
View File

@ -401,6 +401,10 @@ input {
font-style: italic;
}
.leaflet-control-layers input {
height: auto;
padding: 0;
}
/* portal title and image */
h3 {

View File

@ -36,12 +36,11 @@ L.Google = L.Class.extend({
this._initContainer();
this._initMapObject();
// set up events
map.on('viewreset', this._resetCallback, this);
this._map.options.zoomAnimation = false;
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
// set up events
//~ map.on('viewreset', this._resetCallback, this);
map.on('move', this._update, this);
//map.on('moveend', this._update, this);
this._reset();
this._update();
@ -51,7 +50,8 @@ L.Google = L.Class.extend({
this._map._container.removeChild(this._container);
//this._container = null;
this._map.off('viewreset', this._resetCallback, this);
//~ this._map.off('viewreset', this._resetCallback, this);
this._map.options.zoomAnimation = true;
this._map.off('move', this._update, this);
//this._map.off('moveend', this._update, this);
@ -93,6 +93,7 @@ L.Google = L.Class.extend({
center: this._google_center,
zoom: 0,
styles: this._styles,
tilt: 0,
mapTypeId: this._type,
disableDefaultUI: true,
keyboardShortcuts: false,
@ -121,28 +122,22 @@ L.Google = L.Class.extend({
_update: function() {
this._resize();
var bounds = this._map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var google_bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(sw.lat, sw.lng),
new google.maps.LatLng(ne.lat, ne.lng)
);
var center = this._map.getCenter();
var _center = new google.maps.LatLng(center.lat, center.lng);
this._google.setCenter(_center);
this._google.setZoom(this._map.getZoom());
//this._google.fitBounds(google_bounds);
},
_resize: function() {
var size = this._map.getSize();
if (this._container.style.width == size.x &&
this._container.style.height == size.y)
if (parseInt(this._container.style.width) == size.x &&
parseInt(this._container.style.height) == size.y)
return;
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
google.maps.event.trigger(this._google, "resize");
},

View File

@ -188,6 +188,7 @@ window.DESTROY_FIELD = 750; //AP for destroying field
window.CAPTURE_PORTAL = 500; //AP for capturing a portal
window.DEPLOY_RESONATOR = 125; //AP for deploying a resonator
window.COMPLETION_BONUS = 250; //AP for deploying all resonators on portal
window.MAX_PORTAL_LEVEL = 8;
// OTHER MORE-OR-LESS CONSTANTS //////////////////////////////////////
window.TEAM_NONE = 0;

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-compute-ap-stats@Hollow011
// @name iitc: Compute AP statistics
// @version 0.2.1
// @version 0.3
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/compute-ap-stats.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/compute-ap-stats.user.js
@ -44,6 +44,21 @@ window.plugin.compAPStats.onPositionMove = function() {
+ '</table>');
}
window.plugin.compAPStats.missingResonatorAP = function(portal) {
var resAP = 0;
var missing_resonators = 0;
$.each(portal.resonatorArray.resonators, function(ind, reso) {
if(reso === null) {
missing_resonators++;
}
});
if(missing_resonators > 0) {
resAP = window.DEPLOY_RESONATOR * missing_resonators;
resAP += window.COMPLETION_BONUS;
}
return(resAP);
};
window.plugin.compAPStats.compAPStats = function() {
var totalAP_RES = 0;
@ -78,6 +93,9 @@ window.plugin.compAPStats.compAPStats = function() {
if(!field) return true;
allEnlFields.push(field);
});
totalAP_ENL += window.plugin.compAPStats.missingResonatorAP(d);
}
else if (getTeam(d) === TEAM_RES) {
totalAP_ENL += portalSum;
@ -91,6 +109,9 @@ window.plugin.compAPStats.compAPStats = function() {
if(!field) return true;
allResFields.push(field);
});
totalAP_RES += window.plugin.compAPStats.missingResonatorAP(d);
} else {
// it's a neutral portal, potential for both teams. by definition no fields or edges
totalAP_ENL += portalSum;

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-show-portal-weakness@vita10gy
// @name iitc: show portal weakness
// @version 0.3.1
// @version 0.5
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js
@ -74,12 +74,25 @@ window.plugin.portalWeakness.portalAdded = function(data) {
params["dashArray"] = dash;
}
data.portal.setStyle(params);
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5,
dashArray: null});
}
}
}
window.plugin.portalWeakness.portalDataLoaded = function(data) {
$.each(data.portals, function(ind, portal) {
if(window.portals[portal[0]]) {
window.plugin.portalWeakness.portalAdded({portal: window.portals[portal[0]]});
}
});
}
var setup = function() {
window.addHook('portalAdded', window.plugin.portalWeakness.portalAdded);
window.addHook('portalDataLoaded', window.plugin.portalWeakness.portalDataLoaded);
window.COLOR_SELECTED_PORTAL = '#f0f';
}

View File

@ -329,21 +329,34 @@ h2 {
width: 100%;
}
h2 span {
h2 #name {
display: inline-block;
overflow: hidden;
text-overflow: "~";
vertical-align: top;
white-space: nowrap;
width: 205px;
position: relative;
}
h2 div {
h2 #stats {
float: right;
height: 100%;
overflow: hidden;
}
h2 #signout {
font-size: 12px;
font-weight: normal;
line-height: 29px;
padding: 0 4px;
position: absolute;
top: 0;
right: 0;
background-color: rgba(8, 48, 78, 0.5);
display: none; /* starts hidden */
}
h2 sup, h2 sub {
display: block;
font-size: 11px;
@ -401,6 +414,11 @@ input {
font-style: italic;
}
.leaflet-control-layers input {
height: auto;
padding: 0;
}
/* portal title and image */
h3 {