luv-assets 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
function init_share($ele){var shareUrl=$ele.data("share-url");var shareTitle=$ele.data("share-title");
|
|
1
|
+
function init_share($ele){var shareUrl=$ele.data("share-url");var shareTitle=$ele.data("share-title");var elems=$("[data-sharer]");for(var i=0;i<elems.length;i++){elems[i].setAttribute("data-url",shareUrl);elems[i].setAttribute("data-title",shareTitle)}$("#product-link-url-input-js").val(shareUrl);var affiliateUrl=$ele.data("affiliate-url");if(affiliateUrl){$("#affiliate-link-container-js").removeClass("d-none");$("#affiliate-link-url-input-js").val(affiliateUrl)}}function removeFavorite(favorite_id){$.ajax({url:removeFavoriteUrl,type:"POST",dataType:"json",data:{favorite_id:favorite_id,[csrfName]:csrfVal},success:function(response){if(response.status==="success"){$('.favorite-item-js[data-favorite-id="'+favorite_id+'"]').fadeOut(300,function(){$(this).remove()})}else{alert(response.message||"Update failed")}},error:function(){alert("Network error")}})}$(document).ready(function(){const lazyLoadInstance=new LazyLoad({});var pendingDeleteFavoriteId=null;$("#removeDialog").on("show.bs.modal",function(event){var button=$(event.relatedTarget);pendingDeleteFavoriteId=button.data("favorite-id")});$("#removeDialog .btn-primary").on("click",function(){if(pendingDeleteFavoriteId){removeFavorite(pendingDeleteFavoriteId);$("#removeDialog").modal("hide");pendingDeleteFavoriteId=null}});$(document).on("click",".product-detail-icon-share-js",function(e){e.preventDefault();init_share($(this));var $modal=$("#shareBottomSheet");var modalInstance=new bootstrap.Modal($modal[0]);modalInstance.show()});$("#shareBottomSheet").on("hidden.bs.modal",function(){});$(document).on("click",".btn-copy-link-js",function(e){e.preventDefault();const $btn=$(this);const targetId=$btn.data("clipboard-target");const $input=$("#"+targetId);if(!$input.length){console.warn("Copy button target not found:",targetId);return}const textToCopy=$input.val().trim();if(!textToCopy){return}copyTextToClipboard(textToCopy).then(function(success){$btn.find(".copy-label-js").addClass("d-none");$btn.find(".copy-label-copied-js").removeClass("d-none");setTimeout(function(){$btn.find(".copy-label-js").removeClass("d-none");$btn.find(".copy-label-copied-js").addClass("d-none")},2e3);if(!success){}})});$("#product-list-more").infiniteScroll({path:function(){if(this.loadCount<maxPage-1){return UrlUtils.mergeParams(base_url,{...url_params,p:this.loadCount+2})}},append:false,history:false,responseBody:"json",fetchOptions:{method:"GET",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json",Accept:"application/json"}},checkLastPage:true,scrollThreshold:100,status:".page-load-status",prefill:false,debug:false});$("#product-list-more").on("load.infiniteScroll",function(event,body,path){if(body&&body.html&&body.html.trim()!==""){$(this).append(body.html);if(typeof lazyLoadInstance!=="undefined"){lazyLoadInstance.update()}}});$("#product-list-more").on("error.infiniteScroll",function(event,error,path){alert("Failed to load more products.")});$("#product-list-more").on("append.infiniteScroll",function(event,body,path,items){});$("#product-list-more").on("last.infiniteScroll",function(){})});
|