function urltitle(description, id) {
// Trim the description to 30 characters
let title = description.substring(0, 30);
// Replace specific characters with a hyphen
title = title.replace(/['"&]/g, '');
title = title.replace(/[^A-Za-z0-9\-_]/g, '-');
// Remove consecutive hyphens
title = title.replace(/--+/g, '-');
// Remove leading and trailing hyphens
title = title.replace(/^-+|-+$/g, '');
// Convert ID to hexadecimal
let hexString = parseInt(id).toString(16);
// Combine title and hexString
return title + '-' + hexString;
}
function urlTerm(description) {
// Trim the description to 30 characters
let title = description.substring(0, 30);
// Replace specific characters with a hyphen
title = title.replace(/['"&]/g, '');
title = title.replace(/[^A-Za-z0-9\-_]/g, '-');
// Remove consecutive hyphens
title = title.replace(/--+/g, '-');
// Remove leading and trailing hyphens
title = title.replace(/^-+|-+$/g, '');
return title
}
$('#apa-search-text').val('');
sessionStorage.removeItem("search_site");
function doSearch() {
var term = $('#apa-search-text').val();
if (term.length < 1) return;
sessionStorage.setItem("search_site", term);
const redirectUrl = `https://www.marks4antiques.com/price-guides/${urlTerm(term)}`;
window.location.href = redirectUrl;
}
var $input = $('').attr('placeholder', 'Search for items...').attr('id', 'apa-search-text');
var $button = $('