mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 13:50:35 +02:00
fix button click events when stopped
This commit is contained in:
parent
32a4e27d2a
commit
bdce4a71b6
3 changed files with 23 additions and 10 deletions
|
@ -203,6 +203,7 @@ header {
|
||||||
margin-left: @title-margin-left;
|
margin-left: @title-margin-left;
|
||||||
|
|
||||||
#go-server-button {
|
#go-server-button {
|
||||||
|
text-align: center;
|
||||||
float: left;
|
float: left;
|
||||||
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.5);
|
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.5);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -225,7 +226,7 @@ header {
|
||||||
#server-stopped-text {
|
#server-stopped-text {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 20px 0px 0px 20px;
|
margin: 20px 0px 0px 20px;
|
||||||
color: red;
|
color: #D42043;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,6 +277,7 @@ header {
|
||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,9 @@
|
||||||
to build, explore, and share. We’ve started you off with a<br>
|
to build, explore, and share. We’ve started you off with a<br>
|
||||||
home full of goodies to help you learn the ropes. Enjoy!
|
home full of goodies to help you learn the ropes. Enjoy!
|
||||||
</p>
|
</p>
|
||||||
<button id="go-server-button">
|
<a id="go-server-button" href="#">
|
||||||
<img src="images/go-hmd.svg" />
|
<img src="images/go-hmd.svg" />
|
||||||
</button>
|
</a>
|
||||||
<div id="server-stopped-text">
|
<div id="server-stopped-text">
|
||||||
<span>Server stopped<br>Click "Restart"</span>
|
<span>Server stopped<br>Click "Restart"</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,11 +4,14 @@ $(function() {
|
||||||
|
|
||||||
var settingsButton = $('#manage-server #settings');
|
var settingsButton = $('#manage-server #settings');
|
||||||
|
|
||||||
|
const DISABLED_HREF_ATTR = 'data-disabled-href';
|
||||||
function toggleManageButton(button, enabled) {
|
function toggleManageButton(button, enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
button.attr('href', '#');
|
button.attr('href', button.attr(DISABLED_HREF_ATTR));
|
||||||
|
button.removeAttr(DISABLED_HREF_ATTR);
|
||||||
button.removeClass('disabled');
|
button.removeClass('disabled');
|
||||||
} else {
|
} else {
|
||||||
|
button.attr(DISABLED_HREF_ATTR, button.attr('href'));
|
||||||
button.removeAttr('href');
|
button.removeAttr('href');
|
||||||
button.addClass('disabled');
|
button.addClass('disabled');
|
||||||
}
|
}
|
||||||
|
@ -65,7 +68,7 @@ $(function() {
|
||||||
toggleManageButton(stopButton, false);
|
toggleManageButton(stopButton, false);
|
||||||
|
|
||||||
// disable the go button
|
// disable the go button
|
||||||
goButton.addClass('disabled');
|
toggleManageButton(goButton, false);
|
||||||
|
|
||||||
// show the server stopped text
|
// show the server stopped text
|
||||||
serverStopped.show();
|
serverStopped.show();
|
||||||
|
@ -76,7 +79,7 @@ $(function() {
|
||||||
toggleManageButton(stopButton, true);
|
toggleManageButton(stopButton, true);
|
||||||
|
|
||||||
// enable the go button
|
// enable the go button
|
||||||
goButton.removeClass('disabled');
|
toggleManageButton(goButton, true);
|
||||||
|
|
||||||
// hide the server stopped text
|
// hide the server stopped text
|
||||||
serverStopped.hide();
|
serverStopped.hide();
|
||||||
|
@ -89,15 +92,23 @@ $(function() {
|
||||||
ipcRenderer.send('start-interface');
|
ipcRenderer.send('start-interface');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#go-server-button:not(.disabled)').click(function(){
|
$('#go-server-button').click(function(e){
|
||||||
ipcRenderer.send('start-interface', { url: 'hifi://localhost' });
|
if ($(this).hasClass('disabled')) {
|
||||||
|
e.preventDefault();
|
||||||
|
} else {
|
||||||
|
ipcRenderer.send('start-interface', { url: 'hifi://localhost' });
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#manage-server #restart').click(function() {
|
$('#manage-server #restart').click(function() {
|
||||||
ipcRenderer.send('restart-server', { name: 'home' });
|
ipcRenderer.send('restart-server', { name: 'home' });
|
||||||
});
|
});
|
||||||
$('#manage-server #stop').click(function() {
|
$('#manage-server #stop').click(function(e) {
|
||||||
ipcRenderer.send('stop-server', { name: 'home' });
|
if ($(this).hasClass('disabled')) {
|
||||||
|
e.preventDefault();
|
||||||
|
} else {
|
||||||
|
ipcRenderer.send('stop-server', { name: 'home' });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('#open-logs').click(function() {
|
$('#open-logs').click(function() {
|
||||||
ipcRenderer.send('open-logs');
|
ipcRenderer.send('open-logs');
|
||||||
|
|
Loading…
Reference in a new issue