openvibers/openvibe.markets Commits
Alerts through Deals' watches (#4)
Changes
@@@ -67,3 +67,6 @@ html[data-ov-motion="off"] .mk-photo.is-busy .mk-photo-said { animation: none; }.mk-error { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--danger, #b91c1c); color: var(--danger, #fca5a5); }.mk-from-photo { margin: 8px 0 0; color: var(--text-secondary, #9aa4b2); }.mk-from-photo b { color: var(--text, #e8ecf3); }++.mk-watch { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }++.mk-watch a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--accent, #5b8cff); }++.mk-watch small { color: var(--text-secondary, #9aa4b2); }@@@ -87,7 +87,8 @@ function results({ q, deals, links, now = Date.now(), fromPhoto = false }) {return page({title: `${q}: every marketplace`, path: `/search?q=${encodeURIComponent(q)}`, robots: 'noindex, follow', body: `<header class="mk-head">${searchForm(q)}${fromPhoto ? `<p class="mk-from-photo">From your photo: <b>${esc(q)}</b>. Not quite it? Change the words above.</p>` : ''}</header>--<section class="mk-sec" aria-labelledby="mk-deals-h"><h2 id="mk-deals-h">Deals</h2>${found}</section>++<section class="mk-sec" aria-labelledby="mk-deals-h"><h2 id="mk-deals-h">Deals</h2>${found}++<p class="mk-watch"><a href="https://openvibe.deals/watches?query=${encodeURIComponent(q)}">Alert me about new deals for “${esc(q)}”</a> <small>on OpenVibe Deals, when you are signed in</small></p></section><section class="mk-sec" aria-labelledby="mk-else-h"><h2 id="mk-else-h">Search it on</h2><ul class="mk-elsewhere">${links.map((l) => `<li><a href="${esc(l.url)}" target="_blank" rel="noopener noreferrer"><b>${esc(l.name)}</b><small>${esc(l.kind)}</small></a></li>`).join('')}</ul><p class="mk-note">These open each marketplace's own search with your words in it. Markets does not fetch from them or know what you do there; as a permitted feed comes for one, its listings join the results above.</p></section>` });@@@ -70,6 +70,7 @@ const OFFERS = [assert.doesNotMatch(r.text, /javascript:alert/, 'only https links');assert.match(r.text, /<a href="https:\/\/www\.ebay\.com\/sch\/i\.html\?_nkw=headphones" target="_blank" rel="noopener noreferrer">/);assert.strictEqual(asked.pop(), '/api/v1/search?q=headphones&limit=24');++ assert.match(r.text, /href="https:\/\/openvibe\.deals\/watches\?query=headphones">Alert me about new deals for “headphones”/, 'alerts are Deals\' watches');r = await get('/search?q=a%20sofa');assert.match(r.text, /No deal on OpenVibe Deals matches these words yet/);
@@ -67,3 +67,6 @@ html[data-ov-motion="off"] .mk-photo.is-busy .mk-photo-said { animation: none; }
@@ -67,3 +67,6 @@ html[data-ov-motion="off"] .mk-photo.is-busy .mk-photo-said { animation: none; }
.mk-error { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--danger, #b91c1c); color: var(--danger, #fca5a5); }
.mk-error { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--danger, #b91c1c); color: var(--danger, #fca5a5); }
.mk-from-photo { margin: 8px 0 0; color: var(--text-secondary, #9aa4b2); }
.mk-from-photo { margin: 8px 0 0; color: var(--text-secondary, #9aa4b2); }
.mk-from-photo b { color: var(--text, #e8ecf3); }
.mk-from-photo b { color: var(--text, #e8ecf3); }
+.mk-watch { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
+.mk-watch a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--accent, #5b8cff); }
+.mk-watch small { color: var(--text-secondary, #9aa4b2); }
@@ -87,7 +87,8 @@ function results({ q, deals, links, now = Date.now(), fromPhoto = false }) {
@@ -87,7 +87,8 @@ function results({ q, deals, links, now = Date.now(), fromPhoto = false }) {
return page({
return page({
title: `${q}: every marketplace`, path: `/search?q=${encodeURIComponent(q)}`, robots: 'noindex, follow', body: `
title: `${q}: every marketplace`, path: `/search?q=${encodeURIComponent(q)}`, robots: 'noindex, follow', body: `
<header class="mk-head">${searchForm(q)}${fromPhoto ? `<p class="mk-from-photo">From your photo: <b>${esc(q)}</b>. Not quite it? Change the words above.</p>` : ''}</header>
<header class="mk-head">${searchForm(q)}${fromPhoto ? `<p class="mk-from-photo">From your photo: <b>${esc(q)}</b>. Not quite it? Change the words above.</p>` : ''}</header>
-<section class="mk-sec" aria-labelledby="mk-deals-h"><h2 id="mk-deals-h">Deals</h2>${found}</section>
+<section class="mk-sec" aria-labelledby="mk-deals-h"><h2 id="mk-deals-h">Deals</h2>${found}
+<p class="mk-watch"><a href="https://openvibe.deals/watches?query=${encodeURIComponent(q)}">Alert me about new deals for “${esc(q)}”</a> <small>on OpenVibe Deals, when you are signed in</small></p></section>
<section class="mk-sec" aria-labelledby="mk-else-h"><h2 id="mk-else-h">Search it on</h2>
<section class="mk-sec" aria-labelledby="mk-else-h"><h2 id="mk-else-h">Search it on</h2>
<ul class="mk-elsewhere">${links.map((l) => `<li><a href="${esc(l.url)}" target="_blank" rel="noopener noreferrer"><b>${esc(l.name)}</b><small>${esc(l.kind)}</small></a></li>`).join('')}</ul>
<ul class="mk-elsewhere">${links.map((l) => `<li><a href="${esc(l.url)}" target="_blank" rel="noopener noreferrer"><b>${esc(l.name)}</b><small>${esc(l.kind)}</small></a></li>`).join('')}</ul>
<p class="mk-note">These open each marketplace's own search with your words in it. Markets does not fetch from them or know what you do there; as a permitted feed comes for one, its listings join the results above.</p></section>` });
<p class="mk-note">These open each marketplace's own search with your words in it. Markets does not fetch from them or know what you do there; as a permitted feed comes for one, its listings join the results above.</p></section>` });
@@ -70,6 +70,7 @@ const OFFERS = [
@@ -70,6 +70,7 @@ const OFFERS = [
assert.doesNotMatch(r.text, /javascript:alert/, 'only https links');
assert.doesNotMatch(r.text, /javascript:alert/, 'only https links');
assert.match(r.text, /<a href="https:\/\/www\.ebay\.com\/sch\/i\.html\?_nkw=headphones" target="_blank" rel="noopener noreferrer">/);
assert.match(r.text, /<a href="https:\/\/www\.ebay\.com\/sch\/i\.html\?_nkw=headphones" target="_blank" rel="noopener noreferrer">/);
assert.strictEqual(asked.pop(), '/api/v1/search?q=headphones&limit=24');
assert.strictEqual(asked.pop(), '/api/v1/search?q=headphones&limit=24');
+ assert.match(r.text, /href="https:\/\/openvibe\.deals\/watches\?query=headphones">Alert me about new deals for “headphones”/, 'alerts are Deals\' watches');
r = await get('/search?q=a%20sofa');
r = await get('/search?q=a%20sofa');
assert.match(r.text, /No deal on OpenVibe Deals matches these words yet/);
assert.match(r.text, /No deal on OpenVibe Deals matches these words yet/);