PageSourceSearch

https://www.lccm.ac.uk/wp-content/themes/gus-platform/assets/js/custom.js?ver=1.0.0

js lccm.ac.uk collected 2026-10-10 00:41:58 UTC 2,865 bytes, 83 lines download raw bytes

1document.addEventListener('DOMContentLoaded', () => {
2  // Set the minimum date for the event_date input
3  const dateInput = document.getElementById('event_date');
4  if (dateInput) {
5    const today = new Date().toISOString().split('T')[0];
6    dateInput.setAttribute('min', today);
7  }
8
9  // Function to validate URL input
10  function validateUrl(input) {
11    const urlPattern = new RegExp(input.pattern);
12    if (!urlPattern.test(input.value)) {
13      input.value = '';  // Reset to empty string or use input.defaultValue if needed
14    }
15  }
16
17  // Handle video playback on thumbnail click
18  const thumbnails = document.querySelectorAll(".gus-thumbnail");
19  thumbnails.forEach((thumbnail, index) => {
20    thumbnail.addEventListener("click", () => playVideo(index));
21  });
22
23  function playVideo(index) {
24    const thumbnail = thumbnails[index];
25    if (thumbnail) {
26      thumbnail.style.display = "none";
27      
28      const iframe = document.querySelector(".custom-iframe-video");
29      if (iframe) {
30        iframe.style.display = "block";
31        iframe.setAttribute("frameborder", "0");
32        iframe.setAttribute("allowfullscreen", true);
33        iframe.setAttribute(
34          "allow",
35          "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
36        );
37
38        // Update src to trigger video playback
39        const src = iframe.src;
40        const url = new URL(src);
41        url.searchParams.set("autoplay", "1");
42        iframe.src = url.toString();
43      }
44    }
45  }
46
47  // Attach URL validation event listener to URL input fields
48  const urlInputs = document.querySelectorAll('input[type="url"]');
49  urlInputs.forEach(input => {
50    input.addEventListener('change', () => validateUrl(input));
51  });
52});
53
54jQuery(document).ready(function () {
55    const baseUrl = new URL(customScriptData.site_url, window.location.origin);
56    const allowedDomain = new URL(customScriptData.allowed_domain, window.location.origin).origin;
57    const currentPath = window.location.pathname;
58
59    // Validate allowed domain to avoid open redirects
60    if (baseUrl.origin !== allowedDomain) {
61        console.error("Potential open redirect detected!");
62        return;
63    }
64
65    jQuery('a[href$="#coursesForm"]').click(function (event) {
66        const linkHref = this.href;
67        const linkUrl = new URL(linkHref); // parse the full href
68        const linkPath = linkUrl.pathname;
69
70        // Check if the anchor is on the same page
71        if (linkPath === currentPath) {
72            event.preventDefault();
73
74            const target = jQuery('#coursesForm');
75            if (target.length) {
76                jQuery('html, body').animate({
77                    scrollTop: target.offset().top
78                }, 100);
79            }
80        }
81        // Else: allow browser to handle navigation to another page
82    });
83});

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.