You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.0 KiB
79 lines
3.0 KiB
var EXPO = EXPO || {}; //isolated namespace
|
|
EXPO.exposition = EXPO.exposition || {};
|
|
if (EXPO.exposition.list){
|
|
console.warn('WARNING: EXPO.place.object is already defined!');
|
|
}else {
|
|
|
|
EXPO.exposition.list = (function () {
|
|
// dependencies
|
|
var com = EXPO.common,
|
|
$waiter;
|
|
|
|
// variables
|
|
var that = {};
|
|
that.opt = {}; //свойства по умолчанию
|
|
//private
|
|
$(function () {
|
|
$waiter = $('#wait-ajax:not(.absolute)').css({'z-index': '8031'});
|
|
});
|
|
|
|
// methods
|
|
//инициализация общих свойств
|
|
that.init = function (options) {
|
|
$.extend(this.opt, options);
|
|
com.opt.addCalendarText = this.opt.addCalendarText;
|
|
com.opt.removeCalendarText = this.opt.removeCalendarText;
|
|
|
|
$('#'+this.opt.event_news_subscribe.id).on("submit", function () {
|
|
var formData = $(this).serialize(),
|
|
formUrl = $(this).attr("action"),
|
|
$form = $(this),
|
|
/**
|
|
* executes after AJAX get request is complete
|
|
* @param data - data recieved from server ex
|
|
*/
|
|
handler = function (data) {
|
|
var clearValue = function () {
|
|
$('.err',$form).removeClass("err");
|
|
$('.pwf-msg',$form).text('');
|
|
};
|
|
if (data.success != true){
|
|
clearValue();
|
|
for (var k in data.errors){
|
|
if (data.errors.hasOwnProperty(k)) {
|
|
$('input[name="'+k+'"]',$form)
|
|
.closest(".required").addClass("err")
|
|
.siblings(".pwf-msg").text(data.errors[k]);
|
|
}
|
|
}
|
|
|
|
} else {
|
|
clearValue();
|
|
dataLayer.push({'event': 'event-news-subscribe-form'});
|
|
$('input:text',$form).val('');
|
|
$('p#success').show();
|
|
if (data.sent == true) {
|
|
window.location = data.redirect_url;
|
|
} else {
|
|
window.setTimeout(function () {
|
|
$.fancybox.close();
|
|
|
|
$form
|
|
.parents('.pw-body')
|
|
.find('#success')
|
|
.hide();
|
|
}, 1000);
|
|
}
|
|
|
|
|
|
}
|
|
$waiter.hide();
|
|
};
|
|
$waiter.show();
|
|
com.postRequest(formData,formUrl,handler);
|
|
return false;
|
|
});
|
|
};
|
|
return that;
|
|
}());
|
|
}
|
|
|