PageSourceSearch

https://psp.ru/local/templates/psp/js/jquery.modal.js

js psp.ru collected 2026-10-06 20:27:29 UTC 4,611 bytes, 45 lines download raw bytes

1!function(n){"object"==typeof module&&"object"==typeof module.exports?module.exports=n(require("jquery")):n(jQuery)}(function(n){n.fn.jqm=function(o){return this.each(function(){var t=n(this).data("jqm")||n.extend({ID:m++},n.jqm.params),e=n.extend(t,o);n(this).data("jqm",e).addClass("jqm-init")[0]._jqmID=e.ID,n(this).jqmAddTrigger(e.trigger)})},n.fn.jqmAddTrigger=function(t){return t?this.each(function(){a(n(this),"jqmShow",t)||o("jqmAddTrigger must be called on initialized modals")}):void 0},n.fn.jqmAddClose=function(t){return t?this.each(function(){a(n(this),"jqmHide",t)||o("jqmAddClose must be called on initialized modals")}):void 0},n.fn.jqmShow=function(o){return this.each(function(){this._jqmShown||t(n(this),o)})},n.fn.jqmHide=function(o){return this.each(function(){this._jqmShown&&e(n(this),o)})};var o=function(n){window.console&&window.console.error&&window.console.error(n)},t=function(o,t){t=t||window.event;var e=o.data("jqm"),i=parseInt(o.css("z-index"),10)||3e3,s=n("<div></div>").addClass(e.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":i-1,opacity:e.overlay/100}),a={w:o,c:e,o:s,t:t};if(o.css("z-index",i),e.ajax){var d=e.target||o,c=e.ajax;d="string"==typeof d?n(d,o):n(d),"@"===c.substr(0,1)&&(c=n(t).attr(c.substring(1))),d.load(c,function(){e.onLoad&&e.onLoad.call(this,a),l.call(o,e,d)}),e.ajaxText&&d.html(e.ajaxText),r(a)}else r(a)},e=function(n,o){o=o||window.event;var t=n.data("jqm"),e={w:n,c:t,o:n.data("jqmv"),t:o};d(e)},i=function(o){return o.c.overlay>0&&o.o.prependTo("body"),o.w.show(),n.jqm.focusFunc(o.w,!0),!0},s=function(n){return n.w.hide()&&n.o&&n.o.remove(),!0},a=function(o,t,e){var i=o.data("jqm");return i?n(e).each(function(){this[t]=this[t]||[],n.inArray(i.ID,this[t])<0&&(this[t].push(i.ID),n(this).click(function(n){return n.isDefaultPrevented()||o[t](this),!1}))}):void 0},r=function(o){var t=o.w,e=o.o,i=o.c;i.onShow(o)!==!1&&(t[0]._jqmShown=!0,i.modal?(j[0]||c("bind"),j.push(t[0])):t.jqmAddClose(e),l.call(t,i),i.toTop&&e&&t.before('<span id="jqmP'+i.ID+'"></span>').insertAfter(e),t.data("jqmv",e),t.unbind("keydown",n.jqm.closeOnEscFunc),i.closeOnEsc&&t.attr("tabindex",0).bind("keydown",n.jqm.closeOnEscFunc).focus())},d=function(o){var t=o.w,e=o.o,i=o.c;i.onHide(o)!==!1&&(t[0]._jqmShown=!1,i.modal&&(j.pop(),j[0]||c("unbind")),i.toTop&&e&&n("#jqmP"+i.ID).after(t).remove())},c=function(o){n(document)[o]("keypress keydown mousedown",u)},u=function(o){var t=n(o.target).data("jqm")||n(o.target).parents(".jqm-init:first").data("jqm"),e=j[j.length-1];return t&&t.ID===e._jqmID?!0:n.jqm.focusFunc(e,o)},l=function(o,t){t=t||this,o.closeClass&&this.jqmAddClose(n("."+o.closeClass,t))},m=0,j=[];return n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",closeOnEsc:!1,trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:i,onHide:s,onLoad:!1},focusFunc:function(o,t){return t&&n(":input:visible:first",o).focus(),!1},closeOnEscFunc:function(o){return 27===o.keyCode?(n(this).jqmHide(),!1):void 0}},n.jqm});
2
3(function($) {
4    
5    window.jqmPopup = function (popupName, url) {
6        
7        var trigger = '.' + popupName + '-popup-btn',
8            popup = popupName + '-popup';
9    
10        $('body').find('.' + popup).remove();
11        $('body').append('<div data-id="'+popup+'" class="'+popup+' popup"></div>');
12    
13        
14            $('.' + popup).jqm({
15                ajax: BX.message('SITE_DIR') + url,
16                trigger: trigger,
17                ajaxText: '<div class="popup-loading"></div>',
18                onLoad: function (self) {
19                    self.w.addClass('open').css({
20			marginLeft: ($(window).width() > self.w.outerWidth() ? '-' + self.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
21			top: $(document).scrollTop() + (($(window).height() > self.w.outerHeight() ? ($(window).height() - self.w.outerHeight()) / 2 : 10))   + 'px',
22                    });
23                },
24                onShow: function (hash) {
25                    if(hash.c.overlay > 0) {
26                        hash.o.prependTo('body');
27                    }
28
29                    hash.w.show();
30                    $.jqm.focusFunc(hash.w,true);
31                    $('body').addClass('open-modal');
32                },
33                onHide: function (hash) {
34                    if(hash.w.hide() && hash.o) {
35                        hash.o.remove();
36                    }
37                    $('body').removeClass('open-modal');
38                    return true;
39                }
40            });
41        
42        
43    };
44    
45})(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.