Add Munzee code (unusable until Munzee API people talk to us)

master
Skylar Ittner 8 years ago
parent 343a467b6f
commit a052c5a0ac

@ -330,7 +330,7 @@ body {
color: black; color: black;
} }
#found-box { .found-box {
position: absolute; position: absolute;
z-index: 9001; z-index: 9001;
background: rgba(0, 0, 0, .5); background: rgba(0, 0, 0, .5);
@ -344,18 +344,26 @@ body {
display: none; display: none;
} }
#found-box-title { .found-box-title {
font-size: 120%; font-size: 120%;
color: white; color: white;
border-left: 1px solid white; border-left: 1px solid white;
padding-left: 5px; padding-left: 5px;
} }
#found-box-text { .found-box-text {
color: white; color: white;
border-top: 1px solid white; border-top: 1px solid white;
border-right: 1px solid white; border-right: 1px solid white;
padding-right: 5px; padding-right: 5px;
padding-left: 5px; padding-left: 5px;
padding-top: 2px; padding-top: 2px;
}
#munzeeoauth {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
} }

@ -156,6 +156,7 @@ function dologin() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#loading').css('display', 'none'); $('#loading').css('display', 'none');
authOpInProgress = false; authOpInProgress = false;
serverProblemsDialog("Cannot connect to game server.");
}); });
} else { } else {
$('#loginBtn').html('<i class="fa fa-sign-in"></i> Login'); $('#loginBtn').html('<i class="fa fa-sign-in"></i> Login');
@ -172,6 +173,7 @@ function dologin() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#loading').css('display', 'none'); $('#loading').css('display', 'none');
authOpInProgress = false; authOpInProgress = false;
serverProblemsDialog("Cannot connect to login server.");
}); });
} }

