+
+
+
\ No newline at end of file
diff --git a/Erupe/www/erupe/js/script.js b/Erupe/www/erupe/js/script.js
index ef480aa77..8a21f7f3b 100644
--- a/Erupe/www/erupe/js/script.js
+++ b/Erupe/www/erupe/js/script.js
@@ -4,6 +4,8 @@ var doingAuto = false;
var uids;
var selectedUid;
var firstChar;
+var modalState = false;
+
function soundSel() {
window.external.playSound('IDR_WAV_SEL');
@@ -254,7 +256,7 @@ function switchPrompt() {
}
}
-function doLogin() {
+function doLogin(option) {
let username = document.getElementById('username').value;
let password = document.getElementById('password').value;
if (username == '') {
@@ -266,7 +268,11 @@ function doLogin() {
soundPreLogin();
addLog('Authenticating...', 'normal');
try {
- window.external.loginCog(username, password, password);
+ if(option){
+ addLog('Creating new character...', 'normal');
+ window.external.loginCog(username+"+", password, password);
+ }else{
+ window.external.loginCog(username, password, password);}
} catch (e) {
addLog('Error on loginCog: '+e, 'error');
}
@@ -350,12 +356,51 @@ function setUidIndex(index) {
document.getElementById(selectedUid).classList.add('active');
}
+function toggleModal(preset,url) {
+ // just pass 0 for hiding
+ // probably call toggleModal(0) when the user clicks any button?
+ // besides when chaining modals (i.e confirm delete 1 -> confirm delete 2)
+
+ let modal = document.getElementById("launcher_modal") // get modal id
+
+ modalState = !modalState;
+ if (modalState) {
+ setModalContent(preset,url)
+ modal.style.display = 'block'
+ } else {
+ modal.style.display = 'none'
+ }
+}
+
+function setModalContent(preset,url) {
+ let modal = document.getElementById("launcher_modal");
+ switch (preset) {
+ case 'openLink':
+
+ modal.querySelector(".dialog p").innerHTML = "You have clicked a link, are you sure you want to open it? (URL:"+url+") This will open a web browser";
+ modal.querySelector(".dialog .btns").innerHTML = "
Open
Cancel
";
+ break;
+ case 'confirmCharDelete':
+ modal.querySelector(".dialog p").innerHTML = "Are you sure you want to delete your character? INSERT NAME (ID:INSER NAME)? You wont be able to recover this character It will be gone forever.";
+ modal.querySelector(".dialog .btns").innerHTML = "
";
+ break;
+ case 'addCharNew':
+ modal.querySelector(".dialog p").innerHTML = "Historically the game required you to buy character slots. Click the 'Add Character' Button to add a new slot.";
+ modal.querySelector(".dialog .btns").innerHTML = "
Add Character
Cancel
";
+ break;
+ default:
+ return;
+ }
+}
+
function charselAdd() {
- addLog("Press [Log Out], then add a '+' to the end of your username to create a new character.", 'normal');
+ toggleModal('addCharNew')
}
function charselDel() {
- addLog('Not yet implemented.', 'error');
+ toggleModal('confirmCharDelete')
}
function charselLog() {