(function () {
"use strict";
function transform(text) {
if (!text) return null;
// Normalize dashes & spaces (handle hyphen or en dash characters)
var t = String(text).replace(/\u2013|–/g, "–").replace(/\s+/g, " ").trim();
// Single
if (/^Showing the single result$/i.test(t)) return "Found 1 Home Plan!";
// All N
var mAll = t.match(/^Showing all ([\d,]+) results$/i);
if (mAll) return "Found all " + mAll[1] + " Home Plans!";
// A–B of C
var mRange = t.match(/^Showing ([\d,]+)\s*[–-]\s*([\d,]+) of ([\d,]+) results$/i);
if (mRange) return "Found " + mRange[1] + "–" + mRange[2] + " of " + mRange[3] + " Home Plans!";
return null;
}
function rewriteOnce(root) {
var el = (root || document).querySelector(".woocommerce-result-count");
if (!el) return;
// Prevent thrash if another script rewrites repeatedly
if (el.dataset && el.dataset.mhfpCountDone === "1") return;
var src = (el.textContent || el.innerText || "").trim();
var newText = transform(src);
if (newText && newText !== src) {
el.textContent = newText;
if (el.dataset) el.dataset.mhfpCountDone = "1";
}
}
function rewriteAll() {
var found = false;
document.querySelectorAll(".woocommerce-result-count").forEach(function (el) {
if (el.dataset) el.dataset.mhfpCountDone = ""; // let us re-run
found = true;
});
if (found) rewriteOnce(document);
}
// Run early and on load
document.addEventListener("DOMContentLoaded", function () { rewriteOnce(document); });
window.addEventListener("load", rewriteAll);
// Start MutationObserver only when
exists
function startObserver() {
if (!document.body) return; // safety
try {
var mo = new MutationObserver(function (mutations) {
for (var i = 0; i < mutations.length; i++) {
var m = mutations[i];
if (!m.addedNodes || !m.addedNodes.length) continue;
for (var j = 0; j < m.addedNodes.length; j++) {
var node = m.addedNodes[j];
if (node.nodeType !== 1) continue;
if (
(node.matches && node.matches(".woocommerce-result-count, .products, .wbwpf-filter-area, .et_pb_shop")) ||
(node.querySelector && node.querySelector(".woocommerce-result-count"))
) {
rewriteAll();
return;
}
}
}
});
mo.observe(document.body, { childList: true, subtree: true });
} catch (e) {
// Last-resort: retry after DOM is ready
document.addEventListener("DOMContentLoaded", function () {
if (document.body) {
try {
startObserver();
} catch (_) {}
}
});
}
}
if (document.body) startObserver();
else document.addEventListener("DOMContentLoaded", startObserver);
// WBW Product Filter PRO events (old & new)
window.addEventListener("wpf_ajax_success", rewriteAll);
window.addEventListener("wbwpf_ajax_success", rewriteAll);
document.addEventListener("wbwpf_after_ajax_products", rewriteAll);
// Divi shop module AJAX
document.addEventListener("et_ajax_complete", rewriteAll);
// Generic jQuery ajaxComplete (if jQuery exists)
if (window.jQuery) {
jQuery(document).ajaxComplete(function (_e, _xhr, settings) {
if (!settings || !settings.url) return;
if (/wbwpf|product-filter|wc-ajax|et_pb_shop/i.test(settings.url)) rewriteAll();
});
}
})();
Living Room Archives - Page 56 of 66 - My Home Floor Plans
10 Hours FREE Drafting/Modifications INCLUDED. Larger projects cost LESS THAN HALF of competitors.Learn More ➜ We’re still polishing up some details—please use product images to confirm features while we complete reviews.
Living Room
Showing 881–896 of 1053 resultsSorted by average rating