var CommonSelectDialog=function(i,o){void 0==o&&alert("Dialog must defined"),this.opt=$.extend({limitMax:100,limitMin:1,dialogWidth:Math.min($(window).width(),940)+"px",dialogHeight:"90%",server:"/path/to/link/choose/dialog",callback:function(i,o){alert("选择了:"+JSON.stringify(i)+","+JSON.stringify(o))}},i),this.dialog=o,this.runtime={dialog:null}};CommonSelectDialog.prototype.show=function(){var i=this;window.__commonSelectDialogItems=[],window.__commonSelectDialogItems_=[],this.runtime.dialog=this.dialog.dialog(this.opt.server,{width:this.opt.dialogWidth,height:this.opt.dialogHeight,closeCallback:function(){if(window.__commonSelectDialogItems.length)return window.__commonSelectDialogItems.length>i.opt.limitMax?void i.dialog.tipError("最多只能选择"+i.opt.limitMax+"个链接"):window.__commonSelectDialogItems.length<i.opt.limitMin?void i.dialog.tipError("最少选择"+i.opt.limitMin+"个链接"):void i.opt.callback(window.__commonSelectDialogItems,window.__commonSelectDialogItems_)}})},CommonSelectDialog.prototype.close=function(){this.dialog.dialogClose(this.runtime.dialog)},module.exports=CommonSelectDialog;