1
Fork 0

Compare commits

...

4 commits

Author SHA1 Message Date
ashley
ee73dd6770 add vjs to here :3 2024-08-05 05:10:54 +00:00
ashley
8da7fd6030 fix stuff :3 2024-08-04 20:34:11 +00:00
ashley
653de060c5 sorry 2024-08-04 20:25:28 +00:00
ashley
f204c94415 upsell test 2024-08-04 20:23:19 +00:00
2 changed files with 42 additions and 2 deletions

View file

@ -613,6 +613,29 @@ if (isMathExpression(query)) {
const options = { weekday: 'long' };
answer = now.toLocaleDateString(undefined, options);
}
const upsellMessages = [
"[new] Try searching 'What's 4+4?'",
"[new] Ask 'What's the date today?'",
"[new] Try 'What time is it in New York?'",
"[new] Ask 'What's the current year?'",
"[new] Try searching 'What's 7*8?'"
];
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) { %>
<div class="container">
@ -623,8 +646,25 @@ if (isMathExpression(query)) {
<%= answer %>
</span>
</div>
<% } else if (showUpsell) { %>
<style>
.advertisements-upsell-instant-awnsers {
font-size: 22px;
margin-bottom: 3em;
text-decoration: none;
color: #fff;
margin-left: 11.4em;
font-family: "poketube flex";
font-weight: 1000;
font-stretch: extra-expanded;
}
</style>
<a href="/search?query=<%= encodeURIComponent(extractQueryFromUpsellMessage(randomUpsellMessage)) %>" class="advertisements-upsell-instant-awnsers">
<%= randomUpsellMessage %>
</a>
<% } %>
<!-- self harm -->
<%
const searchStrings = [
"suicide", "self harm", "self-harm", "support", "murder", "how to murder", "kill myself",

View file

@ -231,7 +231,7 @@ app.get("/game-hub", function (req, res) {
res.redirect("/css/" + id);
} else if (id.endsWith(".js")) {
if (id.endsWith(".bundle.js")) {
const jsFiles = ["app.js", "custom-css.js", "emojis.js"];
const jsFiles = ["app.js", "custom-css.js", "emojis.js", "vjs.min.js"];
const combinedContent = jsFiles
.map((fileName) => {
const filePath = path.join(html_location, fileName);
@ -247,7 +247,7 @@ app.get("/game-hub", function (req, res) {
res.send(
"// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later" +
`\n` +
`// Includes app.js, emojis.js, and custom-css.js. Source code can be found for these 3 files in https://codeberg.org/Ashley/poketube/src/branch/main/css/` +
`// Includes app.js, emojis.js, vjs.js, and custom-css.js. Source code can be found for these 3 files in https://codeberg.org/Ashley/poketube/src/branch/main/css/` +
`\n` +
minimizedJs +
`\n` +