1document.addEventListener('DOMContentLoaded', function () { 2 3 callbacks.cart.add.push(...TSOFT_APPS.cart.callback.add); 4 callbacks.cart.load.push(...TSOFT_APPS.cart.callback.load); 5 callbacks.cart.delete.push(...TSOFT_APPS.cart.callback.delete); 6 callbacks.cart.deleteAll.push(...TSOFT_APPS.cart.callback.deleteAll); 7 callbacks.cart.update.push(...TSOFT_APPS.cart.callback.update); 8 callbacks.cart.updateAll.push(...TSOFT_APPS.cart.callback.updateAll); 9 10 callbacks.order.address.push(...TSOFT_APPS.order.address.callback); 11 callbacks.order.payment.push(...TSOFT_APPS.order.payment.callback); 12 callbacks.order.makePayment.push(...TSOFT_APPS.order.makePayment.callback); 13 callbacks.order.page.push(...TSOFT_APPS.order.page.callback); 14 15 callbacks.customerOrder.cancel.push(...TSOFT_APPS.order.cancel.callback); 16 callbacks.customerOrder.return.push(...TSOFT_APPS.order.return.callback); 17 18 callbacks.customer.login.push(...TSOFT_APPS.page.tracking.login.callback); 19 callbacks.customer.sign.push(...TSOFT_APPS.page.tracking.sign.callback); 20 21 callbacks.product.quickView.open.push(...TSOFT_APPS.product.quickView.callback.open); 22 callbacks.product.wishList.remove.push(...TSOFT_APPS.product.wishList.callback.delete); 23 callbacks.product.wishList.add.push(...TSOFT_APPS.product.wishList.callback.add); 24 callbacks.product.dynamicLoader.push(...TSOFT_APPS.product.dynamicLoader); 25 callbacks.product.comment.add.push(...TSOFT_APPS.product.comment.callback.add); 26 callbacks.product.stockAlarm.push(...TSOFT_APPS.product.stockAlarm.callback.add); 27 28 callbacks.metaForm.submit.push(...TSOFT_APPS.metaFormSubmit.callback); 29 }); 30 31let TSOFT_APPS_callbackTry = true; 32function TSOFT_APPS_addOrderCallback() { 33 if (!TSOFT_APPS_callbackTry){ 34 return; 35 } 36 if (typeof callbacks?.order?.approve !== 'undefined') { 37 const orderApproveCallback = (approveOrderData) => { 38 if (TSOFT_APPS.order.approve.callback.length > 0) { 39 TSOFT_APPS.order.approve.callback.forEach(call => { 40 if (typeof call === "function") { 41 try { 42 call(approveOrderData); 43 } catch (e) { 44 console.log("Page order approve callback error: ", e.message) 45 } 46 } 47 }) 48 } 49 } 50 callbacks.order.approve.push(orderApproveCallback); 51 } else { 52 TSOFT_APPS_addOrderCallback() 53 } 54 setTimeout(() => { 55 TSOFT_APPS_callbackTry = false; 56 },1500); 57} 58 document.addEventListener('DOMContentLoaded', async function () { 59 60 await TSOFT_APPS.get.basket(); 61 await TSOFT_APPS.get.cart.load(); 62 63 switch (PAGE_TYPE) { 64 case 'other': 65 66 TSOFT_APPS.page.other.callback.forEach(call => { 67 if (typeof call === "function") { 68 try { 69 call(); 70 } catch (e) { 71 console.log("Page other callback error: ", e.message) 72 } 73 } 74 }) 75 76 TSOFT_APPS.page.other.callback.push = function (func) { 77 if (typeof func === 'function') { 78 try { 79 func(); 80 } 81 catch (e) { 82 console.log("Page other callback error: ", e.message) 83 } 84 return Array.prototype.push.apply(this, arguments); 85 } 86 } 87 88 break; 89 case 'home': 90 91 TSOFT_APPS.page.home.callback.forEach(call => { 92 if (typeof call === "function") { 93 try { 94 call(PRODUCT_DATA); 95 } catch (e) { 96 console.log("Page home callback error: ", e.message) 97 } 98 } 99 }) 100 101 TSOFT_APPS.page.home.callback.push = function (func) { 102 if (typeof func === 'function') { 103 try { 104 func(PRODUCT_DATA); 105 } 106 catch (e) { 107 console.log("Page home callback error: ", e.message) 108 } 109 return Array.prototype.push.apply(this, arguments); 110 } 111 } 112 113 break; 114 case 'category': 115 116 TSOFT_APPS.page.category.callback.forEach(call => { 117 if (typeof call === "function") { 118 try { 119 call(CATEGORY_DATA, PRODUCT_DATA); 120 } catch (e) { 121 console.log("Page category callback error: ", e.message) 122 } 123 } 124 }) 125 126 TSOFT_APPS.page.category.callback.push = function (func) { 127 if (typeof func === 'function') { 128 try { 129 func(CATEGORY_DATA, PRODUCT_DATA); 130 } 131 catch (e) { 132 console.log("Page category callback error: ", e.message) 133 } 134 Array.prototype.push.apply(this, arguments); 135 } 136 } 137 138 break; 139 case 'product': 140 141 TSOFT_APPS.product.detail.callback.forEach(call => { 142 if (typeof call === "function") { 143 try { 144 call(PRODUCT_DATA); 145 } catch (e) { 146 console.log("Page product detail callback error: ", e.message) 147 } 148 } 149 }) 150 151 TSOFT_APPS.product.detail.callback.push = function (func) { 152 if (typeof func === 'function') { 153 try { 154 func(PRODUCT_DATA); 155 } 156 catch (e) { 157 console.log("Page product detail callback error: ", e.message) 158 } 159 Array.prototype.push.apply(this, arguments); 160 } 161 } 162 163 break; 164 case 'cart': 165 166 TSOFT_APPS.page.cart.callback.forEach(async call => { 167 if (typeof call === "function") { 168 try { 169 call(await TSOFT_APPS.get.result.basket, await TSOFT_APPS.get.result.cart.load); 170 } catch (e) { 171 console.log("Page cart callback error: ", e.message) 172 } 173 } 174 }) 175 176 TSOFT_APPS.page.cart.callback.push = async function (func) { 177 if (typeof func === 'function') { 178 try { 179 func(await TSOFT_APPS.get.result.basket, await TSOFT_APPS.get.result.cart.load); 180 } 181 catch (e) { 182 console.log("Page cart callback error: ", e.message) 183 } 184 Array.prototype.push.apply(this, arguments); 185 } 186 } 187 188 break; 189 case 'search': 190 191 const searchWord = document.getElementById("search-word").value; 192 193 TSOFT_APPS.page.search.callback.forEach(call => { 194 if (typeof call === "function") { 195 try { 196 call(searchWord, PRODUCT_DATA); 197 } catch (e) { 198 console.log("Page search callback error: ", e.message) 199 } 200 } 201 }) 202 203 TSOFT_APPS.page.search.callback.push = function (func) { 204 if (typeof func === 'function') { 205 try { 206 func(searchWord, PRODUCT_DATA); 207 } 208 catch (e) { 209 console.log("Page search callback error: ", e.message) 210 } 211 Array.prototype.push.apply(this, arguments); 212 } 213 } 214 215 break; 216 case "memberConfirmation": 217 218 TSOFT_APPS.page.member.confirmation.callback.forEach(async call => { 219 if (typeof call === "function") { 220 try { 221 call(MEMBER_INFO); 222 } catch (e) { 223 console.log("Page member confirmation callback error: ", e.message) 224 } 225 } 226 }) 227 228 TSOFT_APPS.page.member.confirmation.callback.push = function (func) { 229 if (typeof func === 'function') { 230 try { 231 func(MEMBER_INFO); 232 } 233 catch (e) { 234 console.log("Page member confirmation callback error: ", e.message) 235 } 236 Array.prototype.push.apply(this, arguments); 237 } 238 } 239 240 break; 241 } 242 243 TSOFT_APPS.page.tracking.login.callback.push = function (func) { 244 if (typeof func === 'function') { 245 callbacks.customer.login.push(func) 246 return Array.prototype.push.apply(this, arguments); 247 } 248 } 249 250 TSOFT_APPS.page.tracking.sign.callback.push = function (func) { 251 if (typeof func === 'function') { 252 callbacks.customer.sign.push(func) 253 return Array.prototype.push.apply(this, arguments); 254 } 255 } 256 257 TSOFT_APPS.order.address.callback.push = function (func) { 258 if (typeof func === 'function') { 259 callbacks.order.address.push(func) 260 return Array.prototype.push.apply(this, arguments); 261 } 262 } 263 264 TSOFT_APPS.order.payment.callback.push = function (func) { 265 if (typeof func === 'function') { 266 callbacks.order.payment.push(func) 267 return Array.prototype.push.apply(this, arguments); 268 } 269 } 270 271 TSOFT_APPS.order.makePayment.callback.push = function (func) { 272 if (typeof func === 'function') { 273 callbacks.order.makePayment.push(func) 274 return Array.prototype.push.apply(this, arguments); 275 } 276 } 277 278 TSOFT_APPS.order.approve.callback.push = function (func) { 279 if (typeof func === 'function') { 280 callbacks.order.approve.push(func) 281 return Array.prototype.push.apply(this, arguments); 282 } 283 } 284 }); 285
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.