');
+ var isLogout = false;
+
+ auths.forEach(function (auth) {
+ var authView = new SwaggerUi.Views.AuthView({data: auth, router: this.router});
+ var authEl = authView.render().el;
+ $el.append(authEl);
+ if (authView.isLogout) {
+ isLogout = true;
+ }
+ }, this);
+
+ this.model.isLogout = isLogout;
+
+ return $el;
}
- },
- template: function(){
- return Handlebars.templates.basic_auth_button_view;
- }
+});
+
+'use strict';
+
+SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({
+ constructor: function() {
+ var args = Array.prototype.slice.call(arguments);
+
+ args[0] = this.parse(args[0]);
+
+ Backbone.Collection.apply(this, args);
+ },
+
+ add: function (model) {
+ var args = Array.prototype.slice.call(arguments);
+
+ if (Array.isArray(model)) {
+ args[0] = _.map(model, function(val) {
+ return this.handleOne(val);
+ }, this);
+ } else {
+ args[0] = this.handleOne(model);
+ }
+
+ Backbone.Collection.prototype.add.apply(this, args);
+ },
+
+ handleOne: function (model) {
+ var result = model;
+
+ if (! (model instanceof Backbone.Model) ) {
+ switch (model.type) {
+ case 'oauth2':
+ result = new SwaggerUi.Models.Oauth2Model(model);
+ break;
+ case 'basic':
+ result = new SwaggerUi.Models.BasicAuthModel(model);
+ break;
+ case 'apiKey':
+ result = new SwaggerUi.Models.ApiKeyAuthModel(model);
+ break;
+ default:
+ result = new Backbone.Model(model);
+ }
+ }
+
+ return result;
+ },
+
+ isValid: function () {
+ var valid = true;
+
+ this.models.forEach(function(model) {
+ if (!model.validate()) {
+ valid = false;
+ }
+ });
+
+ return valid;
+ },
+
+ isAuthorized: function () {
+ return this.length === this.where({ isLogout: true }).length;
+ },
+
+ isPartiallyAuthorized: function () {
+ return this.where({ isLogout: true }).length > 0;
+ },
+
+ parse: function (data) {
+ var authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz);
+
+ return _.map(data, function (auth, name) {
+ var isBasic = authz.basic && auth.type === 'basic';
+
+ _.extend(auth, {
+ title: name
+ });
+
+ if (authz[name] || isBasic) {
+ _.extend(auth, {
+ isLogout: true,
+ value: isBasic ? undefined : authz[name].value,
+ username: isBasic ? authz.basic.username : undefined,
+ password: isBasic ? authz.basic.password : undefined,
+ valid: true
+ });
+ }
+
+ return auth;
+ });
+ }
+});
+'use strict';
+
+SwaggerUi.Views.AuthsCollectionView = Backbone.View.extend({
+
+ initialize: function(opts) {
+ this.options = opts || {};
+ this.options.data = this.options.data || {};
+ this.router = this.options.router;
+
+ this.collection = new SwaggerUi.Collections.AuthsCollection(opts.data);
+
+ this.$innerEl = $('
');
+ },
+
+ render: function () {
+ this.collection.each(function (auth) {
+ this.renderOneAuth(auth);
+ }, this);
+
+ this.$el.html(this.$innerEl.html() ? this.$innerEl : '');
+
+ return this;
+ },
+
+ renderOneAuth: function (authModel) {
+ var authEl, authView;
+ var type = authModel.get('type');
+
+ if (type === 'apiKey') {
+ authView = 'ApiKeyAuthView';
+ } else if (type === 'basic' && this.$innerEl.find('.basic_auth_container').length === 0) {
+ authView = 'BasicAuthView';
+ } else if (type === 'oauth2') {
+ authView = 'Oauth2View';
+ }
+
+ if (authView) {
+ authEl = new SwaggerUi.Views[authView]({model: authModel, router: this.router}).render().el;
+ }
+
+ this.$innerEl.append(authEl);
+ }
+
+});
+
+'use strict';
+
+/* global redirect_uri */
+/* global clientId */
+/* global scopeSeparator */
+/* global additionalQueryStringParams */
+/* global clientSecret */
+/* global onOAuthComplete */
+/* global realm */
+/*jshint unused:false*/
+
+SwaggerUi.Views.AuthView = Backbone.View.extend({
+ events: {
+ 'click .auth_submit__button': 'authorizeClick',
+ 'click .auth_logout__button': 'logoutClick'
+ },
+
+ tpls: {
+ main: Handlebars.templates.auth_view
+ },
+
+ selectors: {
+ innerEl: '.auth_inner',
+ authBtn: '.auth_submit__button'
+ },
+
+ initialize: function(opts) {
+ this.options = opts || {};
+ opts.data = opts.data || {};
+ this.router = this.options.router;
+
+ this.authsCollectionView = new SwaggerUi.Views.AuthsCollectionView({data: opts.data});
+
+ this.$el.html(this.tpls.main({
+ isLogout: this.authsCollectionView.collection.isAuthorized(),
+ isAuthorized: this.authsCollectionView.collection.isPartiallyAuthorized()
+ }));
+ this.$innerEl = this.$(this.selectors.innerEl);
+ this.isLogout = this.authsCollectionView.collection.isPartiallyAuthorized();
+ },
+
+ render: function () {
+ this.$innerEl.html(this.authsCollectionView.render().el);
+
+ return this;
+ },
+
+ authorizeClick: function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ if (this.authsCollectionView.collection.isValid()) {
+ this.authorize();
+ }
+ },
+
+ authorize: function () {
+ this.authsCollectionView.collection.forEach(function (auth) {
+ var keyAuth, basicAuth;
+ var type = auth.get('type');
+
+ if (type === 'apiKey') {
+ keyAuth = new SwaggerClient.ApiKeyAuthorization(
+ auth.get('name'),
+ auth.get('value'),
+ auth.get('in')
+ );
+
+ this.router.api.clientAuthorizations.add(auth.get('title'), keyAuth);
+ } else if (type === 'basic') {
+ basicAuth = new SwaggerClient.PasswordAuthorization(auth.get('username'), auth.get('password'));
+ this.router.api.clientAuthorizations.add(auth.get('type'), basicAuth);
+ } else if (type === 'oauth2') {
+ this.handleOauth2Login(auth);
+ }
+ }, this);
+
+ this.router.load();
+ },
+
+ logoutClick: function (e) {
+ e.preventDefault();
+
+ this.authsCollectionView.collection.forEach(function (auth) {
+ var name = auth.get('type') === 'basic' ? 'basic' : auth.get('title');
+
+ window.swaggerUi.api.clientAuthorizations.remove(name);
+ });
+
+ this.router.load();
+ },
+
+ // taken from lib/swagger-oauth.js
+ handleOauth2Login: function (auth) {
+ var host = window.location;
+ var pathname = location.pathname.substring(0, location.pathname.lastIndexOf('/'));
+ var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
+ var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
+ var url = null;
+ var scopes = _.map(auth.get('scopes'), function (scope) {
+ return scope.scope;
+ });
+ var state, dets, ep;
+ window.OAuthSchemeKey = auth.get('title');
+
+ window.enabledScopes = scopes;
+ var flow = auth.get('flow');
+
+ if(auth.get('type') === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
+ dets = auth.attributes;
+ url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
+ window.swaggerUi.tokenName = dets.tokenName || 'access_token';
+ window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
+ state = window.OAuthSchemeKey;
+ }
+ else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
+ dets = auth.attributes;
+ window.swaggerUi.tokenName = dets.tokenName || 'access_token';
+ this.clientCredentialsFlow(scopes, dets.tokenUrl, window.OAuthSchemeKey);
+ return;
+ }
+ else if(auth.get('grantTypes')) {
+ // 1.2 support
+ var o = auth.get('grantTypes');
+ for(var t in o) {
+ if(o.hasOwnProperty(t) && t === 'implicit') {
+ dets = o[t];
+ ep = dets.loginEndpoint.url;
+ url = dets.loginEndpoint.url + '?response_type=token';
+ window.swaggerUi.tokenName = dets.tokenName;
+ }
+ else if (o.hasOwnProperty(t) && t === 'accessCode') {
+ dets = o[t];
+ ep = dets.tokenRequestEndpoint.url;
+ url = dets.tokenRequestEndpoint.url + '?response_type=code';
+ window.swaggerUi.tokenName = dets.tokenName;
+ }
+ }
+ }
+
+ var redirect_uri = redirectUrl;
+
+ url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
+ url += '&realm=' + encodeURIComponent(realm);
+ url += '&client_id=' + encodeURIComponent(clientId);
+ url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
+ url += '&state=' + encodeURIComponent(state);
+ for (var key in additionalQueryStringParams) {
+ url += '&' + key + '=' + encodeURIComponent(additionalQueryStringParams[key]);
+ }
+
+ window.open(url);
+ },
+
+ // taken from lib/swagger-oauth.js
+ clientCredentialsFlow: function (scopes, tokenUrl, OAuthSchemeKey) {
+ var params = {
+ 'client_id': clientId,
+ 'client_secret': clientSecret,
+ 'scope': scopes.join(' '),
+ 'grant_type': 'client_credentials'
+ };
+ $.ajax({
+ url : tokenUrl,
+ type: 'POST',
+ data: params,
+ success: function (data)
+ {
+ onOAuthComplete(data, OAuthSchemeKey);
+ },
+ error: function ()
+ {
+ onOAuthComplete('');
+ }
+ });
+ }
+
+});
+
+'use strict';
+
+SwaggerUi.Models.BasicAuthModel = Backbone.Model.extend({
+ defaults: {
+ username: '',
+ password: '',
+ title: 'basic'
+ },
+
+ initialize: function () {
+ this.on('change', this.validate);
+ },
+
+ validate: function () {
+ var valid = !!this.get('password') && !!this.get('username');
+
+ this.set('valid', valid);
+
+ return valid;
+ }
+});
+'use strict';
+
+SwaggerUi.Views.BasicAuthView = Backbone.View.extend({
+
+ initialize: function (opts) {
+ this.options = opts || {};
+ this.router = this.options.router;
+ },
+
+ events: {
+ 'change .auth_input': 'inputChange'
+ },
+
+ template: Handlebars.templates.basic_auth,
+
+ render: function(){
+ $(this.el).html(this.template(this.model.toJSON()));
+
+ return this;
+ },
+
+ inputChange: function (e) {
+ var $el = $(e.target);
+ var val = $el.val();
+ var attr = $el.prop('name');
+
+ this.model.set(attr, val);
+ },
+
+ isValid: function () {
+ return this.model.validate();
+ }
});
'use strict';
@@ -19123,8 +19745,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
}
this.trigger('update-swagger-ui', {
- url: $('#input_baseUrl').val(),
- apiKey: $('#input_apiKey').val()
+ url: $('#input_baseUrl').val()
});
},
@@ -19135,7 +19756,6 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
$('#input_baseUrl').val(url);
- //$('#input_apiKey').val(apiKey);
if (trigger) {
this.trigger('update-swagger-ui', {url:url});
}
@@ -19226,26 +19846,9 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
},
- render: function(){
- if (this.model.securityDefinitions) {
- for (var name in this.model.securityDefinitions) {
- var auth = this.model.securityDefinitions[name];
- var button;
-
- if (auth.type === 'apiKey' && $('#apikey_button').length === 0) {
- button = new SwaggerUi.Views.ApiKeyButton({model: auth, router: this.router}).render().el;
- $('.auth_main_container').append(button);
- }
-
- if (auth.type === 'basicAuth' && $('#basic_auth_button').length === 0) {
- button = new SwaggerUi.Views.BasicAuthButton({model: auth, router: this.router}).render().el;
- $('.auth_main_container').append(button);
- }
- }
- }
-
- // Render the outer container for resources
+ render: function () {
$(this.el).html(Handlebars.templates.main(this.model));
+ this.model.securityDefinitions = this.model.securityDefinitions || {};
// Render each resource
@@ -19297,7 +19900,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
onLinkClick: function (e) {
var el = e.target;
- if (el.tagName === 'A') {
+ if (el.tagName === 'A' && el.href) {
if (location.hostname !== el.hostname || location.port !== el.port) {
e.preventDefault();
window.open(el.href, '_blank');
@@ -19308,6 +19911,60 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
'use strict';
+SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
+ defaults: {
+ scopes: {}
+ },
+
+ initialize: function () {
+ this.on('change', this.validate);
+ },
+
+ setScopes: function (name, val) {
+ var auth = _.extend({}, this.attributes);
+ var index = _.findIndex(auth.scopes, function(o) {
+ return o.scope === name;
+ });
+ auth.scopes[index].checked = val;
+
+ this.set(auth);
+ this.validate();
+ },
+
+ validate: function () {
+ var valid = _.findIndex(this.get('scopes'), function (o) {
+ return o.checked === true;
+ }) > -1;
+
+ this.set('valid', valid);
+
+ return valid;
+ }
+});
+'use strict';
+
+SwaggerUi.Views.Oauth2View = Backbone.View.extend({
+ events: {
+ 'change .oauth-scope': 'scopeChange'
+ },
+
+ template: Handlebars.templates.oauth2,
+
+ render: function () {
+ this.$el.html(this.template(this.model.toJSON()));
+
+ return this;
+ },
+
+ scopeChange: function (e) {
+ var val = $(e.target).prop('checked');
+ var scope = $(e.target).data('scope');
+
+ this.model.setScopes(scope, val);
+ }
+});
+'use strict';
+
SwaggerUi.Views.OperationView = Backbone.View.extend({
invocationUrl: null,
@@ -19340,21 +19997,21 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
},
selectText: function(event) {
- var doc = document,
- text = event.target.firstChild,
- range,
- selection;
- if (doc.body.createTextRange) {
- range = document.body.createTextRange();
- range.moveToElementText(text);
- range.select();
- } else if (window.getSelection) {
- selection = window.getSelection();
- range = document.createRange();
- range.selectNodeContents(text);
- selection.removeAllRanges();
- selection.addRange(range);
- }
+ var doc = document,
+ text = event.target.firstChild,
+ range,
+ selection;
+ if (doc.body.createTextRange) {
+ range = document.body.createTextRange();
+ range.moveToElementText(text);
+ range.select();
+ } else if (window.getSelection) {
+ selection = window.getSelection();
+ range = document.createRange();
+ range.selectNodeContents(text);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
},
mouseEnter: function(e) {
@@ -19565,6 +20222,14 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.addStatusCode(statusCode);
}
+ if (Array.isArray(this.model.security)) {
+ var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security);
+
+ authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
+ this.authView = new SwaggerUi.Views.AuthButtonView({data: authsModel, router: this.router, isOperation: true});
+ this.$('.authorize-wrapper').append(this.authView.render().el);
+ }
+
this.showSnippet();
return this;
},
@@ -19800,7 +20465,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// wraps a jquery response as a shred response
wrap: function(data) {
- var h, headerArray, headers, i, l, len, o;
+ var h, headerArray, headers, i, l, len, o;
headers = {};
headerArray = data.getAllResponseHeaders().split('\r');
for (l = 0, len = headerArray.length; l < len; l++) {
@@ -19977,7 +20642,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code = $('
').text('no content');
pre = $('
').append(code);
- // JSON
+ // JSON
} else if (contentType === 'application/json' || /\+json$/.test(contentType)) {
var json = null;
try {
@@ -19988,35 +20653,35 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code = $('
').text(json);
pre = $('
').append(code);
- // XML
+ // XML
} else if (contentType === 'application/xml' || /\+xml$/.test(contentType)) {
code = $('
').text(this.formatXml(content));
pre = $('
').append(code);
- // HTML
+ // HTML
} else if (contentType === 'text/html') {
code = $('
').html(_.escape(content));
pre = $('
').append(code);
- // Plain Text
+ // Plain Text
} else if (/text\/plain/.test(contentType)) {
code = $('
').text(content);
pre = $('
').append(code);
- // Image
+ // Image
} else if (/^image\//.test(contentType)) {
pre = $('
').attr('src', url);
- // Audio
+ // Audio
} else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) {
pre = $('
').append($('').attr('src', url).attr('type', contentType));
- // Download
+ // Download
} else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
- headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
- headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
- headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
+ headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
+ headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
+ headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
if ('Blob' in window) {
var type = contentType || 'text/html';
@@ -20044,11 +20709,11 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
pre = $(' ').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).');
}
- // Location header based redirect download
+ // Location header based redirect download
} else if(headers.location || headers.Location) {
window.location = response.url;
- // Anything else (CORS)
+ // Anything else (CORS)
} else {
code = $('').text(content);
pre = $(' ').append(code);
@@ -20074,8 +20739,8 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
if (opts.showRequestHeaders) {
var form = $('.sandbox', $(this.el)),
- map = this.getInputMap(form),
- requestHeaders = this.model.getHeaderParams(map);
+ map = this.getInputMap(form),
+ requestHeaders = this.model.getHeaderParams(map);
delete requestHeaders['Content-Type'];
$('.request_headers', $(this.el)).html('' + _.escape(JSON.stringify(requestHeaders, null, ' ')).replace(/\n/g, ' ') + ' ');
}
@@ -21302,6 +21967,43 @@ SwaggerUi.partials.signature = (function () {
'use strict';
+SwaggerUi.Views.PopupView = Backbone.View.extend({
+ events: {
+ 'click .api-popup-cancel': 'cancelClick'
+ },
+
+ template: Handlebars.templates.popup,
+ className: 'api-popup-dialog',
+
+ selectors: {
+ content: '.api-popup-content',
+ main : '#swagger-ui-container'
+ },
+
+ initialize: function(){
+ this.$el.html(this.template(this.model));
+ },
+
+ render: function () {
+ this.$(this.selectors.content).append(this.model.content);
+ $(this.selectors.main).first().append(this.el);
+ this.showPopup();
+
+ return this;
+ },
+
+ showPopup: function () {
+ this.$el.show();
+ },
+
+ cancelClick: function () {
+ this.remove();
+ }
+
+});
+
+'use strict';
+
SwaggerUi.Views.ResourceView = Backbone.View.extend({
initialize: function(opts) {
opts = opts || {};
diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js
index e825b529..46f9b733 100644
--- a/dist/swagger-ui.min.js
+++ b/dist/swagger-ui.min.js
@@ -1,9 +1,9 @@
-(function(){function e(){e.history=e.history||[],e.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])}this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a="function",o=t.helperMissing,s=this.escapeExpression;return"\n\n"},useData:!0}),this.Handlebars.templates.basic_auth_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){return'\n\n\n'},useData:!0}),this.Handlebars.templates.content_type=Handlebars.template({1:function(e,t,n,r){var i,a="";return i=t.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,r),inverse:this.noop,data:r}),null!=i&&(a+=i),a},2:function(e,t,n,r){var i=this.lambda,a=this.escapeExpression;return' '+a(i(e,e))+" \n"},4:function(e,t,n,r){return' application/json \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,a,o="function",s=t.helperMissing,l=this.escapeExpression,u='Response Content Type \n\n';return i=t["if"].call(e,null!=e?e.produces:e,{name:"if",hash:{},fn:this.program(1,r),inverse:this.program(4,r),data:r}),null!=i&&(u+=i),u+" \n"},useData:!0}),$(function(){$.fn.vAlign=function(){return this.each(function(){var e=$(this).height(),t=$(this).parent().height(),n=(t-e)/2;$(this).css("margin-top",n)})},$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(){var e=$(this).closest("form").innerWidth(),t=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10),n=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",e-t-n)})},$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent(),$("ul.downplayed li div.content p").vAlign(),$("form.sandbox").submit(function(){var e=!0;return $(this).find("input.required").each(function(){$(this).removeClass("error"),""===$(this).val()&&($(this).addClass("error"),$(this).wiggle(),e=!1)}),e})}),Function.prototype.bind&&console&&"object"==typeof console.log&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call),window.Docs={shebang:function(){var e=$.param.fragment().split("/");switch(e.shift(),e.length){case 1:if(e[0].length>0){var t="resource_"+e[0];Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1})}break;case 2:Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1});var n=e.join("_"),r=n+"_content";Docs.expandOperation($("#"+r)),$("#"+n).slideto({highlight:!1})}},toggleEndpointListForResource:function(e){var t=$("li#resource_"+Docs.escapeResourceName(e)+" ul.endpoints");t.is(":visible")?($.bbq.pushState("#/",2),Docs.collapseEndpointListForResource(e)):($.bbq.pushState("#/"+e,2),Docs.expandEndpointListForResource(e))},expandEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideDown();$("li#resource_"+e).addClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideDown()},collapseEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideUp();$("li#resource_"+e).removeClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideUp()},expandOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideDown():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideUp():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(e){return e.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(e){e.slideDown()},collapseOperation:function(e){e.slideUp()}},Handlebars.registerHelper("sanitize",function(e){return e=e.replace(/