1let TSOFT_APPS = { 2 cart: { 3 callback: { 4 add: [], 5 delete: [], 6 deleteAll: [], 7 update: [], 8 updateAll: [], 9 load: [], 10 } 11 }, 12 order: { 13 address: { 14 callback: [] 15 }, 16 payment: { 17 callback: [] 18 }, 19 approve: { 20 callback: [] 21 }, 22 return : { 23 callback: [] 24 }, 25 cancel : { 26 callback: [] 27 }, 28 page: { 29 callback: [] 30 } 31 }, 32 paymentMethods: { 33 callback: { 34 change: [] 35 } 36 }, 37 product: { 38 detail: { 39 callback: [] 40 }, 41 quickView: { 42 callback: { 43 open: [] 44 } 45 }, 46 wishList: { 47 callback: { 48 add: [], 49 delete: [] 50 } 51 }, 52 click: { 53 callback: [] 54 }, 55 stockAlarm: { 56 callback: { 57 add: [], 58 delete: [], 59 deleteAll: [] 60 } 61 }, 62 dynamicLoader: [], 63 comment: { 64 callback: { 65 add: [] 66 } 67 } 68 }, 69 page: { 70 cart: { 71 callback: [] 72 }, 73 search: { 74 callback: [] 75 }, 76 category: { 77 callback: [], 78 dynamicLoad: { 79 callback: [] 80 } 81 }, 82 tracking: { 83 approve: { 84 callback: [] 85 }, 86 login: { 87 callback: [] 88 }, 89 sign: { 90 callback: [] 91 } 92 }, 93 home: { 94 callback: [] 95 }, 96 other: { 97 callback: [] 98 }, 99 member: { 100 confirmation: { 101 callback: [] 102 } 103 } 104 }, 105 get: { 106 basket: undefined, 107 cart: { 108 count: window.CART_COUNT ?? window.SEPET_MIKTAR, 109 total: window.CART_TOTAL ?? window.SEPET_TOPLAM, 110 load: undefined 111 }, 112 result: { 113 basket: undefined, 114 cart: { 115 load: undefined 116 } 117 }, 118 member: { 119 ...window.MEMBER_INFO, 120 isLogin: window.MEMBER_INFO.ID > 0, 121 }, 122 currencyIso: window.CURRENCY === 'TL' ? "TRY" : window.CURRENCY 123 }, 124 other: { 125 register: [], 126 subscribe: [], 127 member: { 128 save: [] 129 } 130 }, 131 metaFormSubmit: { 132 callback: [] 133 } 134} 135const TSOFT_APPS_LIBS = { 136 fetch: { 137 post: async function (url, body = {}, option) { 138 const options = { 139 method: "POST", 140 headers: { 141 'Content-Type': 'application/json' 142 }, 143 redirect: 'follow', 144 referrerPolicy: 'no-referrer', 145 body: JSON.stringify(body) 146 } 147 const response = await fetch(url, options); 148 return response.json(); 149 } 150 }, 151 get: { 152 script: { 153 head: (uri, callback) => { 154 const script = document.createElement('script'); 155 script.src = uri 156 if (typeof callback === 'function' && callback !== undefined) { 157 script.onload = callback 158 } 159 document.head.appendChild(script); 160 }, 161 body: (uri, callback) => { 162 const script = document.createElement('script'); 163 script.src = uri 164 if (typeof callback === 'function' && callback !== undefined) { 165 script.onload = callback 166 } 167 document.body.appendChild(script); 168 } 169 }, 170 cookie: (cname) => { 171 let name = cname + "="; 172 let decodedCookie = decodeURIComponent(document.cookie); 173 let ca = decodedCookie.split(';'); 174 for (let i = 0; i < ca.length; i++) { 175 let c = ca[i]; 176 while (c.charAt(0) == ' ') { 177 c = c.substring(1); 178 } 179 if (c.indexOf(name) == 0) { 180 return c.substring(name.length, c.length); 181 } 182 } 183 return ""; 184 } 185 }, 186 set: { 187 cookie: (cname, cvalue, exdays) => { 188 const d = new Date(); 189 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 190 let expires = "expires=" + d.toUTCString(); 191 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 192 } 193 } 194} 195const TSOFT_APPS_ENDPOINTS = { 196 getBasket: "/srv/service/customer/get-basket", 197 getCartLoad: "/srv/service/cart/load" 198} 199// Fonksiyonlar 200TSOFT_APPS.get.basket = async function (call) { 201 const response = await fetch(TSOFT_APPS_ENDPOINTS.getBasket) 202 const data = response.json(); 203 TSOFT_APPS.get.result.basket = data; 204 if (typeof call === 'function') { 205 return await call(response.json()); 206 } 207} 208TSOFT_APPS.get.cart.load = async function (call) { 209 const response = await fetch(TSOFT_APPS_ENDPOINTS.getCartLoad) 210 const data = response.json(); 211 TSOFT_APPS.get.result.cart.load = data; 212 if (typeof call === 'function') { 213 return await call(data); 214 } 215} 216 217function TsoftAppsOrderAddressCallback(func) { 218 if (window.PAGE_TYPE === 'address' && typeof func === 'function') { 219 TSOFT_APPS.order.address.callback.push(func) 220 } 221} 222 223function TsoftAppsOrderPaymentCallback(func) { 224 if (window.PAGE_TYPE === 'payment' && typeof func === 'function') { 225 TSOFT_APPS.order.payment.callback.push(func) 226 } 227} 228 229function TsoftAppsOrderApproveCallback(func) { 230 if (window.PAGE_TYPE === 'approve' && typeof func === 'function') { 231 TSOFT_APPS.order.approve.callback.push(func) 232 } 233}
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.