Initial plaything

Signed-off-by: Jyri Eerola <jyri.eerola@jrd.fi>
This commit is contained in:
Jyri Eerola 2019-02-07 22:17:23 +01:00
commit 6bb1c037ac
4 changed files with 468 additions and 0 deletions

119
404.html Normal file
View file

@ -0,0 +1,119 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>The page is not found</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/*<![CDATA[*/
body {
background-color: #fff;
color: #000;
font-size: 0.9em;
font-family: sans-serif,helvetica;
margin: 0;
padding: 0;
}
:link {
color: #c00;
}
:visited {
color: #c00;
}
a:hover {
color: #f50;
}
h1 {
text-align: center;
margin: 0;
padding: 0.6em 2em 0.4em;
background-color: #294172;
color: #fff;
font-weight: normal;
font-size: 1.75em;
border-bottom: 2px solid #000;
}
h1 strong {
font-weight: bold;
font-size: 1.5em;
}
h2 {
text-align: center;
background-color: #3C6EB4;
font-size: 1.1em;
font-weight: bold;
color: #fff;
margin: 0;
padding: 0.5em;
border-bottom: 2px solid #294172;
}
h3 {
text-align: center;
background-color: #ff0000;
padding: 0.5em;
color: #fff;
}
hr {
display: none;
}
.content {
padding: 1em 5em;
}
.alert {
border: 2px solid #000;
}
img {
border: 2px solid #fff;
padding: 2px;
margin: 2px;
}
a:hover img {
border: 2px solid #294172;
}
.logos {
margin: 1em;
text-align: center;
}
/*]]>*/
</style>
</head>
<body>
<h1><strong>nginx error!</strong></h1>
<div class="content">
<h3>The page you are looking for is not found.</h3>
<div class="alert">
<h2>Website Administrator</h2>
<div class="content">
<p>Something has triggered missing webpage on your
website. This is the default 404 error page for
<strong>nginx</strong> that is distributed with
Fedora. It is located
<tt>/usr/share/nginx/html/404.html</tt></p>
<p>You should customize this error page for your own
site or edit the <tt>error_page</tt> directive in
the <strong>nginx</strong> configuration file
<tt>/etc/nginx/nginx.conf</tt>.</p>
</div>
</div>
<div class="logos">
<a href="http://nginx.net/"><img
src="/nginx-logo.png"
alt="[ Powered by nginx ]"
width="121" height="32" /></a>
<a href="http://fedoraproject.org/"><img
src="/poweredby.png"
alt="[ Powered by Fedora ]"
width="88" height="31" /></a>
</div>
</div>
</body>
</html>

119
50x.html Normal file
View file

@ -0,0 +1,119 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>The page is temporarily unavailable</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/*<![CDATA[*/
body {
background-color: #fff;
color: #000;
font-size: 0.9em;
font-family: sans-serif,helvetica;
margin: 0;
padding: 0;
}
:link {
color: #c00;
}
:visited {
color: #c00;
}
a:hover {
color: #f50;
}
h1 {
text-align: center;
margin: 0;
padding: 0.6em 2em 0.4em;
background-color: #294172;
color: #fff;
font-weight: normal;
font-size: 1.75em;
border-bottom: 2px solid #000;
}
h1 strong {
font-weight: bold;
font-size: 1.5em;
}
h2 {
text-align: center;
background-color: #3C6EB4;
font-size: 1.1em;
font-weight: bold;
color: #fff;
margin: 0;
padding: 0.5em;
border-bottom: 2px solid #294172;
}
h3 {
text-align: center;
background-color: #ff0000;
padding: 0.5em;
color: #fff;
}
hr {
display: none;
}
.content {
padding: 1em 5em;
}
.alert {
border: 2px solid #000;
}
img {
border: 2px solid #fff;
padding: 2px;
margin: 2px;
}
a:hover img {
border: 2px solid #294172;
}
.logos {
margin: 1em;
text-align: center;
}
/*]]>*/
</style>
</head>
<body>
<h1><strong>nginx error!</strong></h1>
<div class="content">
<h3>The page you are looking for is temporarily unavailable. Please try again later.</h3>
<div class="alert">
<h2>Website Administrator</h2>
<div class="content">
<p>Something has triggered an error on your
website. This is the default error page for
<strong>nginx</strong> that is distributed with
Fedora. It is located
<tt>/usr/share/nginx/html/50x.html</tt></p>
<p>You should customize this error page for your own
site or edit the <tt>error_page</tt> directive in
the <strong>nginx</strong> configuration file
<tt>/etc/nginx/nginx.conf</tt>.</p>
</div>
</div>
<div class="logos">
<a href="http://nginx.net/"><img
src="/nginx-logo.png"
alt="[ Powered by nginx ]"
width="121" height="32" /></a>
<a href="http://fedoraproject.org/"><img
src="/poweredby.png"
alt="[ Powered by Fedora ]"
width="88" height="31" /></a>
</div>
</div>
</body>
</html>

229
index.html Normal file
View file

