Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Some un-pushed changes.
Browse files Browse the repository at this point in the history
This still doesn't work with the latest Riot build, but it's the latest code.
  • Loading branch information
kaysond committed Oct 7, 2013
1 parent 7c23e1a commit 39f25fa
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
7 changes: 2 additions & 5 deletions ajax.php
Expand Up @@ -152,13 +152,10 @@
{
$_SESSION['cookies'] = $result['cookies'];
$_SESSION['case'] = $result['case'];
if ( $result['case'] == "finished" ) {
if ( $result['case'] == "finished" )
echo '{"status":"finished"}';
} elseif ($result['case'] == "recess") {
echo '{"status":"recess"}';
} else {
else
echo '{"status":"ok","case":"' . $result["case"] . '","numGames":' . $result["numGames"] . '}';
}
}
break;

Expand Down
29 changes: 26 additions & 3 deletions assets/javascripts/mobiletrib.js
Expand Up @@ -12,6 +12,10 @@ Array.prototype.remove = function(from, to) {
return this.push.apply(this, rest);
};

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30304199-1']);
_gaq.push(['_trackPageview']);

$(function() {
// in case there is an updated version
if (window.applicationCache) {
Expand Down Expand Up @@ -99,9 +103,6 @@ $(function() {
if ( data.status === 'finished' ) {
return showOnly('finished');
}
if ( data.status === 'recess' ) {
return showOnly('recess');
}
if ( data.status === 'ok' ) {
loadCase(data);
}
Expand Down Expand Up @@ -147,6 +148,7 @@ function showOnly(elemId) {
}

function doLogout() {
_gaq.push(['_trackEvent', 'User', 'Logout', 'Manual']);
showOnly('loading');
$.ajax({
type: 'POST',
Expand Down Expand Up @@ -188,6 +190,7 @@ function submitLogin(event) {

function processLoginResult(data) {
if (data.status === 'ok') {
_gaq.push(['_trackEvent', 'User', 'Login '+$('#realm').val(), 'Success']);
showOnly('game');
loadCase(data);
} else if (data.status === 'error') {
Expand All @@ -204,9 +207,26 @@ function processLoginResult(data) {
function processCaseSubmissionResult(data) {
showOnly('submit');
if (data.status === 'failed') {
_gaq.push(['_trackEvent', 'Case', 'Submit', 'Comm Error']);
alert('Error communicating with Riot servers');
}
else if (data.status === 'captchafail') {
<<<<<<< HEAD
_gaq.push(['_trackEvent', 'Case', 'Submit', 'Captcha Failed']);
alert('Incorrect captcha');
}
else if (data.status === 'finished') {
_gaq.push(['_trackEvent', 'Case', 'Submit', 'Accepted']);
_gaq.push(['_trackEvent', 'User', 'Cases Exhausted']);
showOnly('finished'); // TODO have a button to retry that checks if you are still expired
}
else if (data.status === 'nosess') {
_gaq.push(['_trackEvent', 'User', 'Logout', 'Timed out']);
showOnly('login'); // TODO show login form instead of reloading
}
else if (data.status === 'ok') {
_gaq.push(['_trackEvent', 'Case', 'Submit', 'Accepted']);
=======
alert('Incorrect captcha');
}
else if (data.status === 'finished') {
Expand All @@ -216,6 +236,7 @@ function processCaseSubmissionResult(data) {
showOnly('login'); // TODO show login form instead of reloading
}
else if (data.status === 'ok') {
>>>>>>> master
loadCase(data);
}
}
Expand Down Expand Up @@ -312,6 +333,7 @@ function loadGame(gameNumber) {
$('#game-selected').html('Game '+gameNumber);

if (!window.cachedGames[gameNumber]) {
_gaq.push(['_trackEvent', 'Case', 'Load Game', 'Uncached', gameNumber]);
$.ajax({
type: 'POST',
dataType: 'json',
Expand All @@ -323,6 +345,7 @@ function loadGame(gameNumber) {
}
});
} else {
_gaq.push(['_trackEvent', 'Case', 'Load Game', 'Cached', gameNumber]);
applyData(window.cachedGames[gameNumber]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/stylesheets/mobiletrib.css
Expand Up @@ -43,7 +43,7 @@ body {
color: white;
}

#finished, #recess {
#finished {
width: 100%;
text-align: center;
}
Expand Down
3 changes: 0 additions & 3 deletions support/parsing.php
Expand Up @@ -34,9 +34,6 @@ function htmlToDoc($html)
function tribParseHTML($html)
{
$doc = htmlToDoc($html);
if (checkRecess($doc)) {
return array('case' => 'recess', 'numGames' => 0);
}
return array( 'numGames' => getNumGames($html), 'case' => getCaseNo($doc) );
}

Expand Down
2 changes: 1 addition & 1 deletion webapp.manifest
@@ -1,5 +1,5 @@
CACHE MANIFEST
#Manifest version 2.2.1
#Manifest version 2.2.0
# Changing one byte in this file will force all
# items in the cache to be re-fetched, so update
# the above version number after making changes
Expand Down

0 comments on commit 39f25fa

Please sign in to comment.