diff --git a/.jshintrc b/.jshintrc index 694473e8..9a1b0c8b 100644 --- a/.jshintrc +++ b/.jshintrc @@ -17,6 +17,7 @@ "strict": true, "trailing": true, "smarttabs": true, + "validthis": true, "globals": { // Libraries @@ -29,6 +30,7 @@ "SwaggerClient": false, "hljs": false, "SwaggerUi": false, + "define": false, // Global object // TODO: remove these diff --git a/.travis.yml b/.travis.yml index d2d38fd1..e9d4c7fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,4 @@ install: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - npm i -g jshint - - npm install - -script: - - jshint . - - npm test \ No newline at end of file + - npm install \ No newline at end of file diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js index 8954a918..20cc321b 100644 --- a/dist/swagger-ui.js +++ b/dist/swagger-ui.js @@ -6,7 +6,7 @@ */ (function(){'use strict'; -var SwaggerUi = Backbone.Router.extend({ +window.SwaggerUi = Backbone.Router.extend({ dom_id: 'swagger_ui', @@ -201,7 +201,6 @@ var SwaggerUi = Backbone.Router.extend({ }); -window.SwaggerUi = SwaggerUi; window.SwaggerUi.Views = {}; // don't break backward compatibility with previous versions and warn users to upgrade their code diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js index c391dc97..008c1e90 100644 --- a/dist/swagger-ui.min.js +++ b/dist/swagger-ui.min.js @@ -1,2 +1,2 @@ -(function(){"use strict";var e=Backbone.Router.extend({dom_id:"swagger_ui",options:null,api:null,headerView:null,mainView:null,initialize:function(n){n=n||{},n.dom_id&&(this.dom_id=n.dom_id,delete n.dom_id),n.supportedSubmitMethods||(n.supportedSubmitMethods=["get","put","post","delete","head","options","patch"]),$("#"+this.dom_id).length||$("body").append('
'),this.options=n,marked.setOptions({gfm:!0});var t=this;this.options.success=function(){return t.render()},this.options.progress=function(e){return t.showMessage(e)},this.options.failure=function(e){return t.onLoadFailure(e)},this.headerView=new e.Views.HeaderView({el:$("#header")}),this.headerView.on("update-swagger-ui",function(e){return t.updateSwaggerUi(e)})},setOption:function(e,n){this.options[e]=n},getOption:function(e){return this.options[e]},updateSwaggerUi:function(e){this.options.url=e.url,this.load()},load:function(){this.mainView&&this.mainView.clear();var e=this.options.url;e&&0!==e.indexOf("http")&&(e=this.buildUrl(window.location.href.toString(),e)),this.options.url=e,this.headerView.update(e),this.api=new SwaggerClient(this.options)},collapseAll:function(){Docs.collapseEndpointListForResource("")},listAll:function(){Docs.collapseOperationsForResource("")},expandAll:function(){Docs.expandOperationsForResource("")},render:function(){switch(this.showMessage("Finished Loading Resource Information. Rendering Swagger UI..."),this.mainView=new e.Views.MainView({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options,router:this}).render(),this.showMessage(),this.options.docExpansion){case"full":this.expandAll();break;case"list":this.listAll()}this.renderGFM(),this.options.onComplete&&this.options.onComplete(this.api,this),setTimeout(Docs.shebang.bind(this),100)},buildUrl:function(e,n){if(0===n.indexOf("/")){var t=e.split("/");return e=t[0]+"//"+t[2],e+n}var a=e.length;return e.indexOf("?")>-1&&(a=Math.min(a,e.indexOf("?"))),e.indexOf("#")>-1&&(a=Math.min(a,e.indexOf("#"))),e=e.substring(0,a),-1!==e.indexOf("/",e.length-1)?e+n:e+"/"+n},showMessage:function(e){void 0===e&&(e=""),$("#message-bar").removeClass("message-fail"),$("#message-bar").addClass("message-success"),$("#message-bar").html(e)},onLoadFailure:function(e){void 0===e&&(e=""),$("#message-bar").removeClass("message-success"),$("#message-bar").addClass("message-fail");var n=$("#message-bar").html(e);return this.options.onFailure&&this.options.onFailure(e),n},renderGFM:function(){$(".markdown").each(function(){$(this).html(marked($(this).html()))})}});window.SwaggerUi=e,window.SwaggerUi.Views={},function(){function n(e){"console"in window&&"function"==typeof window.console.warn&&console.warn(e)}window.authorizations={add:function(){if(n("Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add()."),"undefined"==typeof window.swaggerUi)throw new TypeError("window.swaggerUi is not defined");window.swaggerUi instanceof e&&window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations,arguments)}},window.ApiKeyAuthorization=function(){n("window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization."),SwaggerClient.ApiKeyAuthorization.apply(window,arguments)},window.PasswordAuthorization=function(){n("window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization."),SwaggerClient.PasswordAuthorization.apply(window,arguments)}}(),function(e,n){"function"==typeof define&&define.amd?define(["b"],function(t){return e.SwaggerUi=n(t)}):"object"==typeof exports?module.exports=n(require("b")):e.SwaggerUi=n(e.b)}(this,function(){return e}),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,n,t,a){var i,s="function",l=n.helperMissing,r=this.escapeExpression;return"\n