-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
160 lines (145 loc) · 6.02 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#000000"/>
<title>DOT. The LEDCube</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="manifest" href="/manifest.json">
<style type="text/css">
.custom-file-label{
color: #282828;
}
</style>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
<div class="container">
<a class="navbar-brand" href="#">DOT. The LEDCube</a>
<!--<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">-->
<!--<span class="navbar-toggler-icon"></span>-->
<!--</button>-->
<!--<div class="collapse navbar-collapse" id="navbarResponsive">-->
<!--<ul class="navbar-nav ml-auto">-->
<!--<li class="nav-item active">-->
<!--<a class="nav-link" href="#upload-image">Upload Image</a>-->
<!--</li>-->
<!--<li class="nav-item">-->
<!--<a class="nav-link" href="#apps">Apps</a>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
</div>
</nav>
<!--Image Upload-->
<div class="container" id="upload-image2">
<div class="row">
<div class="col-lg-12">
<form id="pictureForm" action="util.php?do=uploadPicture" method="post" enctype="multipart/form-data">
<h3 class="mt-3 text-center">Image Upload</h3>
<p class="text-left">Image needs to be 384*64px <a data-toggle="collapse" href="#collapseExample"
role="button" aria-expanded="false"
aria-controls="collapseExample">more info...</a></p>
<div class="collapse" id="collapseExample">
<div class="card card-body mb-2 text-left">
The 384px width represent all six cube sides together in one "line". The order of the six sides is:
Top, Left, Front, Right, Back, Bottom.<br>
You can also create an Image with an height multiplied by 64px. The multiple "lines" of Images will
be displayed in a loop, which can be controlled
by pressing "A" on the joystick or setting an animation speed
</div>
</div>
<div class="input-group mb-2">
<div class="custom-file">
<input type="file" class="custom-file-input" id="imageFile" name="image">
<label class="custom-file-label text-left" for="imageFile">Choose file</label>
</div>
</div>
<select class="custom-select mb-2" name="prescaler">
<option selected value="1">40 Fps</option>
<option value="2">20 Fps</option>
<option value="3">13 Fps</option>
<option value="4">10 Fps</option>
<option value="10">4 Fps</option>
<option value="20">2 Fps</option>
<option value="40">1 Fps</option>
<option value="0">Static</option>
</select>
<input type="submit" class="btn btn-primary btn-block mb-2" value="Upload & Display">
</form>
</div>
</div>
</div>
<!-- Apps -->
<div class="container" id="apps">
<div class="row">
<div class="col-lg-12 text-center">
<h3 class="mt-3">Installed Apps</h3>
<div id="appscontainer">
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript -->
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script lang="js">
let appFiles;
// let utilURL = "http://10.0.0.5/util.php";
// let utilURL = "https://cube11.local/util.php";
let utilURL = "/util.php";
$.get(utilURL + "/?do=listAppDir", function (data) {
appFiles = data;
$.each(appFiles["files"], function (index, value) {
$("#appscontainer").append("<button type=\"button\" class=\"btn btn-outline-primary btn-lg btn-block\">" + value["file"] + "</button>");
});
$("#appscontainer button").click(function () {
$.get(utilURL + "/?do=run&app=" + this.innerHTML, function (data) {
});
});
});
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
$("#pictureForm").on('submit', (function (e) {
e.preventDefault();
$.ajax({
url: "util.php?do=uploadPicture",
type: "POST",
data: new FormData(document.getElementById('pictureForm')),
contentType: false,
cache: false,
processData: false,
beforeSend: function () {
//$("#preview").fadeOut();
// $("#err").fadeOut();
},
success: function (data) {
if (data === 'invalid') {
console.log("invalid file");
} else {
console.log("upload complete");
}
},
error: function (e) {
console.log("error with submitting");
}
});
}));
$("#imageFile").change(function (e) {
$("label[for='imageFile']").text(this.value.split("\\").pop());
});
</script>
</body>
</html>