PageSourceSearch

https://www.onlinetravel.com.ar/general/plugin/dwmodal/dwmodal.js?zxc=1791172714

js onlinetravel.com.ar collected 2026-10-05 03:59:46 UTC 10,251 bytes, 361 lines download raw bytes

1
2var HelperModal = {
3    msg: function (title, msg, callback, oninit, type) {
4        var type = type || 1;
5        switch (type) {
6            case 1:
7                var m = new Modal();
8                m.append(msg);
9                m.title(title);
10                m.onClose(function () {
11                    if (typeof callback === 'function') {
12                        callback();
13                    }
14                }, true);
15                m.show(function () {
16                    if (typeof oninit === 'function') {
17                        oninit();
18                    }
19
20                });
21                return m;
22                break;
23            case 2:/*
24                <div class="errpanel">
25        <span class="title">Error grave</span>
26        <span class="text">Lore fhdjs hfjk dshfja hkjfhdkjs fakjdhskjfhdks fdsfds
27        f dsf dsf jkdls fkljdkls fjkdsf</span>
28    </div>
29                    */
30                                       
31                $(".errpanel").remove();
32                var $panel = $('<div />',{class:'errpanel'});
33                var $title = $('<div />',{class:'title', text:title});
34                var $text = $('<div />',{class:'text',html:msg});
35                
36                $panel.append($title);
37                $panel.append($text);
38                
39                $("body").append($panel);
40                $panel.addClass('open');
41                $("body").one('click', function(){
42                    $panel.remove();
43                    callback();
44                });
45                break;
46        }
47
48
49    }
50};
51
52
53
54
55function Modal(options) {
56    var _this = this;
57    var $content = null;
58    var def = {
59        btnclose: true
60    };
61    var settings = $.extend(def, options);
62
63    var $modalFade = $("<div  class='modal fade'  role='dialog' ></div>");
64    var $modalDialog = $("<div class='modal-dialog '></div>");
65    var $modalContent = $("<div class='modal-content'></div>");
66    var $modalHeader = $("<div class='modal-header'></div>");
67    var $headerButtonClose = $('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>');
68    var $headerTitle = $('<h4 class="modal-title" ></h4>');
69    var $modalBody = $("<div class='modal-body'></div>");
70    var $modalFooter = $("<div class='modal-footer'></div>");
71    $modalFooter.append("<table><tr><td class='fleft'></td><td class='fcenter'></td><td class='fright'></td></tr></table>");
72    var $modalFooterButtonGroupLeft = $("<p></p>");
73
74    var $modalConfirm = $("<div class='modal-confirm'></div>");
75    var $modalConfirmBox = $("<div class='modal-confirm-box'></div>");
76    $modalConfirm.append($modalConfirmBox);
77
78    var _theme = '';
79
80    var $footerButtonClose = $('<button type="button" class="btn btn-primary close-modal-button" data-dismiss="modal">Cerrar</button>');
81    var $title = false;
82    var buttonsFooters = [];
83
84    this.big = function () {
85        $modalDialog.addClass('modal-lg');
86    };
87    this.bigest = function () {
88        $modalDialog.addClass('modal-xlg');
89    };
90
91    var init = function () {
92        $modalFooter.append($footerButtonClose);
93        _this.addButton($footerButtonClose, 'right');
94        if (settings.btnclose !== true) {
95            $footerButtonClose.remove();
96        }
97
98        $modalHeader.append($headerButtonClose);
99        $modalHeader.append($headerTitle);
100        $modalContent.append($modalHeader);
101        $modalContent.append($modalBody);
102        $modalContent.append($modalFooter);
103        $modalDialog.append($modalContent);
104        $modalFade.append($modalDialog);
105        $("body").append($modalFade);
106    };
107
108    this.setTheme = function (theme) {
109        _theme = theme;
110    };
111
112    var initEvents = function () {
113        $footerButtonClose.off("click.c").on({
114            "click.c": function () {
115                buttonClosePress = true;
116
117                var brtn = true;
118                if (brtn !== false) {
119                    buttonClosePress = true;
120                }
121                else {
122                    return false;
123                }
124
125            }
126        });
127    };
128
129
130
131    /**
132     * 
133     * @param JQueryObject $content
134     */
135    this.append = function ($appendContent) {
136        $content = $appendContent;
137    };
138
139    this.title = function ($titleContent) {
140        $title = $titleContent;
141    };
142
143    this.addButton = function ($button, floating, callback) {
144
145
146        floating = floating || 'left';
147
148        $modalFooter.find(".f" + floating).append($button);
149
150
151        $button.on({
152            "click.cl": function () {
153                if (typeof callback === 'function') {
154                    callback();
155                    return false;
156                }
157            }
158        });
159
160    };
161    var _bClose = true;
162    this.close = function () {
163
164        if (typeof _onBeforeCloseCallback === 'function') {
165            brtn = _onBeforeCloseCallback();
166        }
167        if (_bClose) {
168            $modalFade.modal('hide');
169        }
170    };
171
172    var _optModal = {};
173    this.preventCloseOutside = function (callback) {
174        _optModal['backdrop'] = 'static';
175        _optModal['keyboard'] = false;
176
177    };
178
179    /**
180     * 
181     * @param function callback
182     */
183    var buttonClosePress = false;
184    this.show = function (_onAfterShowCallback) {
185        if (_theme) {
186            $("body").addClass("modal_" + _theme);
187        }
188
189        $modalFade.modal(_optModal);
190        $modalFade.on('shown.bs.modal', function (e) {
191            $modalBody.append($content);
192            if ($title !== false) {
193                $modalHeader.find(".modal-title").html($title);
194            }
195
196            if (typeof _onAfterShowCallback === 'function') {
197                _onAfterShowCallback($modalFade, $modalBody);
198            }
199        });
200
201        initEvents();
202        /*
203         $modalFade.on('hidden.bs.modal', function (e) {
204         if (typeof _onAfterCloseCallback === 'function' && buttonClosePress) {
205         _onAfterCloseCallback($modalFade);
206         }
207         buttonClosePress =  false;
208         $modalFade.remove();
209         });*/
210    };
211    var _onBeforeCloseCallback;
212    this.onBeforeClose = function (callback) {
213        _onBeforeCloseCallback = callback;
214
215        $modalFade.off('hide.bs.modal').on('hide.bs.modal', function (e) {
216            var rtn = _onBeforeCloseCallback();
217            return rtn;
218
219        });
220    };
221
222
223    var _onAfterCloseCallback;
224    /**
225     * 
226     * @param function callback
227     * @param bool bcallback true: ejecuta ante cualquier evento que cierre la venta , false: solo con boton cerrar.
228     * @returns {undefined}
229     */
230    this.onClose = function (callback, bcallback) {
231
232        _onAfterCloseCallback = callback;
233        _bClose = true;
234        $modalFade.off('hidden.bs.modal').on('hidden.bs.modal', function (e) {
235            $("body").removeClass("modal_" + _theme);
236            if (typeof _onAfterCloseCallback === 'function' && buttonClosePress || bcallback) {
237                var bresult = _onAfterCloseCallback($modalFade, $modalBody);
238                if (bresult === false) {
239                    _bClose = false;
240                }
241            }
242            else {
243                if (buttonClosePress) {
244                }
245                if (bcallback) {
246                }
247
248            }
249            buttonClosePress = false;
250            $modalFade.remove();
251        });
252    };
253
254    this.getFooter = function () {
255        return $modalFooter;
256    };
257
258    this.getButtonClose = function () {
259        return $footerButtonClose;
260    };
261
262    this.prepareSelect2 = function ($select2) {
263        $select2.on({
264            "select2:open": function () {
265                $(".select2-container--open").addClass("onmodal");
266            },
267            "select2:close": function () {
268                $(".select2-container--open").removeClass("onmodal");
269            },
270        });
271    };
272
273    this.destroy = function () {
274        $modalFade.data('bs.modal', null);
275        $modalFade.remove();
276    };
277
278    this.openConfirm = function (options) {
279        def = {
280            class: false,
281            title: '',
282            content: '',
283            labelsi: 'si',
284            labelno: 'no',
285            callbacksi: false,
286            callbackno: false
287        };
288
289        var newopt = $.extend({}, def, options);
290        if ($(".modal-confirm").length > 0) {
291            return;
292        }
293        var $modConf = $modalConfirm.clone();
294
295        var $title = $("<h1>" + newopt.title + "</h1>");
296        var $content = $("<p>" + newopt.content + "</p>");
297        var $btnSi = $("<button class='btn btn-primary'>" + newopt.labelsi + "</button>");
298        var $btnNo = $("<button class='btn btn-primary'>" + newopt.labelno + "</button>");
299        var $buttons = $("<p class='btn-content'></p>");
300
301        if (newopt.class !== false) {
302            $modConf.addClass(newopt.class);
303        }
304
305
306
307        $modalContent.append($modConf);
308        var $modalConfirmBox = $modalContent.find(".modal-confirm-box");
309        $modalConfirmBox.append($title);
310        $modalConfirmBox.append($content);
311        $modalConfirmBox.append($buttons);
312
313
314        if (newopt.labelno !== false) {
315            $buttons.append($btnNo);
316            $btnNo.on({
317                "click": function () {
318                    if (typeof newopt.callbackno === 'function') {
319                        newopt.callbackno($modConf);
320                    }
321                    else {
322                        $modConf.remove();
323
324                    }
325                }
326            });
327        }
328        if (newopt.labelsi !== false) {
329            $buttons.append($btnSi);
330            $btnSi.on({
331                "click": function () {
332                    if (typeof newopt.callbacksi === 'function') {
333                        newopt.callbacksi($modConf);
334                    }
335                }
336            });
337        }
338
339
340
341
342    };
343    var _variabables = {};
344    this.set = function (key, value) {
345        _variabables[key] = value;
346    };
347    this.get = function (key) {
348        if (typeof _variabables[key] !== 'undefined') {
349            return _variabables[key];
350        }
351        else {
352            return false;
353        }
354
355    };
356
357
358    init();
359    initEvents();
360
361}

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.