PageSourceSearch

https://www.occupationalhealthportsmouth.nhs.uk/application/blocks…=ae17b778bc54f78b611b93e854baf5180753f6f5

js occupationalhealthportsmouth.nhs.uk collected 2026-10-03 18:59:43 UTC 2,655 bytes, 71 lines download raw bytes

1$(document).ready(function () {
2    $('.search-weighted.predictive').each(function () {
3        var inputGroup = $(this).find('.inline-submit'),
4            searchTextInput = inputGroup.find('input'),
5            ajaxHolder = $(this).find('.ajax-results-holder'),
6            resultsDiv = $(this).find('.ajax-results-holder'),
7            searchForm = $(this).find('form'),
8            action = searchTextInput.attr('data-action');
9
10        searchTextInput.on('keyup', function(e) {
11            // Ignore shift key
12            if (e.keyCode != 9) {
13                var search = $(this).val();
14                var counter = 0;
15                
16                // Delay each search by 2 seconds
17                var interval = setInterval(function() {
18                    counter++;
19    
20                    if(counter === 1) {
21                        clearInterval(interval);
22    
23                        if (search.trim().length > 0) {
24                            var data = searchForm.serialize();
25            
26                            $.ajax({
27                                url: action,
28                                data: data,
29                                success: function (response) {
30                                    resultsDiv.html(response)
31                                    ajaxHolder.show();
32                                    inputGroup.addClass('predictive-active');
33                                },
34                            });
35                        } else {
36                            resultsDiv.html('')
37                            ajaxHolder.hide();
38                            inputGroup.removeClass('predictive-active');
39                        }
40                    }
41                }, 1000);
42            }
43        });
44
45        searchTextInput.on('focus', function (e) {
46            if (inputGroup.hasClass('predictive-active')) {
47                ajaxHolder.show();
48            }
49        });
50
51        $('body').on('click', function (e) {
52            if (!document.activeElement.dataset.searchElement && inputGroup.hasClass('predictive-active')) {
53                ajaxHolder.hide()
54                inputGroup.removeClass('predictive-active');
55            }
56        });
57
58        if ($(this).parents('header').length) {
59            var focusArea = '.header';
60        } else {
61            var focusArea = '.main';
62        }
63        
64        $(focusArea).focusin(function() {
65            if (!document.activeElement.dataset.searchElement && inputGroup.hasClass('predictive-active')) {
66                ajaxHolder.hide()
67                inputGroup.removeClass('predictive-active');
68            }
69        });
70    })
71});

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.