Add confirmation to surrender button.
This commit is contained in:
parent
7dc7b11a58
commit
10e947df92
101
www/css/ui.css
101
www/css/ui.css
@ -54,77 +54,82 @@ main>table.list td:last-child>button:hover{
|
||||
}
|
||||
|
||||
main>article{
|
||||
display: block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
display:block;
|
||||
position:relative;
|
||||
width:100%;
|
||||
flex-grow:1;
|
||||
|
||||
padding: 1rem;
|
||||
margin: 0;
|
||||
padding:1rem;
|
||||
margin:0;
|
||||
|
||||
line-height: 1.4em;
|
||||
font-size: 1.2rem;
|
||||
color: #c0c0c0;
|
||||
line-height:1.4em;
|
||||
font-size:1.2rem;
|
||||
color:#c0c0c0;
|
||||
|
||||
overflow: auto;
|
||||
overflow:auto;
|
||||
}
|
||||
main>article>h1{
|
||||
padding: 0.5rem;
|
||||
margin: 0 0 0.5rem 0;
|
||||
padding:0.5rem;
|
||||
margin:0 0 0.5rem 0;
|
||||
|
||||
font-size: 1.8rem;
|
||||
font-weight: bold;
|
||||
background-color: #a0a0a0;
|
||||
color: #202020;
|
||||
font-size:1.8rem;
|
||||
font-weight:bold;
|
||||
background-color:#a0a0a0;
|
||||
color:#202020;
|
||||
}
|
||||
main>article>h2{
|
||||
padding: 0 0 0.5rem 0.25rem;
|
||||
margin: 1.5rem 0 0.5rem 0;
|
||||
padding:0 0 0.5rem 0.25rem;
|
||||
margin:1.5rem 0 0.5rem 0;
|
||||
|
||||
font-size: 1.6rem;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid #c0c0c0;
|
||||
color: #c0c0c0;
|
||||
font-size:1.6rem;
|
||||
font-weight:bold;
|
||||
border-bottom:2px solid #c0c0c0;
|
||||
color:#c0c0c0;
|
||||
}
|
||||
main>article>h3{
|
||||
padding: 0 0 0 0.25rem;
|
||||
margin: 1.5rem 0 0.5rem 0;
|
||||
padding:0 0 0 0.25rem;
|
||||
margin:1.5rem 0 0.5rem 0;
|
||||
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
color: #b0b0b0;
|
||||
font-size:1.5rem;
|
||||
font-weight:bold;
|
||||
text-decoration:underline;
|
||||
color:#b0b0b0;
|
||||
}
|
||||
main>article>h4{
|
||||
padding: 0 0 0 0.25rem;
|
||||
margin: 1.5rem 0 0.5rem 0;
|
||||
padding:0 0 0 0.25rem;
|
||||
margin:1.5rem 0 0.5rem 0;
|
||||
|
||||
font-size: 1.3rem;
|
||||
text-decoration: underline;
|
||||
color: #a0a0a0;
|
||||
font-size:1.3rem;
|
||||
text-decoration:underline;
|
||||
color:#a0a0a0;
|
||||
}
|
||||
main>article>p{
|
||||
padding: 0 0.5rem 0 0.5rem;
|
||||
padding:0 0.5rem 0 0.5rem;
|
||||
}
|
||||
main>article a{
|
||||
color: #db758e;
|
||||
text-decoration: none;
|
||||
color:#db758e;
|
||||
text-decoration:none;
|
||||
}
|
||||
main>article>a:hover{
|
||||
text-decoration: underline;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
main>div.turn-slider-padding{
|
||||
display: block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding: 0.25rem 0.5rem 0 0.5rem;
|
||||
background-color: #101010;
|
||||
display:block;
|
||||
position:relative;
|
||||
width:100%;
|
||||
padding:0.25rem 0.5rem 0 0.5rem;
|
||||
background-color:#101010;
|
||||
}
|
||||
#turn-slider{
|
||||
display: block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 1rem;
|
||||
accent-color: #702e2e;
|
||||
input#turn-slider{
|
||||
display:block;
|
||||
position:relative;
|
||||
width:100%;
|
||||
height:1rem;
|
||||
accent-color:#702e2e;
|
||||
}
|
||||
|
||||
button#button-retire.warn {
|
||||
background-color:#471414;
|
||||
color:#e0e0e0;
|
||||
}
|
||||
|
@ -749,6 +749,7 @@ const INTERFACE = {
|
||||
board_state: [ ],
|
||||
play: null,
|
||||
retire:false,
|
||||
retire_warn:false,
|
||||
|
||||
auto_mode: null,
|
||||
|
||||
@ -910,10 +911,31 @@ const INTERFACE = {
|
||||
|
||||
retire() {
|
||||
if(INTERFACE_DATA.mode == INTERFACE.Mode.Online) {
|
||||
MESSAGE_COMPOSE([
|
||||
PACK.u16(OpCode.SessionRetire),
|
||||
INTERFACE_DATA.token,
|
||||
]);
|
||||
let button_retire = document.getElementById("button-retire");
|
||||
|
||||
if(INTERFACE_DATA.retire_warn) {
|
||||
INTERFACE.retire_reset();
|
||||
MESSAGE_COMPOSE([
|
||||
PACK.u16(OpCode.SessionRetire),
|
||||
INTERFACE_DATA.token,
|
||||
]);
|
||||
} else {
|
||||
INTERFACE_DATA.retire_warn = true;
|
||||
button_retire.innerText = "Confirm?";
|
||||
button_retire.setAttribute("class", "warn");
|
||||
setTimeout(INTERFACE.retire_reset, 5_000);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
retire_reset() {
|
||||
if(INTERFACE_DATA.retire_warn) {
|
||||
INTERFACE_DATA.retire_warn = false;
|
||||
|
||||
// Reset retire button
|
||||
let button_retire = document.getElementById("button-retire");
|
||||
button_retire.innerText = "Surrender";
|
||||
button_retire.removeAttribute("class");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -503,7 +503,11 @@ const SCENES = {
|
||||
if(data === null) { return false; }
|
||||
|
||||
let buttons_bottom = [ ];
|
||||
if(data.mode != 2) { buttons_bottom.push(UI.button("Retire", () => { INTERFACE.retire(); })); }
|
||||
if(data.mode != 2) {
|
||||
let button_retire = UI.button("Surrender", () => { INTERFACE.retire(); });
|
||||
button_retire.setAttribute("id", "button-retire");
|
||||
buttons_bottom.push(button_retire);
|
||||
}
|
||||
buttons_bottom.push(UI.button("Back", () => { LOAD(SCENES.Browse) }));
|
||||
|
||||
UI.nav([
|
||||
|
Loading…
x
Reference in New Issue
Block a user