").appendTo(rest_url);
- var new_param = $("
").appendTo(new_div);
- new_param.autosizeInput({"space": 0});
- //var new_label = $("
").appendTo(new_div);
-
-
- } else {
- rest_url.append("
"+params[i]+"");
- }
- }
-}
-
-function select_request(request) {
- if (request === undefined) {
- var el = commandlist.children("li:not(.separator)").eq(0);
- request = slugify(el.text());
-
-/* var keys = Object.keys(requests);
- var index = keys.indexOf(cmd);
- if (index === -1) return;*/
- } else {
- var el = commandlist.find("li a[href='#"+request+"']").parent();
- }
- $(el).siblings().removeClass('selected');
- $(el).addClass('selected');
-
- command = requests[request];
-
- if (command.test_only === true) {
- test_warning.show();
- } else {
- test_warning.hide();
- }
-
- if (command.description) {
- $(description).html(command.description);
-
- if (command.link) {
- $(description).append("
Read more");
- }
-
- $(description).show();
- } else if (command.link) {
- $(description).html("
Read more");
- } else {
- $(description).hide();
- }
-
- selected_command.html($('
')
- .attr('href', DOC_BASE+command.link)
- .text(command.name));
-
- change_path(command);
-
- request_button.val(command.method);
- request_button.text(command.method+" request");
- update_method(request_button);
-
- if (command.hasOwnProperty("body")) {
- cm_request.setValue(JSON.stringify(command.body, null, 2));
- } else {
- //No body, so wipe out the current contents.
- cm_request.setValue("");
- }
- cm_request.refresh();
-
- reset_response_area();
-};
-
-function get_path() {
- s = "";
- rest_url.find(".non_editable, .editable").each(function() {
- if (this.tagName == "INPUT") {
- s += $(this).val();
- } else {
- s += $(this).text();
- }
- });
- return s;
-}
-
-function send_request() {
- //var method = rest_method.val();
- var method = request_button.val();
- if (method != GET && method != POST && method != PUT && method != DELETE) {
- console.log("ERROR: unrecognized http method");
- return;
- }
- //var path = rest_url.val();
- var path = get_path();
-
- $(this).addClass('depressed');
- response_body.addClass('obscured');
-
- var original_cmd = requests[slugify(selected_command.text())];
-
- if (original_cmd.hasOwnProperty("body")) {
- var body = cm_request.getValue();
- $.ajax({
- type: method,
- url: URL_BASE + path,
- data: body,
- contentType: 'application/json',
- processData: false
- }).done(success_output).fail(error_output).always(reset_sending_status);
- } else {
- $.ajax({
- type: method,
- url: URL_BASE + path
- }).done(success_output).fail(error_output).always(reset_sending_status);
- }
-
- spinner.show();
-}
-
-function error_output(xhr,status,statusText) {
- response_code.text(xhr.status+" "+xhr.statusText);
- cm_response.setValue(xhr.responseText);
-}
-
-function success_output(body,status,xhr) {
- response_code.text(xhr.status+" "+xhr.statusText);
- cm_response.setValue(JSON.stringify(body, null, 2));
-}
-
-function reset_sending_status() {
- response_body.removeClass('obscured');
- request_button.removeClass('depressed');
- spinner.hide();
-}
-
-function reset_response_area() {
- cm_response.setValue("");
- response_code.text("");
-}
-
-function change_base_url(u) {
- window.URL_BASE = u;
- $("#rest_host").text(u);
-}
-
-$(document).ready(function() {
- //wait for the Requests to be populated by another file
- generate_table_of_contents();
- make_commands_clickable();
-
- if (window.location.hash) {
- var cmd = window.location.hash.slice(1).toLowerCase();
- select_request(cmd);
- } else {
- select_request();
- }
-
- if (urlParams["base_url"]) {
- change_base_url(urlParams["base_url"]);
- }
-
- request_button.click(send_request);
-
-});
-
-var urlParams;
-(window.onpopstate = function () {
- var match,
- pl = /\+/g, // Regex for replacing addition symbol with a space
- search = /([^&=]+)=?([^&]*)/g,
- decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
- query = window.location.search.substring(1);
-
- urlParams = {};
- while (match = search.exec(query))
- urlParams[decode(match[1])] = decode(match[2]);
-})();
diff --git a/styles/_dev-tools.scss b/styles/_dev-tools.scss
index b8369eb8e9..1dbe2ed220 100644
--- a/styles/_dev-tools.scss
+++ b/styles/_dev-tools.scss
@@ -1,5 +1,14 @@
/* Dev Tool styles stuff ---------------------------------------------------- */
+.command-list-wrapper {
+ // WebSocket Tool right sidebar
+ position: sticky;
+ top: calc(var(--navbar-height) + var(--toc-offset-top));
+ max-height: calc(100vh - var(--navbar-height) - var(--toc-offset-top));
+ overflow-y: auto;
+ width: var(--toc-width);
+}
+
#tx-sender-history .list-group-item {
font-size: small;
color: $gray-600;