jonatkins/ingress-intel-total-conversion — pull request #197 by integ3r (2013-04-24 06:03:24+00:00)
Title: Passcode redemption overhaul: now with plaintext copying, default display, JS console logging, and more

This has been in the works for a while.

I've completely overhauled IITC's passcode redemption, and plan to continue updates on it in the future.

The existing passcode system that I submitted on the day IITC was released works (and has had very substantial updates since then by others). Why change it?

As we saw with the Power Cube update, things break in weird ways. The passcode redemption system made a lot of assumptions about the format of rewards (and the types of items given), which made sense then. However, passcodes have changed in the past, and could change in the future.

This patch assumes that passcodes could (at some point) work like portal hacks, giving multiple types of items at different levels. It also assumes that new types of leveled items and mods will be released, and will actually display them instead of remaining silent.

This patch also brings back the possibility for plaintext reward copying. The last patch included a table, which is definitely more aesthetically pleasing, but is less friendly for copying.

Finally, this patch logs passcode redemption on the JS console. Missed the rewards? Find them in the console.

I did have to change the globally-used window.postAjax function very slightly for this patch (data should be passed as the context for POST responses), but it doesn't break anything anywhere else.

Let me know if you have any questions.