PageSourceSearch

https://partydjradio.hu/wp-content/plugins/pdr-poker-core/assets/p…?ver=0.4.1&pdr_watch_choice=1

js partydjradio.hu collected 2026-10-08 10:20:35 UTC 4,422 bytes, 275 lines download raw bytes

1
2(() => {
3
4    'use strict';
5
6
7
8    const bars = Array.from(document.querySelectorAll('[data-pdrp-infobar]'));
9
10
11
12    if (!bars.length || typeof PDRPokerInfobar === 'undefined') {
13
14        return;
15
16    }
17
18
19
20    let players = [];
21
22    let requestRunning = false;
23
24    let lastSignature = '';
25
26
27
28    function escapeHtml(value) {
29
30        return String(value ?? '')
31
32            .replaceAll('&', '&')
33
34            .replaceAll('<', '&lt;')
35
36            .replaceAll('>', '&gt;')
37
38            .replaceAll('"', '&quot;')
39
40            .replaceAll("'", '&#039;');
41
42    }
43
44
45
46    function render() {
47
48        const signature = JSON.stringify(players);
49
50
51
52        if (signature === lastSignature) {
53
54            return;
55
56        }
57
58
59
60        lastSignature = signature;
61
62
63
64        bars.forEach(bar => {
65
66            if (!players.length) {
67
68                bar.hidden = true;
69
70                bar.setAttribute('aria-hidden', 'true');
71
72                return;
73
74            }
75
76
77
78            bar.hidden = false;
79
80            bar.setAttribute('aria-hidden', 'false');
81
82
83
84            const link = bar.querySelector('a') || bar;
85
86            const waiting = players.some(player => String(player.status || '').toLowerCase().includes('vár'));
87
88            const statusText = waiting ? 'Játékosra vár' : 'Pókereznek';
89
90
91
92            link.innerHTML = `
93
94                <span class="pdrp-infobar-group">
95
96                    ${players.map(player => `
97
98                        <span class="pdrp-infobar-person">
99
100                            <span class="pdrp-infobar-person-avatar">
101
102                                ${
103
104                                    player.avatar
105
106                                        ? `<img src="${escapeHtml(player.avatar)}" alt="">`
107
108                                        : '<i>👤</i>'
109
110                                }
111
112                            </span>
113
114                            <span class="pdrp-infobar-person-copy">
115
116                                <strong>${escapeHtml(player.name)}</strong>
117
118                                <small>${escapeHtml(player.status || statusText)}</small>
119
120                            </span>
121
122                        </span>
123
124                    `).join('')}
125
126                </span>
127
128                <span class="pdrp-infobar-summary">
129
130                    <strong>PDR Póker</strong>
131
132                    <small>${statusText} · ${players.length} aktív játékos</small>
133
134                </span>
135
136                <b class="pdrp-infobar-open">Játék megnyitása</b>
137
138            `;
139
140        });
141
142    }
143
144
145
146    async function refresh() {
147
148        if (document.hidden || requestRunning) {
149
150            return;
151
152        }
153
154
155
156        requestRunning = true;
157
158
159
160        try {
161
162            const body = new URLSearchParams({
163
164                action: 'pdrp_infobar_state',
165
166                nonce: PDRPokerInfobar.nonce
167
168            });
169
170
171
172            const response = await fetch(PDRPokerInfobar.ajaxUrl, {
173
174                method: 'POST',
175
176                credentials: 'same-origin',
177
178                headers: {
179
180                    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
181
182                },
183
184                body,
185
186                cache: 'no-store'
187
188            });
189
190
191
192            if (!response.ok) {
193
194                return;
195
196            }
197
198
199
200            const result = await response.json();
201
202
203
204            if (!result.success || !result.data) {
205
206                return;
207
208            }
209
210
211
212            const incoming = Array.isArray(result.data.players)
213
214                ? result.data.players.filter(player => player && player.name)
215
216                : [];
217
218
219
220            if (JSON.stringify(incoming) !== JSON.stringify(players)) {
221
222                players = incoming;
223
224                render();
225
226            }
227
228        } catch (error) {
229
230            /* A következő ritkított lekérés újrapróbálja. */
231
232        } finally {
233
234            requestRunning = false;
235
236        }
237
238    }
239
240
241
242    bars.forEach(bar => {
243
244        if (!bar.querySelector('[data-pdrp-player-name]')) {
245
246            bar.hidden = true;
247
248        }
249
250    });
251
252
253
254    document.addEventListener('visibilitychange', () => {
255
256        if (!document.hidden) {
257
258            refresh();
259
260        }
261
262    });
263
264
265
266    window.addEventListener('online', refresh);
267
268
269
270    refresh();
271
272    window.setInterval(refresh, Math.max(30000, Number(PDRPokerInfobar.pollInterval) || 30000));
273
274})();
275

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.