summaryrefslogtreecommitdiff
path: root/js/looking-glass.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/looking-glass.js')
-rw-r--r--js/looking-glass.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/looking-glass.js b/js/looking-glass.js
index d510ca0..ec26416 100644
--- a/js/looking-glass.js
+++ b/js/looking-glass.js
@@ -1,3 +1,18 @@
+function request_doc(query) {
+ $.ajax({
+ type: 'post',
+ url: 'execute.php',
+ data: { doc: query, dontlook: '' }
+ }).done(function(response) {
+ var response = $.parseJSON(response);
+
+ $('#command-help').html(response.query);
+ $('#parameter-help').html(response.parameter);
+ }).fail(function(xhr) {
+ $('#help-content').text('Cannot load documentation...');
+ });
+}
+
$(document).ready(function() {
// hide the optional parameters field
$('.result').hide();
@@ -18,6 +33,15 @@ $(document).ready(function() {
$('.result').slideUp();
});
+ // initialize the help modal
+ request_doc($('#query').val());
+
+ // update help when a command is selected
+ $('#query').on('change', function(e) {
+ e.preventDefault();
+ request_doc($('#query').val());
+ });
+
// send an ajax request that will get the info on the router
$('form').on('submit', function(e) {
e.preventDefault();