Files
leanote/public/js/bootstrap-dialog.min.js

1 line
15 KiB
JavaScript
Raw Normal View History

2014-10-22 16:20:45 +08:00
!function(t,e){"use strict";"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")(t)):"function"==typeof define&&define.amd?define("bootstrap-dialog",["jquery"],function(t){return e(t)}):t.BootstrapDialog=e(t.jQuery)}(this,function(t){"use strict";var e=function(n){this.defaultOptions=t.extend(!0,{id:e.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},e.defaultOptions),this.indexedButtons={},this.registeredButtonHotkeys={},this.draggableData={isMouseDown:!1,mouseOffset:{}},this.realized=!1,this.opened=!1,this.initOptions(n),this.holdThisInstance()};return e.NAMESPACE="bootstrap-dialog",e.TYPE_DEFAULT="type-default",e.TYPE_INFO="type-info",e.TYPE_PRIMARY="type-primary",e.TYPE_SUCCESS="type-success",e.TYPE_WARNING="type-warning",e.TYPE_DANGER="type-danger",e.DEFAULT_TEXTS={},e.DEFAULT_TEXTS[e.TYPE_DEFAULT]="提示",e.DEFAULT_TEXTS[e.TYPE_INFO]="提示",e.DEFAULT_TEXTS[e.TYPE_PRIMARY]="提示",e.DEFAULT_TEXTS[e.TYPE_SUCCESS]="Success",e.DEFAULT_TEXTS[e.TYPE_WARNING]="Warning",e.DEFAULT_TEXTS[e.TYPE_DANGER]="Danger",e.SIZE_NORMAL="size-normal",e.SIZE_LARGE="size-large",e.BUTTON_SIZES={},e.BUTTON_SIZES[e.SIZE_NORMAL]="",e.BUTTON_SIZES[e.SIZE_LARGE]="btn-lg",e.ICON_SPINNER="glyphicon glyphicon-asterisk",e.ZINDEX_BACKDROP=1040,e.ZINDEX_MODAL=1050,e.defaultOptions={type:e.TYPE_PRIMARY,size:e.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:!0,closable:!0,closeByBackdrop:!0,closeByKeyboard:!0,spinicon:e.ICON_SPINNER,autodestroy:!0,draggable:!1,animate:!0,description:""},e.configDefaultOptions=function(n){e.defaultOptions=t.extend(!0,e.defaultOptions,n)},e.dialogs={},e.openAll=function(){t.each(e.dialogs,function(t,e){e.open()})},e.closeAll=function(){t.each(e.dialogs,function(t,e){e.close()})},e.moveFocus=function(){var n=null;t.each(e.dialogs,function(t,e){n=e}),null!==n&&n.isRealized()&&n.getModal().focus()},e.showScrollbar=function(){var n=null;if(t.each(e.dialogs,function(t,e){n=e}),null!==n&&n.isRealized()&&n.isOpened()){var o=n.getModal().data("bs.modal");o.checkScrollbar(),t("body").addClass("modal-open"),o.setScrollbar()}},e.prototype={constructor:e,initOptions:function(e){return this.options=t.extend(!0,this.defaultOptions,e),this},holdThisInstance:function(){return e.dialogs[this.getId()]=this,this},initModalStuff:function(){return this.setModal(this.createModal()).setModalDialog(this.createModalDialog()).setModalContent(this.createModalContent()).setModalHeader(this.createModalHeader()).setModalBody(this.createModalBody()).setModalFooter(this.createModalFooter()),this.getModal().append(this.getModalDialog()),this.getModalDialog().append(this.getModalContent()),this.getModalContent().append(this.getModalHeader()).append(this.getModalBody()).append(this.getModalFooter()),this},createModal:function(){var e=t('<div class="modal" tabindex="-1" role="dialog" aria-hidden="true"></div>');return e.prop("id",this.getId()).attr("aria-labelledby",this.getId()+"_title"),e},getModal:function(){return this.$modal},setModal:function(t){return this.$modal=t,this},createModalDialog:function(){return t('<div class="modal-dialog"></div>')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(t){return this.$modalDialog=t,this},createModalContent:function(){return t('<div class="modal-content"></div>')},getModalContent:function(){return this.$modalContent},setModalContent:function(t){return this.$modalContent=t,this},createModalHeader:function(){return t('<div class="modal-header"></div>')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(t){return this.$modalHeader=t,this},createModalBody:function(){return t('<div class="modal-body"></div>')},getModalBody:function(){return this.$modalBody},setModalBody:function(t){return this.$modalBody=t,this},createModalFooter:function(){return t('<div class="modal-footer"></div>')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(t){return this.$modalFooter=t,this},createDynamicContent:function(t){var e=null;return e="function"==typeof t?t.call(t,this):t,"string"==ty