Merge branch 'gh-pages' of github.com:breunigs/ingress-intel-total-conversion into gh-pages

This commit is contained in:
Stefan Breunig 2013-03-08 01:12:12 +01:00
commit 9c2bc7a779
10 changed files with 139 additions and 102 deletions

View File

@ -27,8 +27,9 @@ Please follow the these guidelines. Some are just preference, others are good pr
- use identity operators: `===` and `!==`. [Why do I want this?](http://stackoverflow.com/a/359509/1684530) - use identity operators: `===` and `!==`. [Why do I want this?](http://stackoverflow.com/a/359509/1684530)
- jQuery is your friend - jQuery is your friend
- indent using two spaces - indent using two spaces
- opening brace on the same line with a space after the if/for/etc: `if(blub) {` - opening brace on the same line: `if(blub) {`
- else clauses: `} else if(blub) {` or `} else {` - else clauses: `} else if(blub) {` or `} else {`
- there should be no space after `if`, `for`, etc. E.g. `if(true) { doStuff(); } else { dontDoStuff(); }`
- comments: `// this is a comment` - comments: `// this is a comment`
- quotes: Use single-quotes for JavaScript and double-quotes for HTML content. Example: `$('body').append('<div id="soup">Soup!</div>');`. - quotes: Use single-quotes for JavaScript and double-quotes for HTML content. Example: `$('body').append('<div id="soup">Soup!</div>');`.
- there is no length limit on lines, but try to keep them short where suitable - there is no length limit on lines, but try to keep them short where suitable

View File

@ -16,31 +16,56 @@ window.handleRedeemResponse = function(data, textStatus, jqXHR) {
} }
alert('<strong>' + data.error + '</strong>\n' + error); alert('<strong>' + data.error + '</strong>\n' + error);
} else if(data.result) { } else if(data.result) {
var xmp_level = 0, xmp_count = 0; var tblResult = $('<table class="redeem-result" />');
var res_level = 0, res_count = 0; tblResult.append($('<tr><th colspan="2">Passcode accepted!</th></tr>'));
var shield_rarity = '', shield_count = 0;
if(data.result.apAward)
tblResult.append($('<tr><td>+</td><td>' + data.result.apAward + 'AP</td></tr>'));
if(data.result.xmAward)
tblResult.append($('<tr><td>+</td><td>' + data.result.xmAward + 'XM</td></tr>'));
var resonators = {};
var bursts = {};
var shields = {};
// This assumes that each passcode gives only one type of resonator/XMP/shield.
// This may break at some point, depending on changes to passcode functionality.
for(var i in data.result.inventoryAward) { for(var i in data.result.inventoryAward) {
var acquired = data.result.inventoryAward[i][2]; var acquired = data.result.inventoryAward[i][2];
if(acquired.modResource) { if(acquired.modResource) {
if(acquired.modResource.resourceType === 'RES_SHIELD') { if(acquired.modResource.resourceType === 'RES_SHIELD') {
shield_rarity = acquired.modResource.rarity.split('_').map(function (i) {return i[0]}).join(''); var rarity = acquired.modResource.rarity.split('_').map(function (i) {return i[0]}).join('');
shield_count++; if(!shields[rarity]) shields[rarity] = 0;
shields[rarity] += 1;
} }
} else if(acquired.resourceWithLevels) { } else if(acquired.resourceWithLevels) {
if (acquired.resourceWithLevels.resourceType === 'EMP_BURSTER') { if(acquired.resourceWithLevels.resourceType === 'EMITTER_A') {
xmp_level = acquired.resourceWithLevels.level; var level = acquired.resourceWithLevels.level
xmp_count++; if(!resonators[level]) resonators[level] = 0;
} else if (acquired.resourceWithLevels.resourceType === 'EMITTER_A') { resonators[level] += 1;
res_level = acquired.resourceWithLevels.level; } else if(acquired.resourceWithLevels.resourceType === 'EMP_BURSTER') {
res_count++; var level = acquired.resourceWithLevels.level
if(!bursts[level]) bursts[level] = 0;
bursts[level] += 1;
} }
} }
} }
alert('<strong>Passcode accepted!</strong>\n' + [data.result.apAward + 'AP', data.result.xmAward + 'XM', xmp_count + 'xL' + xmp_level + ' XMP', res_count + 'xL' + res_level + ' RES', shield_count + 'x' + shield_rarity + ' SH'].join('/')); $.each(resonators, function(lvl, count) {
var text = 'Resonator';
if(count >= 2) text += ' ('+count+')';
tblResult.append($('<tr ><td style="color: ' +window.COLORS_LVL[lvl]+ ';">L' +lvl+ '</td><td>' + text + '</td></tr>'));
});
$.each(bursts, function(lvl, count) {
var text = 'Xmp Burster';
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

@ -6,7 +6,7 @@
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"
android:targetSdkVersion="17" /> android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />

View File

@ -3,4 +3,4 @@ ingress intel total conversion (IITC)
# [User documentation moved to the wiki. Please see there!](https://github.com/breunigs/ingress-intel-total-conversion/wiki/IITC-Mobile) # [User documentation moved to the wiki. Please see there!](https://github.com/breunigs/ingress-intel-total-conversion/wiki/IITC-Mobile)
# [For developer docs, please see there!](https://github.com/breunigs/ingress-intel-total-conversion/blob/gh-pages/mobile/HACKING.md) ### [For developer docs, please see HACKING.md](https://github.com/breunigs/ingress-intel-total-conversion/blob/gh-pages/mobile/HACKING.md)

Binary file not shown.

View File

@ -44,7 +44,6 @@ public class IITC_Mobile extends Activity {
} }
}); });
} }
} }
// save instance state to avoid reloading on orientation change // save instance state to avoid reloading on orientation change

View File

@ -748,3 +748,15 @@ td {
td + td { td + td {
padding-left: 4px; padding-left: 4px;
} }
/* redeem results *****************************************************/
.redeem-result {
font-size: 14px;
font-family: arial,helvetica,sans-serif;
table-layout: fixed;
}
.redeem-result tr > td:first-child {
width: 50px;
text-align: right;
}