Changeset 3340928
- Timestamp:
- 08/07/2025 11:22:24 AM (8 months ago)
- Location:
- mylivecart
- Files:
-
- 2 edited
-
tags/1.0.4/assets/js/zt-script.js (modified) (8 diffs)
-
trunk/assets/js/zt-script.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mylivecart/tags/1.0.4/assets/js/zt-script.js
r3321848 r3340928 10 10 jQuery(document).ready( 11 11 function () { 12 let shoppaproductList = jQuery('#product_list').data('product-list'); 12 13 jQuery(".zt-loader").hide(); 13 14 jQuery("#auth_form i.dashicons").on( … … 105 106 if (productID == product_id) { 106 107 console.log('Product_id', product_id); 107 108 108 109 jQuery(this).attr('style', 'display: block !important'); 109 console.log(jQuery(this)); 110 console.log(jQuery(this)); 110 111 jQuery('.highlight_product_separator').show(); 111 112 jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); … … 119 120 jQuery('.highlight_product_separator').hide(); 120 121 jQuery(".product_list_section").css('max-height', '90%'); 121 } 122 } 123 124 // function shopable_highlight(){ 125 // const productList = jQuery('#product_list').data('product-list'); 126 // console.log(productList); 127 128 // setInterval(()=>{ 129 // productList.forEach((item)=>{ 130 // const highlightTime = item.highlight_time; 131 // const date = new Date(); 132 // const currDate = date.toLocaleDateString('en-GB'); 133 // const currTime = date.toLocaleTimeString('en-GB'); 134 135 // const highDate = new Date(highlightTime).toLocaleDateString('en-GB'); 136 // const highTime = new Date(highlightTime).toLocaleTimeString('en-GB'); 137 // if(currDate === highDate && currTime >= highTime){ 138 // jQuery('.hide_product_card').each(function () { 139 // var product_id = jQuery(this).attr('product_id'); 140 // let event_id = jQuery(this).attr('event_id'); 141 142 // if (item.product_id == product_id) { 143 // //jQuery(".high_light_product").show(); 144 // jQuery(this).show(); 145 // jQuery('.highlight_product_separator').show(); 146 // jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 147 // } else { 148 // jQuery(this).hide(); 149 // // jQuery('.highlight_product_separator').hide(); 150 // } 151 152 // }); 153 // } 154 155 156 // }); 157 // },1000); 158 159 // } 160 161 162 function shopable_highlight() { 163 const productList = jQuery('#product_list').data('product-list'); 122 123 } 124 } 125 126 // function shopable_highlight(){ 127 // const productList = jQuery('#product_list').data('product-list'); 128 // console.log(productList); 129 130 // setInterval(()=>{ 131 // productList.forEach((item)=>{ 132 // const highlightTime = item.highlight_time; 133 // const date = new Date(); 134 // const currDate = date.toLocaleDateString('en-GB'); 135 // const currTime = date.toLocaleTimeString('en-GB'); 136 137 // const highDate = new Date(highlightTime).toLocaleDateString('en-GB'); 138 // const highTime = new Date(highlightTime).toLocaleTimeString('en-GB'); 139 // if(currDate === highDate && currTime >= highTime){ 140 // jQuery('.hide_product_card').each(function () { 141 // var product_id = jQuery(this).attr('product_id'); 142 // let event_id = jQuery(this).attr('event_id'); 143 144 // if (item.product_id == product_id) { 145 // //jQuery(".high_light_product").show(); 146 // jQuery(this).show(); 147 // jQuery('.highlight_product_separator').show(); 148 // jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 149 // } else { 150 // jQuery(this).hide(); 151 // // jQuery('.highlight_product_separator').hide(); 152 // } 153 154 // }); 155 // } 156 157 158 // }); 159 // },1000); 160 161 // } 162 163 164 function shopable_highlight() { 165 164 166 const event_type = jQuery('#product_list').data('event-type'); 165 if(event_type != 1){ 166 setInterval(() => { 167 const now = new Date(); 168 169 productList.forEach((item) => { 170 const highlightStart = new Date(item.highlight_time); 171 const highlightEnd = new Date(item.highlight_end_time); 172 173 const isActive = now >= highlightStart && now <= highlightEnd; 174 175 jQuery('.hide_product_card').each(function () { 176 const product_id = jQuery(this).attr('product_id'); 177 178 if (item.product_id == product_id) { 179 const isCurrentlyVisible = jQuery(this).is(':visible'); 180 181 if (isActive && !isCurrentlyVisible) { 182 jQuery(this).show(); 183 jQuery('.highlight_product_separator').show(); 184 jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 185 } 186 187 if (!isActive && isCurrentlyVisible) { 188 jQuery(this).hide(); 189 jQuery('.hide_product_card').hide(); 190 jQuery('.highlight_product_separator').hide(); 191 jQuery(".product_list_section").css('max-height', '90%'); 192 } 167 if (event_type != 1) { 168 169 setInterval(() => { 170 const now = new Date(); 171 172 shoppaproductList.forEach((item) => { 173 const highlightStart = new Date(item.highlight_time); 174 const highlightEnd = new Date(item.highlight_end_time); 175 176 const isActive = now >= highlightStart && now <= highlightEnd; 177 178 jQuery('.hide_product_card').each(function () { 179 const product_id = jQuery(this).attr('product_id'); 180 181 if (item.product_id == product_id) { 182 const isCurrentlyVisible = jQuery(this).is(':visible'); 183 184 if (isActive && !isCurrentlyVisible) { 185 jQuery(this).show(); 186 jQuery('.highlight_product_separator').show(); 187 jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 193 188 } 194 }); 189 190 if (!isActive && isCurrentlyVisible) { 191 jQuery(this).hide(); 192 jQuery('.hide_product_card').hide(); 193 jQuery('.highlight_product_separator').hide(); 194 jQuery(".product_list_section").css('max-height', '90%'); 195 } 196 } 195 197 }); 198 }); 196 199 }, 1000); 197 198 } 199 200 } 201 202 200 201 } 202 203 } 204 205 203 206 204 207 function hideProductCards() { … … 225 228 } 226 229 227 // const navigateToEListHandler = () => {228 // try {229 // // Construct the redirect URL safely230 // if (ztcbl_qv && ztcbl_qv.ztcbl_site_url) {231 // const redirectUrl = `${ztcbl_qv.ztcbl_site_url}/events-list`;232 233 // // Optional: Log for debugging or analytics purposes234 // console.log('Navigating to:', redirectUrl);235 236 // // Perform the redirection237 // window.location.href = redirectUrl;238 // } else {239 // console.error('ztcbl_site_url is not defined.');240 // }241 // } catch (error) {242 // // Handle any potential errors gracefully243 // console.error('Error during redirection:', error);244 // } finally {245 // // Optionally remove the event listener to avoid multiple redirects246 // socket.off('navigateToEList', navigateToEListHandler);247 // }248 // };230 // const navigateToEListHandler = () => { 231 // try { 232 // // Construct the redirect URL safely 233 // if (ztcbl_qv && ztcbl_qv.ztcbl_site_url) { 234 // const redirectUrl = `${ztcbl_qv.ztcbl_site_url}/events-list`; 235 236 // // Optional: Log for debugging or analytics purposes 237 // console.log('Navigating to:', redirectUrl); 238 239 // // Perform the redirection 240 // window.location.href = redirectUrl; 241 // } else { 242 // console.error('ztcbl_site_url is not defined.'); 243 // } 244 // } catch (error) { 245 // // Handle any potential errors gracefully 246 // console.error('Error during redirection:', error); 247 // } finally { 248 // // Optionally remove the event listener to avoid multiple redirects 249 // socket.off('navigateToEList', navigateToEListHandler); 250 // } 251 // }; 249 252 250 253 function connectHighlightedSocket() { … … 253 256 socket.on('connect', () => { 254 257 console.log('Connection Succesfull through wordpress'); 255 socket.emit('joinRoom', { room: eventKey, type: 'wordpress' });256 }); 257 258 259 socket.on('watcherJoined', (data)=>{260 // console.log(data);261 });258 socket.emit('joinRoom', { room: eventKey, type: 'wordpress' }); 259 }); 260 261 262 socket.on('watcherJoined', (data) => { 263 // console.log(data); 264 }); 262 265 socket.on('highlighted', (data) => { 266 console.log(data); 263 267 let eventKey = data.eventKey; 264 268 let urlKey = getEventKey(); … … 266 270 if (eventKey === urlKey) { 267 271 if (data.highlited === 'null') { 272 const event_type = jQuery('#product_list').data('event-type'); 273 if (event_type != 1) shoppaproductList = []; 268 274 hideProductCards(); 269 275 } else { … … 275 281 } 276 282 }); 277 283 278 284 279 285 socket.on('disconnect', () => { … … 1145 1151 const data = await response.json(); 1146 1152 jQuery('#ztcbl_sent_button').removeClass('loading'); 1147 jQuery('#feedback-message').css('display', 'block');1153 jQuery('#feedback-message').css('display', 'block'); 1148 1154 jQuery('#feedback-message').text(data?.message); 1149 1155 setTimeout(() => { -
mylivecart/trunk/assets/js/zt-script.js
r3321848 r3340928 10 10 jQuery(document).ready( 11 11 function () { 12 let shoppaproductList = jQuery('#product_list').data('product-list'); 12 13 jQuery(".zt-loader").hide(); 13 14 jQuery("#auth_form i.dashicons").on( … … 105 106 if (productID == product_id) { 106 107 console.log('Product_id', product_id); 107 108 108 109 jQuery(this).attr('style', 'display: block !important'); 109 console.log(jQuery(this)); 110 console.log(jQuery(this)); 110 111 jQuery('.highlight_product_separator').show(); 111 112 jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); … … 119 120 jQuery('.highlight_product_separator').hide(); 120 121 jQuery(".product_list_section").css('max-height', '90%'); 121 } 122 } 123 124 // function shopable_highlight(){ 125 // const productList = jQuery('#product_list').data('product-list'); 126 // console.log(productList); 127 128 // setInterval(()=>{ 129 // productList.forEach((item)=>{ 130 // const highlightTime = item.highlight_time; 131 // const date = new Date(); 132 // const currDate = date.toLocaleDateString('en-GB'); 133 // const currTime = date.toLocaleTimeString('en-GB'); 134 135 // const highDate = new Date(highlightTime).toLocaleDateString('en-GB'); 136 // const highTime = new Date(highlightTime).toLocaleTimeString('en-GB'); 137 // if(currDate === highDate && currTime >= highTime){ 138 // jQuery('.hide_product_card').each(function () { 139 // var product_id = jQuery(this).attr('product_id'); 140 // let event_id = jQuery(this).attr('event_id'); 141 142 // if (item.product_id == product_id) { 143 // //jQuery(".high_light_product").show(); 144 // jQuery(this).show(); 145 // jQuery('.highlight_product_separator').show(); 146 // jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 147 // } else { 148 // jQuery(this).hide(); 149 // // jQuery('.highlight_product_separator').hide(); 150 // } 151 152 // }); 153 // } 154 155 156 // }); 157 // },1000); 158 159 // } 160 161 162 function shopable_highlight() { 163 const productList = jQuery('#product_list').data('product-list'); 122 123 } 124 } 125 126 // function shopable_highlight(){ 127 // const productList = jQuery('#product_list').data('product-list'); 128 // console.log(productList); 129 130 // setInterval(()=>{ 131 // productList.forEach((item)=>{ 132 // const highlightTime = item.highlight_time; 133 // const date = new Date(); 134 // const currDate = date.toLocaleDateString('en-GB'); 135 // const currTime = date.toLocaleTimeString('en-GB'); 136 137 // const highDate = new Date(highlightTime).toLocaleDateString('en-GB'); 138 // const highTime = new Date(highlightTime).toLocaleTimeString('en-GB'); 139 // if(currDate === highDate && currTime >= highTime){ 140 // jQuery('.hide_product_card').each(function () { 141 // var product_id = jQuery(this).attr('product_id'); 142 // let event_id = jQuery(this).attr('event_id'); 143 144 // if (item.product_id == product_id) { 145 // //jQuery(".high_light_product").show(); 146 // jQuery(this).show(); 147 // jQuery('.highlight_product_separator').show(); 148 // jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 149 // } else { 150 // jQuery(this).hide(); 151 // // jQuery('.highlight_product_separator').hide(); 152 // } 153 154 // }); 155 // } 156 157 158 // }); 159 // },1000); 160 161 // } 162 163 164 function shopable_highlight() { 165 164 166 const event_type = jQuery('#product_list').data('event-type'); 165 if(event_type != 1){ 166 setInterval(() => { 167 const now = new Date(); 168 169 productList.forEach((item) => { 170 const highlightStart = new Date(item.highlight_time); 171 const highlightEnd = new Date(item.highlight_end_time); 172 173 const isActive = now >= highlightStart && now <= highlightEnd; 174 175 jQuery('.hide_product_card').each(function () { 176 const product_id = jQuery(this).attr('product_id'); 177 178 if (item.product_id == product_id) { 179 const isCurrentlyVisible = jQuery(this).is(':visible'); 180 181 if (isActive && !isCurrentlyVisible) { 182 jQuery(this).show(); 183 jQuery('.highlight_product_separator').show(); 184 jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 185 } 186 187 if (!isActive && isCurrentlyVisible) { 188 jQuery(this).hide(); 189 jQuery('.hide_product_card').hide(); 190 jQuery('.highlight_product_separator').hide(); 191 jQuery(".product_list_section").css('max-height', '90%'); 192 } 167 if (event_type != 1) { 168 169 setInterval(() => { 170 const now = new Date(); 171 172 shoppaproductList.forEach((item) => { 173 const highlightStart = new Date(item.highlight_time); 174 const highlightEnd = new Date(item.highlight_end_time); 175 176 const isActive = now >= highlightStart && now <= highlightEnd; 177 178 jQuery('.hide_product_card').each(function () { 179 const product_id = jQuery(this).attr('product_id'); 180 181 if (item.product_id == product_id) { 182 const isCurrentlyVisible = jQuery(this).is(':visible'); 183 184 if (isActive && !isCurrentlyVisible) { 185 jQuery(this).show(); 186 jQuery('.highlight_product_separator').show(); 187 jQuery(".product_list_section").css('max-height', 'calc(90% - 180px)'); 193 188 } 194 }); 189 190 if (!isActive && isCurrentlyVisible) { 191 jQuery(this).hide(); 192 jQuery('.hide_product_card').hide(); 193 jQuery('.highlight_product_separator').hide(); 194 jQuery(".product_list_section").css('max-height', '90%'); 195 } 196 } 195 197 }); 198 }); 196 199 }, 1000); 197 198 } 199 200 } 201 202 200 201 } 202 203 } 204 205 203 206 204 207 function hideProductCards() { … … 225 228 } 226 229 227 // const navigateToEListHandler = () => {228 // try {229 // // Construct the redirect URL safely230 // if (ztcbl_qv && ztcbl_qv.ztcbl_site_url) {231 // const redirectUrl = `${ztcbl_qv.ztcbl_site_url}/events-list`;232 233 // // Optional: Log for debugging or analytics purposes234 // console.log('Navigating to:', redirectUrl);235 236 // // Perform the redirection237 // window.location.href = redirectUrl;238 // } else {239 // console.error('ztcbl_site_url is not defined.');240 // }241 // } catch (error) {242 // // Handle any potential errors gracefully243 // console.error('Error during redirection:', error);244 // } finally {245 // // Optionally remove the event listener to avoid multiple redirects246 // socket.off('navigateToEList', navigateToEListHandler);247 // }248 // };230 // const navigateToEListHandler = () => { 231 // try { 232 // // Construct the redirect URL safely 233 // if (ztcbl_qv && ztcbl_qv.ztcbl_site_url) { 234 // const redirectUrl = `${ztcbl_qv.ztcbl_site_url}/events-list`; 235 236 // // Optional: Log for debugging or analytics purposes 237 // console.log('Navigating to:', redirectUrl); 238 239 // // Perform the redirection 240 // window.location.href = redirectUrl; 241 // } else { 242 // console.error('ztcbl_site_url is not defined.'); 243 // } 244 // } catch (error) { 245 // // Handle any potential errors gracefully 246 // console.error('Error during redirection:', error); 247 // } finally { 248 // // Optionally remove the event listener to avoid multiple redirects 249 // socket.off('navigateToEList', navigateToEListHandler); 250 // } 251 // }; 249 252 250 253 function connectHighlightedSocket() { … … 253 256 socket.on('connect', () => { 254 257 console.log('Connection Succesfull through wordpress'); 255 socket.emit('joinRoom', { room: eventKey, type: 'wordpress' });256 }); 257 258 259 socket.on('watcherJoined', (data)=>{260 // console.log(data);261 });258 socket.emit('joinRoom', { room: eventKey, type: 'wordpress' }); 259 }); 260 261 262 socket.on('watcherJoined', (data) => { 263 // console.log(data); 264 }); 262 265 socket.on('highlighted', (data) => { 266 console.log(data); 263 267 let eventKey = data.eventKey; 264 268 let urlKey = getEventKey(); … … 266 270 if (eventKey === urlKey) { 267 271 if (data.highlited === 'null') { 272 const event_type = jQuery('#product_list').data('event-type'); 273 if (event_type != 1) shoppaproductList = []; 268 274 hideProductCards(); 269 275 } else { … … 275 281 } 276 282 }); 277 283 278 284 279 285 socket.on('disconnect', () => { … … 1145 1151 const data = await response.json(); 1146 1152 jQuery('#ztcbl_sent_button').removeClass('loading'); 1147 jQuery('#feedback-message').css('display', 'block');1153 jQuery('#feedback-message').css('display', 'block'); 1148 1154 jQuery('#feedback-message').text(data?.message); 1149 1155 setTimeout(() => {
Note: See TracChangeset
for help on using the changeset viewer.