PageSourceSearch

https://kincang-banjarnegara.desa.id/assets/js/script.js?v66b831fe8b19ca12e34928d54a492ffe

js kincang-banjarnegara.desa.id collected 2026-10-06 16:59:51 UTC 25,847 bytes, 810 lines download raw bytes

1// https://stackoverflow.com/questions/13261970/how-to-get-the-absolute-path-of-the-current-javascript-file-name/13262027#13262027
2// Untuk mendapatkan base_url, karena aplikasi bisa terinstall di subfolder
3var scripts = document.getElementsByTagName("script");
4var last_script = scripts[scripts.length - 1];
5var file_ini = last_script.src;
6// Harus mengetahui lokasi & nama file script ini
7var base_url = file_ini.replace("assets/js/script.js", "");
8
9$(window).on("load", function() {
10    // Fungsi untuk scroll elemen ke tampilan
11    function scrollToElement(element) {
12        if (element.length) {
13            element[0]?.scrollIntoView({ behavior: "smooth" });
14        }
15    }
16
17    // Scroll ke menu aktif
18    scrollToElement($("li.treeview.active.menu-open"));
19    scrollToElement($("li.active"));
20});
21
22$(document).ready(function() {
23    // Fungsi untuk tombol kembali ke atas
24    $(window).on("scroll", function() {
25        if ($(this).scrollTop() > 100) {
26            $(".scrollToTop").fadeIn();
27        } else {
28            $(".scrollToTop").fadeOut();
29        }
30    });
31
32    $(".scrollToTop").on("click", function(e) {
33        $("html, body").animate({
34            scrollTop: 0
35        }, 500);
36        return false;
37    });
38
39    $(function() {
40        var formModal = $(".modal form");
41
42        $(document).on("keydown", ":input:not(textarea):not(:submit)", function(event) {
43            if (event.key === "Enter") {
44                if ((formModal.is(":visible") && !formModal.valid()) || !$("#validasi").valid()) {
45                    event.preventDefault();
46                    return false;
47                }
48            }
49        });
50    });
51
52
53    // Tombol reset semua
54    $("button[type='reset']").on("click", function() {
55        $($(this).closest("form")).trigger("reset")
56        var form =  $(this).closest("form")
57        // tipe select
58        form.find("select").trigger("change");
59        
60        // tipe input radio
61        form.find("input[type='radio']").each(function(index, el) {
62            var value = $(el).val();
63            var checked = $(el)[0].checked;
64            if (checked == true) {
65                if ($(el).parent().is('label')) {
66                    $(el).parent().addClass('active');
67                }
68            } else {
69                if ($(el).parent().is('label')) {
70                    $(el).parent().removeClass('active');
71                }
72            }
73        });
74        form.find("input[type='radio']").trigger("change");
75    });
76
77    // Fungsi untuk filter menu
78    $("#cari-menu").on("keyup keypress", function() {
79        let hideParentMenu = $(".sidebar-menu li.treeview");
80        let search = $("#cari-menu").val();
81
82        if (search !== "") {
83            hideParentMenu.removeClass("hidden");
84            $(".sidebar-menu li").each(function(index, el) {
85                // abaikan header dan menu yg memiliki submenu
86                if ($(el).hasClass("header")) {
87                    return;
88                }
89
90                if (
91                    el.innerText
92                    .trim()
93                    .toUpperCase()
94                    .includes($("#cari-menu").val().toUpperCase())
95                ) {
96                    $(el).removeClass("hidden");
97                } else {
98                    $(el).addClass("hidden");
99                }
100                if ($(el).parent().parent().hasClass("treeview")) {
101                    hideParentMenu.each(function(indexParent, elParent) {
102                        if (elParent === $(el).parent().parent()[0]) {
103                            hideParentMenu.splice(indexParent, 1);
104                        }
105                    });
106                    $(el).parent().parent().addClass("menu-open");
107                    $(el).parent().show();
108                }
109            });
110            hideParentMenu.addClass("hidden");
111            // untuk semua parent menu yg muncul
112            $(".sidebar-menu li.treeview:not(.hidden)").each(function(index, el) {
113                // jika jumlah semua parent menu yg muncul kurang dari 4, munculkan semua sub menu
114                if ($(".sidebar-menu li.treeview:not(.hidden)").length < 4) {
115                    $(el).find("li").removeClass("hidden");
116                }
117                // jika tidak memiliki sub menu yg dicari, tampilkan semua sub menu
118                else {
119                    if ($(el).find("li:not(.hidden)").length == 0) {
120                        $(el).find("li").removeClass("hidden");
121                    }
122                }
123            });
124        } else {
125            $(".sidebar-menu li").each(function(index, el) {
126                $(el).removeClass("hidden");
127                if ($(el).parent().parent().hasClass("treeview")) {
128                    $(el).parent().parent().removeClass("menu-open");
129                    $(el).parent().hide();
130                }
131            });
132        }
133    });
134    //CheckBox All Selected
135    checkAll();
136    $("table").on("click", "input[name='id_cb[]']", function() {
137        enableHapusTerpilih();
138    });
139    enableHapusTerpilih();
140
141    //Display dialog
142    mapBox();
143    cetakBox();
144
145    $("#modalBox").on("shown.bs.modal", function(e) {
146        var link = $(e.relatedTarget);
147        var title = link.data("title");
148        var size = link.data("size") ?? "";
149        var modal = $(this);
150        // tampilkan halaman loading
151
152        modal.find(".modal-title").text(title);
153        modal.find(".modal-dialog").addClass(size);
154        $(this).find(".fetched-data").load(link.attr("href"));
155        // tambahkan csrf token kalau ada form
156        if (modal.find("form")[0]) {
157            setTimeout(function() {
158                addCsrfField(modal.find("form")[0]);
159            }, 500);
160        }
161    });
162
163    $("#modalBox").on("hidden.bs.modal	", function(e) {
164        var modal = $(this);
165        $(this).find(".fetched-data").html(``);
166        modal.find(".modal-title").text("");
167    });
168
169    //Confirm Delete Modal
170    $("#confirm-delete").on("show.bs.modal", function(e) {
171        var string = document.getElementById("confirm-delete").innerHTML;
172        var hasil = string.replace(
173            "fa fa-text-width text-yellow",
174            "fa fa-exclamation-triangle text-red"
175        );
176        document.getElementById("confirm-delete").innerHTML = hasil;
177
178        var string2 = document.getElementById("confirm-delete").innerHTML;
179        var hasil2 = string2.replace("Konfirmasi", "&nbspKonfirmasi");
180        document.getElementById("confirm-delete").innerHTML = hasil2;
181        $(this).find(".btn-ok").attr("href", $(e.relatedTarget).data("href"));
182    });
183
184    $("#confirm-status").on("show.bs.modal", function(e) {
185        $(this).find(".btn-ok").attr("href", $(e.relatedTarget).data("href"));
186        $(this).find(".modal-body").html($(e.relatedTarget).data("body"));
187    });
188
189    //File Upload
190    $("#file_browser").click(function(e) {
191        e.preventDefault();
192        $("#file").click();
193    });
194    $("#file").change(function() {
195        $("#file_path").val($(this).val());
196        if ($(this).val() == "") {
197            $("#" + $(this).data("submit")).attr("disabled", "disabled");
198        } else {
199            $("#" + $(this).data("submit")).removeAttr("disabled");
200        }
201    });
202    $("#file_path").click(function() {
203        $("#file_browser").click();
204    });
205
206    $("#file_browser1").click(function(e) {
207        e.preventDefault();
208        $("#file1").click();
209    });
210    $("#file1").change(function() {
211        $("#file_path1").val($(this).val());
212        if ($(this).val() == "") {
213            $("#" + $(this).data("submit")).attr("disabled", "disabled");
214        } else {
215            $("#" + $(this).data("submit")).removeAttr("disabled");
216        }
217    });
218    $("#file_path1").click(function() {
219        $("#file_browser1").click();
220    });
221
222    $("#file_browser2").click(function(e) {
223        e.preventDefault();
224        $("#file2").click();
225    });
226    $("#file2").change(function() {
227        $("#file_path2").val($(this).val());
228    });
229    $("#file_path2").click(function() {
230        $("#file_browser2").click();
231    });
232
233    $("#file_browser3").click(function(e) {
234        e.preventDefault();
235        $("#file3").click();
236    });
237    $("#file3").change(function() {
238        $("#file_path3").val($(this).val());
239    });
240    $("#file_path3").click(function() {
241        $("#file_browser3").click();
242    });
243
244    $("#file_browser4").click(function(e) {
245        e.preventDefault();
246        $("#file4").click();
247    });
248    $("#file4").change(function() {
249        $("#file_path4").val($(this).val());
250    });
251    $("#file_path4").click(function() {
252        $("#file_browser4").click();
253    });
254
255    $("#file_browser5").click(function(e) {
256        e.preventDefault();
257        $("#file5").click();
258    });
259    $("#file5").change(function() {
260        $("#file_path5").val($(this).val());
261    });
262    $("#file_path5").click(function() {
263        $("#file_browser5").click();
264    });
265
266    $("#hapus_file").click(function(e) {
267        var hapus_lampiran = document.getElementById("hapus_lampiran").value;
268        var icon = this.querySelector("i");
269        var link_dokumen = document.getElementById("link_dokumen").value;
270
271        if (link_dokumen) {
272            if (hapus_lampiran !== "true") {
273                document.getElementById("hapus_lampiran").value = "true";
274                document.getElementById("file_path4").disabled = true;
275                document.getElementById("file_browser4").disabled = true;
276                document.getElementById("link_dokumen").disabled = true;
277                icon.classList.remove("fa-stop");
278                icon.classList.add("fa-check");
279            } else {
280                document.getElementById("hapus_lampiran").value = "false";
281                document.getElementById("file_path4").disabled = false;
282                document.getElementById("file_browser4").disabled = false;
283                document.getElementById("link_dokumen").disabled = false;
284                icon.classList.remove("fa-check");
285                icon.classList.add("fa-stop");
286            }
287        }
288    });
289
290    $('[data-rel="popover"]').popover({
291        html: true,
292        trigger: "hover",
293    });
294
295    /* set otomatis hari */
296    $(".datepicker.data_hari").change(function() {
297        var hari = {
298            0: "Minggu",
299            1: "Senin",
300            2: "Selasa",
301            3: "Rabu",
302            4: "Kamis",
303            5: "Jumat",
304            6: "Sabtu",
305        };
306        var t = $(this).datepicker("getDate");
307        var i = t.getDay();
308        $(this).closest(".form-group").find(".hari").val(hari[i]);
309    });
310
311    $('[checked="checked"]').parent().addClass("active");
312
313    //color picker with addon
314    if ($(".my-colorpicker2").length > 0) $(".my-colorpicker2").colorpicker();
315    //Text Editor with addon
316    if ($("#min-textarea").length > 0) $("#min-textarea").wysihtml5();
317
318    $("ul.sidebar-menu").on("expanded.tree", function(e) {
319        // Manipulasi menu perlu ada tenggang waktu -- supaya dilakukan sesudah
320        // event lain selesai
321        e.stopImmediatePropagation();
322        setTimeout(scrollTampil($("li.treeview.menu-open")[0]), 500);
323    });
324
325    // ========== Tanda tangan laporan dan surat
326    $("select[name=pamong_ttd]").change(function(e) {
327        $("input[name=jabatan_ttd]").val($(this).find(":selected").data("jabatan"));
328    });
329    $("select[name=pamong_ketahui]").change(function(e) {
330        $("input[name=jabatan_ketahui]").val(
331            $(this).find(":selected").data("jabatan")
332        );
333    });
334    $("select[name=pamong_ttd]").trigger("change");
335    $("select[name=pamong_ketahui]").trigger("change");
336
337    // Untuk input rupiah di form surat
338    // Tambahkan 'Rp.' pada saat form di ketik
339    // gunakan fungsi formatRupiah() untuk mengubah angka yang di ketik menjadi format angka
340    $(".rupiah").keyup(function(e) {
341        var nilai = formatRupiah($(this).val(), "Rp. ");
342        $(this).val(nilai);
343    });
344
345    $(".pop-up-images").on("click", function() {
346        Swal.fire({
347            title: $(this).data("title"),
348            imageUrl: $(this).data("url"),
349            imageAlt: $(this).data("title"),
350            customClass: {
351                popup: "swal-lg",
352            },
353        });
354    });
355
356    $(".pop-up-pdf").on("click", function() {
357        var url = $(this).data("url");
358        Swal.fire({
359            customClass: {
360                popup: "swal-lg",
361            },
362            title: $(this).data("title"),
363            html: `<object data="${url}" style="width: 100%;min-height: 400px;" type="application/pdf"></object>`,
364        });
365    });
366});
367
368/* Fungsi formatRupiah untuk form surat */
369function formatRupiah(angka, prefix, nol_sen = true) {        
370    var number_string = angka.replace(/[^,\d]/g, "").toString(),
371        split = number_string.split(","),
372        sisa = split[0].length % 3,
373        rupiah = split[0].substr(0, sisa),
374        ribuan = split[0].substr(sisa).match(/\d{3}/gi);
375
376    // tambahkan titik jika yang di input sudah menjadi angka ribuan
377    if (ribuan) {
378        separator = sisa ? "." : "";
379        rupiah += separator + ribuan.join(".");
380    }
381
382    rupiah =
383        split[1] != undefined ? rupiah + (nol_sen ? "" : "," + split[1]) : rupiah;
384    return prefix == undefined ? rupiah : rupiah ? "Rp. " + rupiah : "";
385}
386
387function scrollTampil(elem) {
388    elem.scrollIntoView({
389        behavior: "smooth"
390    });
391}
392
393function checkAll(id = "#checkall") {
394    $("table").on("click", id, function() {
395        if ($(this).is(":checked")) {
396            $(".table input[type=checkbox]").each(function() {
397                $(this).prop("checked", true);
398            });
399        } else {
400            $(".table input[type=checkbox]").each(function() {
401                $(this).prop("checked", false);
402            });
403        }
404        $(".table input[type=checkbox]").change();
405        enableHapusTerpilih();
406    });
407    $("[data-toggle=tooltip]").tooltip();
408}
409
410function enableHapusTerpilih() {
411    // cek jika ada tombol hapus ter disable.
412    var disable = $("input[name='id_cb[]']:checked:not(:disabled)").filter(
413        function(index) {
414            return $(this).data("deletable") == 0;
415        }
416    );
417
418    if ($("input[name='id_cb[]']:checked:not(:disabled)").length <= 0) {
419        // cek disable hapus
420        $(".aksi-terpilih").addClass("disabled");
421        $(".hapus-terpilih").addClass("disabled");
422        $(".hapus-terpilih").attr("href", "#");
423    } else {
424        $(".aksi-terpilih").removeClass("disabled");
425        $(".hapus-terpilih").removeClass("disabled");
426        $(".hapus-terpilih").attr("href", "#confirm-delete");
427        if (disable.length != 0) {
428            $(".hapus-terpilih").addClass("disabled");
429            $(".hapus-terpilih").attr("href", "#");
430        }
431    }
432}
433
434function deleteAllBox(idForm, action) {
435    $("#confirm-delete").modal("show");
436    $("#ok-delete").click(function() {
437        $("#" + idForm).attr("action", action);
438        // addCsrfField($("#" + idForm)[0]);
439        refreshFormCsrf();
440        $("#" + idForm).submit();
441    });
442    return false;
443}
444
445function aksiBorongan(idForm, action) {
446    $("#confirm-status").modal("show");
447    $("#ok-status").click(function() {
448        $("#" + idForm).attr("action", action);
449        addCsrfField($("#" + idForm)[0]);
450        $("#" + idForm).submit();
451    });
452    return false;
453}
454
455function cetakBox() {
456    $("#cetakBox").on("show.bs.modal", function(e) {
457        var link = $(e.relatedTarget);
458        var title = link.data("title");
459        var aksi = link.data("aksi");
460        var form_action = link.data("href");
461        var modal = $(this);
462        modal.find(".title").text(title);
463        modal.find(".aksi").text(aksi);
464        modal.find("form").attr("action", form_action);
465        setTimeout(function() {
466            // tambahkan csrf token
467            addCsrfField(modal.find("form")[0]);
468        }, 500);
469    });
470    return false;
471}
472
473function mapBox() {
474    $("#mapBox").on("show.bs.modal", function(e) {
475        var link = $(e.relatedTarget);
476        $(".modal-header #myModalLabel").html(link.attr("data-title"));
477        $(this).find(".fetched-data").load(link.attr("href"));
478    });
479}
480
481function formAction(idForm, action, target = "") {
482    csrf_semua_form();
483    if (target != "") {
484        $("#" + idForm).attr("target", target);
485    }
486    refreshFormCsrf();
487    $("#" + idForm).attr("action", action);
488    $("#" + idForm).submit();
489}
490
491//Delay Alert
492setTimeout(function() {
493    $("#notification").fadeIn("slow");
494}, 500);
495setTimeout(function() {
496    $("#notification").fadeOut("slow");
497}, 3000);
498
499function notification(type, message) {
500    if (type == "") {
501        return;
502    }
503    $("#maincontent").prepend(
504        "" +
505        '<div id="notification" class="alert alert-' +
506        type +
507        ' alert-dismissible">' +
508        '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' +
509        message +
510        "" +
511        "</div>" +
512        ""
513    );
514}
515
516function cek_koneksi() {
517    $("#maincontent").prepend(
518        '<div class = "callout callout-warning">' +
519        '<h4><i class="fa fa-warning"></i>&nbsp;&nbsp;Informasi</h4 >' +
520        "<p> Aplikasi tidak dapat terhubung dengan koneksi internet, beberapa modul mungkin tidak berjalan dengan baik. </a></p>" +
521        "</div>"
522    );
523}
524
525function cari_nik() {
526    $("#cari_nik").change(function() {
527        $("#" + "main").submit();
528    });
529
530    $("#cari_nik_suami").change(function() {
531        $("#" + "main").submit();
532    });
533
534    $("#cari_nik_istri").change(function() {
535        $("#" + "main").submit();
536    });
537}
538
539// Ganti pilihan RW dan RT di form penduduk
540function select_options(select, params) {
541    var url_data = select.attr("data-source") + params;
542    select.find("option").not(".placeholder").remove().end();
543
544    $.ajax({
545        url: url_data,
546    }).then(function(options) {
547        JSON.parse(options).forEach((option) => {
548            var option_elem = $("<option>");
549
550            option_elem
551                .val(option[select.attr("data-valueKey")])
552                .text(option[select.attr("data-displayKey")]);
553
554            select.append(option_elem);
555        });
556    });
557}
558
559$(function() {
560    $("#op_item input:checked")
561        .parent()
562        .css({
563            background: "#c9cdff",
564            border: "0.5px solid #7a82eb"
565        });
566    $("#op_item input").change(function() {
567        if ($(this).is("input:checked")) {
568            $("#op_item input").parent().css({
569                background: "#fafafa"
570            });
571            $("#op_item input:checked")
572                .parent()
573                .css({
574                    background: "#c9cdff",
575                    border: "0.5px solid #7a82eb"
576                });
577            $(this).parent().css({
578                background: "#c9cdff"
579            });
580        } else {
581            $(this).parent().css({
582                background: "#fafafa",
583                border: "0px"
584            });
585        }
586    });
587    $("#op_item label").click(function() {
588        $(this).prev().trigger("click");
589    });
590});
591
592function _calculateAge(birthday) {
593    // birthday is a date (dd-mm-yyyy)
594    if (birthday) {
595        var parts = birthday.split("-");
596        // Ubah menjadi format ISO yyyy-mm-dd
597        // please put attention to the month (parts[0]), Javascript counts months from 0:
598        // January - 0, February - 1, etc
599        // https://stackoverflow.com/questions/5619202/converting-string-to-date-in-js
600        var birthdate = new Date(parts[2], parts[1] - 1, parts[0]);
601        var ageDifMs = new Date().getTime() - birthdate.getTime();
602        var ageDate = new Date(ageDifMs); // miliseconds from epoch
603        return Math.abs(ageDate.getUTCFullYear() - 1970);
604    }
605}
606
607// https://stackoverflow.com/questions/332872/encode-url-in-javascript
608// Menyamakan dengan PHP urlencode supaya kurung '()' juga diencode
609// Digunakan untuk mengirim nama dusun sebagai parameter url query
610function urlencode(str) {
611    str = (str + "").toString();
612
613    // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current
614    // PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following.
615    return encodeURIComponent(str)
616        .replace(/!/g, "%21")
617        .replace(/'/g, "%27")
618        .replace(/\(/g, "%28")
619        .replace(/\)/g, "%29")
620        .replace(/\*/g, "%2A");
621    // .replace(/%20/g, '+');
622}
623
624// https://stackoverflow.com/questions/26018756/bootstrap-button-drop-down-inside-responsive-table-not-visible-because-of-scroll
625$("document").ready(function() {
626    $(".table-responsive").on("show.bs.dropdown", function(e) {
627        var table = $(this),
628            menu = $(e.target).find(".dropdown-menu"),
629            tableOffsetHeight = table.offset().top + table.height(),
630            menuOffsetHeight =
631            $(e.target).offset().top +
632            $(e.target).outerHeight(true) +
633            menu.outerHeight(true);
634
635        if (menuOffsetHeight > tableOffsetHeight) {
636            table.css("padding-bottom", menuOffsetHeight - tableOffsetHeight);
637            $(".table-responsive")[0].scrollIntoView(false);
638        }
639    });
640
641    $(".table-responsive").on("hide.bs.dropdown", function() {
642        $(this).css("padding-bottom", 0);
643    });
644});
645
646// Notifikasi
647function tampil_badge(elem, url) {
648    elem.load(url);
649    setTimeout(function() {
650        if (elem.text().trim().length) elem.show();
651        else elem.hide();
652    }, 500);
653}
654
655function refresh_badge(elem, url) {
656    if (!elem.length) return;
657
658    tampil_badge(elem, url);
659    var refreshInbox = setInterval(function() {
660        tampil_badge(elem, url);
661    }, 10000);
662}
663
664function huruf_awal_besar(str) {
665    return str.replace(
666        /\S+/g,
667        (str) => str.charAt(0).toUpperCase() + str.substr(1).toLowerCase()
668    );
669}
670
671// cek suport es6/es2015
672var supportsES6 = (function() {
673    try {
674        new Function("(a = 0) => a");
675        return true;
676    } catch (err) {
677        return false;
678    }
679})();
680
681function ditolak(
682    id,
683    ajax_url,
684    redirect,
685    title = "Alasan Ditolak",
686    text,
687    placeHolders
688) {
689    Swal.fire({
690        title: title,
691        input: "textarea",
692        inputPlaceholder: placeHolders,
693        text: text,
694        inputValidator: (value) => {
695            if (!value) {
696                return "Kolom keterangan tidak boleh kosong";
697            }
698        },
699        customClass: {
700            popup: "swal-lg",
701            htmlContainer: "swal-left swal-bold",
702        },
703        showCancelButton: true,
704        confirmButtonText: "Kirim",
705        cancelButtonText: "Tutup",
706        showLoaderOnConfirm: true,
707        preConfirm: (alasan) => {
708            const formData = new FormData();
709            formData.append("sidcsrf", getCsrfToken());
710            formData.append("id", id);
711            formData.append("alasan", alasan);
712
713            return fetch(ajax_url, {
714                    method: "POST",
715                    body: formData,
716                })
717                .then((response) => {
718                    if (!response.ok) {
719                        throw new Error(response.statusText);
720                    }
721                    return response.json();
722                })
723                .catch((error) => {
724                    console.log(error);
725                    Swal.showValidationMessage(`Request failed: ${error}`);
726                });
727        },
728    }).then((result) => {
729        if (result.isConfirmed) {
730            if (result.value.status == true) {
731                swal2_success(redirect, "Berhasil dikembalikan");
732            } else {
733                Swal.fire({
734                    icon: "error",
735                    title: result.value.message
736                });
737            }
738        }
739    });
740}
741
742function swal2_success(to, message = "Berhasil disimpan") {
743    Swal.fire({
744        icon: "success",
745        title: message,
746        showConfirmButton: false,
747        timer: 1500,
748    }).then((result) => {
749        window.location.replace(to);
750    });
751}
752
753function swal2_question(url_ajax, redirect, message, data, tolak = false) {
754    Swal.fire({
755        title: message,
756        icon: "question",
757        showCancelButton: true,
758        confirmButtonColor: "#3085d6",
759        cancelButtonColor: "#d73925",
760        confirmButtonText: "Ya",
761        showDenyButton: tolak,
762        denyButtonColor: "#ffc107",
763        denyButtonText: `Tolak`,
764        cancelButtonText: `Tutup`,
765    }).then((result) => {
766        if (result.isConfirmed) {
767            Swal.fire({
768                title: "Sedang Memproses",
769                allowOutsideClick: false,
770                allowEscapeKey: false,
771                showConfirmButton: false,
772                didOpen: () => {
773                    Swal.showLoading();
774                },
775            });
776            $.ajax({
777                    url: url_ajax.confirm,
778                    type: "Post",
779                    data: data,
780                })
781                .done(function() {
782                    window.location.replace(redirect.confirm);
783                })
784                .fail(function(e) {
785                    Swal.fire({
786                        icon: "error",
787                        text: e.statusText,
788                    });
789                });
790        } else if (result.isDenied) {
791            ditolak(data.id, url_ajax.denied, redirect.denied);
792        }
793    });
794}
795
796function parseJwt(token) {
797    var base64Url = token.split(".")[1];
798    var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
799    var jsonPayload = decodeURIComponent(
800        window
801        .atob(base64)
802        .split("")
803        .map(function(c) {
804            return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
805        })
806        .join("")
807    );
808
809    return JSON.parse(jsonPayload);
810}

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.