| mitosbett
function noescape() {
if (document.readyState == 'loading') {
document.addEventListener("keydown", function(event) {
if(event.keyCode === 27){
event.preventDefault();
}
});
}
}
@mitosbett
fn_menu_dropdown = function()
{
// toggle settings modal
let isClose = true;
dataSettingMenu = document.querySelector('[data-setting-menu]')
dataSettingMenu&&dataSettingMenu.addEventListener('click', (e) => {
document.querySelector('[data-drp]').classList.toggle('Rotate(180deg)');
if (isClose) {
isClose = false;
MicroModal.show('modal-3');
document.body.style.overflowY = 'hidden';
}else {
isClose = true;
MicroModal.close('modal-3');
document.body.style.overflowY = 'scroll';
}
});
}
fn_menu_dropdown();
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-JCJXJFJXTK');
const userPackage = {"end_date": "Sun, 11 Jun 2023 01:34:10 GMT", "level": 0, "package_details": [{"package_id": "60861650e534fe6ce1129c7a-3036-58", "product_code": "MAX-LIMIT-UPLOAD", "product_data": 1, "product_description": "Max 1gb size per file", "product_name": "MAX LIMIT UPLOAD"}], "package_id": "60861650e534fe6ce1129c7a-3036-58", "package_name": "Free package", "start_date": "Sun, 11 Jun 2023 01:34:10 GMT", "status": "FREE"};
const tab_active = "";
$('script').each(function (e) {
if ($(this).attr('src') != undefined && $(this).attr('src').lastIndexOf('jquery') == -1) {
var old_src = $(this).attr('src');
var that = $(this);
$(this).attr('src', '');
setTimeout(function () {
that.attr('src', old_src + '?' + new Date().getTime());
}, 250);
}
});
if (tab_active) {
document.getElementById(tab_active)&&document.getElementById(tab_active).classList.remove("Bdb($c3):h","C(#2ab57d):h");
document.getElementById(tab_active)&&document.getElementById(tab_active).classList.add("Bdb($c3)","C(#2ab57d)");
}
MicroModal.init();
MicroModal.init({
onClose: (modal, param) => {
// MicroModal.show('modal-1');
}
});
let tif;
function showModalEdit(t, e) {
tif = e.target.id;
MicroModal.close('modal-1');
MicroModal.show('modal-2');
}
function showModalvApply(t, e) {
MicroModal.close('modal-1');
MicroModal.show('modal-7');
}
function closeModalEdit(t, e) {
MicroModal.close('modal-1');
}
function showCart() {
MicroModal.close('modal-2');
MicroModal.show('modal-1');
}
sp.addToCart.token = ".eJwFwUsOgDAIBcC7sCeBfnjU2yBtE9cu1bs789B9TTooFqR0BO81Krc4N0eqc6p2Nz-Bitea5tiK3ra6rFywWTOEAQibirVRRqHvB_nwFoo.ZITCIg.Dhl94eVdXqh8vtHc9OFau8EddpU";
const counterInput = document.querySelector('[data-counter-input]');
const counterEl = document.querySelector('[data-counter]');
const subtractEl = document.querySelector('[data-counter-sub]');
counterEl ? counterEl.textContent = counterInput.value : '';
function add(add, el) {
let convertToNumber = parseInt(counterInput.value);
const x = false;
const max = +'12';
if (add && convertToNumber >= max && !x) {
alert("You've Reached the Max Quantity Limit");
}else{
add ? convertToNumber += 1 : convertToNumber -= 1;
if (convertToNumber<=0){
convertToNumber = 1;
counterInput.value = 1;
counterEl.value = 1;
} else {
convertToNumber <= 1 ? subtractEl.classList.add('Op(0.5)') : subtractEl.classList.remove('Op(0.5)');
counterInput.value = convertToNumber;
counterEl.value = counterInput.value;
};
};
};
function changeInput(e) {
e.value = !!e.value && Math.abs(e.value) >= 1 ? Math.abs(e.value) : null;
counterInput.value = e.value;
counterEl.value = e.value;
};
$('[data-counter]').focusout((e)=>{
if (e.target.value<= 0) {
e.target.value = 1;
counterInput.value = 1;
counterEl.value = counterInput.value;
}
});
ajaxServerCallPost(e => {}, "POST", "/v1/analytics/visitor-counter", { pkey: $("#fk_store_id").val(), info: visitorinfo }, true)
function thousandSeparator(data) {
const nf = new Intl.NumberFormat();
const spanEl = document.querySelectorAll(`[${data}]`);
spanEl.forEach(el => {
let formated = nf.format(el.textContent);
isNaN(parseInt(formated)) ? spanEl.textContent : el.textContent = formated;
});
};
thousandSeparator('data-price');
function ajaxServerCallPost(callback_func, method, url, data, bool){
let csrf_token = $("#csrf_token").val() ;
_g_jqxhr = $.ajax({
url : url,
method : method,
data : JSON.stringify(data),
dataType : "json",
contentType: "application/json; charset=utf-8",
dataType: 'json',
beforeSend: function(xhr, settings) {
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrf_token);
}
},
success: function(response,request){
callback_func(response);
},
error: function(response){
callback_func(response);
}
});
}
function incrementPageViews(pkey) {
let csrf_token = $("#csrf_token").val();
ajaxServerCallPost(
function(response) {
},
"POST",
"/v1/analytics/page-views/increment",
{ pkey: pkey },
true
);
}
function incrementPageLinkViews(pkey) {
let csrf_token = $("#csrf_token").val();
ajaxServerCallPost(
function(response) {
},
"POST",
"/v1/analytics/page-link-views/increment",
{ pkey: pkey },
true
);
}
function resetContactForm() {
document.getElementById('csrf_token').value = ""
document.getElementById('fullname').value = ""
document.getElementById('contact').value = ""
document.getElementById('custom_field').value = ""
document.getElementById('fk_block_id').value = ""
}
function validateEmail() {
var contact = document.getElementById('contact').value
const regx = new RegExp('^([a-zA-Z0-9\._]+)@([a-zA-Z0-9])+.([a-z]+)(.[a-z]+)?$');
if(regx.test(contact)){
return true
}
else{
alert("Sorry invalid Email Format")
document.getElementById('contact').value = ""
return false
}
}
// FOR EMAIL_SMS - SAVE CONTACT / SUBSCRIBE
function saveContact() {
const csrf_token = document.getElementById('csrf_token').value
const contact = document.getElementById('contact').value
const fk_block_id = document.getElementById('fk_block_id').value
// CAN BE EMPTY
const fullnameEle = document.getElementById("fullname");
if(fullnameEle){
var fullname = fullnameEle.value;
}
else{
var fullname = ""
}
const customFieldEle = document.getElementById("custom_field");
if(customFieldEle){
var custom_field = customFieldEle.value;
}
else{
var custom_field = ""
}
// CHECK CONTACT TYPE IF EMAIL OR SMS
// IF EMAIL GO TO THE VALIDATION
var contactType = document.getElementById('contact').type
var isValidated = true
if(contactType == "email"){
var isValidated = validateEmail();
}
if(isValidated == true){
ajaxServerCallPost(
function(response) {
},
"POST",
"/contact/add",
{
csrf_token : csrf_token,
fullname : fullname,
contact : contact,
custom_field : custom_field,
fk_block_id : fk_block_id
},
true
);
MicroModal.show('modalContact');
}
}
function reloadPage() {
location.reload();
}
x server