PageSourceSearch

https://carntocoast.co.uk/Scripts/Pages/formtemplate.js

js carntocoast.co.uk collected 2026-10-05 23:36:50 UTC 2,777 bytes, 78 lines download raw bytes

1function ShowSpinner() {
2    let $globalLoading = "<div class='global-loading'><div class='message-container' aria-busy='true' role='alert'><i class='fa fa-spinner fa-spin'></i><h2>Please wait...</h2></div></div>";
3    $($globalLoading).hide().appendTo($("#FormPage").closest('.container')).fadeIn('300');
4}
5function HideSpinner() {
6    let $globalLoading = $("#FormPage").closest('.container').find(".global-loading");
7    $globalLoading.fadeOut('300', function () {
8        $globalLoading.remove();
9    });
10}
11
12$(function () {
13
14    $(document).on("click", "#form-symptoms, #form-isemergency", function (event) {
15        event.preventDefault();
16        const url = $(this).data("url");
17        ShowSpinner();
18        $.ajax({
19            url: url,
20            type: "GET",
21            cache: false,
22            success: function (data) {
23                HideSpinner();
24                $("#FormPage").html(data);
25                if (typeof initPagePopups === 'function') {
26                    initPagePopups();
27                }
28            }
29        });
30    });
31
32    $(document).on("submit", "#formTemp", function (event) {
33        event.preventDefault();
34        let $form = $(this);
35        ShowSpinner();
36
37        const siteKey = $form.find("input[name='sitekey']").val();
38
39        grecaptcha.ready(function () {
40            try {
41                grecaptcha.execute(siteKey, { action: 'formSubmit' }).then(function (token) {
42                    $form.find("[name='Captcha']").val(token);
43
44                    const data = $form.serialize();
45                    const action = $form.attr("action");
46
47                    $.ajax({
48                        url: action,
49                        data: data,
50                        type: "POST",
51                        cache: false,
52                        success: function (data) {
53                            HideSpinner();
54                            $("#FormPage").html(data);
55                            $(document).trigger("registerNhsFormBuilderEvents");
56                        },
57                        error: function (request, status, errorThrown) {
58                            // we're assuming bad request are reCaptcha errors (for now)
59                            if (request.status == 400) {
60                                display_reCaptchaError(status);
61                            }
62                        }
63                    });
64                })
65            }
66            catch (err) {
67                display_reCaptchaError(err);
68            }
69        });
70    });
71
72    function display_reCaptchaError(err) {
73        HideSpinner();
74        console.error(err);
75        $("#recaptcha_failed").removeClass("d-none");
76
77    }
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.