@ -0,0 +1,229 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>FKX Tools</title>
<link rel="stylesheet" href="mini-nord.min.css" />
</head>
<body>
<div class="row">
<h2>IN 1</h2>
<div class="col-2">
<br /><br />
<h3>HF enable</h3>
<button id="2" class="hf-enable primary">On</button>
</div>
<div class="col-2">
<div class="row">
<div class="col-sm">
<div class="card">
<h3>50/70M</h3>
<button id="0" class="disabled-on-hf-enable row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>spare</h3>
<button id="1" class="disabled-on-hf-enable row-button">Off</button>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card">
<h3>HF1</h3>
<button id="3" class="enabled-on-hf-enable row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>HF2</h3>
<button id="4" class="enabled-on-hf-enable row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>HF3</h3>
<button id="5" class="enabled-on-hf-enable row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>HF4</h3>
<button id="6" class="enabled-on-hf-enable row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>HF5</h3>
<button id="7" class="enabled-on-hf-enable row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>HF6</h3>
<button id="8" class="enabled-on-hf-enable row-button">Off</button>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<h2>IN 2</h2>
<div class="col-sm">
<div class="card">
<h3>VUHF1</h3>
<button id="9" class="secondary row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>VUHF2</h3>
<button id="10" class="secondary row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>VUHF3</h3>
<button id="11" class="secondary row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>VUHF4</h3>
<button id="12" class="secondary row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>VUHF5</h3>
<button id="13" class="secondary row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>VUHF6</h3>
<button id="14" class="secondary row-button">Off</button>
</div>
</div>
<div class="col-sm">
<div class="card">
<h3>VUHF Spare</h3>
<button id="15" class="secondary row-button">Off</button>
</div>
</div>
</div>
<footer>
<label for="board-url">Board URL</label>
<input id="board-url" placeholder="Board URL" />
<button id="board-url-save">Save</button>
<br />
<label for="secret">Secret</label>
<input id="secret" placeholder="secret" />
<button id="secret-save">Save</button>
</footer>
<script>
hf_enable_button = document.getElementsByClassName("hf-enable")[0];
enabled_on_hf_enable = document.getElementsByClassName("enabled-on-hf-enable");
disabled_on_hf_enable = document.getElementsByClassName("disabled-on-hf-enable");
row_buttons = document.getElementsByClassName("row-button");
function button_toggle(button) {
// toggle colour and text
if(button.classList.contains("secondary")) {
button.textContent = "On";
button.classList.remove("secondary");
button.classList.add("tertiary");
payload = 1 << parseInt(button.id);
fetch_url = localStorage.getItem("board-url") + "/Set/0/" + payload.toString() + "/" + localStorage.getItem("secret");
fetch(fetch_url)
.then((resp) => {
return resp.text();
})
.then((text) => {
console.log(text);
})
.catch((error) => {
console.log("Set failed:", error);
});
} else {
button.textContent = "Off";
button.classList.add("secondary");
button.classList.remove("tertiary");
}
}
function toggle_hf_enable(e) {
// hf is enabled if the button is green
hf_enabled = this.classList.contains("tertiary");
// toggle hf enable button text and color
button_toggle(hf_enable_button);
for(b of enabled_on_hf_enable) {
b.disabled = hf_enabled;
}
for(b of disabled_on_hf_enable) {
b.disabled = !hf_enabled;
}
}
function toggle_in_row(event) {
button = event.target;
previously_on = button.closest(".row").querySelector(".tertiary");
if(previously_on != null) {
button_toggle(previously_on);
}
button_toggle(button);
}
function getRemoteState() {
fetch_url = localStorage.getItem("board-url") + "/GetAll/" + localStorage.getItem("secret");
fetch(fetch_url)
.then((resp) => {
return resp.text();
})
.then((text) => {
res_array = text.match(/\d(\d*)/g);
// console.log(res_array);
activated = Math.log2(parseInt(res_array[0]));
respective_button = document.getElementById(activated.toString());
button_toggle(respective_button);
})
.catch((error) => {
console.log("GetAll failed:", error);
});
}
// add event listeners
hf_enable_button.addEventListener("click", toggle_hf_enable, false);
for(b of row_buttons) {
b.addEventListener("click", toggle_in_row, false);
}
// add listener to save secret token to local storage
password_input = document.getElementById("secret");
password_input.value = localStorage.getItem("secret");
password_save_button = document.getElementById("secret-save");
password_save_button.addEventListener("click", (e) => {
localStorage.setItem("secret", password_input.value);
});
// add listener for board url saving feature
board_url_input = document.getElementById("board-url");
board_url_input.value = localStorage.getItem("board-url");
board_url_save_button = document.getElementById("board-url-save");
board_url_save_button.addEventListener("click", (e) => {
localStorage.setItem("board-url", board_url_input.value);
});
// keep updating state from remote
// var interval_updater = setInterval(getRemoteState, 1000);
</script>
</body>
</html>

1
mini-nord.min.css vendored Normal file

File diff suppressed because one or more lines are too long