Merge branch 'master' into highlighter

This commit is contained in:
vita10gy 2013-04-16 23:07:03 -05:00
commit 3cd664c25c
22 changed files with 8514 additions and 81 deletions

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
default:
./build.py

View File

@ -23,4 +23,7 @@ window.setupGeosearch = function() {
});
e.preventDefault();
});
$('#geosearchwrapper img').click(function(){
map.locate({setView : true});;
});
}

View File

@ -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

View File

@ -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;

View File

@ -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>'
);

View File

@ -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);
}
}

View File

@ -136,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>');
}

8339
external/leaflet-src.js vendored Normal file

File diff suppressed because it is too large Load Diff

6
external/leaflet.js vendored

File diff suppressed because one or more lines are too long

BIN
images/current-location.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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"

View File

@ -85,12 +85,16 @@ document.getElementsByTagName('body')[0].innerHTML = ''
+ ' <div id="sidebar" style="display: none">'
+ ' <div id="playerstat">t</div>'
+ ' <div id="gamestat">&nbsp;loading global control stats</div>'
+ ' <div id="geosearchwrapper">'
+ ' <input id="geosearch" placeholder="Search location…" type="text"/>'
+ ' <img src="@@INCLUDEIMAGE:images/current-location.png@@"/ title="Current Location">'
+ ' </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 onclick="window.aboutIITC()" style="cursor: help">About&nbsp;IITC</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>'

View File

@ -1,7 +1,11 @@
How does this basically work?
-----------------------------
At the moment, the Android App is nothing more then a WebView which renders the normal web page. The IITC script is injected on page load and after this, it works the same way as on desktop browser. More functionality will be added soon...
At the moment, the Android App is a WebView which renders the normal web page. The IITC script is injected by calling ```iitc_view.loadIITC_JS(Context)```. The app uses a local version of the script, which is located in the assets folder, if no external source is given (see "pref\_iitc\_source").
Communication from app to script is handled by loading Javascript function calls. For example: ```iitc_view.loadUrl("javascript: window.goBack();");```
Communication from script to app is handled by the JavascriptInterface (see /mobile/src/com/cradle/iitc\_mobile/IITC_JSInterface.java). If a method ```foo(String)``` is defined in JSInterface, it can be called by ```android.foo("Hello World")``` in the IITC script.
Debugging
---------
@ -16,13 +20,8 @@ Debugging IITC(M) **before** it has booted requires the Android Developer Tools.
Building the APK
----------------
- **Eclipse:** Just import this project and klick the build button.
- **ant:**
Set the ANDROID_HOME environment variable:
```export ANDROID_HOME=/path/to/android_sdk```
and build the project with ant:
`ant debug`
- You can use `build_mobile.js`, too, which builds IITC, compresses
it and uses ant to build a release APK of IITCM. It requires that
you have Python and uglifyjs installed. You need to set the
`ANDROID_HOME`, like explained above.
Then build the app via the build.py script ```./build.py mobile```
- **Eclipse:** Just import this project and klick the build button. Ensure that you have iitc.js in your assets folder. This is automatically created, when executing ```./build.py mobile```. Otherwise, just copy the IITC script to the assets folder and rename it to iitc.js

View File

@ -1,6 +1,22 @@
ingress intel total conversion (IITC)
ingress intel total conversion mobile (IITCM)
=====================================
# [User documentation moved to the wiki. Please see there!](https://github.com/breunigs/ingress-intel-total-conversion/wiki/IITC-Mobile)
The Android App behaves like the desktop version, but uses the mobile view, which is optimized for mobile devices, as default. Furthermore, there are some nice additions:
### [For developer docs, please see HACKING.md](https://github.com/breunigs/ingress-intel-total-conversion/blob/gh-pages/mobile/HACKING.md)
- it should be much faster than the standard mobile ingress intel map
- a gmaps intent is sent, when a portals Map link is clicked (lets you navigate to portals)
- a geolocate button (you have to enable GPS satellites + location access to use this feature)
- toggle between desktop and mobile view (nice for tablets)
- possibility to use a custom IITC script source
- a click on Portal link copies it to clipboard
- more features will be added soon...
**The App only works with Android 4.0+**
### [For developer docs, please see HACKING.md](https://github.com/jonatkins/ingress-intel-total-conversion/blob/master/mobile/HACKING.md)

View File

@ -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&nbsp;player&nbsp;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);
}

View File

@ -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@@
@ -27,7 +27,7 @@ window.plugin.ipasLink.setupCallback = function() {
}
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) {

View File

@ -266,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

View File

@ -99,7 +99,7 @@ window.plugin.portalcounts.getPortals = function(){
}
var setup = function() {
$('#toolbox').append(' <a onclick="window.plugin.portalcounts.getPortals()">Portal&sbsp;counts</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}' +

View File

@ -403,7 +403,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
}
var setup = function() {
$('#toolbox').append(' <a onclick="window.plugin.portalslist.displayPL(0)">Portals&nbsp;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;}' +

View File

@ -389,7 +389,7 @@ window.plugin.scoreboard.fieldArea = function(field) {
}
var setup = function() {
$('#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;}' +

View File

@ -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@@
@ -71,9 +71,18 @@ window.plugin.showLinkedPortal.getPortalByGuid = function (guid) {
var portalDetails = window.portals[guid].options.details;
portalInfoString = '';
var portalNameAdressAlt = "'" + portalDetails.portalV2.descriptiveText.TITLE + "' (" + portalDetails.portalV2.descriptiveText.ADDRESS + ")";
var portalNameAdressTitle = "'<strong>" + portalDetails.portalV2.descriptiveText.TITLE + "</strong>'<br/> <em>(" + portalDetails.portalV2.descriptiveText.ADDRESS + ")</em>";
var portalNameAdressTitle = $('<div/>').append('\'')
.append($('<strong/>').text(portalDetails.portalV2.descriptiveText.TITLE))
.append('\'')
.append($('<br/>'))
.append($('<em/>').text('(' + portalDetails.portalV2.descriptiveText.ADDRESS + ')'))
.html();
var imageUrl = (portalDetails.imageByUrl ? portalDetails.imageByUrl.imageUrl : window.DEFAULT_PORTAL_IMG);
portalInfoString = '<img src="' + imageUrl + '" class="minImg" alt="' + portalNameAdressAlt + '" title="' + portalNameAdressTitle + '"/>';
portalInfoString = $('<div/>').html($('<img/>').attr('src', imageUrl)
.attr('class', 'minImg')
.attr('alt', portalNameAdressAlt)
.attr('title', portalNameAdressTitle))
.html();
}
return portalInfoString;
};
@ -100,10 +109,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();

View File

@ -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,19 @@ 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;
cursor: pointer;
}
::-webkit-input-placeholder {
font-style: italic;
}
@ -602,58 +615,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{
.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;
}
@ -686,9 +692,8 @@ aside {
}
#largepreview img {
box-shadow: 0 0 40px #000;
}
#largepreview img {
border: 2px solid #f8ff5e;
background-color: rgba(8, 48, 78, 0.9); /* as some images - eg ZipCar - have transparency */
}
/* tooltips, dialogs */