- add countdown to function
- small cleanup
This commit is contained in:
parent
7dbe7ed6b1
commit
104c52b575
2
index.js
2
index.js
@ -319,7 +319,7 @@ app.use(function(req, res, next) {
|
|||||||
|
|
||||||
|
|
||||||
console.log("Starting server...");
|
console.log("Starting server...");
|
||||||
const port = 3006
|
const port = 3005
|
||||||
const server = app.listen(port);
|
const server = app.listen(port);
|
||||||
server.on('upgrade', (request, socket, head) => {
|
server.on('upgrade', (request, socket, head) => {
|
||||||
wsServer.handleUpgrade(request, socket, head, socket => {
|
wsServer.handleUpgrade(request, socket, head, socket => {
|
||||||
|
11
package-lock.json
generated
11
package-lock.json
generated
@ -15,6 +15,7 @@
|
|||||||
"bootstrap-icons": "^1.8.1",
|
"bootstrap-icons": "^1.8.1",
|
||||||
"darkreader": "^4.9.44",
|
"darkreader": "^4.9.44",
|
||||||
"express": "^4.17.3",
|
"express": "^4.17.3",
|
||||||
|
"flatpickr": "^4.6.11",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"less": "^3.13",
|
"less": "^3.13",
|
||||||
@ -270,6 +271,11 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/flatpickr": {
|
||||||
|
"version": "4.6.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.6.11.tgz",
|
||||||
|
"integrity": "sha512-/rnbE/hu5I5zndLEyYfYvqE4vPDvI5At0lFcQA5eOPfjquZLcQ0HMKTL7rv5/+DvbPM3/vJcXpXjB/DjBh+1jw=="
|
||||||
|
},
|
||||||
"node_modules/forwarded": {
|
"node_modules/forwarded": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
@ -917,6 +923,11 @@
|
|||||||
"unpipe": "~1.0.0"
|
"unpipe": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flatpickr": {
|
||||||
|
"version": "4.6.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.6.11.tgz",
|
||||||
|
"integrity": "sha512-/rnbE/hu5I5zndLEyYfYvqE4vPDvI5At0lFcQA5eOPfjquZLcQ0HMKTL7rv5/+DvbPM3/vJcXpXjB/DjBh+1jw=="
|
||||||
|
},
|
||||||
"forwarded": {
|
"forwarded": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
"bootstrap-icons": "^1.8.1",
|
"bootstrap-icons": "^1.8.1",
|
||||||
"darkreader": "^4.9.44",
|
"darkreader": "^4.9.44",
|
||||||
"express": "^4.17.3",
|
"express": "^4.17.3",
|
||||||
|
"flatpickr": "^4.6.11",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"less": "^3.13",
|
"less": "^3.13",
|
||||||
|
1
static/flatpickr/dist
Symbolic link
1
static/flatpickr/dist
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../node_modules/flatpickr/dist/
|
@ -462,6 +462,31 @@ $(function () {
|
|||||||
$("#" + event.target.href.split("#")[1]).removeClass("hidden")
|
$("#" + event.target.href.split("#")[1]).removeClass("hidden")
|
||||||
// console.log(event.target.href.split("#")[1])
|
// console.log(event.target.href.split("#")[1])
|
||||||
});
|
});
|
||||||
|
$("#customValue").durationPicker({
|
||||||
|
showSeconds: true,
|
||||||
|
showDays: false,
|
||||||
|
onChanged: function (newVal, test, val2) {
|
||||||
|
currentTime = newVal * 1000
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
flatty = flatpickr("#datetimetester", {
|
||||||
|
enableTime: true,
|
||||||
|
time_24hr: true,
|
||||||
|
dateFormat: "H:i d.m.Y",
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".goTimeGoalCountdown").on("click", function handleCountdownToTime(){
|
||||||
|
const selectTime = flatty.selectedDates[0].getTime()
|
||||||
|
const timeDiff = selectTime - new Date().getTime()
|
||||||
|
$(".goTimeGoalCountdown")[0].innerHTML = '<div class="spinner-border-sm spinner-border"></div>'
|
||||||
|
saveOption("/api/v1/set/addMillisToTimer?time=" + timeDiff, function (ev) {
|
||||||
|
setTimeout(function () {
|
||||||
|
$(".goTimeGoalCountdown")[0].innerHTML = '<i class="bi bi-check2-circle"></i>'
|
||||||
|
}, 200);
|
||||||
|
})
|
||||||
|
console.log( timeDiff)
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
function saveOption(path, callback) {
|
function saveOption(path, callback) {
|
||||||
|
@ -23,9 +23,12 @@
|
|||||||
<link href="/css/mainStyle.css" rel="stylesheet">
|
<link href="/css/mainStyle.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="/coloris/coloris.min.css" />
|
<link rel="stylesheet" href="/coloris/coloris.min.css" />
|
||||||
<link rel="stylesheet" href="/bootstrap-duration-picker/bootstrap-duration-picker.css" />
|
<link rel="stylesheet" href="/bootstrap-duration-picker/bootstrap-duration-picker.css" />
|
||||||
|
<link rel="stylesheet" href="/flatpickr/dist/flatpickr.min.css" />
|
||||||
<script src="/bootstrap-duration-picker/bootstrap-duration-picker-debug.js"></script>
|
<script src="/bootstrap-duration-picker/bootstrap-duration-picker-debug.js"></script>
|
||||||
<script src="/coloris/coloris.min.js"></script>
|
<script src="/coloris/coloris.min.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/flatpickr/dist/flatpickr.js"> </script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/css/bootstrap-icons.css">
|
<link rel="stylesheet" href="/css/bootstrap-icons.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -202,8 +205,6 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<presets class="d-inline-flex justify-content-center">
|
<presets class="d-inline-flex justify-content-center">
|
||||||
<button class="btn btn-outline-secondary m-1 pres" value="300000">00:05:00</button>
|
<button class="btn btn-outline-secondary m-1 pres" value="300000">00:05:00</button>
|
||||||
@ -216,24 +217,30 @@
|
|||||||
<button class="btn btn-outline-secondary m-1 pres" value="2400000">00:40:00</button>
|
<button class="btn btn-outline-secondary m-1 pres" value="2400000">00:40:00</button>
|
||||||
<button class="btn btn-outline-secondary m-1 pres" value="2700000">00:45:00</button>
|
<button class="btn btn-outline-secondary m-1 pres" value="2700000">00:45:00</button>
|
||||||
</presets>
|
</presets>
|
||||||
|
|
||||||
<div class="row" style="width: 100%;">
|
<div class="row" style="width: 100%;">
|
||||||
|
|
||||||
|
|
||||||
<div class="d-inline-flex justify-content-center p-2 col">
|
<div class="d-inline-flex justify-content-center p-2 col">
|
||||||
<input type="text" class="form-control m-1" id="customValue">
|
<input type="text" class="form-control m-1" id="customValue">
|
||||||
|
|
||||||
<button class="btn btn-outline-primary m-1 mt-0 goTimer"><i
|
<button class="btn btn-outline-primary m-1 mt-0 goTimer"><i
|
||||||
class="bi bi-check2-circle"></i></button>
|
class="bi bi-check2-circle"></i></button>
|
||||||
<script>
|
|
||||||
$("#customValue").durationPicker({
|
|
||||||
showSeconds: true,
|
|
||||||
showDays: false,
|
|
||||||
onChanged: function (val, t1, t2) {
|
|
||||||
currentTime = val * 1000
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<h5>
|
||||||
|
Countdown to time
|
||||||
|
</h5>
|
||||||
|
<div class="row justify-content-center flex-nowrap d-flex" >
|
||||||
|
<input id="datetimetester" class="form-control input-sm" style="width: 20%;">
|
||||||
|
<button class="btn btn-outline-primary goTimeGoalCountdown ms-2" style="width: 5%;"><i
|
||||||
|
class="bi bi-check2-circle"></i></button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</page>
|
</page>
|
||||||
@ -326,12 +333,6 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
|
||||||
data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent"
|
|
||||||
aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<i class="bi bi-list"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<h3>Host information</h3>
|
<h3>Host information</h3>
|
||||||
<code id="systemInfo" class="overflow-auto">
|
<code id="systemInfo" class="overflow-auto">
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user