Compare commits
4 commits
d1d83c2dea
...
ee73dd6770
Author | SHA1 | Date | |
---|---|---|---|
|
ee73dd6770 | ||
|
8da7fd6030 | ||
|
653de060c5 | ||
|
f204c94415 |
2 changed files with 42 additions and 2 deletions
|
@ -613,6 +613,29 @@ if (isMathExpression(query)) {
|
||||||
const options = { weekday: 'long' };
|
const options = { weekday: 'long' };
|
||||||
answer = now.toLocaleDateString(undefined, options);
|
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) { %>
|
<% if (answer) { %>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -623,8 +646,25 @@ if (isMathExpression(query)) {
|
||||||
<%= answer %>
|
<%= answer %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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 = [
|
const searchStrings = [
|
||||||
"suicide", "self harm", "self-harm", "support", "murder", "how to murder", "kill myself",
|
"suicide", "self harm", "self-harm", "support", "murder", "how to murder", "kill myself",
|
||||||
|
|
|
@ -231,7 +231,7 @@ app.get("/game-hub", function (req, res) {
|
||||||
res.redirect("/css/" + id);
|
res.redirect("/css/" + id);
|
||||||
} else if (id.endsWith(".js")) {
|
} else if (id.endsWith(".js")) {
|
||||||
if (id.endsWith(".bundle.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
|
const combinedContent = jsFiles
|
||||||
.map((fileName) => {
|
.map((fileName) => {
|
||||||
const filePath = path.join(html_location, fileName);
|
const filePath = path.join(html_location, fileName);
|
||||||
|
@ -247,7 +247,7 @@ app.get("/game-hub", function (req, res) {
|
||||||
res.send(
|
res.send(
|
||||||
"// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later" +
|
"// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later" +
|
||||||
`\n` +
|
`\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` +
|
`\n` +
|
||||||
minimizedJs +
|
minimizedJs +
|
||||||
`\n` +
|
`\n` +
|
||||||
|
|
Loading…
Reference in a new issue