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