Some cleanup in Docs.js

Doc.js is ignored in JSHint so we are not cleaning it up entirely!
This commit is contained in:
Mohsen Azimi
2015-03-12 16:46:51 -07:00
parent dac83b71c8
commit 096cd120a4
3 changed files with 35 additions and 29 deletions

31
dist/swagger-ui.js vendored
View File

@@ -234,25 +234,28 @@ this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":funct
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
'use strict';
$(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);
return this.each(function(){
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);
return this.each(function(){
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);
});
};
@@ -274,7 +277,7 @@ $(function() {
$(this).removeClass('error');
// Tack the error style on if the input is empty..
if ($(this).val() == '') {
if ($(this).val() === '') {
$(this).addClass('error');
$(this).wiggle();
error_free = false;
@@ -287,7 +290,7 @@ $(function() {
});
function clippyCopiedCallback(a) {
function clippyCopiedCallback() {
$('#api_key_copied').fadeIn().delay(1000).fadeOut();
// var b = $("#clippy_tooltip_" + a);
@@ -304,10 +307,10 @@ function log(){
if(this.console){
console.log( Array.prototype.slice.call(arguments)[0] );
}
};
}
// 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") {
if (Function.prototype.bind && console && typeof console.log === "object") {
[
"log","info","warn","error","assert","dir","clear","profile","profileEnd"
].forEach(function (method) {

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +1,25 @@
'use strict';
$(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);
return this.each(function(){
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);
return this.each(function(){
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);
});
};
@@ -38,7 +41,7 @@ $(function() {
$(this).removeClass('error');
// Tack the error style on if the input is empty..
if ($(this).val() == '') {
if ($(this).val() === '') {
$(this).addClass('error');
$(this).wiggle();
error_free = false;
@@ -51,7 +54,7 @@ $(function() {
});
function clippyCopiedCallback(a) {
function clippyCopiedCallback() {
$('#api_key_copied').fadeIn().delay(1000).fadeOut();
// var b = $("#clippy_tooltip_" + a);
@@ -68,10 +71,10 @@ function log(){
if(this.console){
console.log( Array.prototype.slice.call(arguments)[0] );
}
};
}
// 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") {
if (Function.prototype.bind && console && typeof console.log === "object") {
[
"log","info","warn","error","assert","dir","clear","profile","profileEnd"
].forEach(function (method) {