mirror of
https://github.com/ervanalb/keygen.git
synced 2025-12-14 20:35:25 +00:00
start work on web interface
This commit is contained in:
23
web/index.htm
Normal file
23
web/index.htm
Normal file
@@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>keygen</title>
|
||||
<script type="text/javascript" src="jquery.min.js"></script>
|
||||
<script type="text/javascript" src="keygen.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>keygen</h1>
|
||||
<form>
|
||||
<div>Type: <select id="key_type"></select></div>
|
||||
<div>Outline: <select id="key_outline"></select></div>
|
||||
<div>Warding: <select id="key_warding"></select></div>
|
||||
<div id="key_description"></div>
|
||||
<div>Bitting: <input id="key_bitting"></input></div>
|
||||
<input type="submit" value="Generate"></input>
|
||||
</form>
|
||||
<div id="please_wait" style="display:none;">Please wait...</div>
|
||||
<div id="generated_key" style="display:none;">
|
||||
<div id="key_preview"></div>
|
||||
<button id="key_download">Download</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
4
web/jquery.min.js
vendored
Normal file
4
web/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
49
web/keygen.js
Normal file
49
web/keygen.js
Normal file
@@ -0,0 +1,49 @@
|
||||
keygen_endpoint = "http://localhost:8080";
|
||||
|
||||
var key_metadata;
|
||||
|
||||
function populate_types() {
|
||||
$.getJSON( keygen_endpoint, function( data ) {
|
||||
key_metadata = data;
|
||||
|
||||
$("#key_type").empty();
|
||||
$.each(data, function(i, key_type) {
|
||||
$("#key_type").append($('<option/>', {
|
||||
value: key_type.filename,
|
||||
text : key_type.name
|
||||
}));
|
||||
});
|
||||
if(key_metadata.length > 0) {
|
||||
$("#key_type").val(key_metadata[0].filename);
|
||||
populate_outlines_wardings();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populate_outlines_wardings() {
|
||||
key_filename = $("#key_type").val();
|
||||
$("#key_outline").empty();
|
||||
$("#key_warding").empty();
|
||||
$.each(key_metadata, function(i, key_type) {
|
||||
if(key_type.filename == key_filename) {
|
||||
$.each(key_type.outlines, function(i, key_outline) {
|
||||
$("#key_outline").append($('<option/>', {
|
||||
value: key_outline,
|
||||
text : key_outline
|
||||
}));
|
||||
});
|
||||
$.each(key_type.wardings, function(i, key_warding) {
|
||||
$("#key_warding").append($('<option/>', {
|
||||
value: key_warding,
|
||||
text : key_warding
|
||||
}));
|
||||
});
|
||||
$("#key_description").text(key_type.description);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#key_type").on("change", populate_outlines_wardings);
|
||||
populate_types();
|
||||
});
|
||||
Reference in New Issue
Block a user