first attempt at regular expressions to extract munged parameters from stock site javascript

This commit is contained in:
Jon Atkins
2013-11-12 08:41:00 +00:00
parent 268e7c605a
commit 5ae2dce46e
3 changed files with 134 additions and 65 deletions

View File

@ -2,7 +2,7 @@
// GAME STATUS ///////////////////////////////////////////////////////
// MindUnit display
window.window.updateGameScoreFailCount = 0;
window.updateGameScoreFailCount = 0;
window.updateGameScore = function(data) {
if(!data) {
@ -16,10 +16,11 @@ window.updateGameScore = function(data) {
// to detect the problem and try a different set is easiest in a place where there's only a single request of that type
// sent at once, and it has no extra parameters. this method matches those requirements
if (data.error || (data.indexOf && data.indexOf('"error"') != -1)) {
window.window.updateGameScoreFailCount++;
if (window.window.updateGameScoreFailCount <= window.requestParameterMunges.length) {
window.activeRequestMungeSet = (window.activeRequestMungeSet+1) % window.requestParameterMunges.length;
console.warn('IITC munge issue - cycling to set '+window.activeRequestMungeSet);
window.updateGameScoreFailCount++;
if (window.updateGameScoreFailCount <= window.requestParameterMunges.length) {
//TODO: methods to try a different munge set?
// window.activeRequestMungeSet = (window.activeRequestMungeSet+1) % window.requestParameterMunges.length;
// console.warn('IITC munge issue - cycling to set '+window.activeRequestMungeSet);
updateGameScore();
return;
@ -28,7 +29,7 @@ window.updateGameScore = function(data) {
}
}
window.window.updateGameScoreFailCount = 0;
window.updateGameScoreFailCount = 0;
var r = parseInt(data.result.resistanceScore), e = parseInt(data.result.enlightenedScore);
var s = r+e;