@ -5,6 +5,8 @@ energy = 100;
maxenergy = 100; maxenergy = 100;
level = 1; level = 1;
userteamid = 0; userteamid = 0;
MUNZEE_CLIENT_ID = '616cecc70e17f4a3cb64146dce2d33f5';
MUNZEE_REDIRECT = 'http://gs.terranquest.net/munzee.php';
/* /*
* Runs when the app opens * Runs when the app opens
@ -22,8 +24,12 @@ function onDeviceReady() {
} }
} }
function serverProblemsDialog() { function serverProblemsDialog(errmsg) {
openscreen("servererror"); $('#content-zone').load("screens/servererror.html", function () {
if (typeof errmsg !== 'undefined') {
$('#serverproblemmsg').text(errmsg);
}
});
} }
function mkApiUrl(action, server) { function mkApiUrl(action, server) {
@ -84,11 +90,17 @@ function scanCode() {
function (result) { function (result) {
if (!result.cancelled) { if (!result.cancelled) {
$.getJSON(mkApiUrl('code2item', 'gs'), { $.getJSON(mkApiUrl('code2item', 'gs'), {
code: result.text code: result.text,
latitude: latitude,
longitude: longitude,
accuracy: gpsaccuracy
}, function (data) { }, function (data) {
if (data.status === 'OK') { if (data.status === 'OK') {
//navigator.notification.alert("Found one " + data.message, null, "Found an item!", 'OK'); if (data.messages.length >= 2) {
showFoundBox("Found an item!", "Found one " + data.message); showFoundBox2(data.messages[0].title, data.messages[0].text, data.messages[1].title, data.messages[1].text);
} else {
showFoundBox(data.messages[0].title, data.messages[0].text);
}
} else { } else {
showFoundBox("Huh?", data.message); showFoundBox("Huh?", data.message);
} }

@ -41,11 +41,26 @@
</div> </div>
</div> </div>
<div id="found-box"> <div id="found-box" class="found-box">
<div id="found-box-title"> <div class="found-box-title" id="found-box-title">
</div> </div>
<div id="found-box-text"> <div class="found-box-text" id="found-box-text">
</div>
</div>
<div id="found-box-2" class="found-box">
<div class="found-box-title" id="found-box-title-1">
</div>
<div class="found-box-text" id="found-box-text-1">
</div>
<div class="found-box-title" id="found-box-title-2">
</div>
<div class="found-box-text" id="found-box-text-2">
</div> </div>
</div> </div>
@ -74,10 +89,25 @@
$('#found-box').fadeOut('slow'); $('#found-box').fadeOut('slow');
}, 5000); }, 5000);
} }
function showFoundBox2(title, text, title2, text2) {
$('#found-box-title-1').text(title);
$('#found-box-text-1').text(text);
$('#found-box-title-2').text(title2);
$('#found-box-text-2').text(text2);
$('#found-box-2').fadeIn('fast');
setTimeout(function () {
$('#found-box-2').fadeOut('slow');
}, 5000);
}
$('#found-box').click(function (e) { $('#found-box').click(function (e) {
$('#found-box').fadeOut('fast'); $('#found-box').fadeOut('fast');
}); });
$('#found-box-2').click(function (e) {
$('#found-box').fadeOut('fast');
});
</script> </script>
<script src="js/location.js"></script> <script src="js/location.js"></script>
<script src="js/user.js"></script> <script src="js/user.js"></script>

@ -0,0 +1,11 @@
<iframe id="munzeeoauth" src="about:blank"></iframe>
<script>
setTimeout(function () {
$('#munzeeoauth').attr('src', 'https://api.munzee.com/oauth?response_type=code&client_id='
+ MUNZEE_CLIENT_ID
+ '&redirect_uri='
+ MUNZEE_REDIRECT
+ '&scope=read');// capture_light');
}, 1000);
</script>

@ -5,7 +5,7 @@
<br /> <br />
<i class="fa fa-exclamation-triangle fa-3x"></i> <i class="fa fa-exclamation-triangle fa-3x"></i>
<br /> <br />
(sorry) <span id="serverproblemmsg">(sorry)</span>
<div style="background: url(assets/mountains-simple.svg) repeat-x; background-size: auto 100%; height: 20%; position: absolute; bottom: 0; width: 100%;"></div> <div style="background: url(assets/mountains-simple.svg) repeat-x; background-size: auto 100%; height: 20%; position: absolute; bottom: 0; width: 100%;"></div>
</div> </div>
<script> <script>

@ -6,6 +6,11 @@
<div class='list-group-item' onclick='openRules()'> <div class='list-group-item' onclick='openRules()'>
Show Rules Show Rules
</div> </div>
<div class='list-group-item' onclick='openscreen("munzeelink")'>
Link with Munzee account
<br />
<span class="small">When you link a Munzee account, any Munzee QR codes you scan will be automatically captured in Munzee as well.</span>
</div>
<div class='list-group-item' onclick='askLogout()'> <div class='list-group-item' onclick='askLogout()'>
Logout from app Logout from app
</div> </div>

@ -330,7 +330,7 @@ body {
color: black; color: black;
} }
#found-box { .found-box {
position: absolute; position: absolute;
z-index: 9001; z-index: 9001;
background: rgba(0, 0, 0, .5); background: rgba(0, 0, 0, .5);
@ -344,18 +344,26 @@ body {
display: none; display: none;
} }
#found-box-title { .found-box-title {
font-size: 120%; font-size: 120%;
color: white; color: white;
border-left: 1px solid white; border-left: 1px solid white;
padding-left: 5px; padding-left: 5px;
} }
#found-box-text { .found-box-text {
color: white; color: white;
border-top: 1px solid white; border-top: 1px solid white;
border-right: 1px solid white; border-right: 1px solid white;
padding-right: 5px; padding-right: 5px;
padding-left: 5px; padding-left: 5px;
padding-top: 2px; padding-top: 2px;
}
#munzeeoauth {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
} }

@ -156,6 +156,7 @@ function dologin() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#loading').css('display', 'none'); $('#loading').css('display', 'none');
authOpInProgress = false; authOpInProgress = false;
serverProblemsDialog("Cannot connect to game server.");
}); });
} else { } else {
$('#loginBtn').html('<i class="fa fa-sign-in"></i> Login'); $('#loginBtn').html('<i class="fa fa-sign-in"></i> Login');
@ -172,6 +173,7 @@ function dologin() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#loading').css('display', 'none'); $('#loading').css('display', 'none');
authOpInProgress = false; authOpInProgress = false;
serverProblemsDialog("Cannot connect to login server.");
}); });
} }

@ -5,6 +5,8 @@ energy = 100;
maxenergy = 100; maxenergy = 100;
level = 1; level = 1;
userteamid = 0; userteamid = 0;
MUNZEE_CLIENT_ID = '616cecc70e17f4a3cb64146dce2d33f5';
MUNZEE_REDIRECT = 'http://gs.terranquest.net/munzee.php';
/* /*
* Runs when the app opens * Runs when the app opens
@ -22,8 +24,12 @@ function onDeviceReady() {
} }
} }
function serverProblemsDialog() { function serverProblemsDialog(errmsg) {
openscreen("servererror"); $('#content-zone').load("screens/servererror.html", function () {
if (typeof errmsg !== 'undefined') {
$('#serverproblemmsg').text(errmsg);
}
});
} }
function mkApiUrl(action, server) { function mkApiUrl(action, server) {
@ -84,11 +90,17 @@ function scanCode() {
function (result) { function (result) {
if (!result.cancelled) { if (!result.cancelled) {
$.getJSON(mkApiUrl('code2item', 'gs'), { $.getJSON(mkApiUrl('code2item', 'gs'), {
code: result.text code: result.text,
latitude: latitude,
longitude: longitude,
accuracy: gpsaccuracy
}, function (data) { }, function (data) {
if (data.status === 'OK') { if (data.status === 'OK') {
//navigator.notification.alert("Found one " + data.message, null, "Found an item!", 'OK'); if (data.messages.length >= 2) {
showFoundBox("Found an item!", "Found one " + data.message); showFoundBox2(data.messages[0].title, data.messages[0].text, data.messages[1].title, data.messages[1].text);
} else {
showFoundBox(data.messages[0].title, data.messages[0].text);
}
} else { } else {
showFoundBox("Huh?", data.message); showFoundBox("Huh?", data.message);
} }

@ -41,11 +41,26 @@
</div> </div>
</div> </div>
<div id="found-box"> <div id="found-box" class="found-box">
<div id="found-box-title"> <div class="found-box-title" id="found-box-title">
</div> </div>
<div id="found-box-text"> <div class="found-box-text" id="found-box-text">
</div>
</div>
<div id="found-box-2" class="found-box">
<div class="found-box-title" id="found-box-title-1">
</div>
<div class="found-box-text" id="found-box-text-1">
</div>
<div class="found-box-title" id="found-box-title-2">
</div>
<div class="found-box-text" id="found-box-text-2">
</div> </div>
</div> </div>
@ -74,10 +89,25 @@
$('#found-box').fadeOut('slow'); $('#found-box').fadeOut('slow');
}, 5000); }, 5000);
} }
function showFoundBox2(title, text, title2, text2) {
$('#found-box-title-1').text(title);
$('#found-box-text-1').text(text);
$('#found-box-title-2').text(title2);
$('#found-box-text-2').text(text2);
$('#found-box-2').fadeIn('fast');
setTimeout(function () {
$('#found-box-2').fadeOut('slow');
}, 5000);
}
$('#found-box').click(function (e) { $('#found-box').click(function (e) {
$('#found-box').fadeOut('fast'); $('#found-box').fadeOut('fast');
}); });
$('#found-box-2').click(function (e) {
$('#found-box').fadeOut('fast');
});
</script> </script>
<script src="js/location.js"></script> <script src="js/location.js"></script>
<script src="js/user.js"></script> <script src="js/user.js"></script>

@ -0,0 +1,11 @@
<iframe id="munzeeoauth" src="about:blank"></iframe>
<script>
setTimeout(function () {
$('#munzeeoauth').attr('src', 'https://api.munzee.com/oauth?response_type=code&client_id='
+ MUNZEE_CLIENT_ID
+ '&redirect_uri='
+ MUNZEE_REDIRECT
+ '&scope=read');// capture_light');
}, 1000);
</script>

@ -5,7 +5,7 @@
<br /> <br />
<i class="fa fa-exclamation-triangle fa-3x"></i> <i class="fa fa-exclamation-triangle fa-3x"></i>
<br /> <br />
(sorry) <span id="serverproblemmsg">(sorry)</span>
<div style="background: url(assets/mountains-simple.svg) repeat-x; background-size: auto 100%; height: 20%; position: absolute; bottom: 0; width: 100%;"></div> <div style="background: url(assets/mountains-simple.svg) repeat-x; background-size: auto 100%; height: 20%; position: absolute; bottom: 0; width: 100%;"></div>
</div> </div>
<script> <script>

@ -6,6 +6,11 @@
<div class='list-group-item' onclick='openRules()'> <div class='list-group-item' onclick='openRules()'>
Show Rules Show Rules
</div> </div>
<!--<div class='list-group-item' onclick='openscreen("munzeelink")'>
Link with Munzee account
<br />
<span class="small">When you link a Munzee account, any Munzee QR codes you scan will be automatically captured in Munzee as well.</span>
</div>-->
<div class='list-group-item' onclick='askLogout()'> <div class='list-group-item' onclick='askLogout()'>
Logout from app Logout from app
</div> </div>