parent
b94c2357f9
commit
f5bc1754e7
14 changed files with 813 additions and 377 deletions
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 507 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
@ -1,202 +1,204 @@ |
||||
var EXPO = EXPO || {}; //isolated namespace
|
||||
EXPO.exposition = EXPO.exposition || {}; |
||||
if (EXPO.exposition.object){ |
||||
console.warn('WARNING: EXPO.exposition.object is already defined!'); |
||||
console.warn('WARNING: EXPO.exposition.object is already defined!'); |
||||
}else { |
||||
|
||||
EXPO.exposition.object = (function () { |
||||
EXPO.exposition.object = (function () { |
||||
// dependencies
|
||||
var com = EXPO.common, |
||||
$waiter; |
||||
var com = EXPO.common, |
||||
$waiter; |
||||
// variables
|
||||
var that = {}, |
||||
Note = function (it, opt) { |
||||
this.opt = opt; |
||||
this.DOMthis = it; |
||||
this.DOMbutton = it.querySelector('.'+opt.buttonClass); |
||||
this.DOMinput = it.querySelector('.'+opt.inputClass); |
||||
this.inputName = this.DOMinput.getAttribute('name'); |
||||
this.url = this.DOMbutton.getAttribute('href'); |
||||
this._controller(); |
||||
}; |
||||
Note.prototype = { |
||||
_init: function () { |
||||
|
||||
}, |
||||
_controller: function () { |
||||
var self = this; |
||||
$(this.DOMinput).on('blur', function () { |
||||
self.send(); |
||||
}); |
||||
$(this.DOMbutton).on('click', function () { |
||||
return false; |
||||
}); |
||||
}, |
||||
send: function () { |
||||
var data = {}, |
||||
response, |
||||
self = this, |
||||
handler = function (data) { |
||||
if (data.success){ |
||||
console.log('ok'); |
||||
$(self.DOMbutton).addClass('active'); |
||||
}else{ |
||||
console.log('data not send'); |
||||
} |
||||
|
||||
}; |
||||
data[this.inputName] = this.DOMinput.value; |
||||
response = com.getRequest(data,this.url,handler); |
||||
} |
||||
}; |
||||
that.opt = {}; //свойства по умолчанию
|
||||
var that = {}, |
||||
Note = function (it, opt) { |
||||
this.opt = opt; |
||||
this.DOMthis = it; |
||||
this.DOMbutton = it.querySelector('.'+opt.buttonClass); |
||||
this.DOMinput = it.querySelector('.'+opt.inputClass); |
||||
this.inputName = this.DOMinput.getAttribute('name'); |
||||
this.url = this.DOMbutton.getAttribute('href'); |
||||
this._controller(); |
||||
}; |
||||
Note.prototype = { |
||||
_init: function () { |
||||
|
||||
}, |
||||
_controller: function () { |
||||
var self = this; |
||||
$(this.DOMinput).on('blur', function () { |
||||
self.send(); |
||||
}); |
||||
$(this.DOMbutton).on('click', function () { |
||||
return false; |
||||
}); |
||||
}, |
||||
send: function () { |
||||
var data = {}, |
||||
response, |
||||
self = this, |
||||
handler = function (data) { |
||||
if (data.success){ |
||||
console.log('ok'); |
||||
$(self.DOMbutton).addClass('active'); |
||||
}else{ |
||||
console.log('data not send'); |
||||
} |
||||
|
||||
}; |
||||
data[this.inputName] = this.DOMinput.value; |
||||
response = com.getRequest(data,this.url,handler); |
||||
} |
||||
}; |
||||
that.opt = {}; //свойства по умолчанию
|
||||
//private
|
||||
$(function () { |
||||
$waiter = $('#wait-ajax:not(.absolute)').css({'z-index': '8031'}); |
||||
}); |
||||
$(function () { |
||||
$waiter = $('#wait-ajax:not(.absolute)').css({'z-index': '8031'}); |
||||
}); |
||||
|
||||
// methods
|
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
$.extend(this.opt, options); |
||||
var self = this, |
||||
$visitButtons = $('.'+this.opt.visit.activeClass+', .'+this.opt.visit.passiveClass); |
||||
this.notes = []; |
||||
|
||||
$('.'+this.opt.note.wrapClass).each(function () { |
||||
var note = new Note(this,self.opt.note); |
||||
self.notes.push(note); |
||||
}); |
||||
$('.'+this.opt.note.wrapDisabledClass).on('click', function () { |
||||
$.fancybox.open('#pw-login'); |
||||
return false; |
||||
}); |
||||
com.opt.addCalendarText = this.opt.addCalendarText; |
||||
com.opt.removeCalendarText = this.opt.removeCalendarText; |
||||
/** |
||||
* visit buttons |
||||
*/ |
||||
$visitButtons.off('click'); |
||||
$visitButtons.on('click', function () { |
||||
if ($(this).hasClass(self.opt.visit.activeClass)){ |
||||
|
||||
/** |
||||
* I plan to visit |
||||
*/ |
||||
$('.'+self.opt.visit.activeClass).hide().siblings('.'+self.opt.visit.passiveClass).show(); |
||||
|
||||
$('#'+self.opt.visit.visitorsListId).append(self.opt.visit.currentHtml); |
||||
$('#'+self.opt.visit.somebodyId).removeClass("hidden"); |
||||
$('#'+self.opt.visit.nobodyId).addClass("hidden"); |
||||
|
||||
|
||||
}else{ |
||||
/** |
||||
* refuse to visit |
||||
*/ |
||||
$('.'+self.opt.visit.passiveClass).hide().siblings('.'+self.opt.visit.activeClass).show(); |
||||
$('#'+self.opt.visit.visitorsListId).children(".current").remove(); |
||||
|
||||
if($('#'+self.opt.visit.visitorsListId).children().length == 0){ |
||||
|
||||
$('#'+self.opt.visit.somebodyId).addClass("hidden"); |
||||
$('#'+self.opt.visit.nobodyId).removeClass("hidden"); |
||||
} |
||||
|
||||
} |
||||
return false; |
||||
}); |
||||
/** |
||||
* advertise form validation |
||||
*/ |
||||
$('#'+this.opt.advertise.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(); |
||||
//инициализация общих свойств
|
||||
that.init = function (options) { |
||||
$.extend(this.opt, options); |
||||
var self = this, |
||||
$visitButtons = $('.'+this.opt.visit.activeClass+', .'+this.opt.visit.passiveClass); |
||||
this.notes = []; |
||||
|
||||
$('.'+this.opt.note.wrapClass).each(function () { |
||||
var note = new Note(this,self.opt.note); |
||||
self.notes.push(note); |
||||
}); |
||||
$('.'+this.opt.note.wrapDisabledClass).on('click', function () { |
||||
$.fancybox.open('#pw-login'); |
||||
return false; |
||||
}); |
||||
com.opt.addCalendarText = this.opt.addCalendarText; |
||||
com.opt.removeCalendarText = this.opt.removeCalendarText; |
||||
/** |
||||
* visit buttons |
||||
*/ |
||||
$visitButtons.off('click'); |
||||
$visitButtons.on('click', function () { |
||||
if (!$(this).hasClass('no_auth')) { |
||||
if ($(this).hasClass(self.opt.visit.activeClass)) { |
||||
|
||||
/** |
||||
* I plan to visit |
||||
*/ |
||||
$('.' + self.opt.visit.activeClass).hide().siblings('.' + self.opt.visit.passiveClass).show(); |
||||
|
||||
$('#' + self.opt.visit.visitorsListId).append(self.opt.visit.currentHtml); |
||||
$('#' + self.opt.visit.somebodyId).removeClass("hidden"); |
||||
$('#' + self.opt.visit.nobodyId).addClass("hidden"); |
||||
|
||||
|
||||
} else { |
||||
/** |
||||
* refuse to visit |
||||
*/ |
||||
$('.' + self.opt.visit.passiveClass).hide().siblings('.' + self.opt.visit.activeClass).show(); |
||||
$('#' + self.opt.visit.visitorsListId).children(".current").remove(); |
||||
|
||||
if ($('#' + self.opt.visit.visitorsListId).children().length == 0) { |
||||
|
||||
$('#' + self.opt.visit.somebodyId).addClass("hidden"); |
||||
$('#' + self.opt.visit.nobodyId).removeClass("hidden"); |
||||
} |
||||
|
||||
} |
||||
} |
||||
return false; |
||||
}); |
||||
/** |
||||
* advertise form validation |
||||
*/ |
||||
$('#'+this.opt.advertise.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': 'advmemberform'}); |
||||
$('input:text',$form).val(''); |
||||
$.fancybox.close(); |
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
/** |
||||
* event news subscribe form validation |
||||
*/ |
||||
$('#'+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){ |
||||
console.log(data.errors.hasOwnProperty(k)); |
||||
console.log(k); |
||||
if (data.errors.hasOwnProperty(k)) { |
||||
$('input[name="'+k+'"]',$form) |
||||
.closest(".required").addClass("err") |
||||
.siblings(".pwf-msg").text(data.errors[k]); |
||||
} |
||||
} |
||||
|
||||
}else{ |
||||
clearValue(); |
||||
$('input:text',$form).val(''); |
||||
$.fancybox.close(); |
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
/** |
||||
* event news subscribe form validation |
||||
*/ |
||||
$('#'+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){ |
||||
console.log(data.errors.hasOwnProperty(k)); |
||||
console.log(k); |
||||
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(); |
||||
}, 1000); |
||||
} |
||||
|
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
}; |
||||
return that; |
||||
}()); |
||||
$('input:text',$form).val(''); |
||||
$('p#success').show(); |
||||
if (data.sent == true) { |
||||
window.location = data.redirect_url; |
||||
} else { |
||||
window.setTimeout(function () { |
||||
$.fancybox.close(); |
||||
}, 1000); |
||||
} |
||||
|
||||
|
||||
} |
||||
$waiter.hide(); |
||||
}; |
||||
$waiter.show(); |
||||
com.postRequest(formData,formUrl,handler); |
||||
return false; |
||||
}); |
||||
|
||||
}; |
||||
return that; |
||||
}()); |
||||
} |
||||
|
||||
@ -1 +1 @@ |
||||
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.object?console.warn("WARNING: EXPO.exposition.object is already defined!"):EXPO.exposition.object=function(){var t,s=EXPO.common,i={},e=function(t,s){this.opt=s,this.DOMthis=t,this.DOMbutton=t.querySelector("."+s.buttonClass),this.DOMinput=t.querySelector("."+s.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return e.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var t,i={},e=this,o=function(t){t.success?(console.log("ok"),$(e.DOMbutton).addClass("active")):console.log("data not send")};i[this.inputName]=this.DOMinput.value,t=s.getRequest(i,this.url,o)}},i.opt={},$(function(){t=$("#wait-ajax:not(.absolute)").css({"z-index":"8031"})}),i.init=function(i){$.extend(this.opt,i);var o=this,n=$("."+this.opt.visit.activeClass+", ."+this.opt.visit.passiveClass);this.notes=[],$("."+this.opt.note.wrapClass).each(function(){var t=new e(this,o.opt.note);o.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),s.opt.addCalendarText=this.opt.addCalendarText,s.opt.removeCalendarText=this.opt.removeCalendarText,n.off("click"),n.on("click",function(){return $(this).hasClass(o.opt.visit.activeClass)?($("."+o.opt.visit.activeClass).hide().siblings("."+o.opt.visit.passiveClass).show(),$("#"+o.opt.visit.visitorsListId).append(o.opt.visit.currentHtml),$("#"+o.opt.visit.somebodyId).removeClass("hidden"),$("#"+o.opt.visit.nobodyId).addClass("hidden")):($("."+o.opt.visit.passiveClass).hide().siblings("."+o.opt.visit.activeClass).show(),$("#"+o.opt.visit.visitorsListId).children(".current").remove(),0==$("#"+o.opt.visit.visitorsListId).children().length&&($("#"+o.opt.visit.somebodyId).addClass("hidden"),$("#"+o.opt.visit.nobodyId).removeClass("hidden"))),!1}),$("#"+this.opt.advertise.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),n=function(s){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=s.success){i();for(var e in s.errors)s.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(s.errors[e])}else i(),dataLayer.push({event:"advmemberform"}),$("input:text",o).val(""),$.fancybox.close();t.hide()};return t.show(),s.postRequest(i,e,n),!1}),$("#"+this.opt.event_news_subscribe.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),n=function(s){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=s.success){i();for(var e in s.errors)console.log(s.errors.hasOwnProperty(e)),console.log(e),s.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(s.errors[e])}else i(),dataLayer.push({event:"event-news-subscribe-form"}),$("input:text",o).val(""),$("p#success").show(),1==s.sent?window.location=s.redirect_url:window.setTimeout(function(){$.fancybox.close()},1e3);t.hide()};return t.show(),s.postRequest(i,e,n),!1})},i}(); |
||||
var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.object?console.warn("WARNING: EXPO.exposition.object is already defined!"):EXPO.exposition.object=function(){var t,s=EXPO.common,i={},e=function(t,s){this.opt=s,this.DOMthis=t,this.DOMbutton=t.querySelector("."+s.buttonClass),this.DOMinput=t.querySelector("."+s.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return e.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var t,i={},e=this,o=function(t){t.success?(console.log("ok"),$(e.DOMbutton).addClass("active")):console.log("data not send")};i[this.inputName]=this.DOMinput.value,t=s.getRequest(i,this.url,o)}},i.opt={},$(function(){t=$("#wait-ajax:not(.absolute)").css({"z-index":"8031"})}),i.init=function(i){$.extend(this.opt,i);var o=this,n=$("."+this.opt.visit.activeClass+", ."+this.opt.visit.passiveClass);this.notes=[],$("."+this.opt.note.wrapClass).each(function(){var t=new e(this,o.opt.note);o.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),s.opt.addCalendarText=this.opt.addCalendarText,s.opt.removeCalendarText=this.opt.removeCalendarText,n.off("click"),n.on("click",function(){return $(this).hasClass("no_auth")||($(this).hasClass(o.opt.visit.activeClass)?($("."+o.opt.visit.activeClass).hide().siblings("."+o.opt.visit.passiveClass).show(),$("#"+o.opt.visit.visitorsListId).append(o.opt.visit.currentHtml),$("#"+o.opt.visit.somebodyId).removeClass("hidden"),$("#"+o.opt.visit.nobodyId).addClass("hidden")):($("."+o.opt.visit.passiveClass).hide().siblings("."+o.opt.visit.activeClass).show(),$("#"+o.opt.visit.visitorsListId).children(".current").remove(),0==$("#"+o.opt.visit.visitorsListId).children().length&&($("#"+o.opt.visit.somebodyId).addClass("hidden"),$("#"+o.opt.visit.nobodyId).removeClass("hidden")))),!1}),$("#"+this.opt.advertise.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),n=function(s){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=s.success){i();for(var e in s.errors)s.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(s.errors[e])}else i(),dataLayer.push({event:"advmemberform"}),$("input:text",o).val(""),$.fancybox.close();t.hide()};return t.show(),s.postRequest(i,e,n),!1}),$("#"+this.opt.event_news_subscribe.id).on("submit",function(){var i=$(this).serialize(),e=$(this).attr("action"),o=$(this),n=function(s){var i=function(){$(".err",o).removeClass("err"),$(".pwf-msg",o).text("")};if(1!=s.success){i();for(var e in s.errors)console.log(s.errors.hasOwnProperty(e)),console.log(e),s.errors.hasOwnProperty(e)&&$('input[name="'+e+'"]',o).closest(".required").addClass("err").siblings(".pwf-msg").text(s.errors[e])}else i(),dataLayer.push({event:"event-news-subscribe-form"}),$("input:text",o).val(""),$("p#success").show(),1==s.sent?window.location=s.redirect_url:window.setTimeout(function(){$.fancybox.close()},1e3);t.hide()};return t.show(),s.postRequest(i,e,n),!1})},i}(); |
||||
Loading…
Reference in new issue