Merge branch 'master' into highlighter
This commit is contained in:
commit
038a2205b5
55
code/boot.js
55
code/boot.js
@ -1,4 +1,3 @@
|
||||
|
||||
// SETUP /////////////////////////////////////////////////////////////
|
||||
// these functions set up specific areas after the boot function
|
||||
// created a basic framework. All of these functions should only ever
|
||||
@ -103,15 +102,35 @@ window.setupStyles = function() {
|
||||
window.setupMap = function() {
|
||||
$('#map').text('');
|
||||
|
||||
var osmOpt = {attribution: 'Map data © OpenStreetMap contributors', maxZoom: 18, detectRetina: true};
|
||||
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmOpt);
|
||||
//OpenStreetMap attribution - required by several of the layers
|
||||
osmAttribution = 'Map data © OpenStreetMap contributors';
|
||||
|
||||
var cmOpt = {attribution: 'Map data © OpenStreetMap contributors, Imagery © CloudMade', maxZoom: 18, detectRetina: true};
|
||||
var cmMin = new L.TileLayer('http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/22677/256/{z}/{x}/{y}.png', cmOpt);
|
||||
var cmMid = new L.TileLayer('http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/999/256/{z}/{x}/{y}.png', cmOpt);
|
||||
//OpenStreetMap tiles - we shouldn't use these by default, or even an option - https://wiki.openstreetmap.org/wiki/Tile_usage_policy
|
||||
// "Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators"
|
||||
//var osmOpt = {attribution: osmAttribution, maxZoom: 18, detectRetina: true};
|
||||
//var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmOpt);
|
||||
|
||||
var views = [cmMid, cmMin, osm, new L.Google('INGRESS'), new L.Google('ROADMAP'),
|
||||
new L.Google('SATELLITE'), new L.Google('HYBRID')];
|
||||
//CloudMade layers - only 500,000 tiles/month in their free plan. nowhere near enough for IITC
|
||||
var cmOpt = {attribution: osmAttribution+', Imagery © CloudMade', maxZoom: 18, detectRetina: true};
|
||||
//var cmMin = new L.TileLayer('http://{s}.tile.cloudmade.com/{your api key here}/22677/256/{z}/{x}/{y}.png', cmOpt);
|
||||
//var cmMid = new L.TileLayer('http://{s}.tile.cloudmade.com/{your api key here}/999/256/{z}/{x}/{y}.png', cmOpt);
|
||||
|
||||
//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 mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', mazZoom: 18, detectRetena: true, subdomains: mqSubdomains};
|
||||
var mqMap = new L.TileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
|
||||
//MapQuest satellite coverage outside of the US is rather limited - so not really worth having as we have google as an option
|
||||
//var mqSatOpt = {attribution: 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency', mazZoom: 18, detectRetena: true, subdomains: mqSubdomains};
|
||||
//var mqSat = new L.TileLayer('http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg',mqSatOpt);
|
||||
|
||||
var views = [
|
||||
/*0*/ mqMap,
|
||||
/*1*/ new L.Google('INGRESS'),
|
||||
/*2*/ new L.Google('ROADMAP'),
|
||||
/*3*/ new L.Google('SATELLITE'),
|
||||
/*4*/ new L.Google('HYBRID')
|
||||
];
|
||||
|
||||
|
||||
window.map = new L.Map('map', $.extend(getPosition(),
|
||||
@ -137,13 +156,11 @@ window.setupMap = function() {
|
||||
addLayers['Links'] = linksLayer;
|
||||
|
||||
window.layerChooser = new L.Control.Layers({
|
||||
'OSM Midnight': views[0],
|
||||
'OSM Minimal': views[1],
|
||||
'OSM Mapnik': views[2],
|
||||
'Default Ingress Map': views[3],
|
||||
'Google Roads': views[4],
|
||||
'Google Satellite': views[5],
|
||||
'Google Hybrid': views[6]
|
||||
'MapQuest OSM': views[0],
|
||||
'Default Ingress Map': views[1],
|
||||
'Google Roads': views[2],
|
||||
'Google Satellite': views[3],
|
||||
'Google Hybrid': views[4]
|
||||
}, addLayers);
|
||||
|
||||
map.addControl(window.layerChooser);
|
||||
@ -231,7 +248,7 @@ window.setupPlayerStat = function() {
|
||||
+ '<h2 title="'+t+'">'+level+' '
|
||||
+ '<div id="name">'
|
||||
+ '<span class="'+cls+'">'+PLAYER.nickname+'</span>'
|
||||
+ '<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>'
|
||||
+ '<a href="/_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>'
|
||||
@ -291,12 +308,13 @@ window.setupDialogs = function() {
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{ text: 'OK', click: function() { $(this).dialog('close'); } }
|
||||
{ text: 'OK', click: function() { if($(this).data("closeCallback")) {$(this).data("closeCallback")();} $(this).dialog('close'); } }
|
||||
]
|
||||
});
|
||||
|
||||
window.alert = function(text, isHTML) {
|
||||
window.alert = function(text, isHTML, closeCallback) {
|
||||
var h = isHTML ? text : window.convertTextToTableMagic(text);
|
||||
$('#dialog').data("closeCallback", closeCallback);
|
||||
$('#dialog').html(h).dialog('open');
|
||||
}
|
||||
}
|
||||
@ -386,6 +404,7 @@ try { console.log('Loading included JS now'); } catch(e) {}
|
||||
|
||||
try { console.log('done loading included JS'); } catch(e) {}
|
||||
|
||||
//note: no protocol - so uses http or https as used on the current page
|
||||
var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
|
||||
var JQUERYUI = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js';
|
||||
|
||||
|
45
code/chat.js
45
code/chat.js
@ -241,6 +241,14 @@ window.chat.renderFull = function(oldMsgsWereAdded) {
|
||||
// common
|
||||
//
|
||||
|
||||
window.chat.nicknameClicked = function(event, nickname) {
|
||||
var hookData = { event: event, nickname: nickname };
|
||||
|
||||
if (window.runHooks('nicknameClicked', hookData)) {
|
||||
window.chat.addNickname('@' + nickname);
|
||||
}
|
||||
}
|
||||
|
||||
window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) {
|
||||
$.each(newData.result, function(ind, json) {
|
||||
// avoid duplicates
|
||||
@ -283,16 +291,17 @@ window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) {
|
||||
case 'AT_PLAYER':
|
||||
var thisToPlayer = (markup[1].plain == ('@'+window.PLAYER.nickname));
|
||||
var spanClass = thisToPlayer ? "pl_nudge_me" : (markup[1].team + " pl_nudge_player");
|
||||
var atPlayerName = markup[1].plain.replace(/^@/, "");
|
||||
msg += $('<div/>').html($('<span/>')
|
||||
.attr('class', spanClass)
|
||||
.attr('onclick',"window.chat.addNickname('"+markup[1].plain+"')")
|
||||
.attr('onclick',"window.chat.nicknameClicked(event, '"+atPlayerName+"')")
|
||||
.text(markup[1].plain)).html();
|
||||
msgToPlayer = msgToPlayer || thisToPlayer;
|
||||
break;
|
||||
|
||||
case 'PORTAL':
|
||||
var latlng = [markup[1].latE6/1E6, markup[1].lngE6/1E6];
|
||||
var perma = 'https://ingress.com/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid;
|
||||
var perma = '/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+'"'
|
||||
@ -401,7 +410,7 @@ window.chat.renderMsg = function(msg, nick, time, team, msgToPlayer, systemNarro
|
||||
var s = 'style="cursor:pointer; color:'+color+'"';
|
||||
var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
|
||||
var i = ['<span class="invisep"><</span>', '<span class="invisep">></span>'];
|
||||
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" onclick="window.chat.addNickname(\'@' + nick + '\')" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
|
||||
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" onclick="window.chat.nicknameClicked(event, \'' + nick + '\')" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
|
||||
}
|
||||
|
||||
window.chat.addNickname= function(nick){
|
||||
@ -606,21 +615,23 @@ window.chat.setupTime = function() {
|
||||
|
||||
|
||||
window.chat.setupPosting = function() {
|
||||
$('#chatinput input').keydown(function(event) {
|
||||
try {
|
||||
var kc = (event.keyCode ? event.keyCode : event.which);
|
||||
if(kc === 13) { // enter
|
||||
chat.postMsg();
|
||||
event.preventDefault();
|
||||
} else if (kc === 9) { // tab
|
||||
event.preventDefault();
|
||||
window.chat.handleTabCompletion();
|
||||
if (!isSmartphone()) {
|
||||
$('#chatinput input').keydown(function(event) {
|
||||
try {
|
||||
var kc = (event.keyCode ? event.keyCode : event.which);
|
||||
if(kc === 13) { // enter
|
||||
chat.postMsg();
|
||||
event.preventDefault();
|
||||
} else if (kc === 9) { // tab
|
||||
event.preventDefault();
|
||||
window.chat.handleTabCompletion();
|
||||
}
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
debug.printStackTrace();
|
||||
}
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
debug.printStackTrace();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$('#chatinput').submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
@ -4,7 +4,14 @@
|
||||
window.setupGeosearch = function() {
|
||||
$('#geosearch').keypress(function(e) {
|
||||
if((e.keyCode ? e.keyCode : e.which) != 13) return;
|
||||
$.getJSON(NOMINATIM + encodeURIComponent($(this).val()), function(data) {
|
||||
|
||||
var search = $(this).val();
|
||||
|
||||
if (!runHooks('geoSearch', search)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.getJSON(NOMINATIM + encodeURIComponent(search), function(data) {
|
||||
if(!data || !data[0]) return;
|
||||
var b = data[0].boundingbox;
|
||||
if(!b) return;
|
||||
@ -16,4 +23,7 @@ window.setupGeosearch = function() {
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
$('#geosearchwrapper img').click(function(){
|
||||
map.locate({setView : true});;
|
||||
});
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
// array to change order or add additional values to the
|
||||
// details of a portal.
|
||||
// beforePortalReRender: the callback argument is
|
||||
// {portal: ent[2], oldPortal : d, reRender : false}.
|
||||
// {portal: ent[2], oldPortal : d, portalGuid: ent[0], reRender : false}.
|
||||
// The callback needs to update the value of reRender to
|
||||
// true if the plugin has a reason to have the portal
|
||||
// redrawn. It is called early on in the
|
||||
@ -59,15 +59,21 @@
|
||||
window._hooks = {}
|
||||
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
|
||||
'publicChatDataAvailable', 'factionChatDataAvailable', 'portalDataLoaded',
|
||||
'beforePortalReRender', 'checkRenderLimit', 'requestFinished'];
|
||||
'beforePortalReRender', 'checkRenderLimit', 'requestFinished', 'nicknameClicked',
|
||||
'geoSearch'];
|
||||
|
||||
window.runHooks = function(event, data) {
|
||||
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);
|
||||
|
||||
if(!_hooks[event]) return;
|
||||
if(!_hooks[event]) return true;
|
||||
var interupted = false;
|
||||
$.each(_hooks[event], function(ind, callback) {
|
||||
callback(data);
|
||||
if (callback(data) === false) {
|
||||
interupted = true;
|
||||
return false; //break from $.each
|
||||
}
|
||||
});
|
||||
return !interupted;
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,11 +21,18 @@ window.storeMapPosition = function() {
|
||||
// returns a map that shows the whole world.
|
||||
window.getPosition = function() {
|
||||
if(getURLParam('latE6') && getURLParam('lngE6')) {
|
||||
console.log("mappos: reading URL params");
|
||||
console.log("mappos: reading email URL params");
|
||||
var lat = parseInt(getURLParam('latE6'))/1E6 || 0.0;
|
||||
var lng = parseInt(getURLParam('lngE6'))/1E6 || 0.0;
|
||||
// google seems to zoom in far more than leaflet
|
||||
var z = parseInt(getURLParam('z'))+1 || 17;
|
||||
var z = parseInt(getURLParam('z')) || 17;
|
||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
||||
}
|
||||
|
||||
if(getURLParam('ll')) {
|
||||
console.log("mappos: reading stock Intel URL params");
|
||||
var lat = parseFloat(getURLParam('ll').split(",")[0]) || 0.0;
|
||||
var lng = parseFloat(getURLParam('ll').split(",")[1]) || 0.0;
|
||||
var z = parseInt(getURLParam('z')) || 17;
|
||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ window.renderPortal = function(ent) {
|
||||
u = u || oo.level !== portalLevel;
|
||||
|
||||
// Allow plugins to add additional conditions as to when a portal gets re-rendered
|
||||
var hookData = {portal: ent[2], oldPortal: oo.details, reRender: false};
|
||||
var hookData = {portal: ent[2], oldPortal: oo.details, portalGuid: ent[0], reRender: false};
|
||||
runHooks('beforePortalReRender', hookData);
|
||||
u = u || hookData.reRender;
|
||||
|
||||
|
@ -50,7 +50,7 @@ window.renderPortalDetails = function(guid) {
|
||||
|
||||
var lat = d.locationE6.latE6;
|
||||
var lng = d.locationE6.lngE6;
|
||||
var perma = 'https://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
|
||||
var perma = '/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+',\'' + d.portalV2.descriptiveText.TITLE + '\')';
|
||||
var postcard = 'Send in a postcard. Will put it online after receiving. Address:\\n\\nStefan Breunig\\nINF 305 – R045\\n69120 Heidelberg\\nGermany';
|
||||
@ -58,7 +58,8 @@ window.renderPortalDetails = function(guid) {
|
||||
$('#portaldetails')
|
||||
.attr('class', TEAM_TO_CSS[getTeam(d)])
|
||||
.html(''
|
||||
+ '<h3 ondblclick="renderPortalDetails(null);">'+d.portalV2.descriptiveText.TITLE+'</h3>'
|
||||
+ '<h3 class="title">'+d.portalV2.descriptiveText.TITLE+'</h3>'
|
||||
+ '<span class="close" onclick="unselectOldPortal();" title="Close">X</span>'
|
||||
// help cursor via “.imgpreview img”
|
||||
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
|
||||
+ '<img class="hide" src="'+img+'"/>'
|
||||
@ -67,10 +68,10 @@ window.renderPortalDetails = function(guid) {
|
||||
+ '<div class="mods">'+getModDetails(d)+'</div>'
|
||||
+ randDetails
|
||||
+ resoDetails
|
||||
+ '<div class="linkdetails"><aside><a href="'+perma+'" onclick="return androidCopy(this.href)" >portal link</a></aside>'
|
||||
+ '<aside><a onclick="'+poslinks+'">poslinks</a></aside>'
|
||||
+ '<aside><a onclick="alert(\''+postcard+'\');">donate</a></aside>'
|
||||
+ '<aside><a onclick="window.reportPortalIssue()">report issue</a></aside>'
|
||||
+ '<div class="linkdetails">'
|
||||
+ '<aside><a href="'+perma+'" onclick="return androidCopy(this.href)" title="Create a URL link to this portal" >Portal link</a></aside>'
|
||||
+ '<aside><a onclick="'+poslinks+'" title="Link to alternative maps (Google, etc)">Map links</a></aside>'
|
||||
+ '<aside><a onclick="window.reportPortalIssue()" title="Report issues with this portal to Niantic/Google">Report issue</a></aside>'
|
||||
+ '</div>'
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
// REDEEMING /////////////////////////////////////////////////////////
|
||||
|
||||
window.handleRedeemResponse = function(data, textStatus, jqXHR) {
|
||||
@ -27,6 +26,7 @@ window.handleRedeemResponse = function(data, textStatus, jqXHR) {
|
||||
var resonators = {};
|
||||
var bursts = {};
|
||||
var shields = {};
|
||||
var cubes = {};
|
||||
|
||||
for(var i in data.result.inventoryAward) {
|
||||
var acquired = data.result.inventoryAward[i][2];
|
||||
@ -45,6 +45,10 @@ window.handleRedeemResponse = function(data, textStatus, jqXHR) {
|
||||
var level = acquired.resourceWithLevels.level
|
||||
if(!bursts[level]) bursts[level] = 0;
|
||||
bursts[level] += 1;
|
||||
} else if(acquired.resourceWithLevels.resourceType === 'POWER_CUBE') {
|
||||
var level = acquired.resourceWithLevels.level
|
||||
if(!cubes[level]) cubes[level] = 0;
|
||||
cubes[level] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,12 +63,16 @@ window.handleRedeemResponse = function(data, textStatus, jqXHR) {
|
||||
if(count >= 2) text += ' ('+count+')';
|
||||
tblResult.append($('<tr ><td style="color: ' +window.COLORS_LVL[lvl]+ ';">L' +lvl+ '</td><td>' + text + '</td></tr>'));
|
||||
});
|
||||
$.each(cubes, function(lvl, count) {
|
||||
var text = 'Power Cube';
|
||||
if(count >= 2) text += ' ('+count+')';
|
||||
tblResult.append($('<tr ><td style="color: ' +window.COLORS_LVL[lvl]+ ';">L' +lvl+ '</td><td>' + text + '</td></tr>'));
|
||||
});
|
||||
$.each(shields, function(lvl, count) {
|
||||
var text = 'Portal Shield';
|
||||
if(count >= 2) text += ' ('+count+')';
|
||||
tblResult.append($('<tr><td>'+lvl+'</td><td>'+text+'</td></tr>'));
|
||||
});
|
||||
|
||||
alert(tblResult, true);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,30 @@
|
||||
|
||||
|
||||
// UTILS + MISC ///////////////////////////////////////////////////////
|
||||
|
||||
window.aboutIITC = function(){
|
||||
var v = '@@BUILDNAME@@-@@BUILDDATE@@'
|
||||
var a = ''
|
||||
+ ' <div><b>About IITC</b></div> '
|
||||
+ ' <div>Ingress Intel Total Conversion</div> '
|
||||
+ ' <hr>'
|
||||
+ ' <div>'
|
||||
+ ' <a href="http://iitc.jonatkins.com/" target="_blank">IITC Homepage</a><br />'
|
||||
+ ' On the script’s homepage you can:'
|
||||
+ ' <ul>'
|
||||
+ ' <li>Find Updates</li>'
|
||||
+ ' <li>Get Plugins</li>'
|
||||
+ ' <li>Report Bugs</li>'
|
||||
+ ' <li>Contribute!</li>'
|
||||
+ ' </ul>'
|
||||
+ ' </div>'
|
||||
+ ' <div>'
|
||||
+ ' MapQuest OSM tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">'
|
||||
+ ' </div>'
|
||||
+ ' <hr>'
|
||||
+ ' <div>Version: ' + v + '</div>';
|
||||
alert(a);
|
||||
}
|
||||
|
||||
|
||||
window.layerGroupLength = function(layerGroup) {
|
||||
var layersCount = 0;
|
||||
var layers = layerGroup._layers;
|
||||
@ -59,10 +82,7 @@ window.postAjax = function(action, data, success, error) {
|
||||
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
|
||||
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
|
||||
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
|
||||
url: window.location.protocol + '//www.ingress.com/rpc/dashboard.'+action,
|
||||
url: '/rpc/dashboard.'+action,
|
||||
type: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
@ -116,8 +136,8 @@ window.showPortalPosLinks = function(lat, lng, name) {
|
||||
} else {
|
||||
var qrcode = '<div id="qrcode"></div>';
|
||||
var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>';
|
||||
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+portal_name+'">gmaps</a>';
|
||||
var osm = '<a href="http://www.openstreetmap.org/?mlat='+lat+'&mlon='+lng+'&zoom=16">OSM</a>';
|
||||
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+portal_name+'">Google maps</a>';
|
||||
var osm = '<a href="http://www.openstreetmap.org/?mlat='+lat+'&mlon='+lng+'&zoom=16">OpenStreetMap</a>';
|
||||
var latLng = '<span>'+lat+','+lng +'</span>';
|
||||
alert('<div style="text-align: center;">' + qrcode + script + gmaps + ' ' + osm + '<br />' + latLng + '</div>');
|
||||
}
|
||||
@ -260,8 +280,8 @@ window.setPermaLink = function(elm) {
|
||||
var c = map.getCenter();
|
||||
var lat = Math.round(c.lat*1E6);
|
||||
var lng = Math.round(c.lng*1E6);
|
||||
var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + (map.getZoom()-1);
|
||||
$(elm).attr('href', 'https://www.ingress.com/intel?' + qry);
|
||||
var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + map.getZoom();
|
||||
$(elm).attr('href', '/intel?' + qry);
|
||||
}
|
||||
|
||||
window.uniqueArray = function(arr) {
|
||||
|
8339
external/leaflet-src.js
vendored
Normal file
8339
external/leaflet-src.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
external/leaflet.js
vendored
6
external/leaflet.js
vendored
File diff suppressed because one or more lines are too long
BIN
images/current-location.png
Normal file
BIN
images/current-location.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -138,6 +138,27 @@
|
||||
"level": 1,
|
||||
"resourceType": "EMITTER_A"
|
||||
}
|
||||
}],
|
||||
[ "00000000000000000000000000000000.5",
|
||||
1365809491413, {
|
||||
"accessLevel" : {
|
||||
"failure" : {
|
||||
"isAllowed" : false,
|
||||
"requiredLevel" : 4
|
||||
},
|
||||
"requiredLevel" : 4
|
||||
},
|
||||
"inInventory" : {
|
||||
"acquisitionTimestampMs" : "1365809491260",
|
||||
"playerId" : "00000000000000000000000000000000.c"
|
||||
},
|
||||
"powerCube" : {
|
||||
"energy" : 4000
|
||||
},
|
||||
"resourceWithLevels" : {
|
||||
"level" : 4,
|
||||
"resourceType" : "POWER_CUBE"
|
||||
}
|
||||
}]
|
||||
],
|
||||
"playerEntity": ["00000000000000000000000000000000.c",
|
||||
@ -155,6 +176,10 @@
|
||||
"mediaHighWaterMarks": {
|
||||
"General": 8,
|
||||
"RESISTANCE": 9
|
||||
},
|
||||
"notificationSettings" : {
|
||||
"maySendPromoEmail" : false,
|
||||
"shouldSendEmail" : true
|
||||
}
|
||||
}
|
||||
}]
|
||||
@ -285,6 +310,27 @@
|
||||
"level": 1,
|
||||
"resourceType": "EMITTER_A"
|
||||
}
|
||||
}],
|
||||
[ "00000000000000000000000000000000.5",
|
||||
1365809491413, {
|
||||
"accessLevel" : {
|
||||
"failure" : {
|
||||
"isAllowed" : false,
|
||||
"requiredLevel" : 4
|
||||
},
|
||||
"requiredLevel" : 4
|
||||
},
|
||||
"inInventory" : {
|
||||
"acquisitionTimestampMs" : "1365809491260",
|
||||
"playerId" : "00000000000000000000000000000000.c"
|
||||
},
|
||||
"powerCube" : {
|
||||
"energy" : 4000
|
||||
},
|
||||
"resourceWithLevels" : {
|
||||
"level" : 4,
|
||||
"resourceType" : "POWER_CUBE"
|
||||
}
|
||||
}]
|
||||
],
|
||||
"xmAward": "300"
|
||||
|
16
main.js
16
main.js
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id ingress-intel-total-conversion@jonatkins
|
||||
// @name IITC: Ingress intel map total conversion
|
||||
// @version 0.10.3.@@DATETIMEVERSION@@
|
||||
// @version 0.10.5.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -61,7 +61,7 @@ document.getElementsByTagName('head')[0].innerHTML = ''
|
||||
+ '<style>@@INCLUDESTRING:style.css@@</style>'
|
||||
+ '<style>@@INCLUDESTRING:external/leaflet.css@@</style>'
|
||||
//note: smartphone.css injection moved into code/smartphone.js
|
||||
+ '<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Coda"/>';
|
||||
+ '<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Coda"/>';
|
||||
|
||||
document.getElementsByTagName('body')[0].innerHTML = ''
|
||||
+ '<div id="map">Loading, please wait</div>'
|
||||
@ -85,12 +85,16 @@ document.getElementsByTagName('body')[0].innerHTML = ''
|
||||
+ ' <div id="sidebar" style="display: none">'
|
||||
+ ' <div id="playerstat">t</div>'
|
||||
+ ' <div id="gamestat"> loading global control stats</div>'
|
||||
+ ' <input id="geosearch" placeholder="Search location…" type="text"/>'
|
||||
+ ' <div id="geosearchwrapper">'
|
||||
+ ' <input id="geosearch" placeholder="Search location…" type="text"/>'
|
||||
+ ' <img src="@@INCLUDEIMAGE:images/current-location.png@@"/>'
|
||||
+ ' </div>'
|
||||
+ ' <div id="portaldetails"></div>'
|
||||
+ ' <input id="redeem" placeholder="Redeem code…" type="text"/>'
|
||||
+ ' <div id="toolbox">'
|
||||
+ ' <a onmouseover="setPermaLink(this)" onclick="setPermaLink(this);return androidCopy(this.href)" >permalink</a>'
|
||||
+ ' <a href="http://iitc.jonatkins.com/" title="IITC = Ingress Intel Total Conversion.\n\nOn the script’s homepage you can:\n– find updates\n– get plugins\n– report bugs\n– and contribute." style="cursor: help">IITC’s page</a></div>'
|
||||
+ ' <a onmouseover="setPermaLink(this)" onclick="setPermaLink(this);return androidCopy(this.href)" title="URL link to this map view">Permalink</a>'
|
||||
+ ' <a onclick="window.aboutIITC()" style="cursor: help">About IITC</a>'
|
||||
+ ' </div>'
|
||||
+ ' </div>'
|
||||
+ '</div>'
|
||||
+ '<div id="updatestatus"></div>'
|
||||
@ -168,7 +172,7 @@ window.RANGE_INDICATOR_COLOR = 'red'
|
||||
window.PORTAL_RADIUS_ENLARGE_MOBILE = 5;
|
||||
|
||||
|
||||
window.DEFAULT_PORTAL_IMG = 'https://commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
|
||||
window.DEFAULT_PORTAL_IMG = '//commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
|
||||
window.NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q=';
|
||||
|
||||
// INGRESS CONSTANTS /////////////////////////////////////////////////
|
||||
|
@ -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="1"
|
||||
android:versionName="0.2.5" >
|
||||
android:versionCode="9"
|
||||
android:versionName="0.2.8" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
@ -8,9 +8,30 @@
|
||||
<string name="cache_clear">Clear Cache</string>
|
||||
<string name="locate">Get Location</string>
|
||||
<string name="local">local</string>
|
||||
<string name="close">close</string>
|
||||
<string name="build_version">Build Version</string>
|
||||
<string name="iitc_version">IITC Version</string>
|
||||
<string name="about">About</string>
|
||||
|
||||
<string name="pref_about_title">About IITC Mobile</string>
|
||||
<!-- Use CDATA to prevent android from parsing html tags....we are doing this with Html.fromHtml() -->
|
||||
<string name="pref_about_msg">
|
||||
<![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br>
|
||||
<b>by <a href="https://github.com/leCradle">cradle</a></b><br><br>
|
||||
<b>Icon by <a href="https://twitter.com/machtwerk">machtwerk</a></b><br><br>
|
||||
IITC Mobile is an optimized mobile browser for the
|
||||
Ingress Intel Total Conversion (IITC) userscript by <a href="https://github.com/breunigs"><b>breunigs</b></a>.
|
||||
After Niantic asked the main developer to shut down his github project, development
|
||||
is continued on a fork of <a href="https://github.com/jonatkins"><b>jonatkins</b></a>.<br><br>
|
||||
<b>Website:</b><br>
|
||||
<a href="http://iitc.jonatkins.com/">http://iitc.jonatkins.com/</a><br><br>
|
||||
<b>Fork github:</b><br>
|
||||
<a href="https://github.com/jonatkins/ingress-intel-total-conversion">https://github.com/jonatkins/ingress-intel-total-conversion</a><br><br>
|
||||
<b>Old github:</b><br>
|
||||
<a href="https://github.com/breunigs/ingress-intel-total-conversion">https://github.com/breunigs/ingress-intel-total-conversion</a>]]>
|
||||
</string>
|
||||
|
||||
<string name="pref_ui_cat">UI</string>
|
||||
<string name="pref_force_desktop">Force desktop mode</string>
|
||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||
<string name="pref_developer_options">Developer options</string>
|
||||
|
@ -1,10 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<com.cradle.iitc_mobile.IITC_AboutDialogPreference
|
||||
android:key="pref_about"
|
||||
android:title="@string/pref_about_title"
|
||||
android:dialogIcon="@android:drawable/ic_dialog_info"
|
||||
android:negativeButtonText=""
|
||||
android:positiveButtonText=""
|
||||
android:dialogTitle="@string/pref_about_title"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_about_cat"
|
||||
android:title="@string/pref_ui_cat">
|
||||
<CheckBoxPreference
|
||||
android:key="pref_force_desktop"
|
||||
android:title="@string/pref_force_desktop"
|
||||
android:summary="@string/pref_force_desktop_sum"
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_developer_options"
|
||||
@ -28,4 +41,5 @@
|
||||
android:enabled="false"
|
||||
android:selectable="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -0,0 +1,46 @@
|
||||
package com.cradle.iitc_mobile;
|
||||
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.preference.DialogPreference;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class IITC_AboutDialogPreference extends DialogPreference{
|
||||
|
||||
private Context context;
|
||||
|
||||
public IITC_AboutDialogPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/*
|
||||
* start a little about-dialog
|
||||
* srsly...I found no better way for clickable links in a TextView then
|
||||
* using Html.fromHtml...Linkify is just broken and does not understand
|
||||
* html href tags...so let's tag the @string/about_msg with CDATA and
|
||||
* use Html.fromHtml(...) for clickable hrefs with tags.
|
||||
*/
|
||||
@Override
|
||||
protected void onPrepareDialogBuilder(Builder builder) {
|
||||
final TextView message = new TextView(context);
|
||||
String about_msg = context.getText(R.string.pref_about_msg).toString();
|
||||
message.setText(Html.fromHtml(about_msg));
|
||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
builder.setView(message)
|
||||
.setTitle(R.string.about)
|
||||
.setIcon(android.R.drawable.ic_dialog_info)
|
||||
.setNeutralButton(R.string.close, new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
super.onPrepareDialogBuilder(builder);
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,6 @@ import com.cradle.iitc_mobile.R;
|
||||
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.NetworkInfo.State;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -17,6 +16,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -28,6 +28,7 @@ public class IITC_Mobile extends Activity {
|
||||
private boolean back_button_pressed = false;
|
||||
private boolean desktop = false;
|
||||
private OnSharedPreferenceChangeListener listener;
|
||||
private String intel_url = "https://www.ingress.com/intel";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -44,70 +45,78 @@ public class IITC_Mobile extends Activity {
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equals("pref_force_desktop"))
|
||||
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
|
||||
// reload intel map
|
||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
||||
injectJS();
|
||||
IITC_Mobile.this.loadUrl(intel_url);
|
||||
}
|
||||
};
|
||||
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
||||
|
||||
// we do not want to reload our page every time we switch orientations...
|
||||
// so restore state if activity was already created
|
||||
if(savedInstanceState != null) {
|
||||
iitc_view.restoreState(savedInstanceState);
|
||||
// load new iitc web view with ingress intel page
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_VIEW.equals(action)) {
|
||||
Uri uri = intent.getData();
|
||||
String url = uri.toString();
|
||||
if (intent.getScheme().equals("http://"))
|
||||
url = url.replace("http://", "https://");
|
||||
Log.d("iitcm", "intent received url: " + url);
|
||||
if (url.contains("ingress.com")) {
|
||||
Log.d("iitcm", "loading url...");
|
||||
this.loadUrl(url);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// load new iitc web view with ingress intel page
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_VIEW.equals(action)) {
|
||||
Uri uri = intent.getData();
|
||||
String url = uri.toString();
|
||||
if (intent.getScheme().equals("http://"))
|
||||
url = url.replace("http://", "https://");
|
||||
Log.d("Intent received", "url: " + url);
|
||||
if (url.contains("ingress.com")) {
|
||||
Log.d("Intent received", "loading url...");
|
||||
iitc_view.loadUrl(addUrlParam(url));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.d("No Intent call", "loading https://www.ingress.com/intel");
|
||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
||||
}
|
||||
Log.d("iitcm", "no intent...loading " + intel_url);
|
||||
this.loadUrl(intel_url);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// enough idle...let's do some work
|
||||
Log.d("iitcm", "resuming...setting reset idleTimer");
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 0");
|
||||
iitc_view.loadUrl("javascript: window.renderUpdateStatus()");
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
State mobile = conMan.getNetworkInfo(0).getState();
|
||||
State wifi = conMan.getNetworkInfo(1).getState();
|
||||
NetworkInfo mobile = conMan.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
|
||||
if (mobile == NetworkInfo.State.CONNECTED || mobile == NetworkInfo.State.CONNECTING) {
|
||||
// cancel all current requests
|
||||
iitc_view.loadUrl("javascript: window.requests.abort()");
|
||||
// set idletime to maximum...no need for more
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
} else if (wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING) {
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
// check if Mobile or Wifi module is available..then handle states
|
||||
// TODO: theory...we do not have to check for a Wifi module...every android device should have one
|
||||
if (mobile != null) {
|
||||
Log.d("iitcm", "mobile internet module detected...check states");
|
||||
if (mobile.getState() == NetworkInfo.State.CONNECTED || mobile.getState() == NetworkInfo.State.CONNECTING) {
|
||||
Log.d("iitcm", "connected to mobile net...abort all running requests");
|
||||
// cancel all current requests
|
||||
iitc_view.loadUrl("javascript: window.requests.abort()");
|
||||
// set idletime to maximum...no need for more
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
} else if (wifi.getState() == NetworkInfo.State.CONNECTED || wifi.getState() == NetworkInfo.State.CONNECTING) {
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
}
|
||||
} else {
|
||||
Log.d("iitcm", "no mobile internet module detected...check wifi state");
|
||||
if (wifi.getState() == NetworkInfo.State.CONNECTED || wifi.getState() == NetworkInfo.State.CONNECTING) {
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
}
|
||||
}
|
||||
Log.d("iitcm", "stopping iitcm");
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
// save instance state to avoid reloading on orientation change
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
iitc_view.saveState(outState);
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
Log.d("iitcm", "configuration changed...restoring...reset idleTimer");
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 0");
|
||||
iitc_view.loadUrl("javascript: window.renderUpdateStatus()");
|
||||
}
|
||||
|
||||
// we want a self defined behavior for the back button
|
||||
@ -143,8 +152,7 @@ public class IITC_Mobile extends Activity {
|
||||
// Handle item selection
|
||||
switch (item.getItemId()) {
|
||||
case R.id.reload_button:
|
||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
||||
injectJS();
|
||||
this.loadUrl(intel_url);
|
||||
return true;
|
||||
// clear cache
|
||||
case R.id.cache_clear:
|
||||
@ -156,6 +164,7 @@ public class IITC_Mobile extends Activity {
|
||||
case R.id.locate:
|
||||
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
||||
return true;
|
||||
// start settings activity
|
||||
case R.id.settings:
|
||||
Intent intent = new Intent(this, IITC_Settings.class);
|
||||
intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion());
|
||||
@ -185,4 +194,12 @@ public class IITC_Mobile extends Activity {
|
||||
else
|
||||
return (url + "?vp=m");
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
url = addUrlParam(url);
|
||||
Log.d("iitcm", "injecting js...");
|
||||
injectJS();
|
||||
Log.d("iitcm", "loading url: " + url);
|
||||
iitc_view.loadUrl(url);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.cradle.iitc_mobile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebView;
|
||||
@ -22,8 +25,10 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
|
||||
private WebResourceResponse iitcjs;
|
||||
private String js = null;
|
||||
Context context;
|
||||
|
||||
public IITC_WebViewClient(Context c) {
|
||||
this.context = c;
|
||||
try {
|
||||
loadIITC_JS(c);
|
||||
} catch(IOException e) {
|
||||
@ -109,4 +114,17 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
return super.shouldInterceptRequest(view, url);
|
||||
}
|
||||
}
|
||||
|
||||
// start non-ingress-intel-urls in another app...
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.contains("ingress.com")) {
|
||||
return false;
|
||||
} else {
|
||||
Log.d("iitcm", "no ingress intel link, start external app to load url: " + url);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ window.plugin.apList.getPortalLink = function(portal) {
|
||||
var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join();
|
||||
var jsSingleClick = 'window.plugin.apList.selectPortal(\''+portal.guid+'\');return false';
|
||||
var jsDoubleClick = 'window.zoomToAndShowPortal(\''+portal.guid+'\', ['+latlng+']);return false';
|
||||
var perma = 'https://ingress.com/intel?latE6='+portal.locationE6.latE6
|
||||
var perma = '/intel?latE6='+portal.locationE6.latE6
|
||||
+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+portal.guid;
|
||||
//Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal
|
||||
var a = $('<a>',{
|
||||
|
25
plugins/force-https.user.js
Normal file
25
plugins/force-https.user.js
Normal file
@ -0,0 +1,25 @@
|
||||
// ==UserScript==
|
||||
// @id force-https@jonatkins
|
||||
// @name IITC plugin: force https access for ingress.com/intel
|
||||
// @version 0.1.0.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Force https access for ingress.com/intel. If the intel site is accessed via http, it redirects to the https version
|
||||
// @include https://www.ingress.com/intel*
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
|
||||
//NOTE: plugin authors - due to the unique requirements of this plugin, it doesn't use the standard IITC
|
||||
//plugin architechure. do NOT use it as a template for other plugins
|
||||
|
||||
|
||||
if(window.location.protocol !== 'https:') {
|
||||
var redir = window.location.href.replace(/^http:/, 'https:');
|
||||
window.location = redir;
|
||||
throw('Need to load HTTPS version.');
|
||||
}
|
@ -23,7 +23,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||
window.plugin.guessPlayerLevels = function() {};
|
||||
|
||||
window.plugin.guessPlayerLevels.setupCallback = function() {
|
||||
$('#toolbox').append('<a onclick="window.plugin.guessPlayerLevels.guess()">guess player levels</a> ');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.guessPlayerLevels.guess()" title="Show player level guesses based on resonator placement in displayed portals">Guess player levels</a>');
|
||||
addHook('portalAdded', window.plugin.guessPlayerLevels.extractPortalData);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-ipas-link@graphracer
|
||||
// @name IITC Plugin: simulate an attack on portal
|
||||
// @version 0.1.0.@@DATETIMEVERSION@@
|
||||
// @version 0.1.1.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/xosofox/IPAS
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -23,19 +23,23 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||
window.plugin.ipasLink = function() {};
|
||||
|
||||
window.plugin.ipasLink.setupCallback = function() {
|
||||
addHook('portalDetailsUpdated', window.plugin.ipasLink.addLink);
|
||||
addHook('portalDetailsUpdated', window.plugin.ipasLink.addLink);
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.addLink = function(d) {
|
||||
$('.linkdetails').append('<aside style="text-align: center; display: block"><a href="http://ipas.graphracer.com/index.html#' + window.plugin.ipasLink.getHash(d.portalDetails) + '" target="ipaswindow">simulate attack with IPAS</a></aside>');
|
||||
$('.linkdetails').append('<aside><a href="http://ipas.graphracer.com/index.html#' + window.plugin.ipasLink.getHash(d.portalDetails) + '" target="ipaswindow" title="Use IAPS to simulate an attack on this portal">Simulate attack</a></aside>');
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.getHash = function(d) {
|
||||
var hashParts=[];
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
});
|
||||
return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet
|
||||
var hashParts=[];
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
if (reso) {
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
} else {
|
||||
hashParts.push(1 + "," + 35 + "," + 0); // Dummy values, the only important one is energy=0
|
||||
}
|
||||
});
|
||||
return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
@ -57,4 +61,3 @@ if(window.iitcLoaded && typeof setup === 'function') {
|
||||
var script = document.createElement('script');
|
||||
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||
(document.body || document.head || document.documentElement).appendChild(script);
|
||||
|
||||
|
@ -62,6 +62,8 @@ window.plugin.playerTracker.setup = function() {
|
||||
window.plugin.playerTracker.zoomListener();
|
||||
});
|
||||
window.plugin.playerTracker.zoomListener();
|
||||
|
||||
plugin.playerTracker.setupUserSearch();
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.stored = {};
|
||||
@ -264,6 +266,7 @@ window.plugin.playerTracker.drawData = function() {
|
||||
if(window.plugin.guessPlayerLevels !== undefined &&
|
||||
window.plugin.guessPlayerLevels.fetchLevelByPlayer !== undefined) {
|
||||
var playerLevel = window.plugin.guessPlayerLevels.fetchLevelByPlayer(pguid);
|
||||
if (playerLevel === undefined) playerLevel = 1; //if player level unknown, assume level 1
|
||||
if(playerLevel !== undefined) {
|
||||
title += '<span style="font-weight:bold;margin-left:10px;">Level '
|
||||
+ playerLevel
|
||||
@ -341,8 +344,57 @@ window.plugin.playerTracker.handleData = function(data) {
|
||||
plugin.playerTracker.drawData();
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.findUserPosition = function(nick) {
|
||||
nick = nick.toLowerCase();
|
||||
var foundPlayerData = undefined;
|
||||
$.each(plugin.playerTracker.stored, function(pguid, playerData) {
|
||||
if (playerData.nick.toLowerCase() === nick) {
|
||||
foundPlayerData = playerData;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!foundPlayerData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var evtsLength = foundPlayerData.events.length;
|
||||
var last = foundPlayerData.events[evtsLength-1];
|
||||
return plugin.playerTracker.getLatLngFromEvent(last);
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.centerMapOnUser = function(nick) {
|
||||
var position = plugin.playerTracker.findUserPosition(nick);
|
||||
|
||||
if (position === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
map.setView(position, map.getZoom());
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.onNicknameClicked = function(info) {
|
||||
if (info.event.ctrlKey) {
|
||||
plugin.playerTracker.centerMapOnUser(info.nickname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.onGeoSearch = function(search) {
|
||||
if (/^@/.test(search)) {
|
||||
plugin.playerTracker.centerMapOnUser(search.replace(/^@/, ''));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.setupUserSearch = function() {
|
||||
addHook('nicknameClicked', window.plugin.playerTracker.onNicknameClicked);
|
||||
addHook('geoSearch', window.plugin.playerTracker.onGeoSearch);
|
||||
|
||||
var geoSearch = $('#geosearch');
|
||||
var beforeEllipsis = /(.*)…/.exec(geoSearch.attr('placeholder'))[1];
|
||||
geoSearch.attr('placeholder', beforeEllipsis + ' or @player…');
|
||||
}
|
||||
|
||||
|
||||
var setup = plugin.playerTracker.setup;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-portals-count@yenky
|
||||
// @name IITC plugin: Show total counts of portals
|
||||
// @version 0.0.6.@@DATETIMEVERSION@@
|
||||
// @version 0.0.7.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -99,8 +99,7 @@ window.plugin.portalcounts.getPortals = function(){
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
$('body').append('<div id="portalcounts" style="display:none;"></div>');
|
||||
$('#toolbox').append('<a onclick="window.plugin.portalcounts.getPortals()">Portalcounts</a>');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.portalcounts.getPortals()" title="Display a summary of portals in the current view">Portal counts</a>');
|
||||
$('head').append('<style>' +
|
||||
'#portalcounts table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
|
||||
'#portalcounts table td, #portalcounts table th {border-bottom: 1px solid #0b314e; padding:3px; color:white; background-color:#1b415e}' +
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-portals-list@teo96
|
||||
// @name IITC plugin: show list of portals
|
||||
// @version 0.0.9.@@DATETIMEVERSION@@
|
||||
// @version 0.0.10.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -119,7 +119,7 @@ window.plugin.portalslist.displayPL = function() {
|
||||
} else {
|
||||
html = '<table><tr><td>Nothing to Show !</td></tr></table>';
|
||||
};
|
||||
alert('<div id="portalslist">' + html + '</div>');
|
||||
alert('<div id="portalslist">' + html + '</div>', true, function() {$(".ui-dialog").removeClass('ui-dialog-portalslist');});
|
||||
$(".ui-dialog").addClass('ui-dialog-portalslist');
|
||||
|
||||
// Setup sorting
|
||||
@ -353,7 +353,7 @@ window.plugin.portalslist.exportKML = function(){
|
||||
// description contain picture of the portal, address and link to the Intel map
|
||||
var description = '<![CDATA['
|
||||
+ '<div><table><tr><td><img style="width:100px" src="' + portal.img + '"></td><td>' + portal.address
|
||||
+ '<br><a href="https://ingress.com/intel?latE6=' + portal.lat*1E6 + '&lngE6=' + portal.lng*1E6 + '&z=17">Link to Intel Map</a></td></tr></table>'
|
||||
+ '<br><a href="https://www.ingress.com/intel?latE6=' + portal.lat*1E6 + '&lngE6=' + portal.lng*1E6 + '&z=17">Link to Intel Map</a></td></tr></table>'
|
||||
+ ']]>';
|
||||
|
||||
kml += '<Placemark><name>L' + Math.floor(portal.level) + ' - ' + portal.name + '</name>'
|
||||
@ -387,7 +387,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
|
||||
var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join();
|
||||
var jsSingleClick = 'window.renderPortalDetails(\''+guid+'\');return false';
|
||||
var jsDoubleClick = 'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false';
|
||||
var perma = 'https://ingress.com/intel?latE6='+portal.locationE6.latE6+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+guid;
|
||||
var perma = '/intel?latE6='+portal.locationE6.latE6+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+guid;
|
||||
|
||||
//Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal
|
||||
var a = $('<a>',{
|
||||
@ -403,8 +403,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
$('body').append('<div id="portalslist" style="display:none;"></div>');
|
||||
$('#toolbox').append('<a onclick="window.plugin.portalslist.displayPL(0)">Portals List</a>');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.portalslist.displayPL(0)" title="Display a list of portals in the current view">Portals list</a>');
|
||||
$('head').append('<style>' +
|
||||
'.ui-dialog-portalslist {position: absolute !important; top: 10px !important; left: 30px !important;max-width:800px !important; width:733px !important;}' +
|
||||
'#portalslist table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-scoreboard@vita10gy
|
||||
// @name IITC plugin: show a localized scoreboard.
|
||||
// @version 0.1.5.@@DATETIMEVERSION@@
|
||||
// @version 0.1.6.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -362,7 +362,7 @@ window.plugin.scoreboard.display = function() {
|
||||
scoreHtml += 'You need something in view.';
|
||||
}
|
||||
|
||||
alert('<div id="scoreboard">' + scoreHtml + '</div>');
|
||||
alert('<div id="scoreboard">' + scoreHtml + '</div>', true, function() {$(".ui-dialog").removeClass('ui-dialog-scoreboard');});
|
||||
$(".ui-dialog").addClass('ui-dialog-scoreboard');
|
||||
|
||||
// Setup sorting
|
||||
@ -389,8 +389,7 @@ window.plugin.scoreboard.fieldArea = function(field) {
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
$('body').append('<div id="scoreboard" style="display:none;"></div>');
|
||||
$('#toolbox').append('<a onclick="window.plugin.scoreboard.display()">scoreboard</a>');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.scoreboard.display()" title="Display a scoreboard per team for the current view">Scoreboard</a>');
|
||||
$('head').append('<style>' +
|
||||
'.ui-dialog-scoreboard {max-width:600px !important; width:600px !important;}' +
|
||||
'#scoreboard table {margin-top:10px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-show-linked-portals@fstopienski
|
||||
// @name IITC plugin: Show linked portals
|
||||
// @version 0.0.3.@@DATETIMEVERSION@@
|
||||
// @version 0.0.4.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -100,10 +100,10 @@ var setup = function () {
|
||||
'.showLinkedPortalLink9,.showLinkedPortalLink10,.showLinkedPortalLink11,.showLinkedPortalLink12 {left: 59px}' +
|
||||
'.showLinkedPortalLink13,.showLinkedPortalLink14,.showLinkedPortalLink15,.showLinkedPortalLink16 {right: 65px}' +
|
||||
|
||||
'.showLinkedPortalLink1,.showLinkedPortalLink5,.showLinkedPortalLink9,.showLinkedPortalLink13 {top: 100px; }' +
|
||||
'.showLinkedPortalLink2,.showLinkedPortalLink6,.showLinkedPortalLink10,.showLinkedPortalLink14 {top: 144px; }' +
|
||||
'.showLinkedPortalLink3,.showLinkedPortalLink7,.showLinkedPortalLink11,.showLinkedPortalLink15 {top: 188px; }' +
|
||||
'.showLinkedPortalLink4,.showLinkedPortalLink8,.showLinkedPortalLink12,.showLinkedPortalLink16 {top: 232px; }' +
|
||||
'.showLinkedPortalLink1,.showLinkedPortalLink5,.showLinkedPortalLink9,.showLinkedPortalLink13 {top: 25px; }' +
|
||||
'.showLinkedPortalLink2,.showLinkedPortalLink6,.showLinkedPortalLink10,.showLinkedPortalLink14 {top: 69px; }' +
|
||||
'.showLinkedPortalLink3,.showLinkedPortalLink7,.showLinkedPortalLink11,.showLinkedPortalLink15 {top: 113px; }' +
|
||||
'.showLinkedPortalLink4,.showLinkedPortalLink8,.showLinkedPortalLink12,.showLinkedPortalLink16 {top: 157px; }' +
|
||||
'#level{text-align:center; margin-right: 0px;}' +
|
||||
'</style>');
|
||||
window.plugin.showLinkedPortal.setupCallback();
|
||||
|
69
style.css
69
style.css
@ -45,7 +45,7 @@ body {
|
||||
margin-top: -31px; /* -(toggle height / 2) */
|
||||
line-height: 10px;
|
||||
position: absolute;
|
||||
top: 340px; /* (sidebar height / 2) */
|
||||
top: 325px; /* (sidebar height / 2) */
|
||||
z-index: 3001;
|
||||
background-color: rgba(8, 48, 78, 0.9);
|
||||
color: #FFCE00;
|
||||
@ -423,6 +423,18 @@ input {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#geosearch{
|
||||
width:272px;
|
||||
background-color: transparent;
|
||||
}
|
||||
#geosearchwrapper {
|
||||
height:25px;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
#geosearchwrapper img{
|
||||
vertical-align: bottom;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
::-webkit-input-placeholder {
|
||||
font-style: italic;
|
||||
}
|
||||
@ -602,58 +614,51 @@ h3 {
|
||||
margin-left: -6px;
|
||||
text-shadow: 0.0em 0.0em 0.3em #808080;
|
||||
}
|
||||
|
||||
/* links below resos */
|
||||
|
||||
.linkdetails {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
aside {
|
||||
display: inline-block;
|
||||
padding-right: 9px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.linkdetails aside a{
|
||||
font-size:12px;
|
||||
.linkdetails aside {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.linkdetails aside:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.linkdetails aside:nth-child(1) {
|
||||
text-align: right;
|
||||
width:88px;
|
||||
}
|
||||
|
||||
.linkdetails aside:nth-child(2) {
|
||||
text-align: right;
|
||||
width:67px;
|
||||
}
|
||||
|
||||
.linkdetails aside:nth-child(4) {
|
||||
margin-left:13px;
|
||||
}
|
||||
|
||||
#toolbox {
|
||||
padding: 2px;
|
||||
font-size:90%;
|
||||
font-size: 12px;
|
||||
text-align: left; /* centre didn't look as nice here as it did above in .linkdetails */
|
||||
}
|
||||
|
||||
#toolbox > a {
|
||||
padding: 2px;
|
||||
padding-right:6px;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* a common portal display takes this much space (prevents moving
|
||||
* content when first selecting a portal) */
|
||||
|
||||
#portaldetails {
|
||||
min-height: 495px;
|
||||
min-height: 485px;
|
||||
position: relative; /* so the below '#portaldetails .close' is relative to this */
|
||||
}
|
||||
|
||||
#portaldetails .close {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
right: 2px;
|
||||
cursor: pointer;
|
||||
color: #FFCE00;
|
||||
font-family: "Arial", sans;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user