1var abp = abp || {}; 2(function ($) { 3 if (!sweetAlert || !$) { 4 return; 5 } 6 7 /* DEFAULTS *************************************************/ 8 9 abp.libs = abp.libs || {}; 10 abp.libs.sweetAlert = { 11 config: { 12 'default': { 13 14 }, 15 info: { 16 type: 'info' 17 }, 18 success: { 19 type: 'success' 20 }, 21 warn: { 22 type: 'warning' 23 }, 24 error: { 25 type: 'error' 26 }, 27 confirm: { 28 type: 'warning', 29 title: 'Are you sure?', 30 showCancelButton: true, 31 cancelButtonText: 'Cancel', 32 confirmButtonColor: "#DD6B55", 33 confirmButtonText: 'Yes' 34 } 35 } 36 }; 37 38 /* MESSAGE **************************************************/ 39 40 var showMessage = function (type, message, title) { 41 if (!title) { 42 title = message; 43 message = undefined; 44 } 45 46 var opts = $.extend( 47 {}, 48 abp.libs.sweetAlert.config.default, 49 abp.libs.sweetAlert.config[type], 50 { 51 title: title, 52 text: message 53 } 54 ); 55 56 return $.Deferred(function ($dfd) { 57 sweetAlert(opts, function () { 58 $dfd.resolve(); 59 }); 60 }); 61 }; 62 63 abp.message.info = function (message, title) { 64 return showMessage('info', message, title); 65 }; 66 67 abp.message.success = function (message, title) { 68 return showMessage('success', message, title); 69 }; 70 71 abp.message.warn = function (message, title) { 72 return showMessage('warn', message, title); 73 }; 74 75 abp.message.error = function (message, title) { 76 return showMessage('error', message, title); 77 }; 78 79 abp.message.confirm = function (message, titleOrCallback, callback) { 80 var userOpts = { 81 text: message 82 }; 83 84 if ($.isFunction(titleOrCallback)) { 85 callback = titleOrCallback; 86 } else if (titleOrCallback) { 87 userOpts.title = titleOrCallback; 88 }; 89 90 var opts = $.extend( 91 {}, 92 abp.libs.sweetAlert.config.default, 93 abp.libs.sweetAlert.config.confirm, 94 userOpts 95 ); 96 97 return $.Deferred(function ($dfd) { 98 sweetAlert(opts, function (isConfirmed) { 99 callback && callback(isConfirmed); 100 $dfd.resolve(isConfirmed); 101 }); 102 }); 103 }; 104 105 abp.event.on('abp.dynamicScriptsInitialized', function () { 106 abp.libs.sweetAlert.config.confirm.title = abp.localization.abpWeb('AreYouSure'); 107 abp.libs.sweetAlert.config.confirm.cancelButtonText = abp.localization.abpWeb('Cancel'); 108 abp.libs.sweetAlert.config.confirm.confirmButtonText = abp.localization.abpWeb('Yes'); 109 }); 110 111})(jQuery);
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.