Quick validation jsLint

This commit is contained in:
touffies
2013-11-08 12:44:10 +01:00
parent 04de0d7a17
commit c64f16c741

View File

@@ -6,13 +6,14 @@
var confirmCallback = {
'address.delete': function ($elm) {
$.post($elm.attr('href'), function (data) {
if(data.success)
if (data.success) {
$elm.closest('tr').remove();
else
} else {
bootbox.alert(data.message);
}
});
}
}
};
/* ------------------------------------------------------------------
onLoad Function -------------------------------------------------- */
@@ -30,23 +31,20 @@
// Main Navigation Hover
$('.nav-main')
.on('click.subnav', '[data-toggle=dropdown]', function (event) {
if($(this).parent().hasClass('open') && $(this).is(event.target))
return false;
if ($(this).parent().hasClass('open') && $(this).is(event.target)) { return false; }
})
.on('mouseenter.subnav', '.dropdown', function(event){
if($(this).hasClass('open'))
return;
.on('mouseenter.subnav', '.dropdown', function () {
if ($(this).hasClass('open')) { return; }
$(this).addClass('open');
})
.on('mouseleave.subnav', '.dropdown', function () {
var $this = $(this);
if(!$this.hasClass('open'))
return;
if (!$this.hasClass('open')) { return; }
//This will check if an input child has focus. If no then remove class open
if ($this.find(":input:focus").length == 0){
if ($this.find(":input:focus").length === 0) {
$this.removeClass('open');
} else {
$this.find(":input:focus").one('blur', function () {
@@ -61,11 +59,11 @@
});
// Confirm Dialog
$(document).on('click.confirm', '[data-confirm]', function (e) {
$(document).on('click.confirm', '[data-confirm]', function () {
var $this = $(this),
href = $this.attr('href'),
callback = $this.attr('data-confirm-callback'),
title = $this.attr('data-confirm') != '' ? $this.attr('data-confirm') : 'Are you sure?';
title = $this.attr('data-confirm') !== '' ? $this.attr('data-confirm') : 'Are you sure?';
bootbox.confirm(title, function (confirm) {
if (confirm) {
@@ -95,8 +93,7 @@
var $parent = $category_products.parent();
$parent.on('click.view-mode', '[data-toggle=view]', function () {
if( ($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list')))
return;
if (($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list'))) { return; }
// Add loader effect
$loader.show();
@@ -104,7 +101,7 @@
return false;
});
}
};
// Login
var $form_login = $('#form-login');
@@ -193,8 +190,7 @@
}
$(this).on('click.thumbnails', '.thumbnail', function () {
if($(this).hasClass('active'))
return false;
if ($(this).hasClass('active')) { return false; }
$image.attr('src',$(this).attr('href'));
$thumbnails.removeClass('active');
@@ -222,14 +218,7 @@
$(element).closest('.form-group').removeClass('has-error');
},
errorElement: 'span',
errorClass: 'help-block'/*,
errorPlacement: function(error, element) {
if(element.parent('.input-group').length || element.prop('type') === 'checkbox' || element.prop('type') === 'radio'){
error.prepend('<i class="icon-remove"></i> ').insertAfter(element.parent());
}else{
error.prepend('<i class="icon-remove"></i> ').insertAfter(element);
}
}*/
errorClass: 'help-block'
});