PageSourceSearch

https://esinvesticijos.lt/assets/js/accordion.js

js esinvesticijos.lt collected 2026-10-03 21:42:34 UTC 3,270 bytes, 97 lines download raw bytes

1$(document).ready(function () {
2
3    /**
4     * Specialus žymejimas, keičiamas išsikleidžiančių sarašą
5     * Pastaba: turi būti atliktas dar prieš visus kitus funkcionalumo nustatymus
6     * Bootstrap 5
7     */
8
9    var jTextWrapper = $('.text');
10    var card_index = 0;
11    var group_index = 0;
12    jTextWrapper.each(function () {
13
14        var jText = $(this);
15        var text = jText.html();
16
17        var replaceMatches = function (group) {
18            var i_start = group.start['index'],
19                i_end = group.end['index'] + group.end[0].length;
20            var html = text.substring(i_start, i_end);
21
22            html = html.replace(/\<p\>\[\[#ex\]\]\<\/p\>/gm, '');
23            group_index++;
24
25            var lines = html.split(/\<hr(?:\s\/\>|\/\>|\>)/gm);
26
27            var groupId = 'accordion_group_' + group_index,
28                jExWrap = $('<div></div>'),
29                jEx = $('<div id="'+groupId+'" class="accordion"></div>'),
30                jExLine, jHeading, jContent,
31                jFirst;
32
33            for (var i = 0; i < lines.length; i++) {
34                card_index++;
35                jContent = $('<div class="collapse" data-parent="#' + groupId + '"></div>');
36                jContent.html($.trim(lines[i]));
37
38                jFirst = jContent.find('>*:first');
39
40                if (jFirst.length) {
41                    var heading_html = '<button '
42                        + 'class="accordion-button collapsed"'
43                        + ' type="button" data-bs-toggle="collapse" data-bs-target="#ex-' + card_index + '"'
44                        + ' aria-expanded="false" aria-controls="ex-' + card_index + '">'
45                        + jFirst.text()
46                        + '</button>'
47                    ;
48
49                    jHeading = $('<div class="accordion-header p-0"></div>');
50                    jHeading.html(heading_html);
51                }
52
53                if (jContent.find('>*').length > 1) {
54                    jFirst.remove();
55                }
56
57                jContent
58                    .html('<div class="card-body">' + jContent.html() + '</div>')
59                    .attr('id', 'ex-' + card_index);
60
61                jExLine = $('<div class="accordion-item"></div>');
62                jExLine
63                    .append(jHeading)
64                    .append(jContent);
65                jEx.append(jExLine);
66            }
67            jExWrap.append(jEx);
68
69            text = text.substring(0, i_start) + jExWrap.html() + text.substring(i_end);
70        };
71
72        var group = {}, match;
73        var myRegexp = /(?:^|.*)\[\[#ex\]\](?:.*|$)/gm;
74
75        match = myRegexp.exec(text);
76
77        while (match !== null) {
78            if (!group.start) {
79                group.start = match;
80            }
81            else {
82                group.end = match;
83                replaceMatches(group);
84                group = {};
85            }
86            match = myRegexp.exec(text);
87        }
88
89        text = text.replace(/\<p\>\[\[#ex\]\]\<\/p\>/gm, '');
90        jText.html(text);
91    });
92
93
94    if (typeof SystemsightCaptcha !== 'undefined') {
95        SystemsightCaptcha.prototype.initialize();
96    }
97});

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.