From 8da7fd6030b3d747f3e6a3b71acf74e22e5873c3 Mon Sep 17 00:00:00 2001 From: ashley Date: Sun, 4 Aug 2024 20:34:11 +0000 Subject: [PATCH] fix stuff :3 --- html/search.ejs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/html/search.ejs b/html/search.ejs index 00e59cb..faf5299 100644 --- a/html/search.ejs +++ b/html/search.ejs @@ -624,6 +624,17 @@ const upsellMessages = [ const showUpsell = !answer && Math.random() < 0.2; const randomUpsellMessage = showUpsell ? upsellMessages[Math.floor(Math.random() * upsellMessages.length)] : ''; + + +function extractQueryFromUpsellMessage(message) { + return message.replace("[new] Try searching '", "") + .replace("[new] Try '", "") + .replace("[new] Ask '", "") + .replace("[new] Try ", "") + .replace("'", "") + .replace("?", "") + .trim(); +} %> %> <% if (answer) { %> @@ -636,10 +647,24 @@ const randomUpsellMessage = showUpsell ? upsellMessages[Math.floor(Math.random() <% } else if (showUpsell) { %> - - <%= randomUpsellMessage %> + + + <%= randomUpsellMessage %> <% } %> + + <% const searchStrings = [ "suicide", "self harm", "self-harm", "support", "murder", "how to murder", "kill myself",