Merge branch 'gh-pages' of github.com:breunigs/ingress-intel-total-conversion into gh-pages
This commit is contained in:
commit
9c2bc7a779
@ -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)
|
||||
- jQuery is your friend
|
||||
- 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 {`
|
||||
- there should be no space after `if`, `for`, etc. E.g. `if(true) { doStuff(); } else { dontDoStuff(); }`
|
||||
- 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>');`.
|
||||
- there is no length limit on lines, but try to keep them short where suitable
|
||||
|
@ -16,31 +16,56 @@ window.handleRedeemResponse = function(data, textStatus, jqXHR) {
|
||||
}
|
||||
alert('<strong>' + data.error + '</strong>\n' + error);
|
||||
} else if(data.result) {
|
||||
var xmp_level = 0, xmp_count = 0;
|
||||
var res_level = 0, res_count = 0;
|
||||
var shield_rarity = '', shield_count = 0;
|
||||
var tblResult = $('<table class="redeem-result" />');
|
||||
tblResult.append($('<tr><th colspan="2">Passcode accepted!</th></tr>'));
|
||||
|
||||
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) {
|
||||
var acquired = data.result.inventoryAward[i][2];
|
||||
if(acquired.modResource) {
|
||||
if(acquired.modResource.resourceType === 'RES_SHIELD') {
|
||||
shield_rarity = acquired.modResource.rarity.split('_').map(function (i) {return i[0]}).join('');
|
||||
shield_count++;
|
||||
var rarity = acquired.modResource.rarity.split('_').map(function (i) {return i[0]}).join('');
|
||||
if(!shields[rarity]) shields[rarity] = 0;
|
||||
shields[rarity] += 1;
|
||||
}
|
||||
} else if(acquired.resourceWithLevels) {
|
||||
if (acquired.resourceWithLevels.resourceType === 'EMP_BURSTER') {
|
||||
xmp_level = acquired.resourceWithLevels.level;
|
||||
xmp_count++;
|
||||
} else if (acquired.resourceWithLevels.resourceType === 'EMITTER_A') {
|
||||
res_level = acquired.resourceWithLevels.level;
|
||||
res_count++;
|
||||
if(acquired.resourceWithLevels.resourceType === 'EMITTER_A') {
|
||||
var level = acquired.resourceWithLevels.level
|
||||
if(!resonators[level]) resonators[level] = 0;
|
||||
resonators[level] += 1;
|
||||
} else if(acquired.resourceWithLevels.resourceType === 'EMP_BURSTER') {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="17" />
|
||||
android:targetSdkVersion="10" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
|
@ -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)
|
||||
|
||||
# [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.
@ -44,7 +44,6 @@ public class IITC_Mobile extends Activity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// save instance state to avoid reloading on orientation change
|
||||
|
12
style.css
12
style.css
@ -748,3 +748,15 @@ td {
|
||||
td + td {
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user