console-hub/index.html
2019-06-22 21:12:51 +02:00

133 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="cs" dir="ltr">
<head>
<meta charset="utf-8">
<title>Console hub</title>
</head>
<body onload="onLoad();">
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
<iframe disablewebsecurity id="frame" style="display: none; " src="" width="100%" height="100%" frameborder="0"></iframe>
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="jquery.min.js"></script>
<script>if (window.module) module = window.module;</script>
<script>
var wifi, wifiQuality;
var loaded = false;
function onLoad(){
$.ajax("https://console.danbulant.eu")
.done((function (){
loaded = true;
$(".lds-ellipsis").hide();
$('#frame').attr('src', 'https://console.danbulant.eu')
$('#frame').show();
}))
.fail((function (){
$('#frame').attr('src', 'html/index.html');
$('.lds-ellipsis').hide();
$('#frame').show();
}))
}
function showOnline(){
if(!loaded){
if(navigator.online){
$('#frame').attr('src', 'https://console.danbulant.eu');
}
}
}
window.addEventListener('online', showOnline);
// In renderer process (web page).
const { ipcRenderer } = require('electron')
ipcRenderer.on('wifi', (event, arg) => {
wifi = arg;
document.getElementById('frame').contentWindow.wifi = wifi;
})
ipcRenderer.on('wifiQuality', (event, arg) => {
wifiQuality = arg;
document.getElementById("frame").contentWindow.wifiQuality = wifiQuality;
})
ipcRenderer.on('fullscreen', (event, arg) => {
console.log("Fullscreen now " + arg);
document.getElementById("frame").contentWindow.settingMenuItemValues[0] = arg;
})
function sendFullscreen(bool){
console.log("Sending fullscreen " + bool);
ipcRenderer.send('fullscreen', bool);
}
ipcRenderer.send('get-data', 'wifi');
ipcRenderer.send('get-data', 'wifiQuality');
</script>
<style>
html, body, iframe, webview{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background-color: white;
overflow: hidden;
}
.lds-ellipsis {
margin: auto;
display: block;
position: fixed;
top: 47%;
left: 47%;
width: 64px;
height: 64px;
}
.lds-ellipsis div {
position: absolute;
top: 27px;
width: 11px;
height: 11px;
border-radius: 50%;
background: #c4c4c4;
animation-timing-function: cubic-bezier(0, 1, 1, 0);
}
.lds-ellipsis div:nth-child(1) {
left: 6px;
animation: lds-ellipsis1 0.6s infinite;
}
.lds-ellipsis div:nth-child(2) {
left: 6px;
animation: lds-ellipsis2 0.6s infinite;
}
.lds-ellipsis div:nth-child(3) {
left: 26px;
animation: lds-ellipsis2 0.6s infinite;
}
.lds-ellipsis div:nth-child(4) {
left: 45px;
animation: lds-ellipsis3 0.6s infinite;
}
@keyframes lds-ellipsis1 {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}
@keyframes lds-ellipsis3 {
0% {
transform: scale(1);
}
100% {
transform: scale(0);
}
}
@keyframes lds-ellipsis2 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(19px, 0);
}
}
</style>
</body>
</html>