Merge branch 'master' of https://github.com/jonatkins/ingress-intel-total-conversion
This commit is contained in:
commit
4447f1bef2
13
code/chat.js
13
code/chat.js
@ -680,7 +680,18 @@ window.chat.postMsg = function() {
|
||||
var msg = $.trim($('#chatinput input').val());
|
||||
if(!msg || msg === '') return;
|
||||
|
||||
if(c === 'debug') return new Function (msg)();
|
||||
if(c === 'debug') {
|
||||
var result;
|
||||
try {
|
||||
result = eval(msg);
|
||||
} catch(e) {
|
||||
if(e.stack) console.error(e.stack);
|
||||
throw e; // to trigger native error message
|
||||
}
|
||||
if(result !== undefined)
|
||||
console.log(result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
var publik = c === 'public';
|
||||
var latlng = map.getCenter();
|
||||
|
@ -84,10 +84,20 @@ window.debug.console.error = function(text) {
|
||||
|
||||
window.debug.console.overwriteNative = function() {
|
||||
window.debug.console.create();
|
||||
window.console = function() {}
|
||||
window.console.log = window.debug.console.log;
|
||||
window.console.warn = window.debug.console.warn;
|
||||
window.console.error = window.debug.console.error;
|
||||
|
||||
var nativeConsole = window.console;
|
||||
window.console = {};
|
||||
|
||||
function overwrite(which) {
|
||||
window.console[which] = function() {
|
||||
nativeConsole[which].apply(nativeConsole, arguments);
|
||||
window.debug.console[which].apply(window.debug.console, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
overwrite("log");
|
||||
overwrite("warn");
|
||||
overwrite("error");
|
||||
}
|
||||
|
||||
window.debug.console.overwriteNativeIfRequired = function() {
|
||||
|
@ -1,65 +1,45 @@
|
||||
// created to start cleaning up "window" interaction
|
||||
//
|
||||
window.show = function(id) {
|
||||
if (typeof android !== 'undefined' && android && android.switchToPane) {
|
||||
android.switchToPane(id);
|
||||
}
|
||||
/*
|
||||
* disable all map properties when switching to another pane
|
||||
* because sometimes (bug?) touch events are passed to the map when
|
||||
* other panes are focussed
|
||||
*/
|
||||
window.disableMapProperties();
|
||||
window.hideall();
|
||||
window.hideall();
|
||||
|
||||
switch(id) {
|
||||
case 'full':
|
||||
window.chat.show('full');
|
||||
break;
|
||||
case 'compact':
|
||||
window.chat.show('compact');
|
||||
break;
|
||||
case 'public':
|
||||
window.chat.show('public');
|
||||
break;
|
||||
case 'faction':
|
||||
window.chat.show('faction');
|
||||
break;
|
||||
case 'debug':
|
||||
window.debug.console.show();
|
||||
break;
|
||||
case 'map':
|
||||
window.enableMapProperties();
|
||||
window.smartphone.mapButton.click();
|
||||
$('#portal_highlight_select').show();
|
||||
$('#farm_level_select').show();
|
||||
break;
|
||||
case 'info':
|
||||
window.smartphone.sideButton.click();
|
||||
break;
|
||||
default:
|
||||
window.smartphone.mapButton.click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(id) {
|
||||
case 'full':
|
||||
window.chat.show('full');
|
||||
break;
|
||||
case 'compact':
|
||||
window.chat.show('compact');
|
||||
break;
|
||||
case 'public':
|
||||
window.chat.show('public');
|
||||
break;
|
||||
case 'faction':
|
||||
window.chat.show('faction');
|
||||
break;
|
||||
case 'debug':
|
||||
window.debug.console.show();
|
||||
break;
|
||||
case 'map':
|
||||
window.smartphone.mapButton.click();
|
||||
$('#portal_highlight_select').show();
|
||||
$('#farm_level_select').show();
|
||||
break;
|
||||
case 'info':
|
||||
window.smartphone.sideButton.click();
|
||||
break;
|
||||
default:
|
||||
window.smartphone.mapButton.click();
|
||||
break;
|
||||
}
|
||||
|
||||
window.enableMapProperties = function() {
|
||||
window.map.tap.enable();
|
||||
window.map.dragging.enable();
|
||||
window.map.touchZoom.enable();
|
||||
window.map.doubleClickZoom.enable();
|
||||
}
|
||||
|
||||
window.disableMapProperties = function() {
|
||||
window.map.tap.disable();
|
||||
window.map.dragging.disable();
|
||||
window.map.touchZoom.disable();
|
||||
window.map.doubleClickZoom.disable();
|
||||
if (typeof android !== 'undefined' && android && android.switchToPane) {
|
||||
android.switchToPane(id);
|
||||
}
|
||||
}
|
||||
|
||||
window.hideall = function() {
|
||||
$('#chatcontrols, #chat, #chatinput, #sidebartoggle, #scrollwrapper, #updatestatus, #portal_highlight_select').hide();
|
||||
$('#farm_level_select').hide();
|
||||
$('#map').css('visibility', 'hidden');
|
||||
$('.ui-tooltip').remove();
|
||||
$('#chatcontrols, #chat, #chatinput, #sidebartoggle, #scrollwrapper, #updatestatus, #portal_highlight_select').hide();
|
||||
$('#farm_level_select').hide();
|
||||
$('#map').css('visibility', 'hidden');
|
||||
$('.ui-tooltip').remove();
|
||||
}
|
||||
|
@ -90,6 +90,17 @@ window.renderPortalDetails = function(guid) {
|
||||
portalDetailedDescription += '</table>';
|
||||
}
|
||||
|
||||
var levelDetails = getPortalLevel(d);
|
||||
if(levelDetails != 8) {
|
||||
if(levelDetails==Math.ceil(levelDetails))
|
||||
levelDetails += "\n8";
|
||||
else
|
||||
levelDetails += "\n" + (Math.ceil(levelDetails) - levelDetails)*8;
|
||||
levelDetails += " resonator level(s) needed for next portal level";
|
||||
} else {
|
||||
levelDetails += "\nfully upgraded";
|
||||
}
|
||||
levelDetails = "Level " + levelDetails;
|
||||
|
||||
$('#portaldetails')
|
||||
.attr('class', TEAM_TO_CSS[getTeam(d)])
|
||||
@ -98,7 +109,7 @@ window.renderPortalDetails = function(guid) {
|
||||
+ '<span class="close" onclick="renderPortalDetails(null); if(isSmartphone()) show(\'map\');" title="Close">X</span>'
|
||||
// help cursor via ".imgpreview img"
|
||||
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
|
||||
+ '<span id="level">'+Math.floor(getPortalLevel(d))+'</span>'
|
||||
+ '<span id="level" title="'+levelDetails+'">'+Math.floor(getPortalLevel(d))+'</span>'
|
||||
+ '<div class="portalDetails">'+ portalDetailedDescription + '</div>'
|
||||
+ '<img class="hide" src="'+img+'"/></div>'
|
||||
+ '</div>'
|
||||
@ -134,9 +145,14 @@ window.setPortalIndicators = function(d) {
|
||||
|
||||
var range = getPortalRange(d);
|
||||
var coord = [d.locationE6.latE6/1E6, d.locationE6.lngE6/1E6];
|
||||
portalRangeIndicator = (range > 0
|
||||
? L.geodesicCircle(coord, range, { fill: false, color: RANGE_INDICATOR_COLOR, weight: 3, clickable: false })
|
||||
: L.circle(coord, range, { fill: false, stroke: false, clickable: false })
|
||||
portalRangeIndicator = (range.range > 0
|
||||
? L.geodesicCircle(coord, range.range, {
|
||||
fill: false,
|
||||
color: RANGE_INDICATOR_COLOR,
|
||||
weight: 3,
|
||||
dashArray: range.isLinkable ? undefined : "10,10",
|
||||
clickable: false })
|
||||
: L.circle(coord, range.range, { fill: false, stroke: false, clickable: false })
|
||||
).addTo(map);
|
||||
|
||||
portalAccessIndicator = L.circle(coord, HACK_RANGE,
|
||||
|
@ -5,11 +5,20 @@
|
||||
// returns displayable text+link about portal range
|
||||
window.getRangeText = function(d) {
|
||||
var range = getPortalRange(d);
|
||||
|
||||
var title = 'Base range:\t' + digits(Math.floor(range.base))+'m'
|
||||
+ '\nLink amp boost:\t×'+range.boost
|
||||
+ '\nRange:\t'+digits(Math.floor(range.range))+'m';
|
||||
|
||||
if(!range.isLinkable) title += '\nPortal is missing resonators,\nno new links can be made';
|
||||
|
||||
return ['range',
|
||||
'<a onclick="window.rangeLinkClick()">'
|
||||
+ (range > 1000
|
||||
? Math.floor(range/1000) + ' km'
|
||||
: Math.floor(range) + ' m')
|
||||
'<a onclick="window.rangeLinkClick()"'
|
||||
+ (range.isLinkable ? '' : ' style="text-decoration:line-through;"')
|
||||
+ ' title="'+title+'">'
|
||||
+ (range.range > 1000
|
||||
? Math.floor(range.range/1000) + ' km'
|
||||
: Math.floor(range.range) + ' m')
|
||||
+ '</a>'];
|
||||
}
|
||||
|
||||
|
@ -47,18 +47,20 @@ window.getPortalRange = function(d) {
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
if(!reso) {
|
||||
resoMissing = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
lvl += parseInt(reso.level);
|
||||
});
|
||||
if(resoMissing) return 0;
|
||||
|
||||
var range = 160*Math.pow(getPortalLevel(d), 4);
|
||||
var range = {
|
||||
base: 160*Math.pow(getPortalLevel(d), 4),
|
||||
boost: getLinkAmpRangeBoost(d)
|
||||
};
|
||||
|
||||
var boost = getLinkAmpRangeBoost(d);
|
||||
|
||||
return range*boost;
|
||||
range.range = range.boost * range.base;
|
||||
range.isLinkable = !resoMissing;
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
window.getLinkAmpRangeBoost = function(d) {
|
||||
|
@ -602,3 +602,22 @@ window.clampLatLng = function(latlng) {
|
||||
window.clampLatLngBounds = function(bounds) {
|
||||
return new L.LatLngBounds ( clampLatLng(bounds.getSouthWest()), clampLatLng(bounds.getNorthEast()) );
|
||||
}
|
||||
|
||||
// avoid error in stock JS
|
||||
if(goog && goog.style) {
|
||||
goog.style.showElement = function(a, b) {
|
||||
if(a && a.style)
|
||||
a.style.display = b ? "" : "none"
|
||||
};
|
||||
}
|
||||
|
||||
// Fix Leaflet: handle touchcancel events in Draggable
|
||||
L.Draggable.prototype._onDownOrig = L.Draggable.prototype._onDown;
|
||||
L.Draggable.prototype._onDown = function(e) {
|
||||
L.Draggable.prototype._onDownOrig.apply(this, arguments);
|
||||
|
||||
if(e.type === "touchstart") {
|
||||
L.DomEvent.on(document, "touchcancel", this._onUp, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
4
main.js
4
main.js
@ -100,7 +100,9 @@ document.getElementsByTagName('body')[0].innerHTML = ''
|
||||
+ ' </div>'
|
||||
+ ' </div>'
|
||||
+ '</div>'
|
||||
+ '<div id="updatestatus"><div id="innerstatus"></div></div>';
|
||||
+ '<div id="updatestatus"><div id="innerstatus"></div></div>'
|
||||
// avoid error by stock JS
|
||||
+ '<div id="play_button"></div>';
|
||||
|
||||
// putting everything in a wrapper function that in turn is placed in a
|
||||
// script tag on the website allows us to execute in the site’s context
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cradle.iitc_mobile"
|
||||
android:versionCode="55"
|
||||
android:versionName="0.7.5">
|
||||
android:versionCode="56"
|
||||
android:versionName="0.7.6">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
@ -84,7 +84,6 @@ public class IITC_WebView extends WebView {
|
||||
@Override
|
||||
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||
if (consoleMessage.messageLevel() == ConsoleMessage.MessageLevel.ERROR) {
|
||||
Log.d("iitcm", consoleMessage.message());
|
||||
((IITC_Mobile) getContext()).setLoadingState(false);
|
||||
}
|
||||
return super.onConsoleMessage(consoleMessage);
|
||||
|
@ -19,7 +19,7 @@
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
window.PLAYER_TRACKER_MAX_TIME = 3*60*60*1000; // in milliseconds
|
||||
window.PLAYER_TRACKER_MIN_ZOOM = 9;
|
||||
|
||||
window.PLAYER_TRACKER_MIN_OPACITY = 0.3;
|
||||
window.PLAYER_TRACKER_LINE_COLOUR = '#FF00FD';
|
||||
|
||||
|
||||
@ -45,11 +45,18 @@ window.plugin.playerTracker.setup = function() {
|
||||
iconRetinaUrl: iconResRetImage
|
||||
}});
|
||||
|
||||
plugin.playerTracker.drawnTraces = new L.LayerGroup();
|
||||
window.addLayerGroup('Player Tracker', plugin.playerTracker.drawnTraces, true);
|
||||
plugin.playerTracker.drawnTracesEnl = new L.LayerGroup();
|
||||
plugin.playerTracker.drawnTracesRes = new L.LayerGroup();
|
||||
// to avoid any favouritism, we'll put the player's own faction layer first
|
||||
if (PLAYER.team == 'RESISTANCE') {
|
||||
window.addLayerGroup('Player Tracker Resistance', plugin.playerTracker.drawnTracesRes, true);
|
||||
window.addLayerGroup('Player Tracker Enlightened', plugin.playerTracker.drawnTracesEnl, true);
|
||||
} else {
|
||||
window.addLayerGroup('Player Tracker Enlightened', plugin.playerTracker.drawnTracesEnl, true);
|
||||
window.addLayerGroup('Player Tracker Resistance', plugin.playerTracker.drawnTracesRes, true);
|
||||
}
|
||||
map.on('layeradd',function(obj) {
|
||||
if(obj.layer === plugin.playerTracker.drawnTraces)
|
||||
{
|
||||
if(obj.layer === plugin.playerTracker.drawnTracesEnl || obj.layer === plugin.playerTracker.drawnTracesRes) {
|
||||
obj.layer.eachLayer(function(marker) {
|
||||
if(marker._icon) window.setupTooltips($(marker._icon));
|
||||
});
|
||||
@ -77,7 +84,8 @@ window.plugin.playerTracker.stored = {};
|
||||
window.plugin.playerTracker.zoomListener = function() {
|
||||
var ctrl = $('.leaflet-control-layers-selector + span:contains("Player Tracker")').parent();
|
||||
if(window.map.getZoom() < window.PLAYER_TRACKER_MIN_ZOOM) {
|
||||
window.plugin.playerTracker.drawnTraces.clearLayers();
|
||||
window.plugin.playerTracker.drawnTracesEnl.clearLayers();
|
||||
window.plugin.playerTracker.drawnTracesRes.clearLayers();
|
||||
ctrl.addClass('disabled').attr('title', 'Zoom in to show those.');
|
||||
} else {
|
||||
ctrl.removeClass('disabled').attr('title', '');
|
||||
@ -241,9 +249,10 @@ window.plugin.playerTracker.ago = function(time, now) {
|
||||
|
||||
window.plugin.playerTracker.drawData = function() {
|
||||
var gllfe = plugin.playerTracker.getLatLngFromEvent;
|
||||
var layer = plugin.playerTracker.drawnTraces;
|
||||
|
||||
var polyLineByAge = [[], [], [], []];
|
||||
var polyLineByAgeEnl = [[], [], [], []];
|
||||
var polyLineByAgeRes = [[], [], [], []];
|
||||
|
||||
var split = PLAYER_TRACKER_MAX_TIME / 4;
|
||||
var now = new Date().getTime();
|
||||
$.each(plugin.playerTracker.stored, function(pguid, playerData) {
|
||||
@ -259,7 +268,11 @@ window.plugin.playerTracker.drawData = function() {
|
||||
var p = playerData.events[i];
|
||||
var ageBucket = Math.min(parseInt((now - p.time) / split), 4-1);
|
||||
var line = [gllfe(p), gllfe(playerData.events[i-1])];
|
||||
polyLineByAge[ageBucket].push(line);
|
||||
|
||||
if(playerData.team === 'RESISTANCE')
|
||||
polyLineByAgeRes[ageBucket].push(line);
|
||||
else
|
||||
polyLineByAgeEnl[ageBucket].push(line);
|
||||
}
|
||||
|
||||
// tooltip for marker
|
||||
@ -310,19 +323,23 @@ window.plugin.playerTracker.drawData = function() {
|
||||
}
|
||||
});
|
||||
|
||||
// marker opacity
|
||||
var relOpacity = 1 - (now - last.time) / window.PLAYER_TRACKER_MAX_TIME
|
||||
var absOpacity = window.PLAYER_TRACKER_MIN_OPACITY + (1 - window.PLAYER_TRACKER_MIN_OPACITY) * relOpacity;
|
||||
|
||||
// marker itself
|
||||
var icon = playerData.team === 'RESISTANCE' ? new plugin.playerTracker.iconRes() : new plugin.playerTracker.iconEnl();
|
||||
var m = L.marker(gllfe(last), {title: title, icon: icon, referenceToPortal: closestPortal});
|
||||
var m = L.marker(gllfe(last), {title: title, icon: icon, referenceToPortal: closestPortal, opacity: absOpacity});
|
||||
// ensure tooltips are closed, sometimes they linger
|
||||
m.on('mouseout', function() { $(this._icon).tooltip('close'); });
|
||||
m.addTo(layer);
|
||||
m.addTo(playerData.team === 'RESISTANCE' ? plugin.playerTracker.drawnTracesRes : plugin.playerTracker.drawnTracesEnl);
|
||||
plugin.playerTracker.oms.addMarker(m);
|
||||
// jQueryUI doesn’t automatically notice the new markers
|
||||
window.setupTooltips($(m._icon));
|
||||
});
|
||||
|
||||
// draw the poly lines to the map
|
||||
$.each(polyLineByAge, function(i, polyLine) {
|
||||
$.each(polyLineByAgeEnl, function(i, polyLine) {
|
||||
if(polyLine.length === 0) return true;
|
||||
|
||||
var opts = {
|
||||
@ -333,7 +350,20 @@ window.plugin.playerTracker.drawData = function() {
|
||||
dashArray: "5,8"
|
||||
};
|
||||
|
||||
L.multiPolyline(polyLine, opts).addTo(layer);
|
||||
L.multiPolyline(polyLine, opts).addTo(plugin.playerTracker.drawnTracesEnl);
|
||||
});
|
||||
$.each(polyLineByAgeRes, function(i, polyLine) {
|
||||
if(polyLine.length === 0) return true;
|
||||
|
||||
var opts = {
|
||||
weight: 2-0.25*i,
|
||||
color: PLAYER_TRACKER_LINE_COLOUR,
|
||||
clickable: false,
|
||||
opacity: 1-0.2*i,
|
||||
dashArray: "5,8"
|
||||
};
|
||||
|
||||
L.multiPolyline(polyLine, opts).addTo(plugin.playerTracker.drawnTracesRes);
|
||||
});
|
||||
}
|
||||
|
||||
@ -343,11 +373,15 @@ window.plugin.playerTracker.handleData = function(data) {
|
||||
plugin.playerTracker.discardOldData();
|
||||
plugin.playerTracker.processNewData(data);
|
||||
// remove old popups
|
||||
plugin.playerTracker.drawnTraces.eachLayer(function(layer) {
|
||||
plugin.playerTracker.drawnTracesEnl.eachLayer(function(layer) {
|
||||
if(layer._icon) $(layer._icon).tooltip('destroy');
|
||||
});
|
||||
plugin.playerTracker.drawnTracesRes.eachLayer(function(layer) {
|
||||
if(layer._icon) $(layer._icon).tooltip('destroy');
|
||||
});
|
||||
plugin.playerTracker.oms.clearMarkers();
|
||||
plugin.playerTracker.drawnTraces.clearLayers();
|
||||
plugin.playerTracker.drawnTracesEnl.clearLayers();
|
||||
plugin.playerTracker.drawnTracesRes.clearLayers();
|
||||
plugin.playerTracker.drawData();
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,14 @@
|
||||
window.plugin.zaprange.zapLayerEnlHolderGroup.addLayer(window.plugin.zaprange.zapCircleEnlHolderGroup);
|
||||
window.plugin.zaprange.zapLayerResHolderGroup.addLayer(window.plugin.zaprange.zapCircleResHolderGroup);
|
||||
|
||||
window.addLayerGroup('Zaprange Enlightened', window.plugin.zaprange.zapLayerEnlHolderGroup, true);
|
||||
window.addLayerGroup('Zaprange Resistance', window.plugin.zaprange.zapLayerResHolderGroup, true);
|
||||
// to avoid any favouritism, we'll put the player's own faction layer first
|
||||
if (PLAYER.team == 'RESISTANCE') {
|
||||
window.addLayerGroup('Zaprange Resistance', window.plugin.zaprange.zapLayerResHolderGroup, true);
|
||||
window.addLayerGroup('Zaprange Enlightened', window.plugin.zaprange.zapLayerEnlHolderGroup, true);
|
||||
} else {
|
||||
window.addLayerGroup('Zaprange Enlightened', window.plugin.zaprange.zapLayerEnlHolderGroup, true);
|
||||
window.addLayerGroup('Zaprange Resistance', window.plugin.zaprange.zapLayerResHolderGroup, true);
|
||||
}
|
||||
|
||||
window.addHook('portalAdded', window.plugin.zaprange.portalAdded);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user