| 1 |
(function( $ ) { |
| 2 |
'use strict'; |
| 3 |
$.fn.serializeFormJSON = function () { |
| 4 |
var o = {}, |
| 5 |
a = this.serializeArray(); |
| 6 |
$.each(a, function () { |
| 7 |
if (o[this.name]) { |
| 8 |
if (!o[this.name].push) { |
| 9 |
o[this.name] = [o[this.name]]; |
| 10 |
} |
| 11 |
o[this.name].push(this.value || ''); |
| 12 |
} else { |
| 13 |
o[this.name] = this.value || ''; |
| 14 |
} |
| 15 |
}); |
| 16 |
return o; |
| 17 |
}; |
| 18 |
$(document).ready(function () { |
| 19 |
if(!$.fn.goTo){ |
| 20 |
$.fn.goTo = function() { |
| 21 |
$('html, body').animate({ |
| 22 |
scrollTop: $(this).offset().top - 100 + 'px' |
| 23 |
}, 'slow'); |
| 24 |
return this; // for chaining... |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
// for details |
| 29 |
$.fn.aysModal = function(action){ |
| 30 |
var $this = $(this); |
| 31 |
switch(action){ |
| 32 |
case 'hide': |
| 33 |
$(this).find('.ays-modal-content').css('animation-name', 'zoomOut'); |
| 34 |
setTimeout(function(){ |
| 35 |
$(document.body).removeClass('modal-open'); |
| 36 |
$(document).find('.ays-modal-backdrop').remove(); |
| 37 |
$this.hide(); |
| 38 |
}, 250); |
| 39 |
break; |
| 40 |
case 'show': |
| 41 |
default: |
| 42 |
$this.show(); |
| 43 |
$(this).find('.ays-modal-content').css('animation-name', 'zoomIn'); |
| 44 |
$(document).find('.modal-backdrop').remove(); |
| 45 |
$(document.body).append('<div class="ays-modal-backdrop"></div>'); |
| 46 |
$(document.body).addClass('modal-open'); |
| 47 |
break; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
if (!String.prototype.trim) { |
| 52 |
(function() { |
| 53 |
String.prototype.trim = function() { |
| 54 |
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); |
| 55 |
}; |
| 56 |
})(); |
| 57 |
} |
| 58 |
|
| 59 |
}); |
| 60 |
|
| 61 |
|
| 62 |
})( jQuery ); |
| 63 |
|