PageSourceSearch

https://www.ocna.org/shout/web/v6.51.1.R20260831/shout/modules/list/resources/js/list.js

js ocna.org collected 2026-10-02 06:08:26 UTC 6,770 bytes, 188 lines download raw bytes

1(function($) {
2
3$(document).ready(
4    function()
5    {
6        function reloadList(data, callbacks)
7        {
8            var list_css   = Shout.configuration.module.list.list_css;
9            var filter_css = Shout.configuration.module.list.filter_css;
10
11            var $list         = $('.' + list_css + '.section-wrapper > .content-wrapper > .' + list_css);
12            var $filter       = $('.' + list_css + '.section-wrapper > .content-wrapper > .' + filter_css.base);
13            var $list_content = $list.children('.list');
14            var $form         = $filter.children('form');
15            var $actions      = $form.children('.filter-actions');
16            var $apply        = $actions.children('.filter-actions-apply');
17            var $load         = $filter.children('.filter-load');
18
19            // prepare data
20            var url = Shout.configuration.module.list.list_url;
21
22            var query_array = null;
23            if ((typeof data !== 'undefined') && (data !== null))
24            {
25                query_array = data;
26            }
27            else
28            {
29                query_array = $form.serializeArray();
30            }
31//            query_array.push({
32//                name: $apply.attr('name'),
33//                value: $apply.attr('value')
34//            });
35
36//            var query_string = $form.serialize();
37//            url += '&' + query_string + '&' + $apply.attr('name') + '=' + $apply.attr('value');
38
39            // show loading indicators
40            $list_content.css('opacity', '0.2');
41
42            $('html').on('mousemove',
43                function(e)
44                {
45                    if ($load.length)
46                    {
47                        $load.css({
48                            'top' : e.pageY - $load.offsetParent().offset().top + 20,
49                            'left' : e.pageX - $load.offsetParent().offset().left + 20
50                        });
51                    }
52                }
53            );
54            $load.show();
55
56            // disable filter inputs
57            $form.find(':input').prop('disabled', true);
58
59            // remember open "Show more" blocks
60            var show_more = [];
61            $form.children('.filter-item').each(
62                function(index, element)
63                {
64                    if ($(element).find('.filter-item-values-more:visible').length)
65                    {
66                        show_more.push(index);
67                    }
68                }
69            );
70
71            // send request
72            $.get(url, query_array).done(
73                function(data)
74                {
75                    if ((typeof callbacks !== 'undefined') && (callbacks !== null) && (typeof callbacks.done_start === 'function'))
76                    {
77                        callbacks.done_start();
78                    }
79
80                    // hide loading indicators
81                    $load.hide();
82                    $('html').off('mousemove');
83
84                    // replace contents
85                    //var data = $.parseJSON(data);
86
87                    $filter.replaceWith(data['filter']);
88                    $filter = $('.' + list_css + '.section-wrapper > .content-wrapper > .' + filter_css.base);
89                    $form = $filter.children('form');
90
91                    $list.replaceWith(data['unified_list.items']);
92                    $list = $('.' + list_css + '.section-wrapper > .content-wrapper > .' + list_css);
93
94                    // open remembered "Show more" blocks
95                    for (var i = 0; i < show_more.length; i++)
96                    {
97                        if (typeof Shout.configuration.module.list.filter_toggle_more === 'function')
98                        {
99                            Shout.configuration.module.list.filter_toggle_more(null, $form.children('.filter-item:nth-child(' + (show_more[i] + 1) + ')').find('.filter-item-values-toggle'));
100                        }
101                    }
102
103                    // run js
104                    var $scripts = $(data['js']); //.filter('script[defer], script:not([src])');
105
106                    // do not reload jquery lib
107                    $scripts.filter('script').each(function(){
108
109                        var script = this;
110                        var $script = $(script);
111
112                        var src = $script.prop('src');
113
114                        var exclude_node_modules_js_libs = true;
115
116                        if (true === exclude_node_modules_js_libs)
117                        {
118                            if (src && -1 !== src.indexOf('node_modules'))
119                            {
120                                return;
121                            }
122
123                            // if (0 < $('html').find('script[src="'+src+'"]').length)
124                            // {
125                            //     return;
126                            // }
127                        }
128
129                        $list.append($script);
130                    })
131
132                    // bindEvents();
133
134                    // remove page=N from url (requires html5)
135                    if (typeof (history.pushState) != 'undefined')
136                    {
137                        var obj = {
138                            Title: document.title,
139                            Url: location.href.replace(/&?page=[0-9+]/i, '')
140                        };
141                        history.pushState(obj, obj.Title, obj.Url);
142                    }
143
144                    /*
145                    $actions.detach();
146                    $form.html(data);
147                    $form.append($actions);
148                    $actions.find(':input').prop('disabled', false);
149
150                    bindEvents();
151                    */
152
153                    $('body').addClass('filter-applied');
154
155                    if ((typeof callbacks !== 'undefined') && (callbacks !== null) && (typeof callbacks.done_end === 'function'))
156                    {
157                        callbacks.done_end();
158                    }
159
160                    /*
161                    jQuery('body').on('list_reload_complete', '.list', function(evt){
162                        console.group();
163                        console.log('%cthere','color: blue;');
164                        console.log(this,evt);
165                        console.groupEnd()
166                    });
167                    */
168
169                    $list.trigger('list_reload_complete');
170                }
171            );
172        }
173
174//        Shout.configuration.module.list.list_reload = reloadList;
175        var config = {
176            'module': {
177                'list': {
178                    'list_reload': reloadList
179                }
180            }
181        };
182        Shout.configure(config);
183
184        return true;
185    }
186);
187
188})(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.