/* popModal - 1.26 [27.10.17] Author: vadimsva Github: https://github.com/vadimsva/popModal */ $(function(){(function(a){a.fn.popModal=function(c){function f(){function b(a){var b=Math.max(u,v,w);return("bottomLeft"==a?0×')),e.overflowContent&&(p=" popModal_contentOverflow"));k=(new Date).getMilliseconds();d.attr("data-popmodal_id",k);b=a('
');var c=a('
');b.append(n,c);if(a.isPlainObject(e.html)){c.append(e.html.loadingText);var l={url:e.html.url};e.html.method&&(l.method=e.html.method);e.html.data&&(l.data=e.html.data);e.html.dataType&&(l.dataType=e.html.dataType);a.ajax(l).done(function(a){c.empty().append(a)}).fail(function(){e.html.errorText&&c.empty().append(e.html.errorText)})}else"object"==a.type(e.html)?e.html.after(a('
')): "string"==a.type(e.html)&&(e.html=a("
").append(e.html)),c.append(e.html);500>=a(window).width()&&(e.inline=!0);e.inline?d.after(b):a("body").append(b);c[0].scrollWidth>c[0].offsetWidth&&""==e.size&&(b.css({maxWidth:"400px"}),c.addClass("popModal_contentOverflow"));if(a.isPlainObject(e.size)||/^{/i.test(e.size))/^{/i.test(e.size)&&(e.size=a.parseJSON(e.size.replace(new RegExp(/'/,"g"),'"'))),e.size.width&&b.css({maxWidth:e.size.width+"px"}),e.size.height&&(c.addClass("popModal_contentOverflow"), c.css({maxHeight:e.size.height+"px"}));h=a("div[data-popmodal]");b=h.find(".popModal_footer");0!=b.length&&h.find(".popModal_content").css({marginBottom:b.outerHeight()+15+"px"});if(e.onLoad&&a.isFunction(e.onLoad))e.onLoad(h);a(e.html).trigger("load",{el:h});h.on("destroyed",function(){if(e.onClose&&a.isFunction(e.onClose))e.onClose(h);a(e.html).trigger("close",{el:h})});f();if(e.onDocumentClickClose)a("html").on("click.popModalEvent",function(b){a(this).addClass("popModalOpen");h.is(":hidden")&& g();var c=a(b.target);c.parents().addBack().is(".popModal")||c.parents().addBack().is(d)||(b=parseInt(c.parents().filter(function(){return"auto"!==a(this).css("zIndex")}).first().css("zIndex")),isNaN(b)&&(b=0),""!==e.onDocumentClickClosePrevent&&c.is(e.onDocumentClickClosePrevent)&&(b=9999),c=c.css("zIndex"),"auto"==c&&(c=0),b');var m=a('
'),e=a('');g=void 0===g[0]?g.selector:g[0].innerHTML;m.append(e,g);c.append(m);a("body").append(c);b=a(".notifyModal");h||(h=b.css("transitionDuration"),h=void 0!==h?1E3*h.replace("s", ""):0);if(d.onLoad&&a.isFunction(d.onLoad))d.onLoad(b);c.trigger("load",{el:b});b.addClass("open");b.click(function(){f()});-1!=d.duration&&(notifDur=setTimeout(f,d.duration))},hide:function(){f()}};a("html").keydown(function(a){27==a.keyCode&&f()});if(n[c])return n[c].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof c||!c)return n.init.apply(this,arguments)};a("* [data-notifymodal-bind]").bind("click",function(){var c=a(this).attr("data-notifymodal-bind"),f={};void 0!==a(this).attr("data-duration")&& (f.duration=parseInt(a(this).attr("data-duration")));void 0!==a(this).attr("data-placement")&&(f.placement=a(this).attr("data-placement"));void 0!==a(this).attr("data-type")&&(f.type=a(this).attr("data-type"));void 0!==a(this).attr("data-overlay")&&(f.overlay=/^true$/i.test(a(this).attr("data-overlay")));void 0!==a(this).attr("data-icon")&&(f.icon=/^false$/i.test(a(this).attr("data-overlay")));a(c).notifyModal(f)})})(jQuery);(function(a){a.fn.hintModal=function(c){a(".hintModal").off();var f={init:function(){function c(b, c){var d=b.attr("class");var g=b.outerWidth();var f=c.outerWidth(),m=b.offset().left,e=a(window).width()-b.offset().left-g,q=g+m-f,k=g+e-f,l=Math.min(g/2+e-f/2,g/2+m-f/2);g=b.hasClass("bottomLeft")?"bottomLeft":b.hasClass("bottomCenter")?"bottomCenter":b.hasClass("bottomRight")?"bottomRight":"bottomLeft";void 0===b.data("placement")&&b.data("placement",g);b.removeAttr("class").addClass(d+" "+function(a){var b=Math.max(q,k,l);return("bottomLeft"==a?0 .hintModal_container");1 .hintModal_container");1"),p={init:function(c){function e(){b.find('[data-dialogmodal-but="close"]').on("click",function(){f();a(this).off("click")});b.find('[data-dialogmodal-but="ok"]').on("click",function(c){var e;d.onOkBut&&a.isFunction(d.onOkBut)&&(e=d.onOkBut(c,b,k+1));!1!==e&&f();a(this).off("click");g.trigger("okbut",{event:c,el:b,current:k+1})});b.find('[data-dialogmodal-but="cancel"]').on("click",function(c){if(d.onCancelBut&& a.isFunction(d.onCancelBut))d.onCancelBut(c,b,k+1);f();a(this).off("click");g.trigger("cancelbut",{event:c,el:b,current:k+1})});b.find('[data-dialogmodal-but="prev"]').on("click",function(){b.find(".dialogPrev").click()});b.find('[data-dialogmodal-but="next"]').on("click",function(){b.find(".dialogNext").click()})}function m(){y.empty().append(g[k].innerHTML);t.find("span").html(g.find(".dialogModal_header")[k].innerHTML);e();if(d.onChange&&a.isFunction(d.onChange))d.onChange(b,k+1);g.trigger("change", {el:b,current:k+1})}d=a.extend({topOffset:0,top:0,onDocumentClickClose:!1,onOkBut:function(){return!0},onCancelBut:function(){},onLoad:function(){},onClose:function(){},onChange:function(){}},c);a("html.dialogModalOpen").off(".dialogModalEvent").removeClass("dialogModalOpen");a(".dialogModal .dialogPrev, .dialogModal .dialogNext").off("click");a(".dialogModal").remove();0!=d.top&&(d.top="calc("+d.top+" + 60px)");var k=0,l=g.length-1;c=a('
');var p=a('
'),x=a('
'),t=a('
'),y=a('
'),B=a('');c.append(p);p.append(x,y);x.append(t);t.append(B);y.append(g[k].innerHTML);g.each(function(){n.append(a(this))});g.parent().append(a('
')); 0
'));t.append(""+g.find(".dialogModal_header")[k].innerHTML+"");a("body").append(c).addClass("dialogModalOpen");0==d.top&&(c=c.outerWidth()-p[0].scrollWidth,x.css({right:c+"px"}));b=a(".dialogModal");h||(h=b.css("transitionDuration"),h=void 0!==h?1E3*h.replace("s",""):0);if(d.onLoad&&a.isFunction(d.onLoad))d.onLoad(b,k+1);g.trigger("load",{el:b,current:k+1});b.on("destroyed",function(){if(d.onClose&& a.isFunction(d.onClose))d.onClose(b,k+1);g.trigger("close",{el:b,current:k+1})});b.addClass("open");setTimeout(function(){0!=d.top&&p.css({opacity:1});x.addClass("fadeInTopBig");y.addClass("fadeInTopBig")},h+100);e();if(d.onDocumentClickClose)a(".dialogModal_container").on("click.dialogModalEvent",function(b){a(this).addClass("dialogModalOpen");b=a(b.target);b.parents().addBack().is(".dialogModal_body")||b.parents().addBack().is(".dialogModal_header")||f()});b.find(".dialogPrev").on("click",function(){0< k&&(--k,k'); b=a(".titleModal_container");var g=c.attr("data-placement");void 0===g&&(g="bottom");b&&b.remove();c.after(f.append(d));d=g;b=a(".titleModal_container");f=c.position().left;g=c.position().top;var m=c.css("marginLeft"),e=c.css("marginTop"),q=c.outerHeight(),k=c.outerWidth(),l=b.outerWidth(),z=b.outerHeight();switch(d){case "bottom":b.css({top:g+parseInt(e)+q-5+"px",left:f+parseInt(m)+(k-l)/2+"px"}).addClass("fadeInBottom");break;case "top":b.css({top:g+parseInt(e)-z+"px",left:f+parseInt(m)+(k-l)/2+ "px"}).addClass("top fadeInTop");break;case "left":b.css({top:g+parseInt(e)+q/2-z/2+"px",left:f+parseInt(m)-l-10+"px"}).addClass("left fadeInLeft");break;case "right":b.css({top:g+parseInt(e)+q/2-z/2+"px",left:f+parseInt(m)+k+10+"px"}).addClass("right fadeInRight")}}});d.on("mouseleave",function(){c=a(this);if(void 0!==c.attr("data-title")){var d=c.attr("data-title");c.removeAttr("data-title");c.attr("title",d);d=b.attr("class");var f=d.replace("fadeIn","fadeOut");b.removeClass(d).addClass(f);b.remove()}})}}; if(f[c])return f[c].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof c||!c)return f.init.apply(this,arguments)};a(".titleModal").titleModal();document.addEventListener("DOMNodeInserted",function(c){a(c.target).hasClass("titleModal")&&a(".titleModal").titleModal()},!1)})(jQuery);(function(a){a.fn.confirmModal=function(c){function f(){var b=a(".confirmModal");b.removeClass("open");setTimeout(function(){b.remove();a("body").removeClass("confirmModalOpen").css({paddingRight:""}); a("html.confirmModalOpen").off(".confirmModalEvent").removeClass("confirmModalOpen")},h);a(".confirmModal_source").replaceWith(n.children())}var g=a(this),b,d,h,n=a("
"),p={init:function(c){d=a.extend({topOffset:0,top:0,onOkBut:function(){return!0},onCancelBut:function(){},onLoad:function(){},onClose:function(){}},c);a("html.confirmModalOpen").off(".confirmModalEvent").removeClass("confirmModalOpen");a(".confirmModal").remove();c=a('
');var e=a('
');c.append(e);e.append(g[0].innerHTML);g.each(function(){n.append(a(this))});g.parent().append(a('
'));a("body").append(c).addClass("confirmModalOpen");b=a(".confirmModal");h||(h=b.css("transitionDuration"),h=void 0!==h?1E3*h.replace("s",""):0);if(d.onLoad&&a.isFunction(d.onLoad))d.onLoad(b); g.trigger("load",{el:b});b.on("destroyed",function(){if(d.onClose&&a.isFunction(d.onClose))d.onClose(b);g.trigger("close",{el:b})});b.addClass("open");setTimeout(function(){e.addClass("fadeInTopBig");setTimeout(function(){e.removeClass("fadeInTopBig").addClass("open")},h+100)},h+100);(function(){function c(){e.addClass("needConfirm");setTimeout(function(){e.removeClass("needConfirm")},h+100)}b.find('[data-confirmmodal-but="close"]').on("click",function(){f();a(this).off("click")});b.find('[data-confirmmodal-but="ok"]').on("click", function(c){var e;d.onOkBut&&a.isFunction(d.onOkBut)&&(e=d.onOkBut(c,b));!1!==e&&f();g.trigger("okbut",{event:c,el:b});a(this).off("click")});b.find('[data-confirmmodal-but="cancel"]').on("click",function(c){if(d.onCancelBut&&a.isFunction(d.onCancelBut))d.onCancelBut(c,b);g.trigger("cancelbut",{event:c,el:b});f();a(this).off("click")});b.on("click",function(b){a(b.target).parents().addBack().is(e)||c()});a("html").on("keydown.confirmModalEvent",function(a){27==a.keyCode&&c()})})()},hide:function(){f()}}; if(p[c])return p[c].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof c||!c)return p.init.apply(this,arguments)};a("* [data-confirmmodal-bind]").bind("click",function(){var c=a(this).attr("data-confirmmodal-bind"),f={};void 0!==a(this).attr("data-topoffset")&&(f.topOffset=a(this).attr("data-topoffset"));void 0!==a(this).attr("data-top")&&(f.top=a(this).attr("data-top"));a(c).confirmModal(f)});a.event.special.destroyed={remove:function(a){a.handler&&a.handler()}}})(jQuery)});