You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

5 years ago
import 'slick-slider/slick/slick.min'
5 years ago
window.readyResize = (callback, orientation = false) => {
if ($.isFunction(callback)) {
$(document).ready(()=>{
callback()
})
$(window).resize(()=>{
console.log('Window resize ')
callback()
})
if(orientation) {
window.addEventListener("orientationchange", () => {
const WCO = ($(window).width() > $(window).height()) ? "landscape" : "portrait"
console.log('Change orientation: ' + WCO)
callback()
})
}
}
}
4 years ago
$.ajaxSetup({ async: false })
5 years ago
4 years ago
window.apiUrl = ENV.API_URL
window.siteUrl = ENV.SITE_URL
window.Apis = window.Apis || {}
window.Apis.addToCart = (pid, price, qty) => {
4 years ago
return new Promise((resolve, reject) => {
$.post(apiUrl + `/cart_add.php?buster=${new Date().getTime()}`, {pid: pid, price: price, qty: qty}).done( (data) => {
resolve(data)
}).fail((error, status) => {
reject(error)
})
})
}
window.Apis.removeFromCart = (pid) => {
return new Promise((resolve, reject) => {
$.post(apiUrl + `/cart_del.php?buster=${new Date().getTime()}`, {pid: pid}).done( (data) => {
4 years ago
resolve(data)
}).fail((error, status) => {
reject(error)
})
})
}
5 years ago