ie8 fixes
This commit is contained in:
15
dist/lib/swagger.js
vendored
15
dist/lib/swagger.js
vendored
@@ -1,5 +1,5 @@
|
||||
// swagger.js
|
||||
// version 2.0.21
|
||||
// version 2.0.22
|
||||
|
||||
var __bind = function(fn, me){
|
||||
return function(){
|
||||
@@ -15,6 +15,15 @@ log = function(){
|
||||
}
|
||||
};
|
||||
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(obj, start) {
|
||||
for (var i = (start || 0), j = this.length; i < j; i++) {
|
||||
if (this[i] === obj) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
var SwaggerApi = function(url, options) {
|
||||
this.url = null;
|
||||
this.debug = false;
|
||||
@@ -949,7 +958,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
}
|
||||
}
|
||||
|
||||
responseContentType = null;
|
||||
var responseContentType = null;
|
||||
if (this.opts.responseContentType) {
|
||||
responseContentType = this.opts.responseContentType;
|
||||
} else {
|
||||
@@ -1116,7 +1125,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
headers: headers
|
||||
};
|
||||
|
||||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
|
||||
var contentType = (headers["content-type"]||headers["Content-Type"]||null)
|
||||
|
||||
if(contentType != null) {
|
||||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
||||
|
||||
373
dist/swagger-ui.js
vendored
373
dist/swagger-ui.js
vendored
@@ -1,187 +1,192 @@
|
||||
$(function() {
|
||||
|
||||
// Helper function for vertically aligning DOM elements
|
||||
// http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
|
||||
$.fn.vAlign = function() {
|
||||
return this.each(function(i){
|
||||
var ah = $(this).height();
|
||||
var ph = $(this).parent().height();
|
||||
var mh = (ph - ah) / 2;
|
||||
$(this).css('margin-top', mh);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.stretchFormtasticInputWidthToParent = function() {
|
||||
return this.each(function(i){
|
||||
var p_width = $(this).closest("form").innerWidth();
|
||||
var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
|
||||
var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
|
||||
$(this).css('width', p_width - p_padding - this_padding);
|
||||
});
|
||||
};
|
||||
|
||||
$('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
|
||||
|
||||
// Vertically center these paragraphs
|
||||
// Parent may need a min-height for this to work..
|
||||
$('ul.downplayed li div.content p').vAlign();
|
||||
|
||||
// When a sandbox form is submitted..
|
||||
$("form.sandbox").submit(function(){
|
||||
|
||||
var error_free = true;
|
||||
|
||||
// Cycle through the forms required inputs
|
||||
$(this).find("input.required").each(function() {
|
||||
|
||||
// Remove any existing error styles from the input
|
||||
$(this).removeClass('error');
|
||||
|
||||
// Tack the error style on if the input is empty..
|
||||
if ($(this).val() == '') {
|
||||
$(this).addClass('error');
|
||||
$(this).wiggle();
|
||||
error_free = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return error_free;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function clippyCopiedCallback(a) {
|
||||
$('#api_key_copied').fadeIn().delay(1000).fadeOut();
|
||||
|
||||
// var b = $("#clippy_tooltip_" + a);
|
||||
// b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
|
||||
// b.attr("title", "copy to clipboard")
|
||||
// },
|
||||
// 500))
|
||||
}
|
||||
|
||||
// Logging function that accounts for browsers that don't have window.console
|
||||
function log() {
|
||||
if (window.console) console.log.apply(console,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") {
|
||||
[
|
||||
"log","info","warn","error","assert","dir","clear","profile","profileEnd"
|
||||
].forEach(function (method) {
|
||||
console[method] = this.bind(console[method], console);
|
||||
}, Function.prototype.call);
|
||||
}
|
||||
|
||||
var Docs = {
|
||||
|
||||
shebang: function() {
|
||||
|
||||
// If shebang has an operation nickname in it..
|
||||
// e.g. /docs/#!/words/get_search
|
||||
var fragments = $.param.fragment().split('/');
|
||||
fragments.shift(); // get rid of the bang
|
||||
|
||||
switch (fragments.length) {
|
||||
case 1:
|
||||
// Expand all operations for the resource and scroll to it
|
||||
// log('shebang resource:' + fragments[0]);
|
||||
var dom_id = 'resource_' + fragments[0];
|
||||
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
break;
|
||||
case 2:
|
||||
// Refer to the endpoint DOM element, e.g. #words_get_search
|
||||
// log('shebang endpoint: ' + fragments.join('_'));
|
||||
|
||||
// Expand Resource
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
|
||||
// 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);
|
||||
|
||||
Docs.expandOperation($('#'+li_content_dom_id));
|
||||
$('#'+li_dom_id).slideto({highlight: false});
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
toggleEndpointListForResource: function(resource) {
|
||||
var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
|
||||
if (elem.is(':visible')) {
|
||||
Docs.collapseEndpointListForResource(resource);
|
||||
} else {
|
||||
Docs.expandEndpointListForResource(resource);
|
||||
}
|
||||
},
|
||||
|
||||
// Expand resource
|
||||
expandEndpointListForResource: function(resource) {
|
||||
var resource = Docs.escapeResourceName(resource);
|
||||
if (resource == '') {
|
||||
$('.resource ul.endpoints').slideDown();
|
||||
return;
|
||||
}
|
||||
|
||||
$('li#resource_' + resource).addClass('active');
|
||||
|
||||
var elem = $('li#resource_' + resource + ' ul.endpoints');
|
||||
elem.slideDown();
|
||||
},
|
||||
|
||||
// Collapse resource and mark as explicitly closed
|
||||
collapseEndpointListForResource: function(resource) {
|
||||
var resource = Docs.escapeResourceName(resource);
|
||||
$('li#resource_' + resource).removeClass('active');
|
||||
|
||||
var elem = $('li#resource_' + resource + ' ul.endpoints');
|
||||
elem.slideUp();
|
||||
},
|
||||
|
||||
expandOperationsForResource: function(resource) {
|
||||
// Make sure the resource container is open..
|
||||
Docs.expandEndpointListForResource(resource);
|
||||
|
||||
if (resource == '') {
|
||||
$('.resource ul.endpoints li.operation div.content').slideDown();
|
||||
return;
|
||||
}
|
||||
|
||||
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
|
||||
Docs.expandOperation($(this));
|
||||
});
|
||||
},
|
||||
|
||||
collapseOperationsForResource: function(resource) {
|
||||
// Make sure the resource container is open..
|
||||
Docs.expandEndpointListForResource(resource);
|
||||
|
||||
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
|
||||
Docs.collapseOperation($(this));
|
||||
});
|
||||
},
|
||||
|
||||
escapeResourceName: function(resource) {
|
||||
return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
|
||||
},
|
||||
|
||||
expandOperation: function(elem) {
|
||||
elem.slideDown();
|
||||
},
|
||||
|
||||
collapseOperation: function(elem) {
|
||||
elem.slideUp();
|
||||
}
|
||||
|
||||
};
|
||||
$(function() {
|
||||
|
||||
// Helper function for vertically aligning DOM elements
|
||||
// http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
|
||||
$.fn.vAlign = function() {
|
||||
return this.each(function(i){
|
||||
var ah = $(this).height();
|
||||
var ph = $(this).parent().height();
|
||||
var mh = (ph - ah) / 2;
|
||||
$(this).css('margin-top', mh);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.stretchFormtasticInputWidthToParent = function() {
|
||||
return this.each(function(i){
|
||||
var p_width = $(this).closest("form").innerWidth();
|
||||
var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
|
||||
var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
|
||||
$(this).css('width', p_width - p_padding - this_padding);
|
||||
});
|
||||
};
|
||||
|
||||
$('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
|
||||
|
||||
// Vertically center these paragraphs
|
||||
// Parent may need a min-height for this to work..
|
||||
$('ul.downplayed li div.content p').vAlign();
|
||||
|
||||
// When a sandbox form is submitted..
|
||||
$("form.sandbox").submit(function(){
|
||||
|
||||
var error_free = true;
|
||||
|
||||
// Cycle through the forms required inputs
|
||||
$(this).find("input.required").each(function() {
|
||||
|
||||
// Remove any existing error styles from the input
|
||||
$(this).removeClass('error');
|
||||
|
||||
// Tack the error style on if the input is empty..
|
||||
if ($(this).val() == '') {
|
||||
$(this).addClass('error');
|
||||
$(this).wiggle();
|
||||
error_free = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return error_free;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function clippyCopiedCallback(a) {
|
||||
$('#api_key_copied').fadeIn().delay(1000).fadeOut();
|
||||
|
||||
// var b = $("#clippy_tooltip_" + a);
|
||||
// b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
|
||||
// b.attr("title", "copy to clipboard")
|
||||
// },
|
||||
// 500))
|
||||
}
|
||||
|
||||
// Logging function that accounts for browsers that don't have window.console
|
||||
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") {
|
||||
[
|
||||
"log","info","warn","error","assert","dir","clear","profile","profileEnd"
|
||||
].forEach(function (method) {
|
||||
console[method] = this.bind(console[method], console);
|
||||
}, Function.prototype.call);
|
||||
}
|
||||
|
||||
var Docs = {
|
||||
|
||||
shebang: function() {
|
||||
|
||||
// If shebang has an operation nickname in it..
|
||||
// e.g. /docs/#!/words/get_search
|
||||
var fragments = $.param.fragment().split('/');
|
||||
fragments.shift(); // get rid of the bang
|
||||
|
||||
switch (fragments.length) {
|
||||
case 1:
|
||||
// Expand all operations for the resource and scroll to it
|
||||
// log('shebang resource:' + fragments[0]);
|
||||
var dom_id = 'resource_' + fragments[0];
|
||||
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
break;
|
||||
case 2:
|
||||
// Refer to the endpoint DOM element, e.g. #words_get_search
|
||||
// log('shebang endpoint: ' + fragments.join('_'));
|
||||
|
||||
// Expand Resource
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
|
||||
// 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);
|
||||
|
||||
Docs.expandOperation($('#'+li_content_dom_id));
|
||||
$('#'+li_dom_id).slideto({highlight: false});
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
toggleEndpointListForResource: function(resource) {
|
||||
var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
|
||||
if (elem.is(':visible')) {
|
||||
Docs.collapseEndpointListForResource(resource);
|
||||
} else {
|
||||
Docs.expandEndpointListForResource(resource);
|
||||
}
|
||||
},
|
||||
|
||||
// Expand resource
|
||||
expandEndpointListForResource: function(resource) {
|
||||
var resource = Docs.escapeResourceName(resource);
|
||||
if (resource == '') {
|
||||
$('.resource ul.endpoints').slideDown();
|
||||
return;
|
||||
}
|
||||
|
||||
$('li#resource_' + resource).addClass('active');
|
||||
|
||||
var elem = $('li#resource_' + resource + ' ul.endpoints');
|
||||
elem.slideDown();
|
||||
},
|
||||
|
||||
// Collapse resource and mark as explicitly closed
|
||||
collapseEndpointListForResource: function(resource) {
|
||||
var resource = Docs.escapeResourceName(resource);
|
||||
$('li#resource_' + resource).removeClass('active');
|
||||
|
||||
var elem = $('li#resource_' + resource + ' ul.endpoints');
|
||||
elem.slideUp();
|
||||
},
|
||||
|
||||
expandOperationsForResource: function(resource) {
|
||||
// Make sure the resource container is open..
|
||||
Docs.expandEndpointListForResource(resource);
|
||||
|
||||
if (resource == '') {
|
||||
$('.resource ul.endpoints li.operation div.content').slideDown();
|
||||
return;
|
||||
}
|
||||
|
||||
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
|
||||
Docs.expandOperation($(this));
|
||||
});
|
||||
},
|
||||
|
||||
collapseOperationsForResource: function(resource) {
|
||||
// Make sure the resource container is open..
|
||||
Docs.expandEndpointListForResource(resource);
|
||||
|
||||
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
|
||||
Docs.collapseOperation($(this));
|
||||
});
|
||||
},
|
||||
|
||||
escapeResourceName: function(resource) {
|
||||
return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
|
||||
},
|
||||
|
||||
expandOperation: function(elem) {
|
||||
elem.slideDown();
|
||||
},
|
||||
|
||||
collapseOperation: function(elem) {
|
||||
elem.slideUp();
|
||||
}
|
||||
|
||||
};
|
||||
(function() {
|
||||
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// swagger.js
|
||||
// version 2.0.21
|
||||
// version 2.0.22
|
||||
|
||||
var __bind = function(fn, me){
|
||||
return function(){
|
||||
@@ -15,6 +15,15 @@ log = function(){
|
||||
}
|
||||
};
|
||||
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(obj, start) {
|
||||
for (var i = (start || 0), j = this.length; i < j; i++) {
|
||||
if (this[i] === obj) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
var SwaggerApi = function(url, options) {
|
||||
this.url = null;
|
||||
this.debug = false;
|
||||
@@ -949,7 +958,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
}
|
||||
}
|
||||
|
||||
responseContentType = null;
|
||||
var responseContentType = null;
|
||||
if (this.opts.responseContentType) {
|
||||
responseContentType = this.opts.responseContentType;
|
||||
} else {
|
||||
@@ -1116,7 +1125,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
headers: headers
|
||||
};
|
||||
|
||||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
|
||||
var contentType = (headers["content-type"]||headers["Content-Type"]||null)
|
||||
|
||||
if(contentType != null) {
|
||||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"coffee-script": "~1.5.0",
|
||||
"swagger-client": "2.0.21",
|
||||
"swagger-client": "2.0.22",
|
||||
"handlebars": "~1.0.10",
|
||||
"less": "~1.4.2"
|
||||
}
|
||||
|
||||
@@ -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") {
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user