openvibers/openvibe.markets Commits
The search box keeps its examples; no empty picture squares (#1)
Changes
@@@ -47,3 +47,11 @@ html[data-ov-motion="off"] .mk-elsewhere a, html[data-ov-motion="off"] .mk-btn {.mk-card-img { width: 56px; height: 56px; }.mk-card-price { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; }}++/* A card without a picture: the words and the price only (Deals' feed often has none). */++.mk-card--text { grid-template-columns: minmax(0, 1fr) auto; }++.mk-afford { display: inline-flex; align-items: center; min-height: 32px; }++@media (max-width: 520px) {++ .mk-card--text { grid-template-columns: minmax(0, 1fr); }++ .mk-card--text .mk-card-price { grid-column: 1; }++ .mk-afford { min-height: 44px; padding: 0 2px; }++}@@@ -34,7 +34,7 @@ function page({ title, body, path = '/', description = 'Every marketplace, one s}const searchForm = (q = '') => `<form class="mk-search" method="get" action="/search" role="search">--<label class="mk-search-box"><span class="mk-sr">What are you looking for?</span><input type="search" name="q" value="${esc(q)}" placeholder="Headphones, a sofa, a used road bike…" maxlength="100" autocomplete="off" required></label>++<label class="mk-search-box"><span class="mk-sr">What are you looking for?</span><input type="search" name="q" value="${esc(q)}" placeholder="Headphones, a sofa, a used road bike…" maxlength="100" autocomplete="off" required data-ov-trending="own"></label><button class="mk-btn mk-btn--primary" type="submit">Search</button></form>`;function home() {@@@ -52,7 +52,8 @@ ${searchForm()}</section>}function results({ q, deals, links, now = Date.now() }) {-- const card = (r) => `<li class="mk-card">${r.image ? `<img class="mk-card-img" src="${esc(r.image)}" alt="" loading="lazy" width="72" height="72">` : '<span class="mk-card-img mk-card-img--none" aria-hidden="true"></span>'}++ // A deal without a picture takes the whole width: no empty square.++ const card = (r) => `<li class="mk-card${r.image ? '' : ' mk-card--text'}">${r.image ? `<img class="mk-card-img" src="${esc(r.image)}" alt="" loading="lazy" width="72" height="72">` : ''}<span class="mk-card-body"><a class="mk-card-title" href="${esc(r.url)}">${esc(r.title)}</a><small>${esc(r.store || 'A store')} · ${esc(r.source)}${r.condition && r.condition !== 'new' ? ` · ${esc(r.condition)}` : ''}</small></span><span class="mk-card-price">${r.price != null ? `<b>${esc(money(r.price, r.currency || 'USD'))}</b>${r.was != null && r.was > r.price ? `<s>${esc(money(r.was, r.currency || 'USD'))}</s>` : ''}<small>${esc(asOf(r.observed_at, now))}</small>@@@ -51,6 +51,7 @@ const OFFERS = [assert.match(r.text, /Every marketplace, one search/);assert.match(r.text, /<form class="mk-search" method="get" action="\/search"/);assert.match(r.text, /Facebook Marketplace/);++ assert.match(r.text, /data-ov-trending="own"/, 'a product search keeps its own examples, never the page\'s headings');assert.match(r.headers.get('cache-control'), /public/);r = await get('/search?q=headphones');@@@ -60,6 +61,8 @@ const OFFERS = [assert.match(r.text, /\$149\.99<\/b><s>\$199\.99<\/s><small>as of 3 hours ago<\/small>/, 'a price with its time and the price before');assert.match(r.text, /as of Nov 10, 2026/);assert.match(r.text, /price not stated/);++ assert.match(r.text, /<li class="mk-card mk-card--text">/, 'a deal without a picture has no empty square');++ assert.match(r.text, /<img class="mk-card-img" src="https:\/\/img\.example\/nc\.jpg"/);assert.match(r.text, /Shop Example · OpenVibe Deals/);assert.match(r.text, /Refurb Co · OpenVibe Deals · refurbished/);assert.match(r.text, /href="https:\/\/openvibe\.finance\/ahead\?cost=149\.99">Can I afford it\?/);
@@ -47,3 +47,11 @@ html[data-ov-motion="off"] .mk-elsewhere a, html[data-ov-motion="off"] .mk-btn {
@@ -47,3 +47,11 @@ html[data-ov-motion="off"] .mk-elsewhere a, html[data-ov-motion="off"] .mk-btn {
.mk-card-img { width: 56px; height: 56px; }
.mk-card-img { width: 56px; height: 56px; }
.mk-card-price { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; }
.mk-card-price { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; }
}
}
+/* A card without a picture: the words and the price only (Deals' feed often has none). */
+.mk-card--text { grid-template-columns: minmax(0, 1fr) auto; }
+.mk-afford { display: inline-flex; align-items: center; min-height: 32px; }
+@media (max-width: 520px) {
+ .mk-card--text { grid-template-columns: minmax(0, 1fr); }
+ .mk-card--text .mk-card-price { grid-column: 1; }
+ .mk-afford { min-height: 44px; padding: 0 2px; }
+}
@@ -34,7 +34,7 @@ function page({ title, body, path = '/', description = 'Every marketplace, one s
@@ -34,7 +34,7 @@ function page({ title, body, path = '/', description = 'Every marketplace, one s
}
}
const searchForm = (q = '') => `<form class="mk-search" method="get" action="/search" role="search">
const searchForm = (q = '') => `<form class="mk-search" method="get" action="/search" role="search">
-<label class="mk-search-box"><span class="mk-sr">What are you looking for?</span><input type="search" name="q" value="${esc(q)}" placeholder="Headphones, a sofa, a used road bike…" maxlength="100" autocomplete="off" required></label>
+<label class="mk-search-box"><span class="mk-sr">What are you looking for?</span><input type="search" name="q" value="${esc(q)}" placeholder="Headphones, a sofa, a used road bike…" maxlength="100" autocomplete="off" required data-ov-trending="own"></label>
<button class="mk-btn mk-btn--primary" type="submit">Search</button></form>`;
<button class="mk-btn mk-btn--primary" type="submit">Search</button></form>`;
function home() {
function home() {
@@ -52,7 +52,8 @@ ${searchForm()}</section>
@@ -52,7 +52,8 @@ ${searchForm()}</section>
}
}
function results({ q, deals, links, now = Date.now() }) {
function results({ q, deals, links, now = Date.now() }) {
- const card = (r) => `<li class="mk-card">${r.image ? `<img class="mk-card-img" src="${esc(r.image)}" alt="" loading="lazy" width="72" height="72">` : '<span class="mk-card-img mk-card-img--none" aria-hidden="true"></span>'}
+ // A deal without a picture takes the whole width: no empty square.
+ const card = (r) => `<li class="mk-card${r.image ? '' : ' mk-card--text'}">${r.image ? `<img class="mk-card-img" src="${esc(r.image)}" alt="" loading="lazy" width="72" height="72">` : ''}
<span class="mk-card-body"><a class="mk-card-title" href="${esc(r.url)}">${esc(r.title)}</a>
<span class="mk-card-body"><a class="mk-card-title" href="${esc(r.url)}">${esc(r.title)}</a>
<small>${esc(r.store || 'A store')} · ${esc(r.source)}${r.condition && r.condition !== 'new' ? ` · ${esc(r.condition)}` : ''}</small></span>
<small>${esc(r.store || 'A store')} · ${esc(r.source)}${r.condition && r.condition !== 'new' ? ` · ${esc(r.condition)}` : ''}</small></span>
<span class="mk-card-price">${r.price != null ? `<b>${esc(money(r.price, r.currency || 'USD'))}</b>${r.was != null && r.was > r.price ? `<s>${esc(money(r.was, r.currency || 'USD'))}</s>` : ''}<small>${esc(asOf(r.observed_at, now))}</small>
<span class="mk-card-price">${r.price != null ? `<b>${esc(money(r.price, r.currency || 'USD'))}</b>${r.was != null && r.was > r.price ? `<s>${esc(money(r.was, r.currency || 'USD'))}</s>` : ''}<small>${esc(asOf(r.observed_at, now))}</small>
@@ -51,6 +51,7 @@ const OFFERS = [
@@ -51,6 +51,7 @@ const OFFERS = [
assert.match(r.text, /Every marketplace, one search/);
assert.match(r.text, /Every marketplace, one search/);
assert.match(r.text, /<form class="mk-search" method="get" action="\/search"/);
assert.match(r.text, /<form class="mk-search" method="get" action="\/search"/);
assert.match(r.text, /Facebook Marketplace/);
assert.match(r.text, /Facebook Marketplace/);
+ assert.match(r.text, /data-ov-trending="own"/, 'a product search keeps its own examples, never the page\'s headings');
assert.match(r.headers.get('cache-control'), /public/);
assert.match(r.headers.get('cache-control'), /public/);
r = await get('/search?q=headphones');
r = await get('/search?q=headphones');
@@ -60,6 +61,8 @@ const OFFERS = [
@@ -60,6 +61,8 @@ const OFFERS = [
assert.match(r.text, /\$149\.99<\/b><s>\$199\.99<\/s><small>as of 3 hours ago<\/small>/, 'a price with its time and the price before');
assert.match(r.text, /\$149\.99<\/b><s>\$199\.99<\/s><small>as of 3 hours ago<\/small>/, 'a price with its time and the price before');
assert.match(r.text, /as of Nov 10, 2026/);
assert.match(r.text, /as of Nov 10, 2026/);
assert.match(r.text, /price not stated/);
assert.match(r.text, /price not stated/);
+ assert.match(r.text, /<li class="mk-card mk-card--text">/, 'a deal without a picture has no empty square');
+ assert.match(r.text, /<img class="mk-card-img" src="https:\/\/img\.example\/nc\.jpg"/);
assert.match(r.text, /Shop Example · OpenVibe Deals/);
assert.match(r.text, /Shop Example · OpenVibe Deals/);
assert.match(r.text, /Refurb Co · OpenVibe Deals · refurbished/);
assert.match(r.text, /Refurb Co · OpenVibe Deals · refurbished/);
assert.match(r.text, /href="https:\/\/openvibe\.finance\/ahead\?cost=149\.99">Can I afford it\?/);
assert.match(r.text, /href="https:\/\/openvibe\.finance\/ahead\?cost=149\.99">Can I afford it\?/);