PageSourceSearch

https://pohgor.ru/netcat_template/jquery/jquery.nclsdisplay.js?24010

js pohgor.ru collected 2026-10-02 17:48:01 UTC 8,953 bytes, 207 lines download raw bytes

1if (typeof(lsDisplayLibLoaded) == 'undefined') {
2    var lsDisplayLibLoaded = true;
3    var E_CLICK  = 0,
4        E_SUBMIT = 1;
5
6    jQuery(function(){
7        var bindEvents = function($container){
8            jQuery('[data-nc-ls-display-link]', $container).click(function(){
9                eventHandler(this, true, E_CLICK);
10                return false;
11            });
12            jQuery('form[data-nc-ls-display-form]', $container).submit(function(){
13                eventHandler(this, true, E_SUBMIT);
14                return false;
15            });
16        }
17
18        var eventHandler = function(element, callBindEvents, event_type){
19
20            switch (event_type) {
21
22                case E_SUBMIT:
23                    var url_attr  = 'action';
24                    var data_attr = 'data-nc-ls-display-form';
25                    break;
26
27                case E_CLICK:
28                default:
29                    var url_attr  = 'href';
30                    var data_attr = 'data-nc-ls-display-link';
31                    break;
32            }
33
34            var $this    = jQuery(element);
35            var url      = $this.attr(url_attr);
36            var obj_data = $this.attr(data_attr);
37
38            if (obj_data) {
39                obj_data = jQuery.parseJSON(obj_data);
40            }
41            else {
42                return false;
43            }
44
45            var replace_content = obj_data.subdivisionId !== false;
46
47            if (url) {
48                if (obj_data.displayType == 'shortpage' || (obj_data.displayType == 'longpage_vertical' && typeof(obj_data.subdivisionId) == 'undefined')) {
49
50                    var send_as_post = event_type === E_SUBMIT && $this.attr('method').toLowerCase() === 'post';
51                    var send_data    = jQuery.extend({}, obj_data.query); // clone
52
53                    send_data.isNaked       = parseInt(typeof send_data.isNaked !== 'undefined' ? send_data.isNaked : 1);
54                    send_data.lsDisplayType = obj_data.displayType;
55                    send_data.skipTemplate  = parseInt(send_data.skipTemplate ? send_data.skipTemplate : obj_data.displayType == 'shortpage' && typeof(obj_data.subdivisionId) != 'undefined' ? 1 : 0);
56
57                    if (send_as_post) {
58                        url += (url.indexOf('?') >= 0 ? '&' : '?') + jQuery.param(send_data);
59                        send_data = $this.serialize();
60                    }
61
62                    jQuery.ajax({
63                        type:    send_as_post ? 'POST' : 'GET',
64                        url:     url,
65                        data:    send_data,
66                        success: function(data){
67                            var $container = [];
68
69                            if (typeof(obj_data.onSubmit) !== 'undefined') {
70                                if (data[0] == '{' || data[0] == '[') {
71                                    data = jQuery.parseJSON(data);
72                                }
73
74                                if ((eval(obj_data.onSubmit)).call($this.get(0), data) === false) {
75                                    replace_content = false;
76                                }
77                            }
78
79                            if ( ! replace_content) {
80                                return false;
81                            }
82
83                            if (typeof(obj_data.subdivisionId) == 'undefined') {
84                                $container = $this.closest('[data-nc-ls-display-container]');
85                            } else {
86                                jQuery('[data-nc-ls-display-container]').each(function(){
87                                    var $element = jQuery(this);
88                                    var containerData = $element.attr('data-nc-ls-display-container');
89                                    if (containerData) {
90                                        containerData = jQuery.parseJSON(containerData);
91                                        if (containerData.subdivisionId == obj_data.subdivisionId) {
92                                            $container = $element;
93                                            return false;
94                                        }
95                                    }
96
97                                    return true;
98                                });
99                            }
100
101                            if (!$container.length) {
102                                $container = jQuery('[data-nc-ls-display-container]');
103                            }
104
105                            $container.html(data);
106
107                            if (callBindEvents) {
108                                bindEvents($container);
109                            }
110
111                            if (typeof(parent.nc_ls_quickbar) != 'undefined') {
112                                var quickbar = parent.nc_ls_quickbar;
113                                if (quickbar) {
114                                    var $quickbar = jQuery('.nc-navbar').first();
115                                    $quickbar.find('.nc-quick-menu LI:eq(0) A').attr('href', quickbar.view_link);
116                                    $quickbar.find('.nc-quick-menu LI:eq(1) A').attr('href', quickbar.edit_link);
117                                    $quickbar.find('.nc-menu UL LI:eq(0) A').attr('href', quickbar.sub_admin_link);
118                                    $quickbar.find('.nc-menu UL LI:eq(1) A').attr('href', quickbar.template_admin_link);
119                                    $quickbar.find('.nc-menu UL LI:eq(2) A').attr('href', quickbar.admin_link);
120                                }
121                            }
122                        }
123                    });
124
125                } else if (obj_data.displayType == 'longpage_vertical') {
126                    var scrolled = false;
127
128                    var scrollToContainer = function(containerData, $element){
129                        if (containerData) {
130                            containerData = jQuery.parseJSON(containerData);
131                            if (containerData.subdivisionId == obj_data.subdivisionId) {
132                                jQuery('HTML,BODY').animate({
133                                    scrollTop: $element.offset().top - jQuery('BODY').offset().top
134                                }, containerData.animationSpeed);
135                                return true;
136                            }
137                        }
138
139                        return false;
140                    };
141
142                    jQuery('[data-nc-ls-display-pointer]').each(function(){
143                        var $element = jQuery(this);
144                        if (scrollToContainer($element.attr('data-nc-ls-display-pointer'), $element)) {
145                            scrolled = true;
146                            return false;
147                        }
148
149                        return true;
150                    });
151
152                    if (!scrolled) {
153                        jQuery('[data-nc-ls-display-container]').each(function(){
154                            var $element = jQuery(this);
155
156                            if (scrollToContainer($element.attr('data-nc-ls-display-container'), $element)) {
157                                return false;
158                            }
159
160                            return true;
161                        });
162                    }
163                }
164
165                if (replace_content) {
166                    if (!!(window.history && history.pushState)) {
167                        window.history.pushState({}, '', url);
168                    }
169                }
170
171                if (event_type === E_CLICK) {
172                    if (typeof(obj_data.onClick) == 'undefined') {
173                        $this.addClass('active').siblings().removeClass('active');
174                    } else {
175                        eval('var callback = ' + obj_data.onClick);
176                        callback.call($this.get(0));
177                    }
178                }
179
180                return false;
181            }
182        }
183
184        jQuery('[data-nc-ls-display-link]').click(function(){
185            eventHandler(this, true, E_CLICK);
186            return false;
187        });
188
189        jQuery('form[data-nc-ls-display-form]').submit(function(){
190            eventHandler(this, true, E_SUBMIT);
191            return false;
192        });
193
194        jQuery('[data-nc-ls-display-pointer]').each(function(){
195            var $this = jQuery(this);
196            var data = jQuery.parseJSON($this.attr('data-nc-ls-display-pointer'));
197            if (data.onReadyScroll) {
198                setTimeout(function(){
199                    jQuery('HTML,BODY').scrollTop($this.offset().top);
200                }, 1000);
201                return false;
202            }
203
204            return true;
205        });
206    });
vendor: 1 bytes, line 207
207}

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.