1/** 2 * bootbox.js v4.4.0 3 * 4 * http://bootboxjs.com/license.txt 5 */ 6!(function (a, b) { 7 "use strict"; 8 "function" == typeof define && define.amd ? define(["jquery"], b) : "object" == typeof exports ? (module.exports = b(require("jquery"))) : (a.bootbox = b(a.jQuery)); 9})(this, function a(b, c) { 10 "use strict"; 11 function d(a) { 12 var b = q[o.locale]; 13 return b ? b[a] : q.en[a]; 14 } 15 function e(a, c, d) { 16 a.stopPropagation(), a.preventDefault(); 17 var e = b.isFunction(d) && d.call(c, a) === !1; 18 console.log(c); 19 e || c.modal("hide"); 20 if(!e){ 21 $('body').removeClass('modal-open'); 22 c.next().remove() 23 c.remove(); 24 } 25 } 26 function f(a) { 27 var b, 28 c = 0; 29 for (b in a) c++; 30 return c; 31 } 32 function g(a, c) { 33 var d = 0; 34 b.each(a, function (a, b) { 35 c(a, b, d++); 36 }); 37 } 38 function h(a) { 39 var c, d; 40 if ("object" != typeof a) throw new Error("Please supply an object of options"); 41 if (!a.message) throw new Error("Please specify a message"); 42 return ( 43 (a = b.extend({}, o, a)), 44 a.buttons || (a.buttons = {}), 45 (c = a.buttons), 46 (d = f(c)), 47 g(c, function (a, e, f) { 48 if ((b.isFunction(e) && (e = c[a] = { callback: e }), "object" !== b.type(e))) throw new Error("button with key " + a + " must be an object"); 49 e.label || (e.label = a), e.className || (e.className = 2 >= d && f === d - 1 ? "btn-primary" : "btn-default"); 50 }), 51 a 52 ); 53 } 54 function i(a, b) { 55 var c = a.length, 56 d = {}; 57 if (1 > c || c > 2) throw new Error("Invalid argument length"); 58 return 2 === c || "string" == typeof a[0] ? ((d[b[0]] = a[0]), (d[b[1]] = a[1])) : (d = a[0]), d; 59 } 60 function j(a, c, d) { 61 return b.extend(!0, {}, a, i(c, d)); 62 } 63 function k(a, b, c, d) { 64 var e = { className: "bootbox-" + a, buttons: l.apply(null, b) }; 65 return m(j(e, d, c), b); 66 } 67 function l() { 68 for (var a = {}, b = 0, c = arguments.length; c > b; b++) { 69 var e = arguments[b], 70 f = e.toLowerCase(), 71 g = e.toUpperCase(); 72 a[f] = { label: d(g) }; 73 } 74 return a; 75 } 76 function m(a, b) { 77 var d = {}; 78 return ( 79 g(b, function (a, b) { 80 d[b] = !0; 81 }), 82 g(a.buttons, function (a) { 83 if (d[a] === c) throw new Error("button key " + a + " is not allowed (options are " + b.join("\n") + ")"); 84 }), 85 a 86 ); 87 } 88 var n = { 89 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>", 90 header: "<div class='modal-header'><h4 class='modal-title'></h4></div>", 91 footer: "<div class='modal-footer'></div>", 92 closeButton: "<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>×</button>", 93 form: "<form class='bootbox-form'></form>", 94 inputs: { 95 text: "<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />", 96 textarea: "<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>", 97 email: "<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />", 98 select: "<select class='bootbox-input bootbox-input-select form-control'></select>", 99 checkbox: "<div class='checkbox'><label>
99<input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>", 100 date: "<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />", 101 time: "<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />", 102 number: "<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />", 103 password: "<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />", 104 }, 105 }, 106 o = { locale: "en", backdrop: "static", animate: !0, className: null, closeButton: !0, show: !0, container: "body" }, 107 p = {}; 108 (p.alert = function () { 109 var a; 110 if (((a = k("alert", ["ok"], ["message", "callback"], arguments)), a.callback && !b.isFunction(a.callback))) throw new Error("alert requires callback property to be a function when provided"); 111 return ( 112 (a.buttons.ok.callback = a.onEscape = function () { 113 return b.isFunction(a.callback) ? a.callback.call(this) : !0; 114 }), 115 p.dialog(a) 116 ); 117 }), 118 (p.confirm = function () { 119 var a; 120 if ( 121 ((a = k("confirm", ["cancel", "confirm"], ["message", "callback"], arguments)), 122 (a.buttons.cancel.callback = a.onEscape = function () { 123 return a.callback.call(this, !1); 124 }), 125 (a.buttons.confirm.callback = function () { 126 return a.callback.call(this, !0); 127 }), 128 !b.isFunction(a.callback)) 129 ) 130 throw new Error("confirm requires a callback"); 131 return p.dialog(a); 132 }), 133 (p.prompt = function () { 134 var a, d, e, f, h, i, k; 135 if ( 136 ((f = b(n.form)), 137 (d = { className: "bootbox-prompt", buttons: l("cancel", "confirm"), value: "", inputType: "text" }), 138 (a = m(j(d, arguments, ["title", "callback"]), ["cancel", "confirm"])), 139 (i = a.show === c ? !0 : a.show), 140 (a.message = f), 141 (a.buttons.cancel.callback = a.onEscape = function () { 142 return a.callback.call(this, null); 143 }), 144 (a.buttons.confirm.callback = function () { 145 var c; 146 switch (a.inputType) { 147 case "text": 148 case "textarea": 149 case "email": 150 case "select": 151 case "date": 152 case "time": 153 case "number": 154 case "password": 155 c = h.val(); 156 break; 157 case "checkbox": 158 var d = h.find("input:checked"); 159 (c = []), 160 g(d, function (a, d) { 161 c.push(b(d).val()); 162 }); 163 } 164 return a.callback.call(this, c); 165 }), 166 (a.show = !1), 167 !a.title) 168 ) 169 throw new Error("prompt requires a title"); 170 if (!b.isFunction(a.callback)) throw new Error("prompt requires a callback"); 171 if (!n.inputs[a.inputType]) throw new Error("invalid prompt type"); 172 switch (((h = b(n.inputs[a.inputType])), a.inputType)) { 173 case "text": 174 case "textarea": 175 case "email": 176 case "date": 177 case "time": 178 case "number": 179 case "password": 180 h.val(a.value); 181 break; 182 case "select": 183 var o = {}; 184 if (((k = a.inputOptions || []), !b.isArray(k))) throw new Error("Please pass an array of input options"); 185 if (!k.length) throw new Error("prompt with select requires options"); 186 g(k, function (a, d) { 187 var e = h; 188 if (d.value === c || d.text === c) throw new Error("given options in wrong format");
189 d.group && (o[d.group] || (o[d.group] = b("<optgroup/>").attr("label", d.group)), (e = o[d.group])), e.append("<option value='" + d.value + "'>" + d.text + "</option>"); 190 }), 191 g(o, function (a, b) { 192 h.append(b); 193 }), 194 h.val(a.value); 195 break; 196 case "checkbox": 197 var q = b.isArray(a.value) ? a.value : [a.value]; 198 if (((k = a.inputOptions || []), !k.length)) throw new Error("prompt with checkbox requires options"); 199 if (!k[0].value || !k[0].text) throw new Error("given options in wrong format"); 200 (h = b("<div/>")), 201 g(k, function (c, d) { 202 var e = b(n.inputs[a.inputType]); 203 e.find("input").attr("value", d.value), 204 e.find("label").append(d.text), 205 g(q, function (a, b) { 206 b === d.value && e.find("input").prop("checked", !0); 207 }), 208 h.append(e); 209 }); 210 } 211 return ( 212 a.placeholder && h.attr("placeholder", a.placeholder), 213 a.pattern && h.attr("pattern", a.pattern), 214 a.maxlength && h.attr("maxlength", a.maxlength), 215 f.append(h), 216 f.on("submit", function (a) { 217 a.preventDefault(), a.stopPropagation(), e.find(".btn-primary").click(); 218 }), 219 (e = p.dialog(a)), 220 e.off("shown.bs.modal"), 221 e.on("shown.bs.modal", function () { 222 h.focus(); 223 }), 224 i === !0 && e.modal("show"), 225 e 226 ); 227 }), 228 (p.dialog = function (a) { 229 a = h(a); 230 var d = b(n.dialog), 231 f = d.find(".modal-dialog"), 232 i = d.find(".modal-body"), 233 j = a.buttons, 234 k = "", 235 l = { onEscape: a.onEscape }; 236 if (b.fn.modal === c) throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details."); 237 if ( 238 (g(j, function (a, b) { 239 (k += "<button data-bb-handler='" + a + "' type='button' class='btn " + b.className + "'>" + b.label + "</button>"), (l[a] = b.callback); 240 }), 241 i.find(".bootbox-body").html(a.message), 242 a.animate === !0 && d.addClass("fade"), 243 a.className && d.addClass(a.className), 244 "large" === a.size ? f.addClass("modal-lg") : "small" === a.size && f.addClass("modal-sm"), 245 a.title && i.before(n.header), 246 a.closeButton) 247 ) { 248 var m = b(n.closeButton); 249 a.title ? d.find(".modal-header").prepend(m) : m.css("margin-top", "-10px").prependTo(i); 250 } 251 return ( 252 a.title && d.find(".modal-title").html(a.title), 253 k.length && (i.after(n.footer), d.find(".modal-footer").html(k)), 254 d.on("hidden.bs.modal", function (a) { 255 a.target === this && d.remove(); 256 }), 257 d.on("shown.bs.modal", function () { 258 d.find(".btn-primary:first").focus(); 259 }), 260 "static" !== a.backdrop && 261 d.on("click.dismiss.bs.modal", function (a) { 262 d.children(".modal-backdrop").length && (a.currentTarget = d.children(".modal-backdrop").get(0)), a.target === a.currentTarget && d.trigger("escape.close.bb"); 263 }), 264 d.on("escape.close.bb", function (a) { 265 l.onEscape && e(a, d, l.onEscape); 266 }), 267 d.on("click", ".modal-footer button", function (a) { 268 var c = b(this).data("bb-handler"); 269 e(a, d, l[c]); 270 }), 271 d.on("click", ".bootbox-close-button", function (a) { 272 e(a, d, l.onEscape); 273 }), 274 d.on("keyup", function (a) { 275 27 === a.which && d.trigger("escape.close.bb"); 276 }), 277 b(a.container).append(d), 278 d.modal({ backdrop: a.backdrop ? "static" : !1, keyboard: !1, show: !1 }), 279 a.show && d.modal("show"), 280 d 281 ); 282 }), 283 (p.setDefaults = function () { 284 var a = {}; 285 2 === arguments.length ? (a[arguments[0]] = arguments[1]) : (a = arguments[0]), b.extend(o, a); 286 }), 287 (p.hideAll = function () { 288 return b(".bootbox").modal("hide"), p; 289 }); 290 var q = { 291 bg_BG: { OK: "Ðк", CANCEL: "ÐÑказ", CONFIRM: "ÐоÑвÑÑждавам" }, 292 br: { OK: "OK", CANCEL: "Cancelar", CONFIRM: "Sim" }, 293 cs: { OK: "OK", CANCEL: "ZruÅ¡it", CONFIRM: "Potvrdit" }, 294 da: { OK: "OK", CANCEL: "Annuller", CONFIRM: "Accepter" }, 295 de: { OK: "OK", CANCEL: "Abbrechen", CONFIRM: "Akzeptieren" }, 296 el: { OK: "ÎνÏάξει", CANCEL: "ÎκÏÏÏÏη", CONFIRM: "ÎÏιβεβαίÏÏη" }, 297 en: { OK: "OK", CANCEL: "Cancel", CONFIRM: "OK" }, 298 es: { OK: "OK", CANCEL: "Cancelar", CONFIRM: "Aceptar" }, 299 et: { OK: "OK", CANCEL: "Katkesta", CONFIRM: "OK" }, 300 fa: { OK: "ÙØ¨ÙÙ", CANCEL: "ÙØºÙ", CONFIRM: "تاÛÛØ¯" }, 301 fi: { OK: "OK", CANCEL: "Peruuta", CONFIRM: "OK" }, 302 fr: { OK: "OK", CANCEL: "Annuler", CONFIRM: "D'accord" }, 303 he: { OK: "××ש×ר", CANCEL: "×××××", CONFIRM: "××ש×ר" }, 304 hu: { OK: "OK", CANCEL: "Mégsem", CONFIRM: "MegerÅsÃt" }, 305 hr: { OK: "OK", CANCEL: "Odustani", CONFIRM: "Potvrdi" }, 306 id: { OK: "OK", CANCEL: "Batal", CONFIRM: "OK" }, 307 it: { OK: "OK", CANCEL: "Annulla", CONFIRM: "Conferma" }, 308 ja: { OK: "OK", CANCEL: "ãã£ã³ã»ã«", CONFIRM: "確èª" }, 309 lt: { OK: "Gerai", CANCEL: "AtÅ¡aukti", CONFIRM: "Patvirtinti" }, 310 lv: { OK: "Labi", CANCEL: "Atcelt", CONFIRM: "ApstiprinÄt" }, 311 nl: { OK: "OK", CANCEL: "Annuleren", CONFIRM: "Accepteren" }, 312 no: { OK: "OK", CANCEL: "Avbryt", CONFIRM: "OK" }, 313 pl: { OK: "OK", CANCEL: "Anuluj", CONFIRM: "Potwierdź" }, 314 pt: { OK: "OK", CANCEL: "Cancelar", CONFIRM: "Confirmar" }, 315 ru: { OK: "OK", CANCEL: "ÐÑмена", CONFIRM: "ÐÑимениÑÑ" }, 316 sq: { OK: "OK", CANCEL: "Anulo", CONFIRM: "Prano" }, 317 sv: { OK: "OK", CANCEL: "Avbryt", CONFIRM: "OK" }, 318 th: { OK: "à¸à¸à¸¥à¸", CANCEL: "ยà¸à¹à¸¥à¸´à¸", CONFIRM: "ยืà¸à¸¢à¸±à¸" }, 319 tr: { OK: "Tamam", CANCEL: "İptal", CONFIRM: "Onayla" }, 320 zh_CN: { OK: "OK", CANCEL: "åæ¶", CONFIRM: "确认" }, 321 zh_TW: { OK: "OK", CANCEL: "åæ¶", CONFIRM: "確èª" }, 322 }; 323 return ( 324 (p.addLocale = function (a, c) { 325 return ( 326 b.each(["OK", "CANCEL", "CONFIRM"], function (a, b) { 327 if (!c[b]) throw new Error("Please supply a translation for '" + b + "'"); 328 }), 329 (q[a] = { OK: c.OK, CANCEL: c.CANCEL, CONFIRM: c.CONFIRM }), 330 p 331 ); 332 }), 333 (p.removeLocale = function (a) { 334 return delete q[a], p; 335 }), 336 (p.setLocale = function (a) { 337 return p.setDefaults("locale", a); 338 }), 339 (p.init = function (c) { 340 return a(c || b); 341 }), 342 p 343 ); 344});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.