Subscribe to our weekly newsletter

Get coupons from your favorite retailers sent to your inbox at the beginning of every week. You can cancel anytime.

// Vanilla JS replacement for share buttons, popups, and store autocomplete document.addEventListener('DOMContentLoaded', () => { // Toggle share buttons document.querySelectorAll('.shareme, .shareme_m').forEach(btn => { btn.addEventListener('click', () => { const cid = btn.getAttribute('id'); const prefix = btn.classList.contains('shareme_m') ? 'shareit_m' : 'shareit'; const target = document.getElementById(prefix + cid); if (target) { target.style.display = (target.style.display === 'none' || !target.style.display) ? 'block' : 'none'; } }); }); // Load popup content document.querySelectorAll('.pop_trigger').forEach(btn => { btn.addEventListener('click', () => { const cid = btn.getAttribute('id'); fetch(domain + 'pop.html', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'id=' + encodeURIComponent(cid) }) .then(res => res.text()) .then(html => { document.getElementById('popdiv').innerHTML = html; document.querySelectorAll('.pop_content').forEach(el => el.style.display = 'block'); }); }); }); // Typeahead search box replacement const input = document.querySelector('input.typeahead'); const dropdown = document.createElement('ul'); dropdown.className = 'typeahead-results'; dropdown.style.position = 'absolute'; dropdown.style.zIndex = '9999'; dropdown.style.background = '#fff'; dropdown.style.border = '1px solid #ccc'; dropdown.style.display = 'none'; input.parentNode.appendChild(dropdown); input.addEventListener('input', () => { const query = input.value.trim(); if (!query) { dropdown.style.display = 'none'; return; } fetch(domain + '/ajax/response.html', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'query=' + encodeURIComponent(query) + '&task=fndStore' }) .then(res => res.json()) .then(data => { dropdown.innerHTML = ''; if (!data.length) { dropdown.style.display = 'none'; return; } data.forEach(item => { const li = document.createElement('li'); li.textContent = item.category; li.style.padding = '6px'; li.style.cursor = 'pointer'; li.addEventListener('click', () => { window.location.href = item.href; }); dropdown.appendChild(li); }); dropdown.style.display = 'block'; }); }); // Hide dropdown on outside click document.addEventListener('click', e => { if (!dropdown.contains(e.target) && e.target !== input) { dropdown.style.display = 'none'; } }); });