diff --git a/viz/app/search_page.js b/viz/app/search_page.js
index c6ef290..82f6845 100644
--- a/viz/app/search_page.js
+++ b/viz/app/search_page.js
@@ -1,9 +1,18 @@
import { esc, renderThumbHtml, prettyTs } from "./dom.js";
-import { tokenizeQuery, matchesAllTokens, displaySku, keySkuForRow, parsePriceToNumber } from "./sku.js";
+import {
+ tokenizeQuery,
+ matchesAllTokens,
+ displaySku,
+ keySkuForRow,
+ parsePriceToNumber,
+} from "./sku.js";
import { loadIndex, loadRecent, loadSavedQuery, saveQuery } from "./state.js";
import { aggregateBySku } from "./catalog.js";
import { loadSkuRules } from "./mapping.js";
-import { smwsDistilleryCodesForQueryPrefix, smwsDistilleryCodeFromName } from "./smws.js";
+import {
+ smwsDistilleryCodesForQueryPrefix,
+ smwsDistilleryCodeFromName,
+} from "./smws.js";
export function renderSearch($app) {
$app.innerHTML = `
@@ -32,16 +41,19 @@ export function renderSearch($app) {
`;
-
const $q = document.getElementById("q");
const $results = document.getElementById("results");
const $stores = document.getElementById("stores");
+ const $clearSearch = document.getElementById("clearSearch");
$q.value = loadSavedQuery();
@@ -114,15 +126,16 @@ export function renderSearch($app) {
$stores.innerHTML = stores
.map((s, i) => {
- const btn = `${esc(s)}`;
- const brk = i === breakAt - 1 && stores.length > 1
- ? ``
- : "";
+ const btn = `${esc(s)}`;
+ const brk =
+ i === breakAt - 1 && stores.length > 1
+ ? ``
+ : "";
return btn + brk;
})
.join("");
-
-
}
function renderAggregates(items) {
@@ -137,19 +150,21 @@ export function renderSearch($app) {
const storeCount = it.stores.size || 0;
const plus = storeCount > 1 ? ` +${storeCount - 1}` : "";
const price = it.cheapestPriceStr ? it.cheapestPriceStr : "(no price)";
- const store = it.cheapestStoreLabel || ([...it.stores][0] || "Store");
+ const store = it.cheapestStoreLabel || [...it.stores][0] || "Store";
// link must match the displayed store label
const href = urlForAgg(it, store) || String(it.sampleUrl || "").trim();
const storeBadge = href
? `${esc(store)}${esc(
- plus
- )}`
+ )}" target="_blank" rel="noopener noreferrer" onclick="event.stopPropagation()">${esc(
+ store
+ )}${esc(plus)}`
: `${esc(store)}${esc(plus)}`;
- const skuLink = `#/link/?left=${encodeURIComponent(String(it.sku || ""))}`;
+ const skuLink = `#/link/?left=${encodeURIComponent(
+ String(it.sku || "")
+ )}`;
return `
@@ -162,7 +177,9 @@ export function renderSearch($app) {
${esc(it.name || "(no name)")}
${esc(displaySku(it.sku))}
+ )}" target="_blank" rel="noopener noreferrer" onclick="event.stopPropagation()">${esc(
+ displaySku(it.sku)
+ )}