PageSourceSearch

https://www.akaskidor.se/app/plugins/egmont-agillic-newsletter-sig…llic-newsletter-signup-public.js?1748941443

js akaskidor.se collected 2026-10-02 13:27:58 UTC 3,062 bytes, 96 lines download raw bytes

1jQuery(($) => {
2    'use strict';
3
4    const initForm = (key, box) => {
5        const $box = $(box);
6
7        const id = $box.attr('data-form-id');
8        if (!id) {
9            throw new Error('Agillic form attribute "data-form-id" not set or empty');
10        }
11
12        const url = $box.attr('data-form-url');
13        if (!url) {
14            throw new Error('Agillic form attribute "data-form-url" not set or empty');
15        }
16
17        const $form = $("#agillicSubscribe_" + id, box);
18        const $email = $("#agillicAddCustomer_" + id, $box);
19        const $button = $("#agillicSubscribeButton_" + id, $box);
20        const $captcha = $("#agillicCaptcha_" + id, $box);
21        const $terms = $("#agillicSubscribeTerms_" + id, $box);
22        const $msgSuccess = $("#agillicSubscribeConfirm_" + id, $box);
23        const $msgExists = $("#agillicSubscribeExists_" + id, $box);
24        const $msgFail = $("#agillicSubscribeFail_" + id, $box);
25
26        // BEGIN agillicTerms
27        $('#terms_' + id).change(function () {
28            if ($('#terms_' + id).is(':checked')) {
29                agillicFormConfirmation(id, "terms", true);
30            } else {
31                agillicFormConfirmation(id, "terms", false);
32            }
33        });
34        // END agillicTerms
35
36        $form.on('submit', (event) => {
37            $email.hide();
38            $captcha.hide();
39            $terms.hide();
40            $button.prop("disabled", true);
41            $button.val("Var god vänta");
42
43            $.ajax({
44                url: url,
45                type: 'post',
46                dataType: 'json',
47                data: $form.serialize(),
48                success: function (data) {
49                    const status = data.status;
50                    $email.val("");
51                    $email.hide();
52                    $button.hide();
53                    $captcha.hide();
54                    $terms.hide();
55                    if (status === "exists") {
56                        $msgExists.show();
57                    } else if (status === "success") {
58                        $msgSuccess.show();
59                    } else if (status === "fail") {
60                        $msgFail.show();
61                    }
62                }
63            });
64
65            event.preventDefault();
66            return false;
67        });
68    };
69
70    $('.AgillicSignupForm').each(initForm);
71
72});
73
74let agillicStatusCaptcha = false;
75let agillicStatusTerms = false;
76
77function agillicFormConfirmation(id, element, status) {
78    console.log(id, element, status);
79
80    if (element == "captcha") {
81        agillicStatusCaptcha = status;
82    } else if (element == "terms") {
83        agillicStatusTerms = status;
84    }
85
86    console.log("#agillicSubscribeButton_" + id);
87
88    if (agillicStatusCaptcha == true && agillicStatusTerms == true) {
89        console.log("Button is enabled");
90        jQuery("#agillicSubscribeButton_" + id).prop("disabled", false);
91    } else {
92        console.log("Button is disabled");
93        jQuery("#agillicSubscribeButton_" + id).prop("disabled", true);
94    }
95
96}

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.