<!--
TerranQuest - Augmented Reality fantasy game
Copyright 2016 Netsyms Technologies
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
< div class = "h4" > Choose Your Magic< / div >
< p > Before you can harness the power of magic, you must make a difficult choice.
< br / >
The key to unlocking your inner power is channeling it into one of the elements.
Once you have chosen, you cannot change your mind.
< br / >
< i > Choose wisely.< / i >
< / p >
< div class = "list-group" id = "team-choice-list" >
<!-- <div class="list - group - item" id="team0">
< div class = "radio" >
< label >
< input type = "radio" name = "teamChooser" id = "teamChooser0" value = "0" >
< span id = "teamlabel0" > < / span >
< / label >
< / div >
< / div > -->
< / div >
< div id = "submitteamsetbtn" class = "btn btn-success" onclick = "setTeam()" style = "display: none;" > Continue< / div >
< script >
$('input[name=teamChooser]').change(function () {
if (this.checked) {
$('#submitteamsetbtn').css('display', 'block');
}
});
function chooseTeam(id) {
$('#teamChooser' + id).prop('checked', true);
$('#submitteamsetbtn').css('display', 'block');
}
function setTeam() {
//alert($('input[name=teamChooser]:checked').val());
var team = $('input[name=teamChooser]:checked').val();
$.getJSON(mkApiUrl('setteam', 'gs'), {
teamid: team,
lang: USER_LANGUAGE
}, function (data) {
if (data.status === 'OK') {
// We're all good.
openscreen("home");
} else {
// Error?
navigator.notification.alert(data.message, null, "Error", 'OK');
}
}).fail(function () {
navigator.notification.alert("Something went wrong, try again later.", null, "Error", 'OK');
});
}
// Populate the list
for (var i = 1; i < 7 ; i + + ) {
$('#team-choice-list').append('< div class = "list-group-item" onclick = "chooseTeam(' + i + ')" id = "team' + i + '" > < div class = "radio" > < label > < input type = "radio" name = "teamChooser" id = "teamChooser' + i + '" value = "' + i + '" > < span id = "teamlabel' + i + '" > < / span > < / label > < / div > < / div > ');
$('#team' + i).css('background-color', '#' + getTeamColorFromId(i));
$('#teamlabel' + i).html(getTeamNameFromId(i));
}
< / script >