/var/www/vhosts/ihelp.ro/httpdocs/webroot/js
Edit: /var/www/vhosts/ihelp.ro/httpdocs/webroot/js/default.js (3369B)
$(document).ready(function () {
$('.resetFiltersButton').click(function (e) {
e.preventDefault();
var updatedConditions = {};
var filterKey = $(this).data('filter-key');
var selectedValue = $(this).data('selected-value');
updatedConditions[filterKey] = null;
var urlParams = new URLSearchParams(window.location.search);
urlParams.delete(filterKey);
var newUrl = window.location.pathname + '?' + urlParams.toString();
history.replaceState(null, null, newUrl);
window.location.href = newUrl;
});
$('.link').each(function () {
if ($(this).hasClass('checked')) {
var currentHtml = $(this).html();
var updatedHtml = currentHtml.replace('
', '
');
$(this).html(updatedHtml);
}
});
/***********************************************
* Add preview picture
***********************************************/
$(".input-picture").on('change', function (e) {
var file = e.target.files[0];
var mediabase64data;
getBase64(file).then(
mediabase64data => $(this).closest('.container-picture').find('.preview').attr('src', mediabase64data)
);
});
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
});
$(document).ready(function () {
$('.searchButton').click(function (e) {
e.preventDefault();
$('.search').toggleClass('d-none');
});
});
$(document).ready(function () {
$('input[name="value_set"]').on('change', function () {
$('.value-donation').val('');
});
$('.value-donation').on('input', function () {
$('input[name="value_set"]').prop('checked', false);
});
$('.addDonation').on('submit', function (event) {
var valueDonationInput = $('.value-donation');
var selectedRadio = $('input[name="value_set"]:checked');
if (valueDonationInput.val().trim() === '') {
if (selectedRadio.length) {
valueDonationInput.val(selectedRadio.val());
}
}
});
/* ==========================================
counts the characters entered by the user
and shows how many are left to enter
============================================ */
var max = 2000;
$('.total-characters').text(max);
$('.count-chatracter').on('keyup paste', function (e) {
var len = $(this).val().length;
if (len > max) {
this.value = this.value.substring(0, max);
} else {
$('.total-characters').text(max - len);
}
})
/* ==========================================
scrollTop() >= 150
Should be equal the the height of the header
============================================ */
$(window).scroll(function () {
if ($(window).scrollTop() >= 150) {
$('.block__header').addClass('fixed-header');
} else {
$('.block__header').removeClass('fixed-header');
}
});
});