PageSourceSearch

https://hsetube.ru/wp-content/plugins/poll-widget/assets/script.js?ver=6.7.2

js hsetube.ru collected 2026-10-06 07:14:03 UTC 3,035 bytes, 75 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    const pollWidgets = document.querySelectorAll('.poll-widget');
3
4    pollWidgets.forEach(widget => {
5        const correctIndex = parseInt(widget.dataset.correct, 10);
6        const answers = widget.querySelectorAll('li');
7        const resultBox = widget.querySelector('.poll-result');
8        const voteButton = widget.querySelector('.poll-submit-button');
9        const isVariant1 = widget.classList.contains('variant1');
10        let answered = false;
11
12        const text = window.pollWidgetData || {};
13        const pleaseChoose = text.pleaseChooseText || 'Пожалуйста, выберите вариант ответа.';
14        const correctText = text.correctText || 'Вы угадали!';
15        const incorrectText = text.incorrectText || 'Вы не угадали!';
16
17        if (isVariant1 && voteButton) {
18            voteButton.addEventListener('click', () => {
19                if (answered) return;
20
21                const selected = widget.querySelector('input[type="radio"]:checked');
22                if (!selected) {
23                    resultBox.textContent = pleaseChoose;
24                    return;
25                }
26
27                const selectedIndex = parseInt(selected.closest('li').dataset.index, 10);
28                answered = true;
29
30                if (selectedIndex === correctIndex) {
31                    answers[selectedIndex].classList.add('correct');
32                    resultBox.textContent = correctText;
33                } else {
34                    answers[selectedIndex].classList.add('incorrect');
35                    answers[correctIndex].classList.add('correct');
36                    resultBox.textContent = incorrectText;
37                }
38            });
39        } else {
40            answers.forEach(answer => {
41                answer.addEventListener('click', () => {
42                    if (answered) return;
43                    answered = true;
44
45                    const selectedIndex = parseInt(answer.dataset.index, 10);
46
47                    if (selectedIndex === correctIndex) {
48                        answer.classList.add('correct');
49                        resultBox.textContent = correctText;
50                    } else {
51                        answer.classList.add('incorrect');
52                        answers[correctIndex].classList.add('correct');
53                        resultBox.textContent = incorrectText;
54                    }
55                });
56            });
57        }
58    });
59});
60
61document.querySelectorAll('.poll-answers li').forEach(li => {
62    li.addEventListener('click', onClick);
63});
64
65function onClick(event) {
66    const li = event.currentTarget;
67    const radio = li.querySelector('input[type="radio"]');
68    if (radio && !radio.checked) {
69        radio.checked = true;
70        radio.dispatchEvent(new Event('change', { bubbles: true }));
71        document.querySelectorAll('.poll-answers li').forEach(item => {
72            item.removeEventListener('click', onClick);
73        });
74    }
75}

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.