/var/www/vhosts/ihelp.ro/httpdocs/webroot.dev/js
Edit: /var/www/vhosts/ihelp.ro/httpdocs/webroot.dev/js/App.js (10925B)
function requireAll(r) {
r.keys().forEach(r);
}
requireAll(require.context("../svg/", true, /\.svg$/));
// SCSS
import "../scss/app.scss";
// Scripts based on plugins
import "./import/AjaxForm";
import "./import/Newsletter";
import "./import/Slider";
import "./import/Fancybox";
// Ready
$(document).ready(function () {
/* ----------------------------
* Lazy loading
* ---------------------------- */
$("[data-lazy='true']").each(function () {
$(this).attr("src", $(this).attr("data-src"));
setTimeout(function () {
$(this).css("opacity", 1);
}, 200);
});
/* ----------------------------
* Toggle
* ---------------------------- */
$("[data-action='toggle']").on("click", function (e) {
e.preventDefault();
if ($(this).hasClass('is-collapsable')) {
let actionTarget = $("#" + $(this).attr("data-action-target"));
actionTarget.toggleClass("is-active");
$(this).toggleClass("is-active");
}
});
/* ----------------------------
* Go to
* ---------------------------- */
$("body").on("click", "[data-action-href]", function (e) {
e.preventDefault();
let newUrl = $(this).attr("data-action-href");
window.location = newUrl;
});
/* ----------------------------
* Toggle details
* ---------------------------- */
$('[data-action="accordeon"]').on("click", function () {
$(this).toggleClass("is-active");
});
// ------------------------------
// Toggle for the main menu on mobile
// ------------------------------
$('[data-action="activateMenu"]').click(function () {
$(this).toggleClass("is-active");
$("#HeaderMenuMobile").toggleClass("is-active");
$("#app").toggleClass("is-blur");
});
// Smooth scroll
$('a.smooth[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function (event) {
// On-page links
if (
location.pathname.replace(/^\//, "") ==
this.pathname.replace(/^\//, "") &&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ?
target :
$("[name=" + this.hash.slice(1) + "]");
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$("html, body").animate({
scrollTop: target.offset().top,
},
500,
function () {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) {
// Checking if the target was focused
return false;
} else {
$target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
}
}
);
}
}
});
});
if ($('.block__listing .snippet .content').length) {
$('.block__listing .snippet .content').matchHeight();
}
if ($('.block__listing .snippet .title-description').length) {
$('.block__listing .snippet .title-description').matchHeight();
}
if ($('.block__listing .snippet .cause').length) {
$('.block__listing .snippet .cause').matchHeight();
}
if ($('.profile-content-title').length) {
$('.profile-content-title').matchHeight();
}
if ($('.profile-content-wrapper').length) {
$('.profile-content-wrapper').matchHeight();
}
if ($('.order-products').length) {
$(document).on('click', '.viewProductOrders', function () {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
$(this).addClass('outline');
$(this).removeClass('full');
$(this).parent().siblings('.order-products').removeClass('active');
} else {
$(this).addClass('active');
$(this).addClass('full');
$(this).removeClass('outline');
$(this).parent().siblings('.order-products').addClass('active');
}
});
}
$(document).ready(function () {
var current = window.location.pathname;
var link;
// console.log(current);
var i = 0;
$('.profile-side-nav a').each(function () {
i++;
var link = $(this).attr('href');
if (current == link) {
$(this).addClass('active');
}
});
});
$(document).ready(function () {
if ($('.select2').length) {
$('.select2').select2();
}
// if ($('.toggleProfileMenu').length) {
// $(document).on('click', '.toggleProfileMenu', function () {
// if ($(this).hasClass('active')) {
// $(this).removeClass('active');
// $(this).siblings('ul').slideUp('300');
// } else {
// $(this).addClass('active');
// $(this).siblings('ul').slideDown('300');
// }
// });
// }
$(document).on('click', '.historyGoBack', function () {
window.history.go(-1);
});
$(document).on('click', '.id-ellipsis', function () {
$('.id-ellipsis-wrapper').removeClass('active');
$(this).parent().append('
');
var copyText = document.getElementById("copyThis");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */
/* Copy the text inside the text field */
document.execCommand("copy");
/* Alert the copied text */
// console.log("ID copiat:" + copyText.value);
$(this).parent().addClass('active');
$('#copyThis').remove();
setTimeout(function () {
$('.id-ellipsis-wrapper').removeClass('active');
}, 3000);
});
// **************************
// returnCitiesByCounty
// **************************
if ($('.county').length) {
$('.county').on('change', function () {
var id = $(this).val();
$.ajax({
data: {
'id': id,
},
type: 'post',
dataType: 'json',
url: "/api/returnCitiesByCounty/",
beforeSend: function(xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="_csrfToken"]').attr('content'));
},
success: function (result) {
if (result.response.message == true) {
var cities = result.response.cities;
var select = $('.cities').removeAttr('disabled').empty();
$.each(cities, function (key, value) {
select.append(
'
');
});
}
}
});
})
}
});
// responsive tables - begin
$(document).ready(function () {
$('.table-mobile').each(function () {
$(this).find('tr').each(function () {
var i = 0;
$(this).children('th').each(function () {
i++;
$(this).addClass('id-' + i);
});
$(this).children('td').each(function () {
i++;
$(this).wrapInner("
");
// $(this).prepend('
' + $('#id-' + i).text().trim() + '');
$(this).prepend('
' + $(this).parent().parent().siblings('thead').find('.id-' + i).text().trim() + '');
});
if ((i % 2) == 1) {
$(this).children('td').last().addClass('last-child');
}
});
});
});
$(window).on('load resize', function () {
$('.table-mobile td .th-title').attr('style', '');
$('.table-mobile td .td-content').attr('style', '');
// Intialize width/height
var widest = 0,
tallest = 0;
// Loop through equalize elements
if ($(window).width() < 578) {
$('.table td .th-title').each(function () {
// Set width/height to widest/tallest elements
widest = $(this).width() > widest ? $(this).width() : widest;
// tallest = $(this).height() > tallest ? $(this).height() : tallest;
}).width(widest);
$('.table td .td-content').each(function () {
$(this).width(($(this).parent().width() - $(this).siblings('.th-title').width() - 10)); // 7 is padding-right for th-title
});
}
});
// responsive tables - end
$(document).on('click', '.toggleMenu', function () {
if ($('html').hasClass('menuOpen')) {
$('html').removeClass('menuOpen');
} else {
$('html').addClass('menuOpen');
}
});
$(document).on('click', '.toggleProfileMenu', function () {
if ($('html').hasClass('profileMenuOpen')) {
$('html').removeClass('profileMenuOpen');
} else {
$('html').addClass('profileMenuOpen');
}
});
$(document).on('mouseup', function (e) {
var container = $('.block__menu, .toggleMenu');
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0) {
// container.hide();
$('html').removeClass('menuOpen');
}
});
$(document).on('mouseup', function (e) {
var container = $('.profile-menu-wrapper, .toggleProfileMenu');
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0) {
// container.hide();
$('html').removeClass('profileMenuOpen');
}
});
if ($('.slider-homepage').length) {
$('.slider-homepage').owlCarousel({
loop: true,
margin: 10,
items: 1,
nav: true,
dots: true,
// autoplay: true,
autoplayTimeout: 7200,
autoplayHoverPause: true,
smartSpeed: 1000
});
}