PageSourceSearch

https://www.fuji.co.th/wp-content/themes/fuji-2021/js/page-menu.js?ver=1790944560

js fuji.co.th collected 2026-10-02 12:36:39 UTC 6,375 bytes, 168 lines download raw bytes

1function menu_modal_starter() {
2    var menuCard = [...document.querySelectorAll(".menu-card")];
3    var menuModal = document.getElementById("menu_modal");
4    var modal = new bootstrap.Modal(menuModal);
5
6    menuCard.forEach((menu_card) => {
7        var img = menu_card.querySelector(".menu-image").value;
8        var eng_name = menu_card.querySelector(".head-line").innerText;
9        var th_name = menu_card.querySelector(".menu-desc").innerText;
10        var info = menu_card.querySelector(".menu-info").value;
11        var price = menu_card.querySelector(".menu-price").innerText;
12        var info_val = info.split("<br />");
13        // console.log(info_val);
14        menu_card.onclick = function(event) {
15            menuModal.querySelector(".show-img").src = img;
16            menuModal.querySelector(".show-name-en").innerText = eng_name;
17            menuModal.querySelector(".show-name-th").innerText = th_name;
18            menuModal.querySelector(".show-price").innerText = price;
19            var info_box = menuModal.querySelector(".show-info");
20            info_box.innerText = "";
21            if (info_val.length > 1) {
22                info_val.forEach((element) => {
23                    var node_div = document.createElement("div");
24                    node_div.className = "col-6";
25                    node_div.appendChild(document.createTextNode(element.trim()));
26                    info_box.appendChild(node_div);
27                });
28            }
29            modal.show();
30            return false;
31        };
32    });
33}
34menu_modal_starter();
35
36async function getData(url = '') {
37    // Default options are marked with *
38    const response = await fetch(url, {
39        method: 'GET'
40    });
41    console.log(response.ok);
42    return response.text(); // parses JSON response into native JavaScript objects
43}
44
45var btnAll = [...document.querySelectorAll(".btn-all")];
46btnAll.forEach((btn_all) => {
47    btn_all.onclick = function(event) {
48        btn = this;
49        btn.innerText = "Loading..."
50            // console.log(btn);
51        data_tag = btn_all.dataset.tag;
52        data_count = btn_all.dataset.count;
53        console.log(data_tag, data_count);
54        var target = document.getElementById("tag_" + data_tag);
55        var menu_card = target.querySelectorAll(".menu-card:not(.no-mobile)");
56        var excludes = [];
57        // var arrStr = encodeURIComponent(JSON.stringify(myArray));
58        menu_card.forEach(element => {
59            // console.log('element', element.style.display);
60            excludes.push(parseInt(element.dataset.id));
61        });
62        excludes_list = (JSON.stringify(excludes));
63        console.log('excludes', excludes_list);
64        getData('/fuji/api-feed-menu?tag=' + data_tag +
65            "&posts_per_page=" + parseInt(data_count) +
66            "&excludes=" + excludes_list
67        ).then(data => {
68            var initHTML = target.innerHTML;
69            tag_area = document.getElementById("tag_" + data_tag);
70            tag_area.innerHTML = initHTML + data;
71            btn.style.display = "none";
72            btn_toggle = document.querySelector(".btn-toggle[data-tag=" + data_tag + "]");
73            btn_toggle.classList.toggle("d-none");
74
75            btn_toggle.onclick = function(event) {
76                hide_list = [...tag_area.querySelectorAll(".hide-all")];
77
78                var all_hide = this.classList.contains("all-hide");
79                hide_list.forEach((hide_e) => {
80                    if (all_hide) {
81                        hide_e.classList.remove("d-none");
82                        hide_e.classList.add("d-flex");
83                        btn_toggle.innerText = "Hide";
84                        target.querySelector(".hide-all").scrollIntoView({
85                            behavior: "smooth",
86                            block: "end",
87                            inline: "nearest",
88                        });
89                    } else {
90                        hide_e.classList.add("d-none");
91                        hide_e.classList.remove("d-flex");
92                        btn_toggle.innerText = "View All";
93                    }
94                });
95
96                this.classList.toggle("all-hide");
97                return false;
98            };
99            // console.log(btn_toggle);
100            target.querySelector(".hide-all").scrollIntoView({
101                behavior: "smooth",
102                block: "end",
103                inline: "nearest",
104            });
105            menu_modal_starter();
106        });
107        return false;
108    };
109});
110
111var btnPostAll = [...document.querySelectorAll(".btn-post-all")];
112btnPostAll.forEach((btn_all) => {
113    btn_all.onclick = function(event) {
114        btn = this;
115        btn_toggle = btn.nextElementSibling;
116        data_tag = this.dataset.tag;
117        btn.classList.toggle("d-none");
118        btn_toggle.classList.toggle("d-none");
119        console.log(data_tag);
120
121        tag_area = document.getElementById("tag_" + data_tag);
122        hide_all = [...tag_area.querySelectorAll(".hide-all")];
123        hide_mobile = [...tag_area.querySelectorAll(".hide-mobile")];
124
125        // console.log(tag_area, hide_all);
126
127
128        hide_all.forEach((h_all) => {
129            h_all.classList.toggle("d-none");
130            h_all.classList.toggle("d-flex");
131            tag_area.querySelector(".hide-all").scrollIntoView({
132                behavior: "smooth",
133                block: "end",
134                inline: "nearest",
135            });
136        });
137
138        if (window.innerWidth < 992) {
139            hide_mobile.forEach((h_mo) => {
140                h_mo.classList.toggle("d-none");
141                h_mo.classList.toggle("d-lg-flex");
142                h_mo.classList.toggle("d-flex");
143            });
144        }
145
146
147        btn_toggle.onclick = function(event) {
148            btn.classList.toggle("d-none");
149            btn_toggle.classList.toggle("d-none");
150
151            hide_all.forEach((h_all) => {
152                h_all.classList.toggle("d-none");
153                h_all.classList.toggle("d-flex");
154            });
155            if (window.innerWidth < 992) {
156                hide_mobile.forEach((h_mo) => {
157                    h_mo.classList.toggle("d-none");
158                    h_mo.classList.toggle("d-lg-flex");
159                    h_mo.classList.toggle("d-flex");
160                });
161            }
162
163            return false;
164        }
165
166        return false;
167    }
168});

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.