Comparing version 4.5.0 to 4.6.3
/* Optional functions that are a shortcut to call jAlert */ | ||
function alert(e,n){"undefined"==typeof n&&(n=e,e=""),$.jAlert({title:e,content:n})}function confirm(e,n){$.jAlert({type:"confirm",onConfirm:e,onDeny:n})}function showAlert(e,n,t){$.jAlert({title:e,content:n,theme:t})}function successAlert(e,n){"undefined"==typeof n&&(n=e,e="Success"),showAlert(e,n,"green")}function errorAlert(e,n){"undefined"==typeof n&&(n=e,e="Error"),showAlert(e,n,"red")}function infoAlert(e,n){"undefined"==typeof n&&(n=e,e="Info"),showAlert(e,n,"blue")}function warningAlert(e,n){"undefined"==typeof n&&(n=e,e="Warning"),showAlert(e,n,"yellow")}function blackAlert(e,n){"undefined"==typeof n&&(n=e,e="Warning"),showAlert(e,n,"black")}function imageAlert(e,n){"auto"==typeof n&&(iframeHeight=!1),$.jAlert({image:e,imageWidth:n})}function videoAlert(e){$.jAlert({video:e})}function iframeAlert(e,n){"undefined"==typeof n&&(n=!1),$.jAlert({iframe:e,iframeHeight:n})}function ajaxAlert(e,n){"undefined"==typeof n&&(n=function(){return!1}),$.jAlert({ajax:e,onOpen:n})} |
@@ -1,1 +0,6 @@ | ||
!function($){Date.now||(Date.now=function(){return+new Date}),$.fn.jAlert=function(options){$("body").focus(),$("body").blur();var themes=["default","green","dark_green","red","dark_red","black","brown","gray","dark_gray","blue","dark_blue","yellow"],sizes=["xsm","sm","md","lg","xlg","full","auto"],sizeAliases={xsmall:"xsm",small:"sm",medium:"md",large:"lg",xlarge:"xlg"},backgroundColors=["white","black"],styles=[],classes=["animated"],backgroundClasses=[];if(this.length>1)return this.each(function(){$.fn.jAlert(options)}),this;if("undefined"!=typeof $(this)[0]&&"undefined"!=$(this)[0].jAlert)return $(this)[0].jAlert;if($.each($.fn.jAlert.defaults,function(key,val){var lowerKey=key.toLowerCase();"undefined"!=typeof options[lowerKey]&&(options[key]=options[lowerKey])}),options=$.extend({},$.fn.jAlert.defaults,options),options.id)var alert_id=options.id;else var unique=Date.now().toString()+Math.floor(1e5*Math.random()),alert_id="ja_"+unique;var alert={set:function(key,val){return alert[key]=val,alert},__set:function(key,val){return alert.set(key,val)},get:function(key){return alert[key]},__get:function(key){return alert.get(key)},centerAlert:function(){var viewportHeight=$(window).height(),alertHeight=alert.instance.height(),diff=viewportHeight-alertHeight,margin=diff/2;return margin=margin>200?margin-100:margin,margin=margin<=0?0:margin,margin-=1,alert.instance.css("margin-top",margin+"px"),alert.instance.css("margin-bottom","0px"),$("body").css("overflow","hidden"),diff>5?alert.instance.parents(".ja_wrap").css("position","fixed"):(alert.instance.parents(".ja_wrap").css("position","absolute"),$("html, body").animate({scrollTop:top-50},200)),alert},animateAlert:function(which){return"hide"==which?(alert.instance.jAlert().blurBackground&&$("body").removeClass("ja_blur"),alert.instance.removeClass(alert.showAnimation).addClass(alert.hideAnimation)):(alert.instance.jAlert().blurBackground&&$("body").addClass("ja_blur"),alert.centerAlert(),alert.instance.addClass(alert.showAnimation).removeClass(alert.hideAnimation).show()),alert},closeAlert:function(remove,onClose){return 0!=remove&&(remove=!0),alert.instance&&(alert.instance.unbind("DOMSubtreeModified"),alert.animateAlert("hide"),window.setTimeout(function(){var alertWrap=alert.instance.parents(".ja_wrap");remove?alertWrap.remove():alertWrap.hide(),"function"==typeof onClose?onClose(alert.instance):"function"==typeof alert.onClose&&alert.onClose(alert.instance),$(".jAlert:visible").length>0?$(".jAlert:visible:last").jAlert().centerAlert():$("body").css("overflow","auto")},alert.animationTimeout)),alert},showAlert:function(replaceOthers,removeOthers,onOpen,onClose){0!=replaceOthers&&(replaceOthers=!0),removeOthers!==!1&&(removeOthers=!0),replaceOthers&&$(".jAlert:visible").jAlert().closeAlert(removeOthers);var wrap=alert.instance.parents(".ja_wrap");return $("body").append(wrap),alert.animateAlert("show"),"function"==typeof onClose&&(alert.onClose=onClose),window.setTimeout(function(){"function"==typeof onOpen&&onOpen(alert.instance)},alert.animationTimeout),alert}};if($.each(options,function(key,val){alert.set(key,val)}),alert.set("id",alert_id),alert.content&&0===alert.content.indexOf("#")&&$(alert.content).length>0&&(alert.content=$(alert.content).html()),alert.video&&alert.video.indexOf("youtube.com/watch?v=")>-1&&alert.video.indexOf("embed")===-1&&(alert.video=alert.video.replace("watch?v=","embed/")),"confirm"==alert.type&&(alert.content||(alert.content=alert.confirmQuestion),alert.btns=[{text:alert.confirmBtnText,theme:"green",class:"confirmBtn",closeAlert:!0,onClick:alert.onConfirm},{text:alert.denyBtnText,theme:"red",class:"denyBtn",closeAlert:!0,onClick:alert.onDeny}],alert.autofocus=alert.confirmAutofocus),alert.color&&(alert.theme=alert.color),$.inArray(alert.theme,themes)==-1)return console.log("jAlert Config Error: Invalid theme selection."),!1;if(classes.push("ja_"+alert.theme),alert.class&&classes.push(alert.class),alert.classes&&classes.push(alert.classes),alert.noPadContent&&classes.push("ja_no_pad"),alert.title||classes.push("ja_noTitle"),alert.width&&(alert.size=alert.width),alert.size&&"object"==typeof alert.size&&("undefined"==typeof alert.size.width||"undefined"==typeof alert.size.height))return console.log("jAlert Config Error: Invalid size selection (try a preset or make sure you're including height and width in your size object)."),!1;if(alert.size?"object"==typeof alert.size?(styles.push("width: "+alert.size.width+";"),styles.push("height: "+alert.size.height+";"),classes.push("ja_setheight")):("undefined"!=typeof sizeAliases[alert.size]&&(alert.size=sizeAliases[alert.size]),$.inArray(alert.size,sizes)>-1?classes.push("ja_"+alert.size):styles.push("width: "+alert.size+";")):classes.push("ja_sm"),$.inArray(alert.backgroundColor,backgroundColors)==-1)return console.log("jAlert Config Error: Invalid background color selection."),!1;backgroundClasses.push("ja_wrap_"+alert.backgroundColor),alert.onOpen=[alert.onOpen];var onload="onload='$.fn.jAlert.mediaLoaded($(this))'",loader="<div class='ja_loader'>Loading...</div>";alert.picture&&(alert.image=alert.picture),alert.image?(alert.content="<div class='ja_media_wrap'>"+loader+"<img src='"+alert.image+"' class='ja_img' "+onload+"'",alert.imageWidth&&(alert.content+=" style='width: "+alert.imageWidth+"'"),alert.content+="></div>"):alert.video?(alert.content="<div class='ja_media_wrap'>"+loader+"<div class='ja_video'></div></div>",alert.onOpen.unshift(function(elem){var iframe=document.createElement("iframe");iframe.src=elem.jAlert().video,iframe.addEventListener?iframe.addEventListener("load",function(){$.fn.jAlert.mediaLoaded($(this))},!0):iframe.attachEvent?iframe.attachEvent("onload",function(){$.fn.jAlert.mediaLoaded($(this))}):iframe.onload=function(){$.fn.jAlert.mediaLoaded($(this))},elem.find(".ja_video").append(iframe)})):alert.iframe?(alert.iframeHeight||(alert.iframeHeight=.9*$(window).height()+"px"),alert.content="<div class='ja_media_wrap'>"+loader+"</div>",alert.onOpen.unshift(function(elem){var iframe=document.createElement("iframe");iframe.src=elem.jAlert().iframe,iframe.className="ja_iframe",iframe.addEventListener?iframe.addEventListener("load",function(){$.fn.jAlert.mediaLoaded($(this))},!0):iframe.attachEvent?iframe.attachEvent("onload",function(){$.fn.jAlert.mediaLoaded($(this))}):iframe.onload=function(){$.fn.jAlert.mediaLoaded($(this))},elem.find(".ja_media_wrap").append(iframe)})):alert.ajax&&(alert.content="<div class='ja_media_wrap'>"+loader+"</div>",onAjaxCallbacks=alert.onOpen,alert.onOpen=[function(elem){$.ajax(elem.jAlert().ajax,{async:!0,complete:function(jqXHR,textStatus){elem.find(".ja_media_wrap").replaceWith(jqXHR.responseText),$.each(onAjaxCallbacks,function(index,onAjax){onAjax(elem)})},error:function(jqXHR,textStatus,errorThrown){alert.onAjaxFail(elem,"Error getting content: Code: "+jqXHR.status+" : Msg: "+jqXHR.statusText)}})}]);var getBtnHTML=function(btn){if("undefined"==typeof btn.href&&(btn.href=""),"undefined"==typeof btn.class&&(btn.class=""),"undefined"==typeof btn.theme?btn.class+=" ja_btn_default":btn.class+=" ja_btn_"+btn.theme,"undefined"==typeof btn.text&&(btn.text=""),"undefined"==typeof btn.id){var unique=Date.now().toString()+Math.floor(1e5*Math.random());btn.id="ja_btn_"+unique}return"undefined"==typeof btn.target&&(btn.target="_self"),"undefined"==typeof btn.closeAlert&&(btn.closeAlert=!0),$("body").off("click","#"+btn.id),$("body").on("click","#"+btn.id,function(e){var button=$(this);btn.closeAlert&&button.parents(".jAlert").jAlert().closeAlert();var callbackResponse=!0;return"function"==typeof btn.onClick&&(callbackResponse=btn.onClick(e,button)),!callbackResponse||btn.closeAlert?(e.preventDefault(),!1):callbackResponse}),"<a href='"+btn.href+"' id='"+btn.id+"' target='"+btn.target+"' class='ja_btn "+btn.class+"'>"+btn.text+"</a> "},addAlert=function(content){var html="";html+='<div class="ja_wrap '+backgroundClasses.join(" ")+'"><div class="jAlert '+classes.join(" ")+'" style="'+styles.join(" ")+'" id="'+alert.id+'"><div>',alert.closeBtn&&(html+="<div class='closejAlert ja_close",alert.closeBtnAlt?html+=" ja_close_alt":alert.closeBtnRound&&(html+=" ja_close_round"),html+="'>×</div>"),alert.title&&(html+="<div class='ja_title'><div>"+alert.title+"</div></div>"),html+='<div class="ja_body">'+content,alert.btns&&(html+='<div class="ja_btn_wrap ',alert.btnBackground&&(html+="optBack"),html+='">'),"object"==typeof alert.btns[0]?$.each(alert.btns,function(index,btn){"object"==typeof btn&&(html+=getBtnHTML(btn))}):"object"==typeof alert.btns?html+=getBtnHTML(alert.btns):alert.btns&&console.log("jAlert Config Error: Incorrect value for btns (must be object or array of objects): "+alert.btns),alert.btns&&(html+="</div>"),html+="</div></div></div></div>";var alertHTML=$(html);if(alert.replaceOtherAlerts){var alerts=$(".jAlert:visible");alerts.each(function(){$(this).jAlert().closeAlert()})}return $("body").append(alertHTML),alert.instance=$("#"+alert.id),alert.instance[0].jAlert=alert,$("body").css("overflow","hidden"),alert.animateAlert("show"),alert.closeBtn&&alert.instance.on("click",".closejAlert",function(e){return e.preventDefault(),$(this).parents(".jAlert:first").jAlert().closeAlert(),!1}),alert.closeOnClick&&($(document).off("mouseup touchstart",$.fn.jAlert.onMouseUp),$(document).on("mouseup touchstart",$.fn.jAlert.onMouseUp)),alert.closeOnEsc&&($(document).off("keydown",$.fn.jAlert.onEscKeyDown),$(document).on("keydown",$.fn.jAlert.onEscKeyDown)),alert.onOpen&&$.each(alert.onOpen,function(index,onOpen){onOpen(alert.instance)}),alert.autofocus?alert.instance.find(alert.autofocus).focus():alert.instance.focus(),alert.instance.bind("DOMSubtreeModified",function(){alert.centerAlert()}),alert.instance};return this.initialize=function(){return alert.content||alert.image||alert.video||alert.iframe||alert.ajax?(alert.content||(alert.content=""),addAlert(alert.content)):(console.log("jAlert potential error: No content defined"),addAlert(""))},this.initialize(),alert},$.fn.jAlert.defaults={title:!1,content:!1,noPadContent:!1,image:!1,imageWidth:"auto",video:!1,ajax:!1,onAjaxFail:function(alert,errorThrown){alert.jAlert().closeAlert(),errorAlert(errorThrown)},iframe:!1,iframeHeight:!1,class:"",classes:"",id:!1,showAnimation:"fadeInUp",hideAnimation:"fadeOutDown",animationTimeout:600,theme:"default",backgroundColor:"black",blurBackground:!1,size:!1,replaceOtherAlerts:!1,closeOnClick:!1,closeOnEsc:!0,closeBtn:!0,closeBtnAlt:!1,closeBtnRound:!0,btns:!1,btnBackground:!0,autofocus:!1,onOpen:function(alert){return!1},onClose:function(alert){return!1},type:"modal",confirmQuestion:"Are you sure?",confirmBtnText:"Yes",denyBtnText:"No",confirmAutofocus:".confirmBtn",onConfirm:function(e,btn){return e.preventDefault(),console.log("confirmed"),!1},onDeny:function(e,btn){return e.preventDefault(),!1}},$.fn.jAlert.onMouseUp=function(e){var target=e.target?e.target:e.srcElement,lastVisibleAlert=$(".jAlert:visible:last");lastVisibleAlert.length>0&&lastVisibleAlert.jAlert().closeOnClick&&($(target).is(".jAlert *")||lastVisibleAlert.jAlert().closeAlert())},$.fn.jAlert.onEscKeyDown=function(e){if(27===e.keyCode){var lastVisibleAlert=$(".jAlert:visible:last");lastVisibleAlert.length>0&&lastVisibleAlert.jAlert().closeOnEsc&&lastVisibleAlert.jAlert().closeAlert()}},$.fn.attachjAlert=function(e){return e.preventDefault(),$.jAlert($(this).data()),!1},$.jAlert=function(options){if("current"==options){var latest=$(".jAlert:visible:last");return latest.length>0&&latest.jAlert()}return"attach"==options?($("[data-jAlert]").off("click",$.fn.attachjAlert),$("[data-jAlert]").on("click",$.fn.attachjAlert),$("[data-jalert]").off("click",$.fn.attachjAlert),$("[data-jalert]").on("click",$.fn.attachjAlert),!1):$.fn.jAlert(options)},$.fn.alertOnClick=function(options){$(this).on("click",function(e){return e.preventDefault(),$.jAlert(options),!1})},$.alertOnClick=function(selector,options){$("body").on("click",selector,function(e){return e.preventDefault(),$.jAlert(options),!1})},$.fn.closeAlert=function(remove,onClose){$(this).jAlert().closeAlert(remove,onClose)};var $jAlertResizeTimeout;$(window).resize(function(){window.clearTimeout($jAlertResizeTimeout),$jAlertResizeTimeout=window.setTimeout(function(){$(".jAlert:visible").each(function(){$(this).jAlert().centerAlert()})},200)}),$.fn.jAlert.mediaLoaded=function(elem){var wrap=elem.parents(".ja_media_wrap"),vid_wrap=wrap.find(".ja_video"),alert=elem.parents(".jAlert:first"),jalert=alert.jAlert();wrap.find(".ja_loader").remove(),vid_wrap.length>0?vid_wrap.fadeIn("fast"):elem.fadeIn("fast"),"undefined"!=typeof jalert.iframeHeight&&jalert.iframeHeight&&(elem.css("display","block"),elem.height(jalert.iframeHeight)),jalert.centerAlert()}}(jQuery); | ||
/* | ||
jAlert version 4.6.3 | ||
Made with love by HTMLGuy, LLC | ||
MIT Licensed | ||
*/ | ||
!function(d){var n,e;Date.now||(Date.now=function(){return+new Date}),d.fn.jAlert=function(o){d("body").focus(),d("body").blur();var e={xsmall:"xsm",small:"sm",medium:"md",large:"lg",xlarge:"xlg"},i=[],a=["animated"],r=[];if(1<this.length)return this.each(function(){d.fn.jAlert(o)}),this;if(void 0!==d(this)[0]&&"undefined"!=d(this)[0].jAlert)return d(this)[0].jAlert;if(d.each(d.fn.jAlert.defaults,function(e,t){var n=e.toLowerCase();void 0!==o[n]&&(o[e]=o[n])}),(o=d.extend({},d.fn.jAlert.defaults,o)).id)t=o.id;else var t="ja_"+(Date.now().toString()+Math.floor(1e5*Math.random()));var l={set:function(e,t){return l[e]=t,l},__set:function(e,t){return l.set(e,t)},get:function(e){return l[e]},__get:function(e){return l.get(e)},centerAlert:function(){var e=d(window).innerHeight()-l.instance.outerHeight(),t=e/2;return t=(t=200<t?t-100:t)<=0?0:t,l.instance.find(".ja_close_round").length&&(t+=15),l.instance.css("margin-top",t+"px"),l.instance.css("margin-bottom","0px"),d("html,body").css("overflow","hidden"),5<e?l.instance.parents(".ja_wrap").css("position","fixed"):(l.instance.parents(".ja_wrap").css("position","absolute"),d("html, body").animate({scrollTop:top-50},200)),l},animateAlert:function(e){return"hide"==e?(l.instance.jAlert().blurBackground&&d("body").removeClass("ja_blur"),l.instance.removeClass(l.showAnimation).addClass(l.hideAnimation)):(l.instance.jAlert().blurBackground&&d("body").addClass("ja_blur"),l.centerAlert(),l.instance.addClass(l.showAnimation).removeClass(l.hideAnimation).show()),l},closeAlert:function(t,n){return 0!=t&&(t=!0),l.instance&&(l.instance.unbind("DOMSubtreeModified"),l.animateAlert("hide"),window.setTimeout(function(){var e=l.instance.parents(".ja_wrap");t?e.remove():e.hide(),"function"==typeof n?n(l.instance):"function"==typeof l.onClose&&l.onClose(l.instance),0<d(".jAlert:visible").length?d(".jAlert:visible:last").jAlert().centerAlert():d("html,body").css("overflow","auto")},l.animationTimeout)),l},showAlert:function(e,t,n,o){0!=e&&(e=!0),!1!==t&&(t=!0),e&&d(".jAlert:visible").jAlert().closeAlert(t);var i=l.instance.parents(".ja_wrap");return d("body").append(i),l.animateAlert("show"),"function"==typeof o&&(l.onClose=o),window.setTimeout(function(){"function"==typeof n&&n(l.instance)},l.animationTimeout),l}};if(d.each(o,function(e,t){l.set(e,t)}),l.set("id",t),l.content&&0===l.content.indexOf("#")&&0<d(l.content).length&&(l.content=d(l.content).html()),l.video&&-1<l.video.indexOf("youtube.com/watch?v=")&&-1===l.video.indexOf("embed")&&(l.video=l.video.replace("watch?v=","embed/")),"confirm"==l.type&&(l.content||(l.content=l.confirmQuestion),l.btns=[{text:l.confirmBtnText,theme:"green",class:"confirmBtn",closeAlert:!0,onClick:l.onConfirm},{text:l.denyBtnText,theme:"red",class:"denyBtn",closeAlert:!0,onClick:l.onDeny}],l.autofocus=l.confirmAutofocus),l.color&&(l.theme=l.color),-1==d.inArray(l.theme,["default","green","dark_green","red","dark_red","black","brown","gray","dark_gray","blue","dark_blue","yellow"]))return console.log("jAlert Config Error: Invalid theme selection."),!1;if(a.push("ja_"+l.theme),l.class&&a.push(l.class),l.classes&&a.push(l.classes),l.fullscreen&&a.push("ja_fullscreen"),l.noPadContent&&a.push("ja_no_pad"),l.title||a.push("ja_noTitle"),l.width&&(l.size=l.width),l.size&&"object"==typeof l.size&&(void 0===l.size.width||void 0===l.size.height))return console.log("jAlert Config Error: Invalid size selection (try a preset or make sure you're including height and width in your size object)."),!1;if(l.size?"object"==typeof l.size?(i.push("width: "+l.size.width+";"),i.push("height: "+l.size.height+";"),a.push("ja_setheight")):(void 0!==e[l.size]&&(l.size=e[l.size]),-1<d.inArray(l.size,["xsm","sm","md","lg","xlg","full","auto"])?a.push("ja_"+l.size):i.push("width: "+l.size+";")):a.push("ja_sm"),-1==d.inArray(l.backgroundColor,["white","black"]))return console.log("jAlert Config Error: Invalid background color selection."),!1;r.push("ja_wrap_"+l.backgroundColor),l.onOpen=[l.onOpen];var n="<div class='ja_loader'>Loading...</div>";l.picture&&(l.image=l.picture),l.image?(l.content="<div class='ja_media_wrap'>"+n+"<img src='"+l.image+"' class='ja_img' onload='$.fn.jAlert.mediaLoaded($(this))''",l.imageWidth&&(l.content+=" style='width: "+l.imageWidth+"'"),l.content+="></div>"):l.video?(l.content="<div class='ja_media_wrap'>"+n+"<div class='ja_video'></div></div>",l.onOpen.unshift(function(e){var t=document.createElement("iframe");t.src=e.jAlert().video,t.addEventListener?t.addEventListener("load",function(){d.fn.jAlert.mediaLoaded(d(this))},!0):t.attachEvent?t.attachEvent("onload",function(){d.fn.jAlert.mediaLoaded(d(this))}):t.onload=function(){d.fn.jAlert.mediaLoaded(d(this))},e.find(".ja_video").append(t)})):l.iframe?(l.iframeHeight||(l.iframeHeight=d(window).height()+"px"),l.content="<div class='ja_media_wrap'>"+n+"</div>",l.onOpen.unshift(function(e){var t=document.createElement("iframe");t.src=e.jAlert().iframe,t.className="ja_iframe",t.addEventListener?t.addEventListener("load",function(){d.fn.jAlert.mediaLoaded(d(this))},!0):t.attachEvent?t.attachEvent("onload",function(){d.fn.jAlert.mediaLoaded(d(this))}):t.onload=function(){d.fn.jAlert.mediaLoaded(d(this))},e.find(".ja_media_wrap").append(t)})):l.ajax&&(l.content="<div class='ja_media_wrap'>"+n+"</div>",onAjaxCallbacks=l.onOpen,l.onOpen=[function(o){d.ajax(o.jAlert().ajax,{async:!0,complete:function(e,t){o.find(".ja_media_wrap").replaceWith(e.responseText),d.each(onAjaxCallbacks,function(e,t){t(o)})},error:function(e,t,n){l.onAjaxFail(o,"Error getting content: Code: "+e.status+" : Msg: "+e.statusText)}})}]);var s=function(o){if(void 0===o.href&&(o.href=""),void 0===o.class&&(o.class=""),void 0===o.theme?o.class+=" ja_btn_default":o.class+=" ja_btn_"+o.theme,void 0===o.text&&(o.text=""),void 0===o.id){var e=Date.now().toString()+Math.floor(1e5*Math.random());o.id="ja_btn_"+e}return void 0===o.target&&(o.target="_self"),void 0===o.closeAlert&&(o.closeAlert=!0),d("body").off("click","#"+o.id),d("body").on("click","#"+o.id,function(e){var t=d(this);o.closeAlert&&t.parents(".jAlert").jAlert().closeAlert();var n=!0;return"function"==typeof o.onClick&&(n=o.onClick(e,t)),!n||o.closeAlert?(e.preventDefault(),!1):n}),"<a href='"+o.href+"' id='"+o.id+"' target='"+o.target+"' class='ja_btn "+o.class+"'>"+o.text+"</a> "},c=function(e){var n="";n+='<div class="ja_wrap '+r.join(" ")+'"><div class="jAlert '+a.join(" ")+'" style="'+i.join(" ")+'" id="'+l.id+'"><div>',l.closeBtn&&(n+="<div class='closejAlert ja_close",l.closeBtnAlt?n+=" ja_close_alt":l.closeBtnRoundWhite?n+=" ja_close_round_white":l.closeBtnRound&&(n+=" ja_close_round"),n+="'>×</div>"),l.title&&(n+="<div class='ja_title'><div>"+l.title+"</div></div>"),n+='<div class="ja_body">'+e,l.btns&&(n+='<div class="ja_btn_wrap ',l.btnBackground&&(n+="optBack"),n+='">'),"object"==typeof l.btns[0]?d.each(l.btns,function(e,t){"object"==typeof t&&(n+=s(t))}):"object"==typeof l.btns?n+=s(l.btns):l.btns&&console.log("jAlert Config Error: Incorrect value for btns (must be object or array of objects): "+l.btns),l.btns&&(n+="</div>");var t=d(n+="</div></div></div></div>");l.replaceOtherAlerts&&d(".jAlert:visible").each(function(){d(this).jAlert().closeAlert()});return d("body").append(t),l.instance=d("#"+l.id),l.instance[0].jAlert=l,d("html,body").css("overflow","hidden"),l.animateAlert("show"),l.closeBtn&&l.instance.on("click",".closejAlert",function(e){return e.preventDefault(),d(this).parents(".jAlert:first").jAlert().closeAlert(),!1}),l.closeOnClick&&(d(document).off("mouseup touchstart",d.fn.jAlert.onMouseUp),d(document).on("mouseup touchstart",d.fn.jAlert.onMouseUp)),l.closeOnEsc&&(d(document).off("keydown",d.fn.jAlert.onEscKeyDown),d(document).on("keydown",d.fn.jAlert.onEscKeyDown)),l.onOpen&&d.each(l.onOpen,function(e,t){t(l.instance)}),l.autofocus?l.instance.find(l.autofocus).focus():l.instance.focus(),l.autoClose&&d.fn.closeTimer(function(){var e=d.jAlert("current");!1!==e&&e.closeAlert()},l.autoClose),l.instance.bind("DOMSubtreeModified",function(){l.centerAlert()}),l.instance};return this.initialize=function(){return l.content||l.image||l.video||l.iframe||l.ajax?(l.content||(l.content=""),c(l.content)):(console.log("jAlert potential error: No content defined"),c(""))},this.initialize(),l},d.fn.closeTimer=(jQuery,n=0,function(e,t){clearTimeout(n),n=setTimeout(e,t)}),d.fn.jAlert.defaults={title:!1,content:!1,noPadContent:!1,fullscreen:!1,image:!1,imageWidth:"auto",video:!1,ajax:!1,onAjaxFail:function(e,t){e.jAlert().closeAlert(),errorAlert(t)},iframe:!1,iframeHeight:!1,class:"",classes:"",id:!1,showAnimation:"fadeInUp",hideAnimation:"fadeOutDown",animationTimeout:600,theme:"default",backgroundColor:"black",blurBackground:!1,size:!1,replaceOtherAlerts:!1,closeOnClick:!1,closeOnEsc:!0,closeBtn:!0,closeBtnAlt:!1,closeBtnRound:!0,closeBtnRoundWhite:!1,btns:!1,autoClose:!1,btnBackground:!0,autofocus:!1,onOpen:function(e){return!1},onClose:function(e){return!1},type:"modal",confirmQuestion:"Are you sure?",confirmBtnText:"Yes",denyBtnText:"No",confirmAutofocus:".confirmBtn",onConfirm:function(e,t){return e.preventDefault(),console.log("confirmed"),!1},onDeny:function(e,t){return e.preventDefault(),!1}},d.fn.jAlert.onMouseUp=function(e){var t=e.target?e.target:e.srcElement,n=d(".jAlert:visible:last");0<n.length&&n.jAlert().closeOnClick&&(d(t).is(".jAlert *")||n.jAlert().closeAlert())},d.fn.jAlert.onEscKeyDown=function(e){if(27===e.keyCode){var t=d(".jAlert:visible:last");0<t.length&&t.jAlert().closeOnEsc&&t.jAlert().closeAlert()}},d.fn.attachjAlert=function(e){return e.preventDefault(),d.jAlert(d(this).data()),!1},d.jAlert=function(e){if("current"==e){var t=d(".jAlert:visible:last");return 0<t.length&&t.jAlert()}return"attach"==e?(d("[data-jAlert]").off("click",d.fn.attachjAlert),d("[data-jAlert]").on("click",d.fn.attachjAlert),d("[data-jalert]").off("click",d.fn.attachjAlert),d("[data-jalert]").on("click",d.fn.attachjAlert),!1):d.fn.jAlert(e)},d.fn.alertOnClick=function(t){d(this).on("click",function(e){return e.preventDefault(),d.jAlert(t),!1})},d.alertOnClick=function(e,t){d("body").on("click",e,function(e){return e.preventDefault(),d.jAlert(t),!1})},d.fn.closeAlert=function(e,t){d(this).jAlert().closeAlert(e,t)},d(window).resize(function(){window.clearTimeout(e),e=window.setTimeout(function(){d(".jAlert:visible").each(function(){d(this).jAlert().centerAlert()})},200)}),d.fn.jAlert.mediaLoaded=function(e){var t=e.parents(".ja_media_wrap"),n=t.find(".ja_video"),o=e.parents(".jAlert:first").jAlert();t.find(".ja_loader").remove(),0<n.length?n.fadeIn("fast"):e.fadeIn("fast"),void 0!==o.iframeHeight&&o.iframeHeight&&(e.css("display","block"),e.height(o.iframeHeight)),o.centerAlert()}}(jQuery); |
{ | ||
"name": "jAlert", | ||
"version": "4.5.0", | ||
"version": "4.6.3", | ||
"description": "Simple jQuery (Modal | Popup | Lightbox | Alert) Plugin", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/VersatilityWerks/jAlert" | ||
"url": "https://github.com/HTMLGuyLLC/jAlert" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/VersatilityWerks/jAlert/issues" | ||
"url": "https://github.com/HTMLGuyLLC/jAlert/issues" | ||
}, | ||
"homepage": "http://flwebsites.biz/jAlert/", | ||
"homepage": "https://htmlguyllc.github.io/jAlert/", | ||
"private": false, | ||
"dependencies": { | ||
"jquery": "^1.7.1" | ||
}, | ||
"license":{ | ||
"type": "MIT", | ||
"url": "https://www.opensource.org/licenses/mit-license.php" | ||
} | ||
} |
@@ -1,14 +0,15 @@ | ||
[![Packagist](https://img.shields.io/badge/License-MIT-blue.svg)]() | ||
[![Join the chat at https://gitter.im/jAlert/Lobby](https://badges.gitter.im/jAlert/Lobby.svg)](https://gitter.im/jAlert/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Packagist](https://img.shields.io/badge/License-MIT-blue.svg)](http://flwebsites.biz/jAlert/#license) | ||
[![Codeship](https://img.shields.io/badge/Build-Passing-green.svg)]() | ||
[![npm](https://img.shields.io/badge/NPM-v4.5-blue.svg)]() | ||
[![npm](https://img.shields.io/badge/NPM-v4.5.1-blue.svg)](https://npmjs.com/package/jAlert) | ||
jAlert v4 | ||
====== | ||
by Versatility Werks http://flwebsites.biz | ||
by HTMLGuy, LLC | ||
![logo](http://flwebsites.biz/jAlert/index-assets/img/logo.png) | ||
![logo](http://htmlguyllc.github.io/jAlert/index-assets/img/logo.png) | ||
Demo & Detailed Docs | ||
======= | ||
http://flwebsites.biz/jAlert/ | ||
http://htmlguyllc.github.io/jAlert/ | ||
=== | ||
@@ -22,6 +23,16 @@ | ||
Getting the files | ||
======= | ||
Using NPM: | ||
```html | ||
npm install jAlert | ||
``` | ||
Dependencies | ||
======= | ||
jQuery 1.7+ | ||
Setup | ||
====== | ||
Include the CSS files from the src folder in the head section: | ||
Include the CSS files from the folder in the head section: | ||
```html | ||
@@ -31,3 +42,3 @@ <link rel="stylesheet" href="jAlert-master/dist/jAlert.css"> | ||
Include the JS file from the src folder before the `</body>`: | ||
Include the JS file from the folder before the `</body>`: | ||
```html | ||
@@ -142,18 +153,1 @@ <script src="jAlert-master/dist/jAlert.min.js"></script> | ||
``` | ||
Dependencies | ||
======= | ||
jQuery 1.7+ | ||
License | ||
======= | ||
M.I.T. | ||
Copyright (c) 2015 Versatility Werks | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@@ -1,10 +0,6 @@ | ||
/* | ||
* | ||
* | ||
jAlert version 4.5 | ||
Made with love by Versatility Werks (http://flwebsites.biz) | ||
MIT Licensed | ||
* | ||
* | ||
*/ | ||
/* | ||
jAlert version 4.6.3 | ||
Made with love by HTMLGuy, LLC | ||
MIT Licensed | ||
*/ | ||
;(function($) { | ||
@@ -97,4 +93,4 @@ | ||
{ | ||
var viewportHeight = $(window).height(), | ||
alertHeight = alert.instance.height(), | ||
var viewportHeight = $(window).innerHeight(), | ||
alertHeight = alert.instance.outerHeight(), | ||
diff = viewportHeight - alertHeight; | ||
@@ -106,8 +102,13 @@ | ||
margin = margin <= 0 ? 0 : margin; | ||
margin = margin - 1; //make up for border if any - just brings it up a bit anyway. | ||
//add 15 for the round button that sits above the alert | ||
if( alert.instance.find('.ja_close_round').length ) | ||
{ | ||
margin += 15; | ||
} | ||
alert.instance.css('margin-top', margin+'px'); | ||
alert.instance.css('margin-bottom', '0px'); | ||
$('body').css('overflow', 'hidden'); | ||
$('html,body').css('overflow', 'hidden'); | ||
@@ -195,3 +196,3 @@ if( diff > 5 ) | ||
{ | ||
$('body').css('overflow', 'auto'); | ||
$('html,body').css('overflow', 'auto'); | ||
} | ||
@@ -326,2 +327,9 @@ | ||
//if fullscreen, add class | ||
if( alert.fullscreen ) | ||
{ | ||
classes.push('ja_fullscreen'); | ||
} | ||
//if no padding on the content | ||
if( alert.noPadContent ) | ||
@@ -454,3 +462,3 @@ { | ||
{ | ||
alert.iframeHeight = $(window).height() * 0.9+'px'; | ||
alert.iframeHeight = $(window).height() +'px'; | ||
} | ||
@@ -575,2 +583,6 @@ | ||
} | ||
else if( alert.closeBtnRoundWhite ) | ||
{ | ||
html += ' ja_close_round_white'; | ||
} | ||
else if( alert.closeBtnRound ) | ||
@@ -650,3 +662,3 @@ { | ||
//doing this now will prevent it from happening mid-animation | ||
$('body').css('overflow', 'hidden'); | ||
$('html,body').css('overflow', 'hidden'); | ||
@@ -706,3 +718,19 @@ //show the new alert | ||
} | ||
/* | ||
Set Auto | ||
usage $.jAlert({ | ||
autoClose : 3500, | ||
}); | ||
*/ | ||
if(alert.autoClose) | ||
{ | ||
$.fn.closeTimer(function() | ||
{ | ||
var currentAlert = $.jAlert('current'); | ||
if(currentAlert !== false) | ||
{ | ||
currentAlert.closeAlert(); | ||
} | ||
}, alert.autoClose); | ||
} | ||
alert.instance.bind("DOMSubtreeModified", function(){ | ||
@@ -745,2 +773,11 @@ alert.centerAlert(); | ||
/* set closeTimer for preventing on duplicate */ | ||
$.fn.closeTimer = (function(){ | ||
var timer = 0; | ||
return function(callback, ms){ | ||
clearTimeout (timer); | ||
timer = setTimeout(callback, ms); | ||
}; | ||
})(jQuery); | ||
/* Default alert */ | ||
@@ -750,3 +787,4 @@ $.fn.jAlert.defaults = { | ||
'content': false, //html for the popup (replaced if you use image, ajax, or iframe) | ||
'noPadContent': false, //remove padding from | ||
'noPadContent': false, //remove padding from the body | ||
'fullscreen': false, //make the jAlert completely fullscreen | ||
'image': false, //adds a centered img tag | ||
@@ -777,4 +815,6 @@ 'imageWidth': 'auto', //defaults to max-width: 100%; width: auto; | ||
'closeBtnAlt': false, //alternative close button | ||
'closeBtnRound': true, //alternative close button to be round | ||
'closeBtnRound': true, //alternative round close button | ||
'closeBtnRoundWhite': false, //alternative round close button (in white) | ||
'btns': false, //adds buttons to the popup at the bottom. Pass an object for a single button, or an object of objects for many | ||
'autoClose' : false, // By default we specify as false. You can add secound | ||
/* | ||
@@ -962,2 +1002,2 @@ Variety of buttons you could create (also, an example of how to pass the object | ||
/* END OF ON JQUERY LOAD */ | ||
})(jQuery); | ||
})(jQuery); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
193034
11
2456
151