+
+
\ No newline at end of file
diff --git a/Erupe/www/erupe/js/script.js b/Erupe/www/erupe/js/script.js
index ef480aa77..c3553616e 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');
@@ -81,25 +83,25 @@ function saveAccount() {
function createCharItem(name, uid, weapon, hr, gr, date, sex) {
var icon;
- const dateObject = new Date(date * 1000);
- date = dateObject.toLocaleDateString('en-US');
- let dateString = '';
- for (var i = 0; i < date.length; i++) {
- if (date[i] != '') { // invisible LTR char
- dateString += date[i];
- }
- }
+ const dateObject = new Date(date * 1000);
+ date = dateObject.toLocaleDateString('en-US');
+ let dateString = '';
+ for (var i = 0; i < date.length; i++) {
+ if (date[i] != '') { // invisible LTR char
+ dateString += date[i];
+ }
+ }
if (sex == 'M') {
sex = "♂";
} else {
sex = "♀";
}
if (hr > 999) {
- hr = 999;
- }
- if (gr > 999) {
- gr = 999;
- }
+ hr = 999;
+ }
+ if (gr > 999) {
+ gr = 999;
+ }
switch (weapon) {
case '片手剣':
weapon = 'Sword & Shield';
@@ -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,12 @@ 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 +357,93 @@ function setUidIndex(index) {
document.getElementById(selectedUid).classList.add('active');
}
+function toggleModal(preset, url) {
+ let modal = document.getElementById('launcher_modal');
+ 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 = ' \
+ Are you sure you want to open this URL? \
+ \
+ '+url+' \
+ \
+ \
+ This will open in a 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? \
+ NAME \
+ (ID: 000000) \
+ \
+ \
+ You will not be able to recover this character, \
+ it will be gone forever. \
+ \
+ ';
+ modal.querySelector('.dialog .btns').innerHTML = ' \
+
";
+ break;
+ case 'addCharNew':
+ modal.querySelector('.dialog p').innerHTML = ' \
+ Are you sure you want to add a new character? \
+ \
+ \
+ Press [Add Character] 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() {