luv-assets 1.1.6 → 1.1.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.
package/dist/js/js.min.js CHANGED
@@ -1 +1 @@
1
- function isStrictMode(){return function(){return!this}()}function isSurportedLoading(){return"loading"in HTMLImageElement.prototype}function getUrlParams(){const url=new URL(window.location.href);const searchParams=new URLSearchParams(url.search);return searchParams}const UrlUtils={create:(url,origin=window.location.origin)=>new URL(url,origin),getCurrentParams:()=>new URLSearchParams(window.location.search),mergeParams:(url,paramsObj)=>{const newUrl=typeof url==="string"?new URL(url,window.location.origin):url;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){newUrl.searchParams.set(key,paramsObj[key])}});return newUrl.toString()},buildQuery:paramsObj=>{const params=new URLSearchParams;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){params.set(key,paramsObj[key])}});return params.toString()},getParam:(url,paramName)=>{try{const urlObj=new URL(url,window.location.origin);return urlObj.searchParams.get(paramName)}catch(e){console.error("Invalid URL:",url);return null}}};function webLoadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(typeof callback!="undefined"){if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback()}}}else{script.onload=function(){callback()}}}script.src=url;document.body.appendChild(script)}function check_email(email){if(!email||email==""){return false}const myreg=/^([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;if(!myreg.test(email)){return false}return true}function check_pass(str){const re=/^\w{6,30}$/;if(re.test(str)){return true}else{return false}}function setCookie(name,value){const Days=30;const exp=new Date;exp.setTime(exp.getTime()+Days*24*60*60*1e3);document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString()}function getCookie(name){const arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));if(arr){return unescape(arr[2])}else{return null}}function showToast(msg,element){$(element).find(".toast-body").text(msg);const toastEl=$(element);if(toastEl){const toast=bootstrap.Toast.getOrCreateInstance(toastEl[0]);toast.show()}}$(document).ready(function(){if(typeof memberCheckUrl!=="undefined"&&!isEmpty(memberCheckUrl)){const ajax_params={};if(typeof product_id!=="undefined"&&!isEmpty(product_id)){ajax_params["product_id"]=product_id}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",data:ajax_params,url:memberCheckUrl,success:function(data,textStatus){if(data.loginStatus){$("#header-welcome-js").removeClass("d-none");$("#header-email-js").text(data.customer_email);$("#header-login-js").addClass("d-none")}if(data.favorite){$("#product-favorite-js").addClass("text-danger")}if(data.favorite_product_count){}if(data.affiliate){$("#affiliate-link-js").show()}if(data.cart_qty){$(".cart-item-count-js").text(data.cart_qty)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}$("#subscribe_btn").click(function(){$(this).prop("disabled",true);email=$("#subscribe_email").val();if(!check_email(email)){alert("Enter your email address");$("#subscribe_btn").prop("disabled",false);return false}$.ajax({dataType:"json",type:"post",data:{email:email},url:"/member/account/subscribe",success:function(data,textStatus){$("#subscribe_btn").prop("disabled",false);if(data.success){alert(data.message);$("#subscribe_email").val("")}else{alert(data.message)}},error:function(error){alert("Oops! Something went wrong. Please try again later.");$("#subscribe_btn").prop("disabled",false)}})})});function isValidSearchKeyword(keyword,maxLength=100){keyword=keyword.trim();if(keyword===""){return false}if(keyword.length>maxLength){return false}const safePattern=/^[\p{L}\p{N}\s.;:'"!?-]+$/u;if(!safePattern.test(keyword)){return false}const escapedKeyword=keyword.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return true}const historyKey="search_history";function pullSearchHistory(Url){let localHistory=getCompatibleSearchHistoryFromLocalStorage();if(!isSyncNeeded(localHistory)){return}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",url:Url,success:function(data,textStatus){if(data.data.length>0){mergeLocalSearchHistory(data.data)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveOneSearchHistory(keyword,Url){$.ajax({async:true,timeout:6e3,dataType:"json",type:"post",url:Url,data:{keyword:keyword},success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveSearchToLocalStorage(keyword){let searchHistory=getCompatibleSearchHistoryFromLocalStorage();const index=searchHistory.data.indexOf(keyword);if(index>-1){searchHistory.data.splice(index,1)}searchHistory.data.unshift(keyword);if(searchHistory.data.length>maxSearchHistoryLength){searchHistory.data=searchHistory.data.slice(0,maxSearchHistoryLength)}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory))}function removeSearchFromLocalStorage(keyword){let searchHistory=JSON.parse(localStorage.getItem(historyKey));if(searchHistory&&Array.isArray(searchHistory.data)){if(keyword){searchHistory.data=searchHistory.data.filter(item=>item!==keyword)}else{localStorage.removeItem(historyKey);return}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory));return}else{localStorage.removeItem(historyKey);return}}function getSearchHistoryFromLocalStorage(){let searchHistory=JSON.parse(localStorage.getItem(historyKey))||{update_time:null,last_sync_time:null,data:[]};return searchHistory}function getCompatibleSearchHistoryFromLocalStorage(){const rawHistory=localStorage.getItem(historyKey);if(!rawHistory){return{update_time:null,last_sync_time:null,data:[]}}let history;try{history=JSON.parse(rawHistory)}catch(e){console.error("Failed to parse history:",e);return{update_time:null,last_sync_time:null,data:[]}}if(Array.isArray(history)){history={update_time:null,last_sync_time:null,data:history};localStorage.setItem(historyKey,JSON.stringify(history))}return history}function isSyncNeeded(history){if(!history||!history.last_sync_time)return true;const lastSyncTime=new Date(history.last_sync_time);const currentTime=new Date;const diffInMinutes=(currentTime-lastSyncTime)/(1e3*60);return diffInMinutes>15}function mergeLocalSearchHistory(serverHistory){let localHistory=getCompatibleSearchHistoryFromLocalStorage();localHistory.last_sync_time=(new Date).toISOString();let mergedData=Array.from(new Set([...localHistory.data,...serverHistory]));localHistory.data=mergedData;localStorage.setItem(historyKey,JSON.stringify(localHistory))}function is_valid_url(url){var regex=new RegExp(/^(https?|s):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i);return regex.test(url)}function is_same_domain(base_url,custom_url){base_url=base_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];custom_url=custom_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];return base_url==custom_url||base_url.indexOf(custom_url)!=-1||custom_url.indexOf(base_url)!=-1}function process_friendly_url(param,value,url){var hash=url.split("#")[1];url=url.split("#")[0];var re=new RegExp("([/]"+param+"[/][^?]*)"),match=re.exec(url);var re2=new RegExp("([?].*)"),match2=re2.exec(url);if(match&&match[0])url=url.replace(match[0],"");if(match2&&match2[0])url=url.replace(match2[0],"");var re3=new RegExp("([/]"+param+"$)"),match3=re3.exec(url);if(match3&&match3[0])url=url.replace(match3[0],"");url=url.replace(/\/+$/,"");url=url+"/"+param+"/"+value+"/";if(match2&&match2[0])url=url+match2[0];if(hash)url+="#"+hash;return url}function add_query_arg(param,value,url){var re=new RegExp("[\\?&]"+param+"=([^&#]*)"),match=re.exec(url),delimiter,newString;var hash=url.split("#")[1];url=url.split("#")[0];if(match===null){var hasQuestionMark=/\?/.test(url);delimiter=hasQuestionMark?"&":"?";newString=url+delimiter+param+"="+value}else{delimiter=match[0].charAt(0);newString=url.replace(re,delimiter+param+"="+value)}if(hash){newString+="#"+hash}return newString}
1
+ function isStrictMode(){return function(){return!this}()}function isSurportedLoading(){return"loading"in HTMLImageElement.prototype}const UrlUtils={create:(url,origin=window.location.origin)=>new URL(url,origin),getCurrentParams:()=>new URLSearchParams(window.location.search),mergeParams:(url,paramsObj)=>{const newUrl=typeof url==="string"?new URL(url,window.location.origin):url;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){newUrl.searchParams.set(key,paramsObj[key])}});return newUrl.toString()},buildQuery:paramsObj=>{const params=new URLSearchParams;Object.keys(paramsObj).forEach(key=>{if(paramsObj[key]!==undefined&&paramsObj[key]!==null){params.set(key,paramsObj[key])}});return params.toString()},getParam:(url,paramName)=>{try{const urlObj=new URL(url,window.location.origin);return urlObj.searchParams.get(paramName)}catch(e){console.error("Invalid URL:",url);return null}}};function webLoadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(typeof callback!="undefined"){if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback()}}}else{script.onload=function(){callback()}}}script.src=url;document.body.appendChild(script)}function check_email(email){if(!email||email==""){return false}const myreg=/^([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-|\-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;if(!myreg.test(email)){return false}return true}function check_pass(str){const re=/^\w{6,30}$/;if(re.test(str)){return true}else{return false}}function setCookie(name,value){const Days=30;const exp=new Date;exp.setTime(exp.getTime()+Days*24*60*60*1e3);document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString()}function getCookie(name){const arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));if(arr){return unescape(arr[2])}else{return null}}function showToast(msg,element){$(element).find(".toast-body").text(msg);const toastEl=$(element);if(toastEl){const toast=bootstrap.Toast.getOrCreateInstance(toastEl[0]);toast.show()}}$(document).ready(function(){if(typeof memberCheckUrl!=="undefined"){const ajax_params={};if(typeof product_id!=="undefined"){ajax_params["product_id"]=product_id}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",data:ajax_params,url:memberCheckUrl,success:function(data,textStatus){if(data.loginStatus){$("#header-welcome-js").removeClass("d-none");$("#header-email-js").text(data.customer_email);$("#header-login-js").addClass("d-none")}if(data.favorite){$("#product-favorite-js").addClass("text-danger")}if(data.favorite_product_count){}if(data.affiliate){$("#affiliate-link-js").show()}if(data.cart_qty){$(".cart-item-count-js").text(data.cart_qty)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}$("#subscribe_btn").click(function(){$(this).prop("disabled",true);email=$("#subscribe_email").val();if(!check_email(email)){alert("Enter your email address");$("#subscribe_btn").prop("disabled",false);return false}$.ajax({dataType:"json",type:"post",data:{email:email},url:"/member/account/subscribe",success:function(data,textStatus){$("#subscribe_btn").prop("disabled",false);if(data.success){alert(data.message);$("#subscribe_email").val("")}else{alert(data.message)}},error:function(error){alert("Oops! Something went wrong. Please try again later.");$("#subscribe_btn").prop("disabled",false)}})})});function isValidSearchKeyword(keyword,maxLength=100){keyword=keyword.trim();if(keyword===""){return false}if(keyword.length>maxLength){return false}const safePattern=/^[\p{L}\p{N}\s.;:'"!?-]+$/u;if(!safePattern.test(keyword)){return false}const escapedKeyword=keyword.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return true}const historyKey="search_history";function pullSearchHistory(Url){let localHistory=getCompatibleSearchHistoryFromLocalStorage();if(!isSyncNeeded(localHistory)){return}$.ajax({async:true,timeout:6e3,dataType:"json",type:"get",url:Url,success:function(data,textStatus){if(data.data.length>0){mergeLocalSearchHistory(data.data)}},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function removeHistory(url,keyword){data={};if(keyword){data["keyword"]=keyword}$.ajax({async:true,timeout:6e3,dataType:"json",data:data,type:"post",url:url,success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveOneSearchHistory(keyword,Url){$.ajax({async:true,timeout:6e3,dataType:"json",type:"post",url:Url,data:{keyword:keyword},success:function(data,textStatus){},error:function(XMLHttpRequest,textStatus,errorThrown){}})}function saveSearchToLocalStorage(keyword){let searchHistory=getCompatibleSearchHistoryFromLocalStorage();const index=searchHistory.data.indexOf(keyword);if(index>-1){searchHistory.data.splice(index,1)}searchHistory.data.unshift(keyword);if(searchHistory.data.length>maxSearchHistoryLength){searchHistory.data=searchHistory.data.slice(0,maxSearchHistoryLength)}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory))}function removeSearchFromLocalStorage(keyword){let searchHistory=JSON.parse(localStorage.getItem(historyKey));if(searchHistory&&Array.isArray(searchHistory.data)){if(keyword){searchHistory.data=searchHistory.data.filter(item=>item!==keyword)}else{localStorage.removeItem(historyKey);return}searchHistory.update_time=(new Date).toISOString();localStorage.setItem(historyKey,JSON.stringify(searchHistory));return}else{localStorage.removeItem(historyKey);return}}function getSearchHistoryFromLocalStorage(){let searchHistory=JSON.parse(localStorage.getItem(historyKey))||{update_time:null,last_sync_time:null,data:[]};return searchHistory}function getCompatibleSearchHistoryFromLocalStorage(){const rawHistory=localStorage.getItem(historyKey);if(!rawHistory){return{update_time:null,last_sync_time:null,data:[]}}let history;try{history=JSON.parse(rawHistory)}catch(e){console.error("Failed to parse history:",e);return{update_time:null,last_sync_time:null,data:[]}}if(Array.isArray(history)){history={update_time:null,last_sync_time:null,data:history};localStorage.setItem(historyKey,JSON.stringify(history))}return history}function isSyncNeeded(history){if(!history||!history.last_sync_time)return true;const lastSyncTime=new Date(history.last_sync_time);const currentTime=new Date;const diffInMinutes=(currentTime-lastSyncTime)/(1e3*60);return diffInMinutes>15}function mergeLocalSearchHistory(serverHistory){let localHistory=getCompatibleSearchHistoryFromLocalStorage();localHistory.last_sync_time=(new Date).toISOString();let mergedData=Array.from(new Set([...localHistory.data,...serverHistory]));localHistory.data=mergedData;localStorage.setItem(historyKey,JSON.stringify(localHistory))}function is_valid_url(url){var regex=new RegExp(/^(https?|s):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i);return regex.test(url)}function is_same_domain(base_url,custom_url){base_url=base_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];custom_url=custom_url.replace("http://","").replace("https://","").replace("www.","").replace("m.","").split(/[/?#]/)[0];return base_url==custom_url||base_url.indexOf(custom_url)!=-1||custom_url.indexOf(base_url)!=-1}function process_friendly_url(param,value,url){var hash=url.split("#")[1];url=url.split("#")[0];var re=new RegExp("([/]"+param+"[/][^?]*)"),match=re.exec(url);var re2=new RegExp("([?].*)"),match2=re2.exec(url);if(match&&match[0])url=url.replace(match[0],"");if(match2&&match2[0])url=url.replace(match2[0],"");var re3=new RegExp("([/]"+param+"$)"),match3=re3.exec(url);if(match3&&match3[0])url=url.replace(match3[0],"");url=url.replace(/\/+$/,"");url=url+"/"+param+"/"+value+"/";if(match2&&match2[0])url=url+match2[0];if(hash)url+="#"+hash;return url}function add_query_arg(param,value,url){var re=new RegExp("[\\?&]"+param+"=([^&#]*)"),match=re.exec(url),delimiter,newString;var hash=url.split("#")[1];url=url.split("#")[0];if(match===null){var hasQuestionMark=/\?/.test(url);delimiter=hasQuestionMark?"&":"?";newString=url+delimiter+param+"="+value}else{delimiter=match[0].charAt(0);newString=url.replace(re,delimiter+param+"="+value)}if(hash){newString+="#"+hash}return newString}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "luv-assets",
3
3
  "description": "Include Bootstrap's source Sass and individual JavaScript plugins with Webpack.",
4
- "version": "1.1.6",
4
+ "version": "1.1.8",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",