-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (54 loc) · 2.89 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Raspicode home</title>
<script>
// Send picode to transmit
function send(){
// Clear result iframe before picode transmit
doc = document.getElementById('resultsIframe').contentWindow.document;
doc.body.innerHTML = "<pre>Transmitting...</pre>";
// Re-size result iframe
iframe = document.getElementById('resultsIframe');
iframe.style.height = 32 + 'px'; // Fix Firefox extra height
iframe.style.height = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
// Disable picode textarea
document.getElementById("picodeTextarea").readOnly=true;
document.getElementById("picodeTextarea").style.setProperty("color", "grey");
// Disable send button
document.getElementById("sendButton").disabled=true;
// Form submit
document.getElementById("formPicode").submit();
}
// On result iframe load
function iframeOnLoad(obj){
// Re-enable picode textarea
document.getElementById("picodeTextarea").readOnly=false;
document.getElementById("picodeTextarea").style.removeProperty("color");
// Re-enable send button
document.getElementById("sendButton").disabled=false;
// Re-size result iframe
obj.style.height = 32 + 'px'; // Fix Firefox extra height
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
</script>
</head>
<body>
<pre>
Raspicode
Simple RESTful API for Raspberry Pi using Flask Web Server
to transmit picode string format RF 315/433 Mhz OOK codes
See: <a href="https://github.com/latchdevel/raspicode" target="_blank">https://github.com/latchdevel/raspicode</a>
<button onClick="javascript:window.open('/status', 'results');" style="font-family:monospace;">Show status</button> <button onClick="javascript:window.open('/config', 'results');" style="font-family:monospace;">Show config</button> <button onClick="javascript:window.open('/logs', '_blank');" style="font-family:monospace;">Show logs</button>
<form action="/" method="post" target="results" id="formPicode">
Picode to transmit:
<textarea name="picode" id="picodeTextarea" rows="5" style="width:95%; font-family:monospace;" placeholder="Paste a picode here!"></textarea>
<button id="sendButton" onclick="send()" style="font-family:monospace;">Transmit</button>
</form>
<iframe name="results" id="resultsIframe" frameborder="0" width="95%" height="100" scrolling="auto" src="about:blank" onload="iframeOnLoad(this)"></iframe>
</pre>
</body>
</html>