some cleanup

This commit is contained in:
2026-07-12 16:09:48 +00:00
parent 7fd56a3e0d
commit 5cd55c096d
595 changed files with 123 additions and 82756 deletions

View File

@@ -546,26 +546,6 @@ function rakar_content_load_scripts() {
});
});
$(".masonary-active, .woocommerce-Reviews .comment-list").imagesLoaded(function () {
var $filter = ".masonary-active, .woocommerce-Reviews .comment-list",
$filterItem = ".filter-item, .woocommerce-Reviews .comment-list li";
if ($($filter).length > 0) {
$($filter).isotope({
itemSelector: $filterItem,
filter: "*",
masonry: {
// use outer width of grid-sizer for columnWidth
columnWidth: 1,
},
});
}
$('[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
$($filter).isotope({
filter: "*",
});
});
});
/*----------- 14. Counter Up ----------*/
$(".counter-number").counterUp({
@@ -606,77 +586,8 @@ function rakar_content_load_scripts() {
$('.shape-mockup').shapeMockup();
}
/*----------- 17. Progress Bar Animation ----------*/
$('.progress-bar').waypoint(function() {
$('.progress-bar').css({
animation: "animate-positive 1.8s",
opacity: "1"
});
}, { offset: '75%' });
/*----------- 18. Countdown ----------*/
$.fn.countdown = function () {
$(this).each(function () {
var $counter = $(this),
countDownDate = new Date($counter.data("offer-date")).getTime(), // Set the date we're counting down toz
exprireCls = "expired";
// Finding Function
function s$(element) {
return $counter.find(element);
}
// Update the count down every 1 second
var counter = setInterval(function () {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor(
(distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
var minutes = Math.floor(
(distance % (1000 * 60 * 60)) / (1000 * 60)
);
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Check If value is lower than ten, so add zero before number
days < 10 ? (days = "0" + days) : null;
hours < 10 ? (hours = "0" + hours) : null;
minutes < 10 ? (minutes = "0" + minutes) : null;
seconds < 10 ? (seconds = "0" + seconds) : null;
// If the count down is over, write some text
if (distance < 0) {
clearInterval(counter);
$counter.addClass(exprireCls);
$counter.find(".message").css("display", "block");
} else {
// Output the result in elements
s$(".day").html(days);
s$(".hour").html(hours);
s$(".minute").html(minutes);
s$(".seconds").html(seconds);
}
}, 1000);
});
};
if ($(".counter-list").length) {
$(".counter-list").countdown();
}
/*---------- 19. Hero 2 Animation ----------*/
if ($('.hero-2').length > 0) {
window.addEventListener('scroll', function() {
let value = window.scrollY;
$('.line').css('width', "calc(" + 'var(--size)' + " - " + value * 0.1 + 'px' + ")");
})
};
/*----------- 21. Overlay Direction ----------*/
if ($('.overlay-direction').length > 0) {
@@ -784,94 +695,8 @@ function rakar_content_load_scripts() {
$('.slider-button').css('left', `calc(${sliderPos}% - 32px)`)
});
/*----------- 00. Color Scheme ----------*/
$('.color-switch-btns button').each(function () {
// Get color for button
const button = $(this);
const color = button.data('color');
button.css('--theme-color', color);
// Change theme color on click
button.on('click', function () {
const clickedColor = $(this).data('color');
$(':root').css('--theme-color', clickedColor);
});
});
// Handle color picker change event
$('#thcolorpicker').on('input', function () {
const pickedColor = $(this).val();
updateThemeColor(pickedColor);
});
function updateThemeColor(color) {
$(':root').css('--theme-color', color);
}
$(document).on('click','.switchIcon',function() {
$('.color-scheme').toggleClass('active');
});
/*----------- 00. Woocommerce Toggle ----------*/
// Ship To Different Address
$("#ship-to-different-address-checkbox").on("change", function () {
if ($(this).is(":checked")) {
$("#ship-to-different-address")
.next(".shipping_address")
.slideDown();
} else {
$("#ship-to-different-address").next(".shipping_address").slideUp();
}
});
// Woocommerce Payment Toggle
$('.wc_payment_methods input[type="radio"]:checked')
.siblings(".payment_box")
.show();
$('.wc_payment_methods input[type="radio"]').each(function () {
$(this).on("change", function () {
$(".payment_box").slideUp();
$(this).siblings(".payment_box").slideDown();
});
});
// Woocommerce Rating Toggle
$(".rating-select .stars a").each(function () {
$(this).on("click", function (e) {
e.preventDefault();
$(this).siblings().removeClass("active");
$(this).parent().parent().addClass("selected");
$(this).addClass("active");
});
});
// Quantity Plus Minus ---------------------------
$(document).on('click', '.quantity-plus, .quantity-minus', function (e) {
e.preventDefault();
// Get current quantity values
var qty = $(this).closest('.quantity, .product-quantity').find('.qty-input');
var val = parseFloat(qty.val());
var max = parseFloat(qty.attr('max'));
var min = parseFloat(qty.attr('min'));
var step = parseFloat(qty.attr('step'));
// Change the value if plus or minus
if ($(this).is('.quantity-plus')) {
if (max && (max <= val)) {
qty.val(max);
} else {
qty.val(val + step);
}
} else {
if (min && (min >= val)) {
qty.val(min);
} else if (val > 0) {
qty.val(val - step);
}
}
$('.cart_table button[name="update_cart"]').prop('disabled', false);
});
/*----------- Search Masonary ----------*/
$('.search-active').imagesLoaded(function () {
@@ -953,74 +778,8 @@ function rakar_content_load_scripts() {
// Window Load
$(window).on('load', function () {
rakar_content_load_scripts();
/*---------- 18. Image to SVG Code ----------*/
const cache = {};
$.fn.inlineSvg = function fnInlineSvg() {
this.each(imgToSvg);
return this;
};
function imgToSvg() {
const $img = $(this);
const src = $img.attr("src");
// fill cache by src with promise
if (!cache[src]) {
const d = $.Deferred();
$.get(src, (data) => {
d.resolve($(data).find("svg"));
});
cache[src] = d.promise();
}
// replace img with svg when cached promise resolves
cache[src].then((svg) => {
const $svg = $(svg).clone();
if ($img.attr("id")) $svg.attr("id", $img.attr("id"));
if ($img.attr("class")) $svg.attr("class", $img.attr("class"));
if ($img.attr("style")) $svg.attr("style", $img.attr("style"));
if ($img.attr("width")) {
$svg.attr("width", $img.attr("width"));
if (!$img.attr("height")) $svg.removeAttr("height");
}
if ($img.attr("height")) {
$svg.attr("height", $img.attr("height"));
if (!$img.attr("width")) $svg.removeAttr("width");
}
$svg.insertAfter($img);
$img.trigger("svgInlined", $svg[0]);
$img.remove();
});
}
$(".svg-img").inlineSvg();
});
// Cart count with ajax
jQuery(function ($) {
$(document).on('click', '.add_to_cart_button', function (e) {
e.preventDefault();
var $button = $(this);
var product_id = $button.data('product_id');
$.ajax({
type: 'POST',
url: wc_add_to_cart_params.ajax_url,
data: {
'action': 'update_cart_count',
'product_id': product_id
},
success: function (response) {
$('.cart_badge').text(response);
}
});
});
});
})(jQuery);

File diff suppressed because it is too large Load Diff