forked from swagger-api/swagger-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,908 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<html> | ||
<head> | ||
<title>Swagger UI</title> | ||
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/> | ||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> | ||
<script src='lib/jquery.min.js' type='text/javascript'></script> | ||
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script> | ||
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script> | ||
<script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script> | ||
<script src='lib/handlebars.runtime-1.0.0.beta.6.js' type='text/javascript'></script> | ||
<script src='lib/underscore-min.js' type='text/javascript'></script> | ||
<script src='lib/backbone-min.js' type='text/javascript'></script> | ||
<script src='lib/swagger.js' type='text/javascript'></script> | ||
<script src='swagger-ui.js' type='text/javascript'></script> | ||
|
||
<style type="text/css"> | ||
.swagger-ui-wrap { | ||
max-width: 960px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
.icon-btn { | ||
cursor: pointer; | ||
} | ||
|
||
#message-bar { | ||
min-height: 30px; | ||
text-align: center; | ||
padding-top: 10px; | ||
} | ||
|
||
.message-success { | ||
color: #89BF04; | ||
} | ||
|
||
.message-fail { | ||
color: #cc0000; | ||
} | ||
</style> | ||
|
||
<script type="text/javascript"> | ||
$(function () { | ||
window.ui = new SwaggerUi({ | ||
discoveryUrl:"http://petstore.swagger.wordnik.com/api/resources.json", | ||
apiKey:"special-key", | ||
dom_id:"swagger-ui-container", | ||
supportHeaderParams: false | ||
}); | ||
}); | ||
|
||
</script> | ||
</head> | ||
|
||
<body> | ||
<div id='header'> | ||
<div class="swagger-ui-wrap"> | ||
<a id="logo" href="http://swagger.wordnik.com">swagger</a> | ||
|
||
<form id='api_selector'> | ||
<div class='input icon-btn'> | ||
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis"> | ||
</div> | ||
<div class='input icon-btn'> | ||
<img id="show-wordnik-dev-icon" src="images/wordnik_api.png" title="Show Wordnik Developer Apis"> | ||
</div> | ||
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" | ||
type="text"/></div> | ||
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div> | ||
<div class='input'><a id="explore" href="#">Explore</a></div> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<div id="message-bar" class="swagger-ui-wrap"> | ||
| ||
</div> | ||
|
||
<div id="swagger-ui-container" class="swagger-ui-wrap"> | ||
|
||
</div> | ||
|
||
</body> | ||
|
||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
// lib/handlebars/base.js | ||
var Handlebars = {}; | ||
|
||
Handlebars.VERSION = "1.0.beta.6"; | ||
|
||
Handlebars.helpers = {}; | ||
Handlebars.partials = {}; | ||
|
||
Handlebars.registerHelper = function(name, fn, inverse) { | ||
if(inverse) { fn.not = inverse; } | ||
this.helpers[name] = fn; | ||
}; | ||
|
||
Handlebars.registerPartial = function(name, str) { | ||
this.partials[name] = str; | ||
}; | ||
|
||
Handlebars.registerHelper('helperMissing', function(arg) { | ||
if(arguments.length === 2) { | ||
return undefined; | ||
} else { | ||
throw new Error("Could not find property '" + arg + "'"); | ||
} | ||
}); | ||
|
||
var toString = Object.prototype.toString, functionType = "[object Function]"; | ||
|
||
Handlebars.registerHelper('blockHelperMissing', function(context, options) { | ||
var inverse = options.inverse || function() {}, fn = options.fn; | ||
|
||
|
||
var ret = ""; | ||
var type = toString.call(context); | ||
|
||
if(type === functionType) { context = context.call(this); } | ||
|
||
if(context === true) { | ||
return fn(this); | ||
} else if(context === false || context == null) { | ||
return inverse(this); | ||
} else if(type === "[object Array]") { | ||
if(context.length > 0) { | ||
for(var i=0, j=context.length; i<j; i++) { | ||
ret = ret + fn(context[i]); | ||
} | ||
} else { | ||
ret = inverse(this); | ||
} | ||
return ret; | ||
} else { | ||
return fn(context); | ||
} | ||
}); | ||
|
||
Handlebars.registerHelper('each', function(context, options) { | ||
var fn = options.fn, inverse = options.inverse; | ||
var ret = ""; | ||
|
||
if(context && context.length > 0) { | ||
for(var i=0, j=context.length; i<j; i++) { | ||
ret = ret + fn(context[i]); | ||
} | ||
} else { | ||
ret = inverse(this); | ||
} | ||
return ret; | ||
}); | ||
|
||
Handlebars.registerHelper('if', function(context, options) { | ||
var type = toString.call(context); | ||
if(type === functionType) { context = context.call(this); } | ||
|
||
if(!context || Handlebars.Utils.isEmpty(context)) { | ||
return options.inverse(this); | ||
} else { | ||
return options.fn(this); | ||
} | ||
}); | ||
|
||
Handlebars.registerHelper('unless', function(context, options) { | ||
var fn = options.fn, inverse = options.inverse; | ||
options.fn = inverse; | ||
options.inverse = fn; | ||
|
||
return Handlebars.helpers['if'].call(this, context, options); | ||
}); | ||
|
||
Handlebars.registerHelper('with', function(context, options) { | ||
return options.fn(context); | ||
}); | ||
|
||
Handlebars.registerHelper('log', function(context) { | ||
Handlebars.log(context); | ||
}); | ||
; | ||
// lib/handlebars/utils.js | ||
Handlebars.Exception = function(message) { | ||
var tmp = Error.prototype.constructor.apply(this, arguments); | ||
|
||
for (var p in tmp) { | ||
if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; } | ||
} | ||
|
||
this.message = tmp.message; | ||
}; | ||
Handlebars.Exception.prototype = new Error; | ||
|
||
// Build out our basic SafeString type | ||
Handlebars.SafeString = function(string) { | ||
this.string = string; | ||
}; | ||
Handlebars.SafeString.prototype.toString = function() { | ||
return this.string.toString(); | ||
}; | ||
|
||
(function() { | ||
var escape = { | ||
"<": "<", | ||
">": ">", | ||
'"': """, | ||
"'": "'", | ||
"`": "`" | ||
}; | ||
|
||
var badChars = /&(?!\w+;)|[<>"'`]/g; | ||
var possible = /[&<>"'`]/; | ||
|
||
var escapeChar = function(chr) { | ||
return escape[chr] || "&"; | ||
}; | ||
|
||
Handlebars.Utils = { | ||
escapeExpression: function(string) { | ||
// don't escape SafeStrings, since they're already safe | ||
if (string instanceof Handlebars.SafeString) { | ||
return string.toString(); | ||
} else if (string == null || string === false) { | ||
return ""; | ||
} | ||
|
||
if(!possible.test(string)) { return string; } | ||
return string.replace(badChars, escapeChar); | ||
}, | ||
|
||
isEmpty: function(value) { | ||
if (typeof value === "undefined") { | ||
return true; | ||
} else if (value === null) { | ||
return true; | ||
} else if (value === false) { | ||
return true; | ||
} else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
}; | ||
})();; | ||
// lib/handlebars/runtime.js | ||
Handlebars.VM = { | ||
template: function(templateSpec) { | ||
// Just add water | ||
var container = { | ||
escapeExpression: Handlebars.Utils.escapeExpression, | ||
invokePartial: Handlebars.VM.invokePartial, | ||
programs: [], | ||
program: function(i, fn, data) { | ||
var programWrapper = this.programs[i]; | ||
if(data) { | ||
return Handlebars.VM.program(fn, data); | ||
} else if(programWrapper) { | ||
return programWrapper; | ||
} else { | ||
programWrapper = this.programs[i] = Handlebars.VM.program(fn); | ||
return programWrapper; | ||
} | ||
}, | ||
programWithDepth: Handlebars.VM.programWithDepth, | ||
noop: Handlebars.VM.noop | ||
}; | ||
|
||
return function(context, options) { | ||
options = options || {}; | ||
return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data); | ||
}; | ||
}, | ||
|
||
programWithDepth: function(fn, data, $depth) { | ||
var args = Array.prototype.slice.call(arguments, 2); | ||
|
||
return function(context, options) { | ||
options = options || {}; | ||
|
||
return fn.apply(this, [context, options.data || data].concat(args)); | ||
}; | ||
}, | ||
program: function(fn, data) { | ||
return function(context, options) { | ||
options = options || {}; | ||
|
||
return fn(context, options.data || data); | ||
}; | ||
}, | ||
noop: function() { return ""; }, | ||
invokePartial: function(partial, name, context, helpers, partials, data) { | ||
options = { helpers: helpers, partials: partials, data: data }; | ||
|
||
if(partial === undefined) { | ||
throw new Handlebars.Exception("The partial " + name + " could not be found"); | ||
} else if(partial instanceof Function) { | ||
return partial(context, options); | ||
} else if (!Handlebars.compile) { | ||
throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); | ||
} else { | ||
partials[name] = Handlebars.compile(partial); | ||
return partials[name](context, options); | ||
} | ||
} | ||
}; | ||
|
||
Handlebars.template = Handlebars.VM.template; | ||
; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
jQuery Wiggle | ||
Author: WonderGroup, Jordan Thomas | ||
URL: http://labs.wondergroup.com/demos/mini-ui/index.html | ||
License: MIT (http://en.wikipedia.org/wiki/MIT_License) | ||
*/ | ||
jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);} | ||
if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; |
Oops, something went wrong.