PageSourceSearch

https://lsrhs.net/js/general.js?v=20260923224145

js lsrhs.net collected 2026-09-24 10:09:28 UTC 2,874 bytes, 78 lines download raw bytes

1/////
2// A general JS file for sitewide functions
3/////
4
5function setLightboxMultiViewScrollClasses(el) {
6    const isScrolledToBottom = el.scrollHeight < el.clientHeight + el.scrollTop + 1;
7    const isScrolledToTop = el.scrollTop === 0;
8    const scrollDownNotification = $(el).parents('.ss-lightbox-modal').find('.lightbox-modal-scroll-down-notification-container');
9    const scrollUpNotification = $(el).parents('.ss-lightbox-modal').find('.lightbox-modal-scroll-up-notification-container');
10    scrollDownNotification.toggleClass('hidden', isScrolledToBottom);
11    scrollUpNotification.toggleClass('hidden', isScrolledToTop);
12}
13
14// Start Code Embed apply to all sites JS
15$(document).on('click', '#applyToAllSitesCheckbox', function() {
16    if ($(this).is(':checked')) {
17        $('#applyToAllSites').val('true');
18    } else {
19        $('#applyToAllSites').val('false');
20    }
21});
22
23$(document).on('click', '#updateWebsiteHeaderBtn', function() {
24    let applyToAllSites = $('#applyToAllSites').val();
25    if (applyToAllSites === 'true') {
26        $('#confirmApplyToAllSitesModalBtn').trigger('click');
27    } else {
28        $.LoadingOverlay("show");
29        $('#websiteheader').submit();
30    }
31});
32
33$(document).on('click', '#confirmApplyToAllSitesOk', function() {
34    $.LoadingOverlay("show");
35    $('#websiteheader').submit();
36});
37// End Code Embed apply to all sites JS
38
39/**
40 * Utility function to escape quotes in objects/arrays to make them HTML safe
41 * Used when embedding JSON data in HTML attributes
42 * @param {Object|Array} obj - The object or array to escape quotes in
43 * @returns {Object|Array} - The object with escaped quotes
44 */
45function escapeAllQuotes(obj) {
46    let escapedObj = Array.isArray(obj) ? [] : {};
47    for (const [key, value] of Object.entries(obj)) {
48        if (typeof value === 'string') {
49            escapedObj[key] = getHtmlSafeString(value);
50        } else if (Array.isArray(value)) {
51            escapedObj[key] = value.map(function(o) {
52                if (typeof o === 'object') {
53                    return o === null ? o : escapeAllQuotes(o);
54                }
55                if (typeof o === 'string') {
56                    return getHtmlSafeString(o);
57                }
58                return o;
59            });
60        } else if (typeof value === 'object') {
61            escapedObj[key] = value === null ? value : escapeAllQuotes(value);
62        } else {
63            escapedObj[key] = value;
64        }
65    }
66    return escapedObj;
67}
68
69/**
70 * Function to replace single quotes with HTML safe characters
71 * Can be expanded to include other characters as needed
72 * Note: replacing double quotes with &quot; will cause issues when parsing JSON
73 * @param {string} string - The string to make HTML safe
74 * @returns {string} - The HTML safe string
75 */
76function getHtmlSafeString(string) {
77    return string.replace(/'/g, '&apos;');
78}

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.