adicionado switch pra habilitar ou desativar o autostart

This commit is contained in:
Eder Moraes 2026-01-27 00:32:52 -03:00
parent 636a7a7f62
commit e54015cfba
3 changed files with 74 additions and 4 deletions

View File

@ -201,6 +201,7 @@ function createOperatorWindow() {
});
// operatorWin.webContents.openDevTools();
operatorWin.webContents.executeJavaScript('localStorage.setItem("version","' + app.getVersion() + '")');
operatorWin.loadFile('operator.html');
@ -264,8 +265,6 @@ function createFloatingWindow() {
floatingWin.loadFile('floating.html');
floatingWin.webContents.executeJavaScript('localStorage.setItem("version","' + app.getVersion() + '")');
// Envia a contagem inicial para a janela flutuante
const data = readData();
floatingWin.webContents.on('did-finish-load', () => {

View File

@ -19,6 +19,14 @@
<option value="">Selecione um operador</option>
<!-- Operadores serão carregados aqui -->
</select>
&nbsp;
<p>
Iniciar automaticamente com o sistema
</p>
<label class="switch">
<input type="checkbox" id="active-switch" checked>
<span class="slider round"></span>
</label>
</div>
<button id="select-button" disabled>Continuar</button>
@ -29,11 +37,11 @@
<script>
$(function(){
let opse = localStorage.getItem('selectedOperator');
let vs = localStorage.getItem('version');
setTimeout(()=>{
let vs = localStorage.getItem('version');
$('span.op').text(opse);
$('#version').text(vs);
},2000);
},1000);
});
</script>
</body>

View File

@ -301,3 +301,66 @@ button{
#save-button:hover{
background-color: var(--warning-color);
}
/* Estilo do Switch */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
z-index: 1; /* Garante que o switch esteja acima de outros elementos */
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: var(--success-color);
}
input:focus + .slider {
box-shadow: 0 0 1px var(--success-color);
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
/* width: 60px; */
}
.slider.round:before {
border-radius: 50%;
}