Merge branch 'bodnia-performance'

This commit is contained in:
Tony Tam
2016-02-22 07:48:15 -08:00
18 changed files with 1083 additions and 613 deletions

61
dist/css/print.css vendored
View File

@@ -120,6 +120,67 @@
.swagger-section pre .xml .cdata {
opacity: 0.5;
}
.swagger-section .hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
.swagger-section .hljs,
.swagger-section .hljs-subst {
color: #444;
}
.swagger-section .hljs-keyword,
.swagger-section .hljs-attribute,
.swagger-section .hljs-selector-tag,
.swagger-section .hljs-meta-keyword,
.swagger-section .hljs-doctag,
.swagger-section .hljs-name {
font-weight: bold;
}
.swagger-section .hljs-built_in,
.swagger-section .hljs-literal,
.swagger-section .hljs-bullet,
.swagger-section .hljs-code,
.swagger-section .hljs-addition {
color: #1F811F;
}
.swagger-section .hljs-regexp,
.swagger-section .hljs-symbol,
.swagger-section .hljs-variable,
.swagger-section .hljs-template-variable,
.swagger-section .hljs-link,
.swagger-section .hljs-selector-attr,
.swagger-section .hljs-selector-pseudo {
color: #BC6060;
}
.swagger-section .hljs-type,
.swagger-section .hljs-string,
.swagger-section .hljs-number,
.swagger-section .hljs-selector-id,
.swagger-section .hljs-selector-class,
.swagger-section .hljs-quote,
.swagger-section .hljs-template-tag,
.swagger-section .hljs-deletion {
color: #880000;
}
.swagger-section .hljs-title,
.swagger-section .hljs-section {
color: #880000;
font-weight: bold;
}
.swagger-section .hljs-comment {
color: #888888;
}
.swagger-section .hljs-meta {
color: #2B6EA1;
}
.swagger-section .hljs-emphasis {
font-style: italic;
}
.swagger-section .hljs-strong {
font-weight: bold;
}
.swagger-section .swagger-ui-wrap {
line-height: 1;
font-family: "Droid Sans", sans-serif;

61
dist/css/screen.css vendored
View File

@@ -120,6 +120,67 @@
.swagger-section pre .xml .cdata {
opacity: 0.5;
}
.swagger-section .hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
.swagger-section .hljs,
.swagger-section .hljs-subst {
color: #444;
}
.swagger-section .hljs-keyword,
.swagger-section .hljs-attribute,
.swagger-section .hljs-selector-tag,
.swagger-section .hljs-meta-keyword,
.swagger-section .hljs-doctag,
.swagger-section .hljs-name {
font-weight: bold;
}
.swagger-section .hljs-built_in,
.swagger-section .hljs-literal,
.swagger-section .hljs-bullet,
.swagger-section .hljs-code,
.swagger-section .hljs-addition {
color: #1F811F;
}
.swagger-section .hljs-regexp,
.swagger-section .hljs-symbol,
.swagger-section .hljs-variable,
.swagger-section .hljs-template-variable,
.swagger-section .hljs-link,
.swagger-section .hljs-selector-attr,
.swagger-section .hljs-selector-pseudo {
color: #BC6060;
}
.swagger-section .hljs-type,
.swagger-section .hljs-string,
.swagger-section .hljs-number,
.swagger-section .hljs-selector-id,
.swagger-section .hljs-selector-class,
.swagger-section .hljs-quote,
.swagger-section .hljs-template-tag,
.swagger-section .hljs-deletion {
color: #880000;
}
.swagger-section .hljs-title,
.swagger-section .hljs-section {
color: #880000;
font-weight: bold;
}
.swagger-section .hljs-comment {
color: #888888;
}
.swagger-section .hljs-meta {
color: #2B6EA1;
}
.swagger-section .hljs-emphasis {
font-style: italic;
}
.swagger-section .hljs-strong {
font-weight: bold;
}
.swagger-section .swagger-ui-wrap {
line-height: 1;
font-family: "Droid Sans", sans-serif;

8
dist/index.html vendored
View File

@@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
<head>
@@ -20,7 +19,8 @@
<script src='lib/lodash.min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
<script src='lib/jsoneditor.min.js' type='text/javascript'></script>
<script src='lib/marked.js' type='text/javascript'></script>
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
@@ -39,6 +39,10 @@
url = "http://petstore.swagger.io/v2/swagger.json";
}
hljs.configure({
highlightSizeThreshold: 5000
});
// Pre load translate...
if(window.SwaggerTranslator) {
window.SwaggerTranslator.translate();

File diff suppressed because one or more lines are too long

2
dist/lib/highlight.9.1.0.pack.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
'use strict';
(function () {
var configure, highlightBlock;
configure = hljs.configure;
// "extending" hljs.configure method
hljs.configure = function _configure (options) {
var size = options.highlightSizeThreshold;
// added highlightSizeThreshold option to set maximum size
// of processed string. Set to null if not a number
hljs.highlightSizeThreshold = size === +size ? size : null;
configure.call(this, options);
};
highlightBlock = hljs.highlightBlock;
// "extending" hljs.highlightBlock method
hljs.highlightBlock = function _highlightBlock (el) {
var innerHTML = el.innerHTML;
var size = hljs.highlightSizeThreshold;
// check if highlightSizeThreshold is not set or element innerHTML
// is less than set option highlightSizeThreshold
if (size == null || size > innerHTML.length) {
// proceed with hljs.highlightBlock
highlightBlock.call(hljs, el);
}
};
})();

View File

@@ -212,7 +212,7 @@ function initOAuth(opts) {
return;
}
//$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
$('.api-ic').unbind();
$('.api-ic').click(function(s) {
if($(s.target).hasClass('ic-off'))

1235
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
'use strict';
(function () {
var configure, highlightBlock;
configure = hljs.configure;
// "extending" hljs.configure method
hljs.configure = function _configure (options) {
var size = options.highlightSizeThreshold;
// added highlightSizeThreshold option to set maximum size
// of processed string. Set to null if not a number
hljs.highlightSizeThreshold = size === +size ? size : null;
configure.call(this, options);
};
highlightBlock = hljs.highlightBlock;
// "extending" hljs.highlightBlock method
hljs.highlightBlock = function _highlightBlock (el) {
var innerHTML = el.innerHTML;
var size = hljs.highlightSizeThreshold;
// check if highlightSizeThreshold is not set or element innerHTML
// is less than set option highlightSizeThreshold
if (size == null || size > innerHTML.length) {
// proceed with hljs.highlightBlock
highlightBlock.call(hljs, el);
}
};
})();

View File

@@ -212,7 +212,7 @@ function initOAuth(opts) {
return;
}
//$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
$('.api-ic').unbind();
$('.api-ic').click(function(s) {
if($(s.target).hasClass('ic-off'))

View File

@@ -120,6 +120,67 @@
.swagger-section pre .xml .cdata {
opacity: 0.5;
}
.swagger-section .hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
.swagger-section .hljs,
.swagger-section .hljs-subst {
color: #444;
}
.swagger-section .hljs-keyword,
.swagger-section .hljs-attribute,
.swagger-section .hljs-selector-tag,
.swagger-section .hljs-meta-keyword,
.swagger-section .hljs-doctag,
.swagger-section .hljs-name {
font-weight: bold;
}
.swagger-section .hljs-built_in,
.swagger-section .hljs-literal,
.swagger-section .hljs-bullet,
.swagger-section .hljs-code,
.swagger-section .hljs-addition {
color: #1F811F;
}
.swagger-section .hljs-regexp,
.swagger-section .hljs-symbol,
.swagger-section .hljs-variable,
.swagger-section .hljs-template-variable,
.swagger-section .hljs-link,
.swagger-section .hljs-selector-attr,
.swagger-section .hljs-selector-pseudo {
color: #BC6060;
}
.swagger-section .hljs-type,
.swagger-section .hljs-string,
.swagger-section .hljs-number,
.swagger-section .hljs-selector-id,
.swagger-section .hljs-selector-class,
.swagger-section .hljs-quote,
.swagger-section .hljs-template-tag,
.swagger-section .hljs-deletion {
color: #880000;
}
.swagger-section .hljs-title,
.swagger-section .hljs-section {
color: #880000;
font-weight: bold;
}
.swagger-section .hljs-comment {
color: #888888;
}
.swagger-section .hljs-meta {
color: #2B6EA1;
}
.swagger-section .hljs-emphasis {
font-style: italic;
}
.swagger-section .hljs-strong {
font-weight: bold;
}
.swagger-section .swagger-ui-wrap {
line-height: 1;
font-family: "Droid Sans", sans-serif;

View File

@@ -120,6 +120,67 @@
.swagger-section pre .xml .cdata {
opacity: 0.5;
}
.swagger-section .hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
.swagger-section .hljs,
.swagger-section .hljs-subst {
color: #444;
}
.swagger-section .hljs-keyword,
.swagger-section .hljs-attribute,
.swagger-section .hljs-selector-tag,
.swagger-section .hljs-meta-keyword,
.swagger-section .hljs-doctag,
.swagger-section .hljs-name {
font-weight: bold;
}
.swagger-section .hljs-built_in,
.swagger-section .hljs-literal,
.swagger-section .hljs-bullet,
.swagger-section .hljs-code,
.swagger-section .hljs-addition {
color: #1F811F;
}
.swagger-section .hljs-regexp,
.swagger-section .hljs-symbol,
.swagger-section .hljs-variable,
.swagger-section .hljs-template-variable,
.swagger-section .hljs-link,
.swagger-section .hljs-selector-attr,
.swagger-section .hljs-selector-pseudo {
color: #BC6060;
}
.swagger-section .hljs-type,
.swagger-section .hljs-string,
.swagger-section .hljs-number,
.swagger-section .hljs-selector-id,
.swagger-section .hljs-selector-class,
.swagger-section .hljs-quote,
.swagger-section .hljs-template-tag,
.swagger-section .hljs-deletion {
color: #880000;
}
.swagger-section .hljs-title,
.swagger-section .hljs-section {
color: #880000;
font-weight: bold;
}
.swagger-section .hljs-comment {
color: #888888;
}
.swagger-section .hljs-meta {
color: #2B6EA1;
}
.swagger-section .hljs-emphasis {
font-style: italic;
}
.swagger-section .hljs-strong {
font-weight: bold;
}
.swagger-section .swagger-ui-wrap {
line-height: 1;
font-family: "Droid Sans", sans-serif;

View File

@@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
<head>
@@ -20,7 +19,8 @@
<script src='lib/lodash.min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
<script src='lib/jsoneditor.min.js' type='text/javascript'></script>
<script src='lib/marked.js' type='text/javascript'></script>
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
@@ -39,6 +39,10 @@
url = "http://petstore.swagger.io/v2/swagger.json";
}
hljs.configure({
highlightSizeThreshold: 5000
});
// Pre load translate...
if(window.SwaggerTranslator) {
window.SwaggerTranslator.translate();

View File

@@ -1,4 +1,5 @@
'use strict';
/*jslint eqeq: true*/
Handlebars.registerHelper('sanitize', function(html) {
// Strip the script tags from the html, and return it as a Handlebars.SafeString
@@ -51,3 +52,27 @@ Handlebars.registerHelper('renderTextParam', function(param) {
}
return new Handlebars.SafeString(result);
});
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '<':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case '<=':
return (v1 <= v2) ? options.fn(this) : options.inverse(this);
case '>':
return (v1 > v2) ? options.fn(this) : options.inverse(this);
case '>=':
return (v1 >= v2) ? options.fn(this) : options.inverse(this);
case '&&':
return (v1 && v2) ? options.fn(this) : options.inverse(this);
case '||':
return (v1 || v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});

View File

@@ -132,4 +132,76 @@ pre .xml .cdata {
opacity: 0.5;
}
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0
}
.hljs,
.hljs-subst {
color: #444
}
.hljs-keyword,
.hljs-attribute,
.hljs-selector-tag,
.hljs-meta-keyword,
.hljs-doctag,
.hljs-name {
font-weight: bold
}
.hljs-built_in,
.hljs-literal,
.hljs-bullet,
.hljs-code,
.hljs-addition {
color: #1F811F
}
.hljs-regexp,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #BC6060
}
.hljs-type,
.hljs-string,
.hljs-number,
.hljs-selector-id,
.hljs-selector-class,
.hljs-quote,
.hljs-template-tag,
.hljs-deletion {
color: #880000
}
.hljs-title,
.hljs-section {
color: #880000;
font-weight: bold
}
.hljs-comment {
color: #888888
}
.hljs-meta {
color: #2B6EA1
}
.hljs-emphasis {
font-style: italic
}
.hljs-strong {
font-weight: bold
}
}