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