PageSourceSearch

https://xn--80aabfhgglecf7cgdfd5akt9xka.xn--p1ai/web/java/confirm-bootstrap.js

js xn--80aabfhgglecf7cgdfd5akt9xka.xn--p1ai collected 2026-10-08 05:35:03 UTC 4,869 bytes, 130 lines download raw bytes

1/* ===================================================
2 * confirmModal by Maxime AILLOUD
3 * https://github.com/maxailloud/confirm-bootstrap
4 * ===================================================
5 *            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENCE
6 *                    Version 2, December 2004
7 *
8 * Copyright (C) 2004 Sam Hocevar <[email protected]>
9 *
10 * Everyone is permitted to copy and distribute verbatim or modified
11 * copies of this licence document, and changing it is allowed as long
12 * as the name is changed.
13 *
14 *            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENCE
15 *   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16 *
17 *  0. You just DO WHAT THE FUCK YOU WANT TO.
18 * ========================================================== */
19
20
21 (function($) {
22    $.fn.confirmModal = function(opts)
23    {
24        var body = $('body');
25        var defaultOptions    = {
26            confirmTitle     : 'Please confirm',
27            confirmMessage   : 'Are you sure you want to perform this action ?',
28            confirmOk        : 'Yes',
29            confirmCancel    : 'Cancel',
30            confirmDirection : 'rtl',
31            confirmStyle     : 'primary',
32            confirmCallback  : defaultCallback,
33            confirmDismiss   : true,
34            confirmAutoOpen  : false
35        };
36
37        var headModalTemplate =
38            '<div class="modal fade" id="#modalId#" tabindex="-1" role="dialog" aria-labelledby="#AriaLabel#" aria-hidden="true">' +
39                '<div class="modal-dialog">' +
40                    '<div class="modal-content">' +
41                        '<div class="modal-header">' +
42                            '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
43                            '<h4 id="#AriaLabel#" class="modal-title">#Heading#</h4>' +
44                        '</div>' +
45                        '<div class="modal-body">' +
46                            '<p>#Body#</p>' +
47                        '</div>' +
48                        '<div class="modal-footer">' +
49                        '#buttonTemplate#' +
50                        '</div>' +
51                    '</div>' +
52                '</div>' +
53            '</div>'
54            ;
55
56        return this.each(function()
57        {
58            var options = $.extend({}, defaultOptions, opts);
59
60            var confirmLink = $(this);
61            var targetData  = confirmLink.data();
62
63            $.extend(options, targetData);
64
65            var modalId = "confirmModal" + Math.floor(Math.random()*(1e+9));
66            var modalTemplate = headModalTemplate;
67            var buttonTemplate =
68                '<button class="btn btn-default" data-dismiss="modal">#Cancel#</button>' +
69                '<button class="btn btn-#Style#" data-dismiss="ok">#Ok#</button>'
70            ;
71
72            if(options.confirmDirection == 'ltr')
73            {
74                buttonTemplate =
75                    '<button class="btn btn-#Style#" data-dismiss="ok">#Ok#</button>' +
76                    '<button class="btn btn-default" data-dismiss="modal">#Cancel#</button>'
77                ;
78            }
79
80            var confirmTitle = options.confirmTitle;
81            if(typeof options.confirmTitle == 'function')
82            {
83                confirmTitle = options.confirmTitle.call(this);
84            }
85
86            var confirmMessage = options.confirmMessage;
87            if(typeof options.confirmMessage == 'function')
88            {
89                confirmMessage = options.confirmMessage.call(this);
90            }
91
92            modalTemplate = modalTemplate.
93                replace('#buttonTemplate#', buttonTemplate).
94                replace('#modalId#', modalId).
95                replace('#AriaLabel#', confirmTitle).
96                replace('#Heading#', confirmTitle).
97                replace('#Body#', confirmMessage).
98                replace('#Ok#', options.confirmOk).
99                replace('#Cancel#', options.confirmCancel).
100                replace('#Style#', options.confirmStyle)
101            ;
102
103            body.append(modalTemplate);
104
105            var confirmModal = $('#' + modalId);
106
107            confirmLink.on('click', function(modalEvent)
108            {
109                modalEvent.preventDefault();
110                confirmModal.modal('show');
111            });
112
113            $('button[data-dismiss="ok"]', confirmModal).on('click', function(event) {
114                if (options.confirmDismiss) {
115                    confirmModal.modal('hide');
116                }
117                options.confirmCallback(confirmLink, confirmModal);
118            });
119
120            if (options.confirmAutoOpen) {
121                confirmModal.modal('show');
122            }
123        });
124
125        function defaultCallback(target, modal)
126        {
127            window.location = $(target).attr('href');
128        }
129    };
130})(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.