LoginAction/MyCourse/web/lib/bootbox/bootbox.min.js

2 lines
8.4 KiB
JavaScript
Raw Permalink Normal View History

2023-02-07 04:17:56 +00:00
/*! bootbox.js v4.4.0 http://bootboxjs.com/license.txt */
!function(t,o){"use strict";"function"==typeof define&&define.amd?define(["jquery"],o):"object"==typeof exports?module.exports=o(require("jquery")):t.bootbox=o(t.jQuery)}(this,function t(o,e){"use strict";function a(t){var o=h[f.locale];return o?o[t]:h.en[t]}function n(t,e,a){t.stopPropagation(),t.preventDefault();var n=o.isFunction(a)&&a.call(e,t)===!1;n||e.modal("hide")}function r(t){var o,e=0;for(o in t)e++;return e}function i(t,e){var a=0;o.each(t,function(t,o){e(t,o,a++)})}function c(t){var e,a;if("object"!=typeof t)throw new Error("Please supply an object of options");if(!t.message)throw new Error("Please specify a message");return t=o.extend({},f,t),t.buttons||(t.buttons={}),e=t.buttons,a=r(e),i(e,function(t,n,r){if(o.isFunction(n)&&(n=e[t]={callback:n}),"object"!==o.type(n))throw new Error("button with key "+t+" must be an object");n.label||(n.label=t),n.className||(2===a&&("ok"===t||"confirm"===t)||1===a?n.className="btn-primary":n.className="btn-default")}),t}function l(t,o){var e=t.length,a={};if(e<1||e>2)throw new Error("Invalid argument length");return 2===e||"string"==typeof t[0]?(a[o[0]]=t[0],a[o[1]]=t[1]):a=t[0],a}function s(t,e,a){return o.extend(!0,{},t,l(e,a))}function u(t,o,e,a){var n={className:"bootbox-"+t,buttons:p.apply(null,o)};return b(s(n,a,e),o)}function p(){for(var t={},o=0,e=arguments.length;o<e;o++){var n=arguments[o],r=n.toLowerCase(),i=n.toUpperCase();t[r]={label:a(i)}}return t}function b(t,o){var a={};return i(o,function(t,o){a[o]=!0}),i(t.buttons,function(t){if(a[t]===e)throw new Error("button key "+t+" is not allowed (options are "+o.join("\n")+")")}),t}var d={dialog:"<div class='bootbox modal' tabindex='-1' role='dialog'><div class='modal-dialog'><div class='modal-content'><div class='modal-body'><div class='bootbox-body'></div></div></div></div></div>",header:"<div class='modal-header'><h4 class='modal-title'></h4></div>",footer:"<div class='modal-footer'></div>",closeButton:"<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>&times;</button>",form:"<form class='bootbox-form'></form>",inputs:{text:"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",textarea:"<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",email:"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",select:"<select class='bootbox-input bootbox-input-select form-control'></select>",checkbox:"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",date:"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",time:"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",number:"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",password:"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"}},f={locale:o.zui&&o.zui.clientLang?o.zui.clientLang():"zh_cn",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},m={};m.alert=function(){var t;if(t=u("alert",["ok"],["message","callback"],arguments),t.callback&&!o.isFunction(t.callback))throw new Error("alert requires callback property to be a function when provided");return t.buttons.ok.callback=t.onEscape=function(){return!o.isFunction(t.callback)||t.callback.call(this)},m.dialog(t)},m.confirm=function(){var t;if(t=u("confirm",["confirm","cancel"],["message","callback"],arguments),t.buttons.cancel.callback=t.onEscape=function(){return t.callback.call(this,!1)},t.buttons.confirm.callback=function(){return t.callback.call(this,!0)},!o.isFunction(t.callback))throw new Error("confirm requires a callback");return m.dialog(t)},m.prompt=function(){var t,a,n,r,c,l,u;if(r=o(d.form),a={className:"bootbox-prompt",buttons:p("cancel","confirm"),value:"",inputType:"text"},t=b(s(a,arguments,["title","callback"]),["confirm","cancel"]),l=t.show===e||t.show,t.message=r,t.butto