From 1902f301a75ee4e2c7a200a3653e3136859f7beb Mon Sep 17 00:00:00 2001 From: Napster Date: Thu, 6 Mar 2014 12:56:06 +0100 Subject: [PATCH] merged with https://github.com/wordnik/swagger-ui/pull/413 --- .../rest_framework_swagger/swagger-ui.js | 165 ++++++++---------- .../rest_framework_swagger/swagger-ui.min.js | 2 +- 2 files changed, 77 insertions(+), 90 deletions(-) diff --git a/rest_framework_swagger/static/rest_framework_swagger/swagger-ui.js b/rest_framework_swagger/static/rest_framework_swagger/swagger-ui.js index a625c42..e271409 100755 --- a/rest_framework_swagger/static/rest_framework_swagger/swagger-ui.js +++ b/rest_framework_swagger/static/rest_framework_swagger/swagger-ui.js @@ -62,9 +62,14 @@ function clippyCopiedCallback(a) { } // Logging function that accounts for browsers that don't have window.console -function log() { - if (window.console) console.log.apply(console,arguments); -} +log = function(){ + log.history = log.history || []; + log.history.push(arguments); + if(this.console){ + console.log( Array.prototype.slice.call(arguments) ); + } +}; + // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) if (Function.prototype.bind && console && typeof console.log == "object") { [ @@ -86,7 +91,7 @@ var Docs = { switch (fragments.length) { case 1: // Expand all operations for the resource and scroll to it -// log('shebang resource:' + fragments[0]); + log('shebang resource:' + fragments[0]); var dom_id = 'resource_' + fragments[0]; Docs.expandEndpointListForResource(fragments[0]); @@ -94,18 +99,18 @@ var Docs = { break; case 2: // Refer to the endpoint DOM element, e.g. #words_get_search -// log('shebang endpoint: ' + fragments.join('_')); + log('shebang endpoint: ' + fragments.join('_')); - // Expand Resource - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); + // Expand Resource + Docs.expandEndpointListForResource(fragments[0]); + $("#"+dom_id).slideto({highlight: false}); - // Expand operation + // Expand operation var li_dom_id = fragments.join('_'); var li_content_dom_id = li_dom_id + "_content"; -// log("li_dom_id " + li_dom_id); -// log("li_content_dom_id " + li_content_dom_id); + log("li_dom_id " + li_dom_id); + log("li_content_dom_id " + li_content_dom_id); Docs.expandOperation($('#'+li_content_dom_id)); $('#'+li_dom_id).slideto({highlight: false}); @@ -180,9 +185,7 @@ var Docs = { collapseOperation: function(elem) { elem.slideUp(); } - -}; -(function() { +};(function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; @@ -360,96 +363,56 @@ function program11(depth0,data) { else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + " operation' id='"; - if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } + if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); } + else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "_"; if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "_"; - if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "_"; - if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "'>\n
\n

\n \n "; if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "\n \n \n "; if (stack1 = helpers.path) { stack1 = stack1.call(depth0, {hash:{},data:data}); } else { stack1 = depth0.path; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } buffer += escapeExpression(stack1) + "\n \n

\n \n
\n