ax5ui-dialog
Advanced tools
Comparing version 1.3.39 to 1.3.40
{ | ||
"name": "ax5ui-dialog", | ||
"version": "1.3.39", | ||
"version": "1.3.40", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "ThomasJ <tom@axisj.com>" |
@@ -12,3 +12,3 @@ "use strict"; | ||
className: "dialog", | ||
version: "1.3.39" | ||
version: "1.3.40" | ||
}, function () { | ||
@@ -15,0 +15,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
"use strict";!function(){var i,t=ax5.ui,e=ax5.util;t.addClass({className:"dialog",version:"1.3.39"},function(){var l=function(){var l,n=this;this.instanceId=ax5.getGuid(),this.config={id:"ax5-dialog-"+this.instanceId,clickEventName:"click",theme:"default",width:300,title:"",msg:"",lang:{ok:"ok",cancel:"cancel"},animateTime:150},this.activeDialog=null,l=this.config;var a=function(i,t){return i&&i.onStateChanged?i.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),t=null,!0},o=function(t,e){var n={dialogId:t,title:e.title||l.title||"",msg:(e.msg||l.msg||"").replace(/\n/g,"<br/>"),input:e.input,btns:e.btns,_crlf:function(){return this.replace(/\n/g,"<br/>")}};try{return i.tmpl.get.call(this,"dialogDisplay",n)}finally{n=null}},d=function(i,t){var e,n={};i.id=i.id||l.id,e={width:i.width},jQuery(document.body).append(o.call(this,i.id,i)),this.activeDialog=jQuery("#"+i.id),this.activeDialog.css({width:e.width}),i.height=e.height=this.activeDialog.height(),"undefined"==typeof i.position||"center"===i.position?(n.top=jQuery(window).height()/2-e.height/2,n.left=jQuery(window).width()/2-e.width/2):(n.left=i.position.left||0,n.top=i.position.top||0),l.zIndex&&(n["z-index"]=l.zIndex),this.activeDialog.css(n),"prompt"===i.dialogType?this.activeDialog.find("[data-dialog-prompt]").get(0).focus():this.activeDialog.find("[data-dialog-btn]").get(0).focus(),this.activeDialog.find("[data-dialog-btn]").on(l.clickEventName,function(e){c.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(e){g.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(i){s.call(this,i||window.event)}.bind(this)),a.call(this,i,{self:this,state:"open"}),n=null,e=null},s=function(i){if(!this.activeDialog)return this;var t=n.dialogConfig,e={width:t.width,height:t.height};return"undefined"==typeof t.position||"center"===t.position?(e.top=window.innerHeight/2-e.height/2,e.left=window.innerWidth/2-e.width/2):(e.left=t.position.left||0,e.top=t.position.top||0),e.left<0&&(e.left=0),e.top<0&&(e.top=0),this.activeDialog.css(e),t=null,e=null,this},c=function(i,t,l,n,a){var o;if(i.srcElement&&(i.target=i.srcElement),n=e.findParentNode(i.target,function(i){if(i.getAttribute("data-dialog-btn"))return!0})){if(a=n.getAttribute("data-dialog-btn"),o={self:this,key:a,value:t.btns[a],dialogId:t.id,btnTarget:n},"prompt"===t.dialogType){var d=null;for(var s in t.input)if(o[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),""==o[s]||null==o[s]){d=s;break}}if(t.btns[a].onClick)t.btns[a].onClick.call(o,a);else if("alert"===t.dialogType)l&&l.call(o,a),this.close({doNotCallback:!0});else if("confirm"===t.dialogType)l&&l.call(o,a),this.close({doNotCallback:!0});else if("prompt"===t.dialogType){if("ok"===a&&d)return this.activeDialog.find('[data-dialog-prompt="'+d+'"]').get(0).focus(),!1;l&&l.call(o,a),this.close({doNotCallback:!0})}}o=null,t=null,l=null,n=null,a=null},g=function(i,t,e,l,n){var a,o=null;if(i.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===t.dialogType&&i.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:n,value:t.btns[n],dialogId:t.id,btnTarget:l};for(var d in t.input)if(a[d]=this.activeDialog.find("[data-dialog-prompt="+d+"]").val(),""==a[d]||null==a[d]){o=d;break}if(o)return a=null,o=null,!1;e&&e.call(a,n),this.close({doNotCallback:!0})}a=null,o=null,t=null,e=null,l=null,n=null};this.init=function(){this.onStateChanged=l.onStateChanged},this.alert=function(i,t,a){return e.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","alert")):setTimeout(function(){this.alert(i,t,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="alert",i.theme=i.theme||l.theme||"",i.callback=t,"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme}}),d.call(this,i,t),this)},this.confirm=function(i,t,a){return e.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","confirm")):setTimeout(function(){this.confirm(i,t,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="confirm",i.theme=i.theme||l.theme||"",i.callback=t,"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme},cancel:{label:l.lang.cancel}}),d.call(this,i,t),this)},this.prompt=function(i,t,a){return e.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","prompt")):setTimeout(function(){this.prompt(i,t,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="prompt",i.theme=i.theme||l.theme||"",i.callback=t,"undefined"==typeof i.input&&(i.input={value:{label:""}}),"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme},cancel:{label:l.lang.cancel}}),d.call(this,i,t),this)},this.close=function(i){var t,e;return this.activeDialog&&(t=n.dialogConfig,this.activeDialog.addClass("destroy"),jQuery(window).unbind("keydown.ax5dialog"),jQuery(window).unbind("resize.ax5dialog"),setTimeout(function(){this.activeDialog&&(this.activeDialog.remove(),this.activeDialog=null),e={self:this,state:"close",dialogId:t.id},!t.callback||i&&i.doNotCallback||t.callback.call(e),t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),t=null,e=null}.bind(this),l.animateTime)),this},this.main=function(){t.dialog_instance=t.dialog_instance||[],t.dialog_instance.push(this),arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return l}()),i=ax5.ui.dialog}(),function(){var i=ax5.ui.dialog,t=function(i){return' \n <div id="{{dialogId}}" data-ax5-ui="dialog" class="ax5-ui-dialog {{theme}}">\n <div class="ax-dialog-header">\n {{{title}}}\n </div>\n <div class="ax-dialog-body">\n <div class="ax-dialog-msg">{{{msg}}}</div>\n \n {{#input}}\n <div class="ax-dialog-prompt">\n {{#@each}}\n <div class="form-group">\n {{#@value.label}}\n <label>{{#_crlf}}{{{.}}}{{/_crlf}}</label>\n {{/@value.label}}\n <input type="{{@value.type}}" placeholder="{{@value.placeholder}}" class="form-control {{@value.theme}}" data-dialog-prompt="{{@key}}" style="width:100%;" value="{{@value.value}}" />\n {{#@value.help}}\n <p class="help-block">{{#_crlf}}{{.}}{{/_crlf}}</p>\n {{/@value.help}}\n </div>\n {{/@each}}\n </div>\n {{/input}}\n \n <div class="ax-dialog-buttons">\n <div class="ax-button-wrap">\n {{#btns}}\n {{#@each}}\n <button type="button" data-dialog-btn="{{@key}}" class="btn btn-{{@value.theme}}">{{@value.label}}</button>\n {{/@each}}\n {{/btns}}\n </div>\n </div>\n </div>\n </div> \n '};i.tmpl={dialogDisplay:t,get:function(t,e,l){return ax5.mustache.render(i.tmpl[t].call(this,l),e)}}}(); | ||
"use strict";!function(){var i,t=ax5.ui,e=ax5.util;t.addClass({className:"dialog",version:"1.3.40"},function(){var l=function(){var l,n=this;this.instanceId=ax5.getGuid(),this.config={id:"ax5-dialog-"+this.instanceId,clickEventName:"click",theme:"default",width:300,title:"",msg:"",lang:{ok:"ok",cancel:"cancel"},animateTime:150},this.activeDialog=null,l=this.config;var a=function(i,t){return i&&i.onStateChanged?i.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),t=null,!0},o=function(t,e){var n={dialogId:t,title:e.title||l.title||"",msg:(e.msg||l.msg||"").replace(/\n/g,"<br/>"),input:e.input,btns:e.btns,_crlf:function(){return this.replace(/\n/g,"<br/>")}};try{return i.tmpl.get.call(this,"dialogDisplay",n)}finally{n=null}},d=function(i,t){var e,n={};i.id=i.id||l.id,e={width:i.width},jQuery(document.body).append(o.call(this,i.id,i)),this.activeDialog=jQuery("#"+i.id),this.activeDialog.css({width:e.width}),i.height=e.height=this.activeDialog.height(),"undefined"==typeof i.position||"center"===i.position?(n.top=jQuery(window).height()/2-e.height/2,n.left=jQuery(window).width()/2-e.width/2):(n.left=i.position.left||0,n.top=i.position.top||0),l.zIndex&&(n["z-index"]=l.zIndex),this.activeDialog.css(n),"prompt"===i.dialogType?this.activeDialog.find("[data-dialog-prompt]").get(0).focus():this.activeDialog.find("[data-dialog-btn]").get(0).focus(),this.activeDialog.find("[data-dialog-btn]").on(l.clickEventName,function(e){c.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(e){g.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(i){s.call(this,i||window.event)}.bind(this)),a.call(this,i,{self:this,state:"open"}),n=null,e=null},s=function(i){if(!this.activeDialog)return this;var t=n.dialogConfig,e={width:t.width,height:t.height};return"undefined"==typeof t.position||"center"===t.position?(e.top=window.innerHeight/2-e.height/2,e.left=window.innerWidth/2-e.width/2):(e.left=t.position.left||0,e.top=t.position.top||0),e.left<0&&(e.left=0),e.top<0&&(e.top=0),this.activeDialog.css(e),t=null,e=null,this},c=function(i,t,l,n,a){var o;if(i.srcElement&&(i.target=i.srcElement),n=e.findParentNode(i.target,function(i){if(i.getAttribute("data-dialog-btn"))return!0})){if(a=n.getAttribute("data-dialog-btn"),o={self:this,key:a,value:t.btns[a],dialogId:t.id,btnTarget:n},"prompt"===t.dialogType){var d=null;for(var s in t.input)if(o[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),""==o[s]||null==o[s]){d=s;break}}if(t.btns[a].onClick)t.btns[a].onClick.call(o,a);else if("alert"===t.dialogType)l&&l.call(o,a),this.close({doNotCallback:!0});else if("confirm"===t.dialogType)l&&l.call(o,a),this.close({doNotCallback:!0});else if("prompt"===t.dialogType){if("ok"===a&&d)return this.activeDialog.find('[data-dialog-prompt="'+d+'"]').get(0).focus(),!1;l&&l.call(o,a),this.close({doNotCallback:!0})}}o=null,t=null,l=null,n=null,a=null},g=function(i,t,e,l,n){var a,o=null;if(i.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===t.dialogType&&i.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:n,value:t.btns[n],dialogId:t.id,btnTarget:l};for(var d in t.input)if(a[d]=this.activeDialog.find("[data-dialog-prompt="+d+"]").val(),""==a[d]||null==a[d]){o=d;break}if(o)return a=null,o=null,!1;e&&e.call(a,n),this.close({doNotCallback:!0})}a=null,o=null,t=null,e=null,l=null,n=null};this.init=function(){this.onStateChanged=l.onStateChanged},this.alert=function(i,t,a){return e.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","alert")):setTimeout(function(){this.alert(i,t,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="alert",i.theme=i.theme||l.theme||"",i.callback=t,"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme}}),d.call(this,i,t),this)},this.confirm=function(i,t,a){return e.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","confirm")):setTimeout(function(){this.confirm(i,t,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="confirm",i.theme=i.theme||l.theme||"",i.callback=t,"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme},cancel:{label:l.lang.cancel}}),d.call(this,i,t),this)},this.prompt=function(i,t,a){return e.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","prompt")):setTimeout(function(){this.prompt(i,t,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="prompt",i.theme=i.theme||l.theme||"",i.callback=t,"undefined"==typeof i.input&&(i.input={value:{label:""}}),"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme},cancel:{label:l.lang.cancel}}),d.call(this,i,t),this)},this.close=function(i){var t,e;return this.activeDialog&&(t=n.dialogConfig,this.activeDialog.addClass("destroy"),jQuery(window).unbind("keydown.ax5dialog"),jQuery(window).unbind("resize.ax5dialog"),setTimeout(function(){this.activeDialog&&(this.activeDialog.remove(),this.activeDialog=null),e={self:this,state:"close",dialogId:t.id},!t.callback||i&&i.doNotCallback||t.callback.call(e),t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),t=null,e=null}.bind(this),l.animateTime)),this},this.main=function(){t.dialog_instance=t.dialog_instance||[],t.dialog_instance.push(this),arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return l}()),i=ax5.ui.dialog}(),function(){var i=ax5.ui.dialog,t=function(i){return' \n <div id="{{dialogId}}" data-ax5-ui="dialog" class="ax5-ui-dialog {{theme}}">\n <div class="ax-dialog-header">\n {{{title}}}\n </div>\n <div class="ax-dialog-body">\n <div class="ax-dialog-msg">{{{msg}}}</div>\n \n {{#input}}\n <div class="ax-dialog-prompt">\n {{#@each}}\n <div class="form-group">\n {{#@value.label}}\n <label>{{#_crlf}}{{{.}}}{{/_crlf}}</label>\n {{/@value.label}}\n <input type="{{@value.type}}" placeholder="{{@value.placeholder}}" class="form-control {{@value.theme}}" data-dialog-prompt="{{@key}}" style="width:100%;" value="{{@value.value}}" />\n {{#@value.help}}\n <p class="help-block">{{#_crlf}}{{.}}{{/_crlf}}</p>\n {{/@value.help}}\n </div>\n {{/@each}}\n </div>\n {{/input}}\n \n <div class="ax-dialog-buttons">\n <div class="ax-button-wrap">\n {{#btns}}\n {{#@each}}\n <button type="button" data-dialog-btn="{{@key}}" class="btn btn-{{@value.theme}}">{{@value.label}}</button>\n {{/@each}}\n {{/btns}}\n </div>\n </div>\n </div>\n </div> \n '};i.tmpl={dialogDisplay:t,get:function(t,e,l){return ax5.mustache.render(i.tmpl[t].call(this,l),e)}}}(); |
{ | ||
"name": "ax5ui-dialog", | ||
"version": "1.3.39", | ||
"version": "1.3.40", | ||
"description": "A dialog plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package