Merge remote-tracking branch 'upstream/master'
This commit is contained in:
24
code/boot.js
24
code/boot.js
@ -115,13 +115,21 @@ function createDefaultBaseMapLayers() {
|
||||
//OpenStreetMap attribution - required by several of the layers
|
||||
osmAttribution = 'Map data © OpenStreetMap contributors';
|
||||
|
||||
//MapQuest offer tiles - http://developer.mapquest.com/web/products/open/map
|
||||
//their usage policy has no limits (except required notification above 4000 tiles/sec - we're perhaps at 50 tiles/sec based on CloudMade stats)
|
||||
var mqSubdomains = [ 'otile1','otile2', 'otile3', 'otile4' ];
|
||||
var mqTileUrlPrefix = window.location.protocol !== 'https:' ? 'http://{s}.mqcdn.com' : 'https://{s}-s.mqcdn.com';
|
||||
var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxNativeZoom: 18, maxZoom: 21, subdomains: mqSubdomains};
|
||||
baseLayers['MapQuest OSM'] = new L.TileLayer(mqTileUrlPrefix+'/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
|
||||
// MapQuest - http://developer.mapquest.com/web/products/open/map
|
||||
// now requires an API key
|
||||
//var mqSubdomains = [ 'otile1','otile2', 'otile3', 'otile4' ];
|
||||
//var mqTileUrlPrefix = window.location.protocol !== 'https:' ? 'http://{s}.mqcdn.com' : 'https://{s}-s.mqcdn.com';
|
||||
//var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxNativeZoom: 18, maxZoom: 21, subdomains: mqSubdomains};
|
||||
//baseLayers['MapQuest OSM'] = new L.TileLayer(mqTileUrlPrefix+'/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
|
||||
|
||||
// MapBox - https://www.mapbox.com/api-documentation/
|
||||
// Access MapBox via the GNOME Project proxy.
|
||||
// In the future, this URL will provide improved tiles from the GNOME Project with localized labels.
|
||||
var gnomeStreetUrl = 'https://gis.gnome.org/tiles/street/v1/{z}/{x}/{y}';
|
||||
var gnomeAerialUrl = 'https://gis.gnome.org/tiles/satellite/v1/{z}/{x}/{y}';
|
||||
baseLayers['MapBox Street'] = L.tileLayer(gnomeStreetUrl);
|
||||
baseLayers['MapBox Satellite'] = L.tileLayer(gnomeAerialUrl);
|
||||
|
||||
// cartodb has some nice tiles too - both dark and light subtle maps - http://cartodb.com/basemaps/
|
||||
// (not available over https though - not on the right domain name anyway)
|
||||
var cartoAttr = '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>';
|
||||
@ -201,7 +209,7 @@ window.setupMap = function() {
|
||||
portalsFactionLayers[i] = [L.layerGroup(), L.layerGroup(), L.layerGroup()];
|
||||
portalsLayers[i] = L.layerGroup(portalsFactionLayers[i]);
|
||||
map.addLayer(portalsLayers[i]);
|
||||
var t = (i === 0 ? 'Unclaimed' : 'Level ' + i) + ' Portals';
|
||||
var t = (i === 0 ? 'Unclaimed/Placeholder' : 'Level ' + i) + ' Portals';
|
||||
addLayers[t] = portalsLayers[i];
|
||||
// Store it in hiddenLayer to remove later
|
||||
if(!isLayerGroupDisplayed(t, true)) hiddenLayer.push(portalsLayers[i]);
|
||||
@ -664,7 +672,7 @@ function boot() {
|
||||
$.each(badPlugins,function(name,desc) {
|
||||
warning += '<li><b>'+name+'</b>: '+desc+'</li>';
|
||||
});
|
||||
warning += '</ul><p>Please uninstall the problem plugins and reload the page. See this <a href="http://iitc.jonatkins.com/?page=faq#uninstall">FAQ entry</a> for help.</p><p><i>Note: It is tricky for IITC to safely disable just problem plugins</i></p>';
|
||||
warning += '</ul><p>Please uninstall the problem plugins and reload the page. See this <a href="http://iitc.me/faq/#uninstall">FAQ entry</a> for help.</p><p><i>Note: It is tricky for IITC to safely disable just problem plugins</i></p>';
|
||||
|
||||
dialog({
|
||||
title: 'Plugin Warning',
|
||||
|
@ -29,6 +29,9 @@
|
||||
// the Leaflet CircleMarker for the portal in "portal" var.
|
||||
// linkAdded: called when a link is about to be added to the map
|
||||
// fieldAdded: called when a field is about to be added to the map
|
||||
// portalRemoved: called when a portal has been removed
|
||||
// linkRemoved: called when a link has been removed
|
||||
// fieldRemoved: called when a field has been removed
|
||||
// portalDetailsUpdated: fired after the details in the sidebar have
|
||||
// been (re-)rendered Provides data about the portal that
|
||||
// has been selected.
|
||||
@ -60,6 +63,7 @@ window.VALID_HOOKS = [
|
||||
'portalSelected', 'portalDetailsUpdated', 'artifactsUpdated',
|
||||
'mapDataRefreshStart', 'mapDataEntityInject', 'mapDataRefreshEnd',
|
||||
'portalAdded', 'linkAdded', 'fieldAdded',
|
||||
'portalRemoved', 'linkRemoved', 'fieldRemoved',
|
||||
'publicChatDataAvailable', 'factionChatDataAvailable',
|
||||
'requestFinished', 'nicknameClicked',
|
||||
'geoSearch', 'search', 'iitcLoaded',
|
||||
|
@ -36,6 +36,14 @@ window.getPosition = function() {
|
||||
return {center: new L.LatLng(lat, lng), zoom: z};
|
||||
}
|
||||
|
||||
if(getURLParam('pll')) {
|
||||
console.log("mappos: reading stock Intel URL portal params");
|
||||
var lat = parseFloat(getURLParam('pll').split(",")[0]) || 0.0;
|
||||
var lng = parseFloat(getURLParam('pll').split(",")[1]) || 0.0;
|
||||
var z = parseInt(getURLParam('z')) || 17;
|
||||
return {center: new L.LatLng(lat, lng), zoom: z};
|
||||
}
|
||||
|
||||
if(readCookie('ingress.intelmap.lat') && readCookie('ingress.intelmap.lng')) {
|
||||
console.log("mappos: reading cookies");
|
||||
var lat = parseFloat(readCookie('ingress.intelmap.lat')) || 0.0;
|
||||
|
@ -225,6 +225,7 @@ window.Render.prototype.deletePortalEntity = function(guid) {
|
||||
window.ornaments.removePortal(p);
|
||||
this.removePortalFromMapLayer(p);
|
||||
delete window.portals[guid];
|
||||
window.runHooks('portalRemoved', {portal: p, data: p.options.data });
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,6 +234,7 @@ window.Render.prototype.deleteLinkEntity = function(guid) {
|
||||
var l = window.links[guid];
|
||||
linksFactionLayers[l.options.team].removeLayer(l);
|
||||
delete window.links[guid];
|
||||
window.runHooks('linkRemoved', {link: l, data: l.options.data });
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,6 +246,7 @@ window.Render.prototype.deleteFieldEntity = function(guid) {
|
||||
|
||||
fieldsFactionLayers[f.options.team].removeLayer(f);
|
||||
delete window.fields[guid];
|
||||
window.runHooks('fieldRemoved', {field: f, data: f.options.data });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ window.renderPortalDetails = function(guid) {
|
||||
|
||||
|
||||
var img = fixPortalImageUrl(details ? details.image : data.image);
|
||||
var title = (details && details.title) || (data && data.title) || '(untitled)';
|
||||
var title = (details && details.title) || (data && data.title) || 'null';
|
||||
|
||||
var lat = data.latE6/1E6;
|
||||
var lng = data.lngE6/1E6;
|
||||
|
@ -168,6 +168,7 @@ window.setupRedeem = function() {
|
||||
if((e.keyCode ? e.keyCode : e.which) !== 13) return;
|
||||
|
||||
var passcode = $(this).val();
|
||||
passcode = passcode.replace(/[^\x20-\x7E]+/g, ''); //removes non-printable characters
|
||||
if(!passcode) return;
|
||||
|
||||
var jqXHR = window.postAjax('redeemReward', {passcode:passcode}, window.handleRedeemResponse, function(response) {
|
||||
|
@ -7,8 +7,8 @@ addHook('search', function(query) {});
|
||||
|
||||
`query` is an object with the following members:
|
||||
- `term` is the term for which the user has searched
|
||||
- `confirmed` is a boolean indicating if the user has pressed enter after searching. You should not search online or
|
||||
heavy processing unless the user has confirmed the search term
|
||||
- `confirmed` is a boolean indicating if the user has pressed enter after searching. You should not search online or
|
||||
do heavy processing unless the user has confirmed the search term
|
||||
- `addResult(result)` can be called to add a result to the query.
|
||||
|
||||
`result` may have the following members (`title` is required, as well as one of `position` and `bounds`):
|
||||
@ -219,6 +219,8 @@ window.search.setup = function() {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// search for portals
|
||||
addHook('search', function(query) {
|
||||
var term = query.term.toLowerCase();
|
||||
var teams = ['NEU','RES','ENL'];
|
||||
@ -251,21 +253,41 @@ addHook('search', function(query) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// search for locations
|
||||
// TODO: recognize 50°31'03.8"N 7°59'05.3"E and similar formats
|
||||
// TODO: if a portal with these exact coordinates is found, select it
|
||||
addHook('search', function(query) {
|
||||
if(query.term.split(',').length == 2) {
|
||||
var ll = query.term.split(',');
|
||||
if(!isNaN(ll[0]) && !isNaN(ll[1])) {
|
||||
query.addResult({
|
||||
title: query.term,
|
||||
description: 'geo coordinates',
|
||||
position: L.latLng(parseFloat(ll[0]), parseFloat(ll[1])),
|
||||
});
|
||||
}
|
||||
}
|
||||
var locations = query.term.match(/[+-]?\d+\.\d+,[+-]?\d+\.\d+/g);
|
||||
var added = {};
|
||||
if(!locations) return;
|
||||
locations.forEach(function(location) {
|
||||
var pair = location.split(',').map(function(s) { return parseFloat(s).toFixed(6); });
|
||||
var ll = pair.join(",");
|
||||
var latlng = L.latLng(pair.map(function(s) { return parseFloat(s); }));
|
||||
if(added[ll]) return;
|
||||
added[ll] = true;
|
||||
|
||||
query.addResult({
|
||||
title: ll,
|
||||
description: 'geo coordinates',
|
||||
position: latlng,
|
||||
onSelected: function(result, event) {
|
||||
for(var guid in window.portals) {
|
||||
var p = window.portals[guid].getLatLng();
|
||||
if((p.lat.toFixed(6)+","+p.lng.toFixed(6)) == ll) {
|
||||
renderPortalDetails(guid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
urlPortalLL = [result.position.lat, result.position.lng];
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// search on OpenStreetMap
|
||||
addHook('search', function(query) {
|
||||
if(!query.confirmed) return;
|
||||
|
||||
|
@ -38,7 +38,7 @@ window.aboutIITC = function() {
|
||||
+ ' <div>Ingress Intel Total Conversion</div> '
|
||||
+ ' <hr>'
|
||||
+ ' <div>'
|
||||
+ ' <a href="http://iitc.jonatkins.com/" target="_blank">IITC Homepage</a><br />'
|
||||
+ ' <a href="http://iitc.me/" target="_blank">IITC Homepage</a><br />'
|
||||
+ ' On the script’s homepage you can:'
|
||||
+ ' <ul>'
|
||||
+ ' <li>Find Updates</li>'
|
||||
|
Reference in New Issue
Block a user