PageSourceSearch

https://www.uklidmecesko.cz/scripts/datepicker-translate-fix.js

js uklidmecesko.cz collected 2026-10-02 02:41:21 UTC 1,509 bytes, 38 lines download raw bytes

1/*
2 * Oprava jQuery UI datepickeru pro stranky prelozene automatickym prekladacem.
3 *
4 * Google Translate (a vestaveny preklad v Chrome/Edge/Safari) prepisuje DOM tak,
5 * ze kazdy textovy uzel obali do <font style="vertical-align: inherit;">.
6 * jQuery UI 1.11.1 cte cislo dne v _selectDay pres $("a", td).html(), takze misto
7 * "2" dostane "<font ...>2</font>" -> new Date(rok, mesic, "<font...>") je Invalid
8 * Date -> do inputu se zapise "NaN.NaN.NaN".
9 *
10 * Nacitat az za /scripts/jquery-ui.min.js.
11 */
12(function ($) {
13    if (!$ || !$.datepicker) {
14        return;
15    }
16
17    // 1) Vyjmout kalendar z prekladu, aby jeho vnitrek zustal netknuty.
18    if ($.datepicker.dpDiv) {
19        $.datepicker.dpDiv.addClass("notranslate").attr("translate", "no");
20    }
21
22    // 2) Pojistka pro pripad, ze prekladac "translate=no" ignoruje: cist den
23    //    pres .text() a vytahnout z nej cislice.
24    $.datepicker._selectDay = function (id, month, year, td) {
25        var target = $(id),
26            inst;
27
28        if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
29            return;
30        }
31
32        inst = this._getInst(target[0]);
33        inst.selectedDay = inst.currentDay = parseInt($("a", td).text().replace(/\D/g, ""), 10);
34        inst.selectedMonth = inst.currentMonth = month;
35        inst.selectedYear = inst.currentYear = year;
36        this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear));
37    };
38}(window.jQuery));

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.