Search & Filter
/*
EMERALD QUICK SHIP - "BACK TO QUICK SHIP HOME" BUTTON V1A
November 19, 2026
*/
(() => {
'use strict';
const HOME = '/quickship';
const IDS = ['1366565','1366566','1366567','1366568','1366569','1366570','1366571','1366572','1366573','1366574','1366575'];
const onQuickShip = () => document.body && IDS.some(id => document.body.classList.contains('ex-categoryid-' + id));
const CSS = `
.eqs-back-row{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:12px!important;flex-wrap:wrap!important}
.eqs-back-row > h1.catalog-name{margin-right:auto!important}
.eqs-back-row-solo{justify-content:flex-end!important;margin:0 0 14px!important}
a.eqs-back-btn{display:inline-flex!important;align-items:center!important;gap:8px!important;padding:9px 18px!important;border:2px solid rgb(0,128,58)!important;border-radius:999px!important;background:#fff!important;color:rgb(0,128,58)!important;font:600 14px/18px Poppins,Arial,sans-serif!important;text-decoration:none!important;white-space:nowrap!important;transition:background .15s,color .15s!important}
a.eqs-back-btn:hover,a.eqs-back-btn:focus{background:rgb(0,128,58)!important;color:#fff!important;text-decoration:none!important}
a.eqs-back-btn svg{width:16px!important;height:16px!important;fill:none!important;stroke:currentColor!important;stroke-width:2.4!important;stroke-linecap:round!important;stroke-linejoin:round!important}
@media (max-width:575px){a.eqs-back-btn{padding:7px 14px!important;font-size:13px!important}}`;
function apply() {
if (!onQuickShip()) return;
if (!document.getElementById('eqs-back-style')) {
const st = document.createElement('style');
st.id = 'eqs-back-style';
st.textContent = CSS;
document.head.appendChild(st);
}
// Breadcrumb "Quick Ship Furniture" -> Quick Ship home
document.querySelectorAll('ol.breadcrumb a').forEach(a => {
if (/quick\s*ship/i.test(a.textContent) && a.getAttribute('href') !== HOME) a.setAttribute('href', HOME);
});
// Button beside the category title (or top of the product area if the title is hidden)
if (document.querySelector('a.eqs-back-btn')) return;
const h1 = document.querySelector('h1.catalog-name');
const row = document.createElement('div');
row.className = 'eqs-back-row';
if (h1) {
h1.parentNode.insertBefore(row, h1);
row.appendChild(h1);
} else {
const host = document.querySelector('.productsgrid_container') || document.querySelector('.griditems')?.parentElement;
if (!host) return;
row.classList.add('eqs-back-row-solo');
host.insertBefore(row, host.firstChild);
}
const btn = document.createElement('a');
btn.className = 'eqs-back-btn';
btn.href = HOME;
btn.innerHTML = 'Back to Quick Ship Home';
row.appendChild(btn);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', apply);
else apply();
window.addEventListener('load', apply);
setTimeout(apply, 1500);
})();

