PageSourceSearch

https://sprunkin.pages.dev/assets/js/app.js?v1.2

js sprunkin.pages.dev collected 2026-10-03 05:58:31 UTC 15,340 bytes, 422 lines download raw bytes

1document.addEventListener("DOMContentLoaded", (function () {
2    var e = function (e) {
3        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 400;
4        e.style.transitionProperty = "height, margin, padding", e.style.transitionDuration = t + "ms", e.style.height = e.offsetHeight + "px", e.offsetHeight, e.style.overflow = "hidden", e.style.height = 0, e.style.paddingTop = 0, e.style.paddingBottom = 0, e.style.marginTop = 0, e.style.marginBottom = 0, e.previousElementSibling && (e.previousElementSibling.style.pointerEvents = "none"), window.setTimeout((function () {
5            e.style.display = "none", e.style.removeProperty("height"), e.style.removeProperty("padding-top"), e.style.removeProperty("padding-bottom"), e.style.removeProperty("margin-top"), e.style.removeProperty("margin-bottom"), e.style.removeProperty("overflow"), e.style.removeProperty("transition-duration"), e.style.removeProperty("transition-property"), e.previousElementSibling && (e.previousElementSibling.style.pointerEvents = "auto")
6        }), t), e.parentNode.classList.remove("is--open")
7    }, t = function (e) {
8        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 400;
9        e.style.removeProperty("display");
10        var o = window.getComputedStyle(e).display;
11        "none" === o && (o = "block"), e.style.display = o;
12        var n = e.offsetHeight;
13        e.style.overflow = "hidden", e.style.height = 0, e.style.paddingTop = 0, e.style.paddingBottom = 0, e.style.marginTop = 0, e.style.marginBottom = 0, e.offsetHeight, e.style.transitionProperty = "height, margin, padding", e.style.transitionDuration = t + "ms", e.style.height = n + "px", e.style.removeProperty("padding-top"), e.style.removeProperty("padding-bottom"), e.style.removeProperty("margin-top"), e.style.removeProperty("margin-bottom"), e.previousElementSibling && (e.previousElementSibling.style.pointerEvents = "none"), window.setTimeout((function () {
14            e.style.removeProperty("height"), e.style.removeProperty("overflow"), e.style.removeProperty("transition-duration"), e.style.removeProperty("transition-property"), e.previousElementSibling && (e.previousElementSibling.style.pointerEvents = "auto")
15        }), t), e.parentNode.classList.add("is--open")
16    }, o = document.querySelectorAll(".accordeon__trigger");
17    o && o.forEach((function (o) {
18        o.addEventListener("click", (function (n) {
19            n.preventDefault(), o.parentNode.classList.contains("is--open") ? e(o.nextElementSibling) : t(o.nextElementSibling)
20        }))
21    }));
22    var n = document.querySelector(".game"), i = document.querySelector(".game__btn");
23    n && i && i.addEventListener("click", (function (e) {
24        e.preventDefault(), n.classList.contains("preview-hidden") || n.classList.add("preview-hidden")
25    }))
26}));
27
28
29if (!String.prototype.replaceAll) {
30    String.prototype.replaceAll = function(str, newStr){
31
32        // If a regex pattern
33        if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
34            return this.replace(str, newStr);
35        }
36
37        // If a string
38        return this.replace(new RegExp(str, 'g'), newStr);
39
40    };
41}
42
43function attemptsCounter() {
44    let count = 0;
45
46    return function () {
47        return ++count;
48    }
49}
50
51let attemptsCount = new attemptsCounter();
52let maxAttempts = 5;
53
54window.addEventListener('poof', (event) => {
55    if(getSettings('confetti_mode') == null || getSettings('confetti_mode') == 1) {
56        poof();
57    }
58
59    /**
60     * @deprecated
61     */
62    let targetWord = event.detail.target;
63    let currentGuess = event.detail.currentGuess;
64    let maxGuesses = event.detail.maxGuesses;
65
66
67    $('.share-button').each(function () {
68        let target = $(this).data('target');
69
70        let shareText = window.translations.share
71            .replace('[word]', targetWord.toUpperCase())
72            .replace('[number_try]', currentGuess)
73            .replace('[total_try]', maxGuesses)
74            .replace('[try]', currentGuess > 1 ? 'tries' : 'try');
75
76        let url;
77        switch(target) {
78            case 'facebook': url = 'https://www.facebook.com/sharer/sharer.php?u=[source]'; break;
79            case 'twitter': url = 'https://www.twitter.com/share?url=[source]&text=[text]'; break;
80            case 'whatsapp': url = 'https://api.whatsapp.com/send?text=[text]'; break;
81            case 'reddit': url = 'https://www.reddit.com/submit?url=[source]&title=[text]'; break;
82        }
83
84        if(url === undefined) {
85            return
86        }
87
88        url = url.replace('[source]', window.location.href);
89        url = url.replace('[text]', shareText);
90
91        $(this).attr('href', url);
92    });
93}, false);
94
95/**
96 * @deprecated
97 */
98window.addEventListener('updateStats', (event) => {
99    let statsPlayed = event.detail.statsPlayed;
100    let statsWon = event.detail.statsWon;
101    let statsPercent = event.detail.statsPercent;
102    let statsMaxStreak = event.detail.statsMaxStreak;
103
104    $('.share-stats-button').each(function () {
105        let target = $(this).data('target');
106
107        let shareText = window.translations.share_stats
108            .replace('[stats_played]', statsPlayed)
109            .replace('[stats_won]', statsWon)
110            .replace('[stats_percent]', statsPercent)
111            .replace('[stats_max_streak]', statsMaxStreak);
112
113        let url;
114        switch(target) {
115            case 'facebook': url = 'https://www.facebook.com/sharer/sharer.php?u=[source]'; break;
116            case 'twitter': url = 'https://www.twitter.com/share?url=[source]&text=[text]'; break;
117            case 'whatsapp': url = 'https://api.whatsapp.com/send?text=[text]'; break;
118            case 'reddit': url = 'https://www.reddit.com/submit?url=[source]&title=[text]'; break;
119        }
120
121        if(url === undefined) {
122            return
123        }
124
125        url = url.replace('[source]', window.location.href);
126        url = url.replace('[text]',  encodeURIComponent(shareText));
127
128        $(this).attr('href', url);
129    });
130}, false);
131
132$(function () {
133    if($('.start-preview').length) {
134        const now = Math.round((+new Date / 1000));
135        const time = getCookie('start_preview') ? parseInt(getCookie('start_preview')) : 0;
136        const duration = 86400;
137        if(time == 0 || time + duration < now) {
138            $('.start-preview').show();
139            $('#game').addClass('game-locked');
140        }
141    }
142
143    $('.js-start-preview').click(function(){
144        setCookie('start_preview', Math.round((+new Date / 1000)));
145        $('.game').removeClass('game-locked');
146    });
147
148
149    // Rating
150    $('.starability-basic input').on('change', function () {
151        $('.starability-basic input').prop('disabled', 'disabled');
152
153        var rating = $(this).val();
154        var section = $(this).closest('.starability-basic').attr('data-section');
155
156        $.ajax({
157            url: '/vote',
158            headers: {
159                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
160            },
161            data: {rating: rating, section: section},
162            type: 'post',
163            dataType: 'json',
164            success: function (data) {
165                if(data.status == 'ok') {
166                    $('.rating__value b').text(data.rating);
167                    $('.rating__help span').text(data.total_votes);
168                }
169            },
170            complete: function() {
171            }
172        })
173    });
174
175    $('body').on('change', 'input[name="dark_mode"][type="checkbox"]', function(e) {
176        e.preventDefault()
177
178        if ($(this).is(':checked') ) {
179            $('html').addClass('dark');
180            $('body').addClass('dark-theme');
181            setSettings('theme_mode', 'night');
182        } else{
183            $('html').removeClass('dark');
184            $('body').removeClass('dark-theme');
185            $('.game_rows').removeClass('dark-theme');
186            setSettings('theme_mode', 'day');
187        }
188    });
189
190    if(getSettings('theme_mode') == 'night') {
191        setSettings('theme_mode', 'night');
192        $('input[name="dark_mode"][type="checkbox"]').prop('checked', true);
193        $('html').addClass('dark');
194        $('body').addClass('dark-theme');
195    }
196
197    $('body').on('change', 'input[name="color_blind_mode"][type="checkbox"]', function(e) {
198        e.preventDefault()
199
200        if ($(this).is(':checked') ) {
201            $('body').addClass('color-blind-mode');
202            setSettings('colorblind_mode', 1);
203        } else{
204            $('body').removeClass('color-blind-mode');
205            setSettings('colorblind_mode', 0);
206        }
207    });
208    if(getSettings('colorblind_mode') == 1) {
209        $('input[name="color_blind_mode"][type="checkbox"]').prop('checked', true);
210    }
211
212    // Confetti Animation
213    $('body').on('change', 'input[name="confetti_mode"][type="checkbox"]', function(e) {
214        e.preventDefault()
215
216        if ($(this).is(':checked') ) {
217            setSettings('confetti_mode', 1);
218        } else{
219            setSettings('confetti_mode', 0);
220        }
221    });
222    if(getSettings('confetti_mode') == null || getSettings('confetti_mode') == 1) {
223        $('input[name="confetti_mode"][type="checkbox"]').prop('checked', true);
224    }
225
226
227    firstClick = false
228
229    $('.mini_modal_link').click(function(e){
230        e.preventDefault()
231
232        let modalId = $(this).data('modal-id')
233
234        $(modalId).find('.js-share_btn').css('display', 'block');
235        $(modalId).find('.js-share_btn').siblings('.links').css('display', 'none');
236
237        if( $(this).hasClass('active') ){
238            $(this).removeClass('active')
239            $('.mini_modal').removeClass('active')
240            $('#game-wrapper').show();
241
242            firstClick = false
243
244            if( $(window).width() < 1024 ){
245                $('body').css('cursor', 'default')
246            }
247
248            $('.overlay').fadeOut(200)
249        }else{
250            $('.mini_modal_link').removeClass('active')
251            $(this).addClass('active')
252
253            $('.mini_modal').removeClass('active')
254            $(modalId).addClass('active')
255
256            $('#game-wrapper').hide();
257
258            firstClick = true
259
260            if( $(window).width() < 1024 ){
261                $('body').css('cursor', 'pointer')
262            }
263
264            $('.overlay').fadeIn(200)
265        }
266
267        $(this).blur();
268    })
269
270    $(document).click(function(e){
271        if ( !firstClick && $(e.target).closest('.mini_modal').length == 0 ){
272            if( $('.mini_modal_link').hasClass('active') ){
273                $('.overlay').fadeOut(200)
274            }
275
276            $('.mini_modal, .mini_modal_link').removeClass('active')
277
278            $('#game-wrapper').show();
279
280            if( $(window).width() < 1024 ){
281                $('body').css('cursor', 'default')
282            }
283        }
284
285        firstClick = false
286    })
287
288    $('body').on('click', '.mini_modal .close', function(e) {
289        e.preventDefault()
290
291        $('.mini_modal, .mini_modal_link').removeClass('active')
292
293        $('#game-wrapper').show();
294
295        if( $(window).width() < 1024 ){
296            $('body').css('cursor', 'default')
297        }
298
299        $('.overlay').fadeOut(200)
300
301        firstClick = false
302    })
303
304    $('body').on('click', '.modal_finish .close', function(e) {
305        e.preventDefault()
306
307        $('.modal_finish').removeClass('active')
308
309        if( $(window).width() < 1024 ){
310            $('body').css('cursor', 'default')
311        }
312    })
313
314    // Open block "Share"
315    $('body').on('click', '.js-share_btn button', function(e) {
316        e.preventDefault()
317
318        $(this).parent().hide();
319        $(this).parent().next('.links').fadeIn(300).css('display', 'flex')
320    })
321
322    // Open block "Share"
323    $('body').on('click', '.open_alert', function(e) {
324        e.preventDefault()
325
326        $('.alert').fadeIn(300, function() {
327            setTimeout(function function_name(argument) {
328                $('.alert').fadeOut(300)
329            }, 650)
330        });
331    });
332
333
334    // Download screenshot
335    $('body').on('click', '.download-screenshot', function(e) {
336        e.preventDefault()
337
338        if($('html').hasClass('dark')) {
339            $('.game_rows').addClass('dark-theme');
340        } else {
341            $('.game_rows').removeClass('dark-theme');
342        }
343
344        $('.game_rows').addClass('game_rows-downloading');
345
346        html2canvas(document.querySelector(".game_rows")).then(canvas => {
347            $('.game_rows').removeClass('game_rows-downloading');
348            canvas.toBlob(function(blob) {
349                saveAs(blob, "wordle.png");
350            });
351        });
352    });
353});
354
355
356var share = {
357    open: function (params) {
358        let prefix = language.prefix != '' ? `/${language.prefix}` : '';
359        let url = `${prefix}/share?${params.join('&')}`;
360        share.popup(url, 'Share', 840, 700);
361    },
362
363    popup: function (url, title, w, h) {
364        var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;
365        var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;
366
367        var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
368        var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
369
370        var systemZoom = width / window.screen.availWidth;
371        var left = (width - w) / 2 / systemZoom + dualScreenLeft
372        var top = (height - h) / 2 / systemZoom + dualScreenTop
373        var newWindow = window.open(url, title, 'menubar=no,toolbar=no, width=' + w / systemZoom + ', height=' + h / systemZoom + ', top=' + top + ', left=' + left);
374        if(window.focus) newWindow.focus();
375    }
376};
377
378function getSettings(name) {
379    return localStorage.getItem(name);
380}
381
382function setSettings(name, value) {
383    setCookie(name, value, 11000);
384    localStorage.setItem(name, value);
385}
386
387function getCookie(e) {
388    var s = "(?:; )?" + e + "=([^;]*);?";
389    return !!new RegExp(s).test(document.cookie) && decodeURIComponent(RegExp.$1)
390}
391
392function setCookie(name,value,days) {
393    var expires = "";
394    if (days) {
395        var date = new Date();
396        date.setTime(date.getTime() + (days*24*60*60*1000));
397        expires = "; expires=" + date.toUTCString();
398    }
399    document.cookie = name + "=" + (value || "")  + expires + "; path=/";
400}
401
402
403function isNumberKey(evt) {
404    var charCode = (evt.which) ? evt.which : event.keyCode
405    if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 96 || charCode > 105)) return false;
406    return true;
407}
408
409function ordinal_suffix_of(i) {
410    var j = i % 10,
411        k = i % 100;
412    if (j == 1 && k != 11) {
413        return i + "st";
414    }
415    if (j == 2 && k != 12) {
416        return i + "nd";
417    }
418    if (j == 3 && k != 13) {
419        return i + "rd";
420    }
421    return i + "th";
422}

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.