rollback swagger-static template

This commit is contained in:
wing328 2015-06-09 12:58:41 +08:00
parent f2ee63da3b
commit d8060f47a8
11 changed files with 5674 additions and 8754 deletions

View File

@ -67,7 +67,7 @@ sub {
}
img {
width: auto \9;
width: auto\9;
height: auto;
max-width: 100%;
vertical-align: middle;
@ -144,56 +144,45 @@ textarea {
background: transparent !important;
box-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page {
margin: 0.5cm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;

View File

@ -105,7 +105,7 @@
font-weight: bold;
font-size: 15px;
padding: 6px 0;
color: rgb(57, 57, 57);
color: rgb(57,57,57);
}
.content {
@ -157,7 +157,7 @@ li.parameter {
padding-left: 1em;
}
.param {
.param{
display: block;
}
@ -169,7 +169,6 @@ li.parameter {
font-weight: bold;
font-size: 1.1em;
}
.param-type {
margin-left: 1em;
font-style: italic;

View File

@ -34,14 +34,14 @@
var el = document.createElement('bootstrap')
, transEndEventNames = {
'WebkitTransition': 'webkitTransitionEnd'
, 'MozTransition': 'transitionend'
, 'OTransition': 'oTransitionEnd otransitionend'
, 'transition': 'transitionend'
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd otransitionend'
, 'transition' : 'transitionend'
}
, name
for (name in transEndEventNames) {
for (name in transEndEventNames){
if (el.style[name] !== undefined) {
return transEndEventNames[name]
}
@ -57,8 +57,7 @@
})
}(window.jQuery);
/* ==========================================================
}(window.jQuery);/* ==========================================================
* bootstrap-alert.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
@ -156,8 +155,7 @@
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
}(window.jQuery);
/* ============================================================
}(window.jQuery);/* ============================================================
* bootstrap-button.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
@ -261,8 +259,7 @@
$btn.button('toggle')
})
}(window.jQuery);
/* ==========================================================
}(window.jQuery);/* ==========================================================
* bootstrap-carousel.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#carousel
* ==========================================================
@ -382,9 +379,7 @@
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () {
that.$element.trigger('slid')
}, 0)
setTimeout(function () { that.$element.trigger('slid') }, 0)
})
} else {
this.$element.trigger(e)
@ -448,8 +443,7 @@
e.preventDefault()
})
}(window.jQuery);
/* =============================================================
}(window.jQuery);/* =============================================================
* bootstrap-collapse.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#collapse
* =============================================================
@ -615,8 +609,7 @@
$(target).collapse(option)
})
}(window.jQuery);
/* ============================================================
}(window.jQuery);/* ============================================================
* bootstrap-dropdown.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
* ============================================================
@ -771,17 +764,12 @@
$(document)
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) {
e.stopPropagation()
})
.on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) {
e.stopPropagation()
})
.on('click.dropdown.data-api touchstart.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]', Dropdown.prototype.keydown)
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
}(window.jQuery);
/* =========================================================
}(window.jQuery);/* =========================================================
* bootstrap-modal.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
@ -857,9 +845,7 @@
that.enforceFocus()
transition ?
that.$element.one($.support.transition.end, function () {
that.$element.focus().trigger('shown')
}) :
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')
})
@ -903,7 +889,7 @@
, escape: function () {
var that = this
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.modal', function (e) {
this.$element.on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
@ -964,7 +950,7 @@
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade') ?
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
this.removeBackdrop()
@ -1016,7 +1002,7 @@
var $this = $(this)
, href = $this.attr('href')
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({remote: !/#/.test(href) && href}, $target.data(), $this.data())
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
e.preventDefault()
@ -1084,7 +1070,7 @@
}
this.options.selector ?
(this._options = $.extend({}, this.options, {trigger: 'manual', selector: ''})) :
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
@ -1108,7 +1094,7 @@
clearTimeout(this.timeout)
self.hoverState = 'in'
this.timeout = setTimeout(function () {
this.timeout = setTimeout(function() {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
@ -1120,7 +1106,7 @@
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.hoverState = 'out'
this.timeout = setTimeout(function () {
this.timeout = setTimeout(function() {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
@ -1150,7 +1136,7 @@
$tip
.detach()
.css({top: 0, left: 0, display: 'block'})
.css({ top: 0, left: 0, display: 'block' })
.insertAfter(this.$element)
pos = this.getPosition(inside)
@ -1282,7 +1268,7 @@
var old = $.fn.tooltip
$.fn.tooltip = function (option) {
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tooltip')
@ -1314,8 +1300,7 @@
return this
}
}(window.jQuery);
/* ===========================================================
}(window.jQuery);/* ===========================================================
* bootstrap-popover.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#popovers
* ===========================================================
@ -1412,14 +1397,11 @@
$.fn.popover.Constructor = Popover
$.fn.popover.defaults = $.extend({}, $.fn.tooltip.defaults, {
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
placement: 'right'
,
trigger: 'click'
,
content: ''
,
template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
, trigger: 'click'
, content: ''
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
})
@ -1431,8 +1413,7 @@
return this
}
}(window.jQuery);
/* =============================================================
}(window.jQuery);/* =============================================================
* bootstrap-scrollspy.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
@ -1493,11 +1474,9 @@
, $href = /^#\w/.test(href) && $(href)
return ( $href
&& $href.length
&& [[$href.position().top + self.$scrollElement.scrollTop(), href]] ) || null
})
.sort(function (a, b) {
return a[0] - b[0]
&& [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
self.offsets.push(this[0])
self.targets.push(this[1])
@ -1515,14 +1494,14 @@
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets.last()[0])
&& this.activate(i)
&& this.activate ( i )
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate(targets[i])
&& this.activate( targets[i] )
}
}
@ -1595,8 +1574,7 @@
})
})
}(window.jQuery);
/* ========================================================
}(window.jQuery);/* ========================================================
* bootstrap-tab.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#tabs
* ========================================================
@ -1645,7 +1623,7 @@
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
if ($this.parent('li').hasClass('active')) return
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active:last a')[0]
@ -1668,7 +1646,7 @@
})
}
, activate: function (element, container, callback) {
, activate: function ( element, container, callback) {
var $active = container.find('> .active')
, transition = callback
&& $.support.transition
@ -1689,7 +1667,7 @@
element.removeClass('fade')
}
if (element.parent('.dropdown-menu')) {
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
@ -1710,7 +1688,7 @@
var old = $.fn.tab
$.fn.tab = function (option) {
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tab')
@ -1739,8 +1717,7 @@
$(this).tab('show')
})
}(window.jQuery);
/* =============================================================
}(window.jQuery);/* =============================================================
* bootstrap-typeahead.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* =============================================================
@ -1760,7 +1737,7 @@
* ============================================================ */
!function ($) {
!function($){
"use strict"; // jshint ;_;
@ -1927,7 +1904,7 @@
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}
, eventSupported: function (eventName) {
, eventSupported: function(eventName) {
var isSupported = eventName in this.$element
if (!isSupported) {
this.$element.setAttribute(eventName, 'return;')
@ -1939,7 +1916,7 @@
, move: function (e) {
if (!this.shown) return
switch (e.keyCode) {
switch(e.keyCode) {
case 9: // tab
case 13: // enter
case 27: // escape
@ -1961,7 +1938,7 @@
}
, keydown: function (e) {
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40, 38, 9, 13, 27])
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
this.move(e)
}
@ -1971,7 +1948,7 @@
}
, keyup: function (e) {
switch (e.keyCode) {
switch(e.keyCode) {
case 40: // down arrow
case 38: // up arrow
case 16: // shift
@ -2000,9 +1977,7 @@
, blur: function (e) {
var that = this
setTimeout(function () {
that.hide()
}, 150)
setTimeout(function () { that.hide() }, 150)
}
, click: function (e) {
@ -2097,9 +2072,7 @@
this.options = $.extend({}, $.fn.affix.defaults, options)
this.$window = $(window)
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.affix.data-api', $.proxy(function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}, this))
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
this.$element = $(element)
this.checkPosition()
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
window.onhashchange = function () {
window.onhashchange = function() {
choose(window.location.href.toString());
}
@ -6,20 +6,20 @@ var selectionImage;
function choose(url) {
var f = url.split("/").slice(-1)[0].split("?")[0];
if (f.match(/#/g) && f.match(/#/g).length > 0) {
if(f.match(/#/g) && f.match(/#/g).length > 0) {
f = f.split("#")[0];
}
$('div.non-sidebar').empty();
$('div.non-sidebar').load("operations/" + f + ".html", function () {
$('div.non-sidebar').load("operations/" + f + ".html", function(){
goToAnchor();
// rebind the models
$(".model a").on("click", function (e) {
$(".model a").on("click", function(e){
e.preventDefault();
var model = $(this).parent().attr("data-model")
var parentOffset = $(this).parent().offset();
var encodedWord = encodeURI(model);
if (!selectionImage) {
if(!selectionImage) {
selectionImage = $('<div>').attr({
title: 'Model detail',
target: '_blank',
@ -29,7 +29,7 @@ function choose(url) {
}
selectionImage.load("models/" + encodedWord + ".html")
selectionImage.attr('href', url.replace('{term}', encodeURI(model))).css({
selectionImage.attr('href',url.replace('{term}',encodeURI(model))).css({
left: e.pageX + 20,
top: e.pageY - 10,
position: "absolute"
@ -37,10 +37,10 @@ function choose(url) {
})
});
$("body").on("click", function (e) {
$("body").on("click",function(e) {
var target = $(e.target);
if (target.parents(".model-detail-popup").length == 0 && target.parents('.model').length != 1) {
if (document.querySelector('.model-detail-popup')) {
if(document.querySelector('.model-detail-popup')) {
document.querySelector('.model-detail-popup').style.display = 'none';
}
}
@ -50,20 +50,21 @@ function choose(url) {
function goToAnchor() {
var doARead = $($('a')[0]).offset();
var anchorArr = window.location.href.toString().split("#");
if (anchorArr.length > 2) {
var anchor = anchorArr[anchorArr.length - 1];
window.scrollTo(0, $('a[name=' + anchor + ']').offset().top - 80);
if(anchorArr.length > 2) {
var anchor = anchorArr[anchorArr.length-1];
window.scrollTo(0,$('a[name='+anchor+']').offset().top - 80);
}
}
function resize() {
$(".sidebar").css('height', $(window).height() - 60);
$("#content-window").css('height', $(window).height() - 60);
function resize()
{
$(".sidebar").css('height', $(window).height() -60);
$("#content-window").css('height', $(window).height() -60);
}
$(function () {
$(function(){
window.onresize = resize;
resize();
$(window).bind('hashchange', function () {
$(window).bind('hashchange', function() {
choose(window.location.href.toString());
});
});

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.css" media="screen">
@ -12,13 +12,13 @@
<title>REST API Resources</title>
</head>
<body>
<div class="header">
<div class="header">
<div class="top-bar">
<h1 id="logo"><a class="logo" href="/"><span>Swagger</span><span class="light">API Docs</span></a></h1>
</div>
</div>
<div class="model-container"></div>
<div class="content">
</div>
<div class="model-container"></div>
<div class="content">
<div class="box clearfix">
<div class="sidebar">
<div class="section-box">
@ -49,9 +49,7 @@
<div class="non-sidebar">
<div class="main-content">
<h2>Getting Started</h2>
<p>To begin using your fancy HTTP API, follow the steps below.</p>
<p>You can add some helpful tips, here</p>
</div>
</div>

View File

@ -1,13 +1,13 @@
{{#models}}
{{#model}}
{{#model}}
<h2>{{classname}}</h2>
<h2>{{classname}}</h2>
{{#vars}}
<ul class="parameter">
<ul class="parameter">
<li class="param-required-{{required}}">{{name}} : {{datatype}}
<br/>{{description}}
</li>
</ul>
</ul>
{{/vars}}
{{/model}}
{{/model}}
{{/models}}

View File

@ -1,6 +1,5 @@
<div class="main-content">
<h2><a name="{{className}}"></a>{{className}}</h2>
<p>This is the {{className}} API</p>
{{#operations}}
@ -11,12 +10,9 @@
{{#notes}}<p>{{notes}}</p>{{/notes}}
<h3 class="section">URL</h3>
<code>{{basePath}}{{path}}</code>
<h3 class="section">HTTP Method</h3>
<code>{{httpMethod}}</code>
<h3 class="section">Response Type</h3>
<div class="model" data-model="{{returnBaseType}}"><a href="">{{returnType}}</a></div>
<h3 class="section">Parameters</h3>
<ul>

View File

@ -1,12 +1,12 @@
{
"name": "swagger-docs",
"version": "1.0.0",
"main": "main.js",
"engines": {
"node": ">= 0.8.x"
},
"dependencies": {
"express": "3.x"
},
"license": "apache 2.0"
"name": "swagger-docs",
"version": "1.0.0",
"main": "main.js",
"engines": {
"node": ">= 0.8.x"
},
"dependencies": {
"express": "3.x"
},
"license": "apache 2.0"
}

View File

@ -1,4 +1,4 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>