From ad3e9e5481507ce7079f655bb2eaf402b34ab40c Mon Sep 17 00:00:00 2001 From: Alex Agranov Date: Fri, 19 Sep 2014 18:14:28 -0400 Subject: [PATCH 1/2] pull out onChange handler for #input_apiKey so it can be called manually --- dist/index.html | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/dist/index.html b/dist/index.html index caf4ef0e..17cd7e93 100644 --- a/dist/index.html +++ b/dist/index.html @@ -51,14 +51,24 @@ sorter : "alpha" }); + function addApiKeyAuthorization() { + var key = $('#input_apiKey')[0].value; + log("key: " + key); + if(key && key.trim() != "") { + log("added key " + key); + window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query")); + } + } + $('#input_apiKey').change(function() { - var key = $('#input_apiKey')[0].value; - log("key: " + key); - if(key && key.trim() != "") { - log("added key " + key); - window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query")); - } - }) + addApiKeyAuthorization(); + }); + + // if you have an apiKey you would like to pre-populate on the page for demonstration purposes... + // var apiKey = "myApiKeyXXXX123456789"; + // $('#input_apiKey').val(apiKey); + // addApiKeyAuthorization(); + window.swaggerUi.load(); }); From 19c34cf1ead0a3ca83a940f6033545902589d2f4 Mon Sep 17 00:00:00 2001 From: Alex Agranov Date: Fri, 19 Sep 2014 18:18:57 -0400 Subject: [PATCH 2/2] tidy up the commenting --- dist/index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dist/index.html b/dist/index.html index 17cd7e93..1a419be6 100644 --- a/dist/index.html +++ b/dist/index.html @@ -65,9 +65,11 @@ }); // if you have an apiKey you would like to pre-populate on the page for demonstration purposes... - // var apiKey = "myApiKeyXXXX123456789"; - // $('#input_apiKey').val(apiKey); - // addApiKeyAuthorization(); + /* + var apiKey = "myApiKeyXXXX123456789"; + $('#input_apiKey').val(apiKey); + addApiKeyAuthorization(); + */ window.swaggerUi.load(); });