PageSourceSearch

https://isecretshop.com/js/main/modal.js?v=3

js isecretshop.com collected 2026-09-24 09:51:24 UTC 3,978 bytes, 111 lines download raw bytes

1$(document).ready(function() {
2    app.modal = {
3        hideCallback: true,
4        init : function () {
5            $('#modal-remote').on('show.bs.modal', function (e) {
6                app.modal.onShow(e, $(this));
7            }).on('loaded.bs.modal', function (e) {
8                app.modal.onLoaded($(this));
9            }).on('hide.bs.modal', function (e) {
10                app.modal.onHide(e, $(this));
11            });
12
13            // A modal cannot open a second modal in the same #modal-remote container
14            // without toggling itself closed. Buttons flagged data-modal-reload load
15            // their remote-url into the modal body in place instead.
16            $(document).off('click.modalReload', '[data-modal-reload]')
17                .on('click.modalReload', '[data-modal-reload]', function (e) {
18                    e.preventDefault();
19                    app.modal.reload($(this).data('remoteUrl'));
20                });
21        },
22
23        reload : function (url) {
24            if (!url) {
25                return;
26            }
27            var modal = $('#modal-remote');
28            var load = function () {
29                modal.find('#modal-content-remote').html('').load(url, function () {
30                    modal.trigger('loaded.bs.modal');
31                });
32            };
33            if (modal.hasClass('in')) {
34                load();
35            } else {
36                modal.one('shown.bs.modal', load).modal('show');
37            }
38        },
39
40        onShow : function (event, modal) {
41            var relatedTarget = $(event.relatedTarget);
42            if (!relatedTarget.length) {
43                return;
44            }
45            relatedTarget.attr('disabled', 'disabled');
46            modal.find('#modal-content-remote').html('').load(relatedTarget.data('remoteUrl'), $.proxy(function () {
47                modal.trigger('loaded.bs.modal')
48            }, modal));
49
50            var hideCallback = relatedTarget.data('hideCallback');
51            if (typeof hideCallback != 'undefined' && hideCallback.length) {
52                modal.off('hide.bs.modal').on('hide.bs.modal', function (e) {
53                    if (app.modal.hideCallback && $(this).attr('id') == $(e.target).attr('id')) {
54                        eval(hideCallback);
55                    }
56                    app.modal.onHide(e, $(this));
57                });
58            }
59        },
60
61        onLoaded : function (modal) {
62            var modalForm = modal.find('form');
63            if (modalForm.data('ajaxSubmit')) {
64                modalForm.on('beforeSubmit', function (e) {
65                    var form = $(this);
66                    if(form.find('.has-error').length) {
67                        return false;
68                    }
69
70                    app.modal.sendAjax(modal, form);
71
72                    return false;
73                });
74            }
75        },
76
77        onHide : function (event, modal) {
78            $('[data-remote-url]').removeAttr('disabled');
79            if (!app.modal.hideCallback) {
80                app.modal.hideCallback = true;
81            };
82        },
83
84        sendAjax : function (modal, form) {
85            $.ajax({
86                url: form.attr('action'),
87                type: 'post',
88                data: app.modal.getFormData(form),
89                processData: false,
90                contentType: false,
91                success: function(response) {
92                    if (response === true) {
93                        modal.modal('hide');
94                    }
95                }
96            });
97        },
98
99        getFormData : function (form) {
100            var formData = new FormData;
101            form.serializeArray().forEach(function(field) {
102                formData.append(field.name, field.value);
103            });
104            form.find('input[type=file]').each(function () {
105                formData.append($(this).attr('name'), $(this)[0].files[0]);
106            });
107
108            return formData;
109        }
110    }
111});

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.