Your IP : 216.73.216.68


Current Path : /home/jeromecohp/www/templates/yootheme_jeromecourville/js/
Upload File :
Current File : /home/jeromecohp/www/templates/yootheme_jeromecourville/js/corner-popup.min.js

if("undefined"==typeof jQuery)throw new Error("Corner Popup requires jQuery");!function($){$.fn.cornerpopup=function(options){var key,value,ttl,options=$.extend({popupName:"jcpopup",expireAfter:0,active:!0,displayOnce:!1,timeOut:0,delay:0,slide:!1,slideTop:!1,closeBtn:!0,shadow:!0,escClose:!1,stickToBottom:!1,topCorner:!1,link:"https://www.jeromecourville.com, _self",header:"Jérôme Courville",text:"",button:"OK",width:"390px",beforePopup:function(){},afterPopup:function(){},onBtnClick:function(){}},options);function popupClose(){options.slide?popupSlideUndo():$(cp).fadeOut(400,function(){$(this).remove(),options.afterPopup.call(this)})}function popupSlideUndo(){options.slideTop&&$(cp).removeClass("slide-top").addClass("slide-top-rev"),(cpTemp=$(cp)).animation="none",cpTemp.offsetHeight,cpTemp.animation=null,cpTemp.one("webkitAnimationEnd oanimationend msAnimationEnd animationend",function(){cpTemp.remove(),options.afterPopup.call(this)})}cp="#corner-popup",$(cp).length&&$(cp).remove(),options.active&&((!options.displayOnce||options.displayOnce&&null===function(key){var itemStr=localStorage.getItem(key);if(!itemStr)return null;itemStr=JSON.parse(itemStr);const now=new Date;return 0<itemStr.expiry&&now.getTime()>itemStr.expiry?(localStorage.removeItem(key),null):itemStr.value}(options.popupName))&&$("<div/>",{id:"corner-popup",class:"popup-xs"}).appendTo("body"),"%"==options.width.substr(-1)?(widthPercent=!0,noPercents=options.width.slice(0,-1)):(widthPercent=!1,noUnit=options.width.match(/^\d+$/)?options.width:options.width.replace(/\D/g,"")),columnTwo=700<noUnit||1==widthPercent&&50<noPercents?(columnOne="p-sm-2","p-sm-10"):450<noUnit||1==widthPercent&&25<noPercents?(columnOne="p-sm-3","p-sm-9"):(columnOne="p-sm-4","p-sm-8"),options.link=options.link.replace(/\s/g,"").split(","),options.link[1]||(options.link[1]="_self"),popupContent='<div class="p-col p-xs-12 p-sm-12"><div class="corner-close" tabindex="0"></div><div class="corner-container-2"><p class="corner-head">'+options.header+'</p><p class="corner-text">'+options.text+'</p><a href="'+options.link[0]+'" class="corner-btn-close" target="'+options.link[1]+'">'+options.button+"</a></div></div>",function(){options.beforePopup.call(this),options.slide?options.slideTop&&$(cp).addClass("slide-top"):($(cp).html(popupContent).css("display","flex").hide().fadeIn(800),0!=options.delay&&($(cp).hide(),setTimeout(function(){$(cp).fadeIn(800)},options.delay))),$(cp).html(popupContent).css("display","flex").show(),0!=options.delay&&($(cp).hide(),setTimeout(function(){$(cp).show()},options.delay))}(),options.displayOnce?(key=options.popupName,value=!0,ttl=options.expireAfter,value={value:value,expiry:(new Date).getTime()+ttl},localStorage.setItem(key,JSON.stringify(value))):localStorage.removeItem(options.popupName),verticalPosition=options.topCorner?($(cp).addClass("corner-top"),"top"):($(cp).removeClass("corner-top"),"bottom"),options.closeBtn||($(".corner-close").remove(),768<$(window).width()&&$(cp).css("right","70px"),$(".corner-container").css({bottom:"15px","padding-top":"30px"}),$(".corner-container-1").css({bottom:"0","padding-bottom":"10px","padding-top":"20px"}),$(".corner-container-2").css({bottom:"12px","padding-top":"30px"})),options.shadow||$(cp).css("box-shadow","none"),"390px"!==options.width&&$(cp).css("width",options.width),window.onresize=function(){$(window).width()<768?$(cp).css("width","100%"):$(cp).css("width",options.width)},options.stickToBottom&&768<$(window).width()&&($(cp).css(verticalPosition,"0"),$(cp).css({right:"0"})),0!==options.timeOut&&(ttl=options.timeOut,setTimeout(function(){options.slide?popupSlideUndo():$(cp).fadeOut(400,function(){$(this).remove(),options.afterPopup.call(this)})},ttl)),$(".corner-close").click(function(){popupClose()}),$(".corner-close").keyup(function(event){"Enter"===event.key&&popupClose()}),$(".corner-btn, .corner-btn-close, .corner-btn-cookie").click(function(event){elementClassName=$(this).attr("class"),13<options.onBtnClick.toString().length?(event.preventDefault(),options.onBtnClick.call(this)):popupClose()}),$(document).keyup(function(event){options.escClose&&"Escape"===event.key&&popupClose()}),$.fn.cornerpopup.popupClose=function(timing){setTimeout(popupClose,timing)},$.fn.cornerpopup.popupHide=function(timing){$(cp).delay(timing).fadeOut(400)},$.fn.cornerpopup.popupShow=function(timing){$(cp).delay(timing).fadeIn(800)})}}(jQuery);