PageSourceSearch

https://scoi.com/wp-content/uploads/components/component/4663/component.js?v=1789581806

js scoi.com collected 2026-09-24 20:30:23 UTC 3,678 bytes, 187 lines download raw bytes

1;(function($){ 
2
3 var $win = $(window); 
4
5$win.on('lm:middle.lm-component-4663', function(event, lm){ 
6
7lm.item.find('.lm-component-4663').each(function(){ 
8
9var $component = $(this); 
10
11/*
12 *  $component
13 *  component element
14 * 
15 *  lm
16 *  global lemons object
17 */
18
19var $docForm = $(document).find('.form-keyword-search');
20var $docS = $docForm.find('input[name="s"]');
21var $compS = $component.find('input[name="s"]');
22var $button = $component.find('.btn-submit');
23
24var btnText = $button.html();
25
26
27$(document).ready(function() {
28
29    if ($(document).find('.keywords').length) return;
30
31    var elem = $('<ul>', {
32        html: '',
33        class: 'keywords hide'
34    });
35
36    $('body').append(elem);
37
38});
39
40
41$(document).on("click", ".keywords li", function(e) {
42
43    //on keyword item click update search input
44
45    var _keywords = $(document).find('.keywords');
46
47    e.preventDefault();
48
49    $docS.val($(this).html());
50
51    _keywords.addClass('hide');
52
53});
54
55
56$compS.on('click', function() {
57
58    //set dropdown position on input click
59
60    var _adminBarHeight = $(document).find("#wpadminbar");
61    _adminBarHeight = _adminBarHeight.length ? _adminBarHeight.outerHeight() : 0;
62
63    var _keywrap = $(this).parents('.form').find('.keywords-wrap');
64    var _keywords = $(document).find('.keywords');
65
66    _keywords.css({
67        top: _keywrap.offset().top - _adminBarHeight - 1,
68        left: _keywrap.offset().left,
69        width: _keywrap.width() - 2
70    })
71
72    //_keywords.removeClass('hide');
73
74})
75
76$(document).on('click', function(event) {
77
78    //hiding dropdown on a outside click
79
80    var _keywords = $(document).find('.keywords');
81
82    if (!$(event.target).closest('.lm-component-4663').length) {
83
84        _keywords.addClass('hide');
85
86    }
87});
88
89lm.$win.on('resize load', function() {
90
91    //hiding dropdown on resize and load
92
93    var _keywords = $(document).find('.keywords');
94
95    _keywords.addClass('hide');
96
97
98})
99
100$docS.on('change', function() {
101
102    // change values on all keyword search fields
103
104    $docS.val($(this).val());
105})
106
107var timeout;
108var typing = false;
109$compS.on('input', function(e) {
110
111    var _keywords = $(document).find('.keywords');
112    var form = $(this).parents('.form-keyword-search').serializeJSON();
113
114    form.filter = {
115        action: 'search_keyword',
116        s: form.s
117    };
118
119    //console.log(form);
120
121    if (form.s.length < 3) {
122
123        _keywords.addClass('hide')
124
125        return false;
126    }
127
128    typing = true;
129    clearTimeout(timeout);
130
131    timeout = setTimeout(() => {
132
133        typing = false;
134
135        if (!typing) {
136
137            $.ajax({
138                url: './',
139                data: form,
140                method: "POST",
141            }).done(function(response) {
142
143                var resHtml = '';
144
145                if (Array.isArray(response) && response.length >= 1) {
146
147                    response = response.map(function(curr) {
148
149                        return "<li>" + curr + "</li>"
150
151                    })
152
153                    resHtml = response.join(" ");
154                    _keywords.html(resHtml)
155                    _keywords.removeClass('hide')
156
157                } else {
158
159                    _keywords.addClass('hide')
160
161                }
162
163            }).fail(function(xhr) {
164
165                _keywords.addClass('hide')
166
167            }).always(function() {
168
169                //$button.html(btnText);
170
171            });
172
173        } else {
174            console.log('Request throttled');
175        }
176    }, 200)
177
178    return false;
179
180
181}) 
182
183}); 
184
185}); 
186
187}(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.