Repeated table contents now generated by javascript function.
This commit is contained in:
parent
e2990c346e
commit
fd1866bb9a
3 changed files with 97 additions and 66 deletions
|
@ -48,6 +48,37 @@ td { text-align: center; }
|
|||
<html>
|
||||
<script src="jquery.js" type="text/javascript"></script>
|
||||
<script src="knockout.js" type="text/javascript"></script>
|
||||
<script>
|
||||
function jogRowHTML(axis)
|
||||
{
|
||||
var result = "";
|
||||
|
||||
for(var i = -1; i < 3; i++)
|
||||
{
|
||||
var k = Math.pow(10.0, i);
|
||||
var pos = '<td><button data-bind="click: function(data, event) { sendJog(';
|
||||
pos += "'" + axis + "', ";
|
||||
var neg = pos;
|
||||
pos += '' + k;
|
||||
neg += '' + (-k);
|
||||
pos += ', data, event) }">' + axis + ' ';
|
||||
neg += ', data, event) }"><';
|
||||
for(var j = -1; j < i; j++)
|
||||
{
|
||||
pos += '-';
|
||||
neg += '-';
|
||||
}
|
||||
pos += '>';
|
||||
neg += ' ' + axis;
|
||||
pos += '</button></td>';
|
||||
neg += '</button></td>';
|
||||
result += pos;
|
||||
neg += result;
|
||||
result = neg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<a href="http://reprappro.com" target="_blank"><img src="logo.png" alt="RepRapPro logo" align="right"></a>
|
||||
|
@ -96,42 +127,27 @@ td { text-align: center; }
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('X', data, event) }">Home X</button></td>
|
||||
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -100, data, event) }"><--- X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -10, data, event) }"><-- X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -1, data, event) }"><- X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -0.1, data, event) }">< X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 0.1, data, event) }">X ></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 1, data, event) }">X --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 10, data, event) }">X --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 100, data, event) }">X ---></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('X', data, event) }">Home X
|
||||
</button></td>
|
||||
<script>
|
||||
document.write(jogRowHTML('X'));
|
||||
</script>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Y', data, event) }">Home Y</button></td>
|
||||
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', -100, data, event) }"><--- Y</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', -10, data, event) }"><-- Y</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', -1, data, event) }"><- Y</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', -0.1, data, event) }">< Y</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', 0.1, data, event) }">Y ></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', 1, data, event) }">Y --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', 10, data, event) }">Y --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Y', 100, data, event) }">Y ---></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Y', data, event) }">Home Y
|
||||
</button></td>
|
||||
<script>
|
||||
document.write(jogRowHTML('Y'));
|
||||
</script>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Z', data, event) }">Home Z</button></td>
|
||||
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', -100, data, event) }"><--- Z</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', -10, data, event) }"><-- Z</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', -1, data, event) }"><- Z</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', -0.1, data, event) }">< Z</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', 0.1, data, event) }">Z ></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', 1, data, event) }">Z --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', 10, data, event) }">Z --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('Z', 100, data, event) }">Z ---></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Z', data, event) }">Home Z
|
||||
</button></td>
|
||||
<script>
|
||||
document.write(jogRowHTML('Z'));
|
||||
</script>
|
||||
</tr>
|
||||
|
||||
</div></table>
|
||||
|
@ -193,7 +209,6 @@ function viewModel()
|
|||
self.sendPassword = function()
|
||||
{
|
||||
$.get('/rr_password', {pwd: self.pwd()}, self.gotPassword);
|
||||
//self.chosenPageId(self.pages[0]);
|
||||
};
|
||||
|
||||
self.sendHome = function(axis, data, event)
|
||||
|
|
|
@ -48,6 +48,37 @@ td { text-align: center; }
|
|||
<html>
|
||||
<script src="jquery.js" type="text/javascript"></script>
|
||||
<script src="knockout.js" type="text/javascript"></script>
|
||||
<script>
|
||||
function jogRowHTML(axis)
|
||||
{
|
||||
var result = "";
|
||||
|
||||
for(var i = -1; i < 3; i++)
|
||||
{
|
||||
var k = Math.pow(10.0, i);
|
||||
var pos = '<td><button data-bind="click: function(data, event) { sendJog(';
|
||||
pos += "'" + axis + "', ";
|
||||
var neg = pos;
|
||||
pos += '' + k;
|
||||
neg += '' + (-k);
|
||||
pos += ', data, event) }">' + axis + ' ';
|
||||
neg += ', data, event) }"><';
|
||||
for(var j = -1; j < i; j++)
|
||||
{
|
||||
pos += '-';
|
||||
neg += '-';
|
||||
}
|
||||
pos += '>';
|
||||
neg += ' ' + axis;
|
||||
pos += '</button></td>';
|
||||
neg += '</button></td>';
|
||||
result += pos;
|
||||
neg += result;
|
||||
result = neg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<a href="http://reprappro.com" target="_blank"><img src="logo.png" alt="RepRapPro logo" align="right"></a>
|
||||
|
@ -96,42 +127,27 @@ td { text-align: center; }
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('X', data, event) }">Home X</button></td>
|
||||
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -100, data, event) }"><--- X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -10, data, event) }"><-- X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -1, data, event) }"><- X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', -0.1, data, event) }">< X</button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 0.1, data, event) }">X ></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 1, data, event) }">X --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 10, data, event) }">X --></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendJog('X', 100, data, event) }">X ---></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('X', data, event) }">Home X
|
||||
</button></td>
|
||||
<script>
|
||||
document.write(jogRowHTML('X'));
|
||||
</script>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Y', data, event) }">Home Y</button></td>
|
||||
|
||||
<td><button type="button" onclick="return move('Y', -100)"><--- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -10)"><-- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -1)"><- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -0.1)">< Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', 0.1)">Y ></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 1)">Y -></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 10)">Y --></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 100)">Y ---></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Y', data, event) }">Home Y
|
||||
</button></td>
|
||||
<script>
|
||||
document.write(jogRowHTML('Y'));
|
||||
</script>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Z', data, event) }">Home Z</button></td>
|
||||
|
||||
<td><button type="button" onclick="return move('Z', -100)"><--- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -10)"><-- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -1)"><- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -0.1)">< Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', 0.1)">Z ></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 1)">Z -></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 10)">Z --></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 100)">Z ---></button></td>
|
||||
<td><button data-bind="click: function(data, event) { sendHome('Z', data, event) }">Home Z
|
||||
</button></td>
|
||||
<script>
|
||||
document.write(jogRowHTML('Z'));
|
||||
</script>
|
||||
</tr>
|
||||
|
||||
</div></table>
|
||||
|
@ -193,7 +209,6 @@ function viewModel()
|
|||
self.sendPassword = function()
|
||||
{
|
||||
$.get('/rr_password', {pwd: self.pwd()}, self.gotPassword);
|
||||
//self.chosenPageId(self.pages[0]);
|
||||
};
|
||||
|
||||
self.sendHome = function(axis, data, event)
|
||||
|
|
|
@ -282,8 +282,6 @@ void Webserver::WriteByte()
|
|||
void Webserver::CheckPassword()
|
||||
{
|
||||
gotPassword = StringEndsWith(clientQualifier, password);
|
||||
|
||||
//strcpy(clientRequest, INDEX_PAGE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -326,7 +324,8 @@ void Webserver::GetKOString(char* request)
|
|||
|
||||
if(StringStartsWith(request, "gcode"))
|
||||
{
|
||||
// TODO interpret GCode here, not in parse qual.
|
||||
if(!LoadGcodeBuffer(&clientQualifier[6], true))
|
||||
platform->Message(HOST_MESSAGE, "Webserver: buffer not free!<br>\n");
|
||||
strcpy(jsonResponse, "{}");
|
||||
ok = true;
|
||||
}
|
||||
|
@ -482,12 +481,14 @@ void Webserver::ParseQualifier()
|
|||
if(!gotPassword) //Doan work fur nuffink
|
||||
return;
|
||||
|
||||
if(StringStartsWith(clientQualifier, "gcode="))
|
||||
/*
|
||||
if(StringStartsWith(clientQualifier, "gcode="))
|
||||
{
|
||||
if(!LoadGcodeBuffer(&clientQualifier[6], true))
|
||||
platform->Message(HOST_MESSAGE, "Webserver: buffer not free!<br>\n");
|
||||
//strcpy(clientRequest, INDEX_PAGE);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// if you've gotten to the end of the line (received a newline
|
||||
|
|
Reference in a new issue