forked from marva/sumorobot-web
add css comments
This commit is contained in:
parent
5cc6efa684
commit
f1ee5bdec2
11
index.html
11
index.html
@ -15,10 +15,10 @@
|
|||||||
<script src="sumorobot.js"></script>
|
<script src="sumorobot.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="bar">Disconnected<span id="battery"></span></div>
|
<div id="battery">Disconnected</div>
|
||||||
|
|
||||||
<div id="panel">
|
<div id="panel">
|
||||||
<object type="image/svg+xml" data="logo.svg">
|
<object class="logo" type="image/svg+xml" data="logo.svg">
|
||||||
RoboKoding logo
|
RoboKoding logo
|
||||||
</object>
|
</object>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -46,16 +46,15 @@
|
|||||||
<label class="btn btn-primary active" id="remote-disabled">
|
<label class="btn btn-primary active" id="remote-disabled">
|
||||||
<input type="radio" name="remote" autocomplete="off" checked> Disabled
|
<input type="radio" name="remote" autocomplete="off" checked> Disabled
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-primary" id="remote-enabled">
|
<label class="btn btn-primary" id="remote-enabled">
|
||||||
<input type="radio" name="remote" autocomplete="off"> Enabled
|
<input type="radio" name="remote" autocomplete="off"> Enabled
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
Remote control
|
Remote control
|
||||||
<!--<input type="checkbox" class="form-check-input big-checkbox" id="remote-control">-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table>
|
<table class="blockly-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td id="blocklyArea"></td>
|
<td id="blocklyArea"></td>
|
||||||
<td id="blocklyCodeArea">
|
<td id="blocklyCodeArea">
|
||||||
|
96
styles.css
96
styles.css
@ -6,96 +6,101 @@ body {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
h1 {
|
/* logo object */
|
||||||
font-size: 140%;
|
object.logo {
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
object {
|
|
||||||
width: 45%;
|
width: 45%;
|
||||||
}
|
}
|
||||||
table {
|
/* the whole interface is in the table */
|
||||||
|
table.blockly-table {
|
||||||
height: 95%;
|
height: 95%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
/* non clickable input forms */
|
||||||
|
.non-clickable {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
/* spans */
|
||||||
span.has-error {
|
span.has-error {
|
||||||
color: #a94442 !important;
|
color: #a94442 !important;
|
||||||
border-color: #a94442 !important;
|
border-color: #a94442 !important;
|
||||||
background-color: #f2dede !important;
|
background-color: #f2dede !important;
|
||||||
}
|
}
|
||||||
input.has-error {
|
span.addon-no-border {
|
||||||
border-color: #a94442 !important;
|
|
||||||
}
|
|
||||||
.non-clickable {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.form-control {
|
|
||||||
padding: 0.5vw 1vw !important;
|
|
||||||
}
|
|
||||||
.addon-no-border {
|
|
||||||
border-left: 0px !important;
|
border-left: 0px !important;
|
||||||
border-right: 0px !important;
|
border-right: 0px !important;
|
||||||
}
|
}
|
||||||
.input-group-addon {
|
span.input-group-addon {
|
||||||
padding: 0.5vw 1vw !important;
|
padding: 0.5vw 1vw !important;
|
||||||
}
|
}
|
||||||
div.remote-label {
|
/* form items */
|
||||||
font-size: 4vw;
|
label.btn-primary {
|
||||||
margin-top: 1vw;
|
border-width: 3px !important;
|
||||||
font-weight: bold;
|
|
||||||
}
|
}
|
||||||
.btn-group-control {
|
input.form-control {
|
||||||
z-index: 34;
|
padding: 0.5vw 1vw !important;
|
||||||
bottom: 0px;
|
|
||||||
position: fixed !important;
|
|
||||||
}
|
}
|
||||||
.btn-robot-nr, .btn-robot-add {
|
input.has-error {
|
||||||
|
border-color: #a94442 !important;
|
||||||
|
}
|
||||||
|
/* buttons */
|
||||||
|
a.btn-robot-nr, a.btn-robot-add {
|
||||||
font-size: 10vw !important;
|
font-size: 10vw !important;
|
||||||
border: 3px solid rgba(0, 0, 0, 0.1) !important;
|
border: 3px solid rgba(0, 0, 0, 0.1) !important;
|
||||||
}
|
}
|
||||||
.btn-robot-add {
|
a.btn-robot-add {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
.btn-selected {
|
a.btn-selected {
|
||||||
border-color: #fc3 !important;
|
border-color: #fc3 !important;
|
||||||
}
|
}
|
||||||
.btn-success {
|
a.btn-success {
|
||||||
border-width: 3px !important;
|
border-width: 3px !important;
|
||||||
background-color: #44CC00 !important;
|
background-color: #44CC00 !important;
|
||||||
}
|
}
|
||||||
.btn-primary {
|
a.btn-danger {
|
||||||
border-width: 3px !important;
|
|
||||||
}
|
|
||||||
.btn-danger {
|
|
||||||
border-width: 3px !important;
|
border-width: 3px !important;
|
||||||
background-color: #b80000 !important;
|
background-color: #b80000 !important;
|
||||||
}
|
}
|
||||||
.btn-danger.disabled {
|
a.btn-danger.disabled {
|
||||||
background-color: #ee4d4d !important;
|
background-color: #ee4d4d !important;
|
||||||
}
|
}
|
||||||
.btn:hover, .btn.hover {
|
.btn:hover, .btn.hover {
|
||||||
border-width: 3px;
|
border-width: 3px;
|
||||||
border-color: #fc3 !important;
|
border-color: #fc3 !important;
|
||||||
}
|
}
|
||||||
.big-checkbox {
|
/* google blockly modifications */
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
}
|
|
||||||
.form-check-label {
|
|
||||||
font-size: 5vw;
|
|
||||||
}
|
|
||||||
.goog-menuitem-content {
|
.goog-menuitem-content {
|
||||||
font-size: 2em !important;
|
font-size: 2em !important;
|
||||||
}
|
}
|
||||||
div#bar {
|
/* remote control enabler container */
|
||||||
right: 0px;
|
div.form-check-label {
|
||||||
|
font-size: 5vw;
|
||||||
|
}
|
||||||
|
/* remote control enabler label container */
|
||||||
|
div.remote-label {
|
||||||
|
font-size: 4vw;
|
||||||
|
margin-top: 1vw;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
/* start and stop button group */
|
||||||
|
div.btn-group-control {
|
||||||
z-index: 34;
|
z-index: 34;
|
||||||
|
bottom: 0px;
|
||||||
|
position: fixed !important;
|
||||||
|
}
|
||||||
|
/* the battery div */
|
||||||
|
div#battery {
|
||||||
|
z-index: 34;
|
||||||
|
right: 0.5vw;
|
||||||
font-size: 2vw;
|
font-size: 2vw;
|
||||||
color: #ee4d4d;
|
color: #ee4d4d;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
div#bar.connected {
|
/* the battery div connected status */
|
||||||
|
div#battery.connected {
|
||||||
color: #44CC00;
|
color: #44CC00;
|
||||||
}
|
}
|
||||||
|
/* the control panel */
|
||||||
div#panel {
|
div#panel {
|
||||||
z-index: 35;
|
z-index: 35;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -104,11 +109,13 @@ div#panel {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: rgba(255, 255, 255, 0.9);
|
background-color: rgba(255, 255, 255, 0.9);
|
||||||
}
|
}
|
||||||
|
/* the live stream div */
|
||||||
div#stream {
|
div#stream {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
/* for mobile and tablet screen */
|
||||||
@media screen and (max-width: 1000px) {
|
@media screen and (max-width: 1000px) {
|
||||||
td#blocklyArea {
|
td#blocklyArea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -121,6 +128,7 @@ div#stream {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* for desktop screen */
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
td#blocklyArea {
|
td#blocklyArea {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
|
10
sumorobot.js
10
sumorobot.js
@ -2,7 +2,7 @@
|
|||||||
var hotkeys = true;
|
var hotkeys = true;
|
||||||
/* enable disable remote control */
|
/* enable disable remote control */
|
||||||
var remoteControl = false;
|
var remoteControl = false;
|
||||||
/* the server URL */
|
/* the local/remote server URL */
|
||||||
//var robotServer = "10.42.0.1";
|
//var robotServer = "10.42.0.1";
|
||||||
var robotServer = "iot.koodur.com";
|
var robotServer = "iot.koodur.com";
|
||||||
|
|
||||||
@ -59,10 +59,8 @@ Sumorobot.prototype.connect = function() {
|
|||||||
var data = evt.data.replace(/'/g, '"').toLowerCase();
|
var data = evt.data.replace(/'/g, '"').toLowerCase();
|
||||||
console.log(data);
|
console.log(data);
|
||||||
var battery = JSON.parse(data)["battery_voltage"];
|
var battery = JSON.parse(data)["battery_voltage"];
|
||||||
battery = Math.round((((battery - 3.0) * 100) / (4.2 - 3.0)));
|
$("#battery").html(battery + "V");
|
||||||
$("#battery").html(battery + "%");
|
$("#battery").addClass("connected");
|
||||||
//$("#bar").html("Battery");
|
|
||||||
$("#bar").addClass("connected");
|
|
||||||
};
|
};
|
||||||
/* when there is an WebSocket error */
|
/* when there is an WebSocket error */
|
||||||
this.websocket.onerror = function(err) {
|
this.websocket.onerror = function(err) {
|
||||||
@ -411,10 +409,8 @@ window.onload = function() {
|
|||||||
$(".btn-start").click(function() {
|
$(".btn-start").click(function() {
|
||||||
sumostart = true;
|
sumostart = true;
|
||||||
if (pythonEnabled) {
|
if (pythonEnabled) {
|
||||||
console.log($("#blocklyCode").val().replace(/sumorobot./g, ""));
|
|
||||||
sumorobot.send("start:" + $("#blocklyCode").val().replace(/sumorobot./g, ""));
|
sumorobot.send("start:" + $("#blocklyCode").val().replace(/sumorobot./g, ""));
|
||||||
} else {
|
} else {
|
||||||
console.log(sumocode.replace(/sumorobot./g, ""));
|
|
||||||
sumorobot.send("start:" + sumocode.replace(/sumorobot./g, ""));
|
sumorobot.send("start:" + sumocode.replace(/sumorobot./g, ""));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user