Skip to content

Commit 5f55b2b

Browse files
committed
fonts
1 parent 9b4b9fb commit 5f55b2b

File tree

13 files changed

+1617
-1553
lines changed

13 files changed

+1617
-1553
lines changed

bot.html

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -856,42 +856,42 @@
856856
log(err);
857857
});
858858
}
859-
function getTranslation(key, value = false) {
860-
if (translation && translation.innerHTML && (key in translation.innerHTML)) {
861-
// these are the proper translations
862-
return translation.innerHTML[key];
863-
} else if (translation && translation.miscellaneous && translation.miscellaneous && (key in translation.miscellaneous)) {
864-
return translation.miscellaneous[key];
865-
} else if (value !== false) {
866-
return value;
867-
} else {
868-
return key.replaceAll("-", " "); //
869-
}
870-
}
871-
function resolveSourceImageUrl(src) {
872-
if (!src) {
873-
return "";
874-
}
875-
var str = (src + "").trim();
876-
if (!str) {
877-
return "";
878-
}
879-
if (/^[a-z][a-z0-9+.-]*:/i.test(str) || str.startsWith("//")) {
880-
return str;
881-
}
882-
var cleaned = str.replace(/^\.\/+/, "").replace(/^\/+/, "");
883-
var lowerCleaned = cleaned.toLowerCase();
884-
var prefix = "sources/images/";
885-
if (!lowerCleaned.startsWith(prefix)) {
886-
cleaned = prefix + cleaned;
887-
}
888-
return "./" + cleaned;
889-
}
890-
891-
var newFileHandle = false;
892-
893-
async function overwriteFile(data = false) {
894-
if (data == "setup") {
859+
function getTranslation(key, value = false) {
860+
if (translation && translation.innerHTML && (key in translation.innerHTML)) {
861+
// these are the proper translations
862+
return translation.innerHTML[key];
863+
} else if (translation && translation.miscellaneous && translation.miscellaneous && (key in translation.miscellaneous)) {
864+
return translation.miscellaneous[key];
865+
} else if (value !== false) {
866+
return value;
867+
} else {
868+
return key.replaceAll("-", " "); //
869+
}
870+
}
871+
function resolveSourceImageUrl(src) {
872+
if (!src) {
873+
return "";
874+
}
875+
var str = (src + "").trim();
876+
if (!str) {
877+
return "";
878+
}
879+
if (/^[a-z][a-z0-9+.-]*:/i.test(str) || str.startsWith("//")) {
880+
return str;
881+
}
882+
var cleaned = str.replace(/^\.\/+/, "").replace(/^\/+/, "");
883+
var lowerCleaned = cleaned.toLowerCase();
884+
var prefix = "sources/images/";
885+
if (!lowerCleaned.startsWith(prefix)) {
886+
cleaned = prefix + cleaned;
887+
}
888+
return "./" + cleaned;
889+
}
890+
891+
var newFileHandle = false;
892+
893+
async function overwriteFile(data = false) {
894+
if (data == "setup") {
895895
const opts = {
896896
types: [
897897
{
@@ -1407,10 +1407,15 @@
14071407
}
14081408

14091409
if (urlParams.get('font')) {
1410-
const raw = urlParams.get('font').trim();
1411-
const clean = raw.replace(/^['"]|['"]$/g, '');
1412-
const escaped = clean.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
1413-
document.documentElement.style.setProperty('--font-family', `"${escaped}", Sora, Roboto, Helvetica, Geneva, Verdana, Arial, sans-serif`);
1410+
const fontParam = urlParams.get('font').trim();
1411+
const fonts = fontParam.split(',').map(f => {
1412+
const clean = f.trim().replace(/^['"]|['"]$/g, '');
1413+
const escaped = clean.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
1414+
return escaped ? `"${escaped}"` : '';
1415+
}).filter(Boolean);
1416+
if (fonts.length) {
1417+
document.documentElement.style.setProperty('--font-family', `${fonts.join(', ')}, Sora, Roboto, Helvetica, Geneva, Verdana, Arial, sans-serif`);
1418+
}
14141419
}
14151420

14161421
if (urlParams.get("googlefont")) {
@@ -2114,22 +2119,22 @@
21142119
showType = data.type;
21152120
}
21162121

2117-
var customSourceClass = "sourceOffset";
2118-
if (showType && showsource && avatar) {
2119-
showType = '<img src="./sources/images/' + showType + '.png" class="icon sourcetype" data-icon-name="' + showType + '" onerror="this.style.display=\'none\'" />';
2120-
} else if (showType && showsource && !avatar) {
2121-
showType = '<img src="./sources/images/' + showType + '.png" class="icon sourcetype noavatar-source" data-icon-name="' + showType + '" onerror="this.style.display=\'none\'" />';
2122-
} else {
2123-
customSourceClass = "";
2124-
showType = "";
2125-
}
2126-
2127-
var resolvedSourceImg = data.sourceImg ? resolveSourceImageUrl(data.sourceImg) : "";
2128-
if (resolvedSourceImg && customSource && avatar) {
2129-
showType += '<img src="' + resolvedSourceImg + '" class="icon sourcetype ' + customSourceClass + '" onerror="this.style.display=\'none\'" />';
2130-
} else if (resolvedSourceImg && customSource && !avatar) {
2131-
showType += '<img src="' + resolvedSourceImg + '" class="icon sourcetype ' + customSourceClass + ' noavatar-source" onerror="this.style.display=\'none\'" />';
2132-
}
2122+
var customSourceClass = "sourceOffset";
2123+
if (showType && showsource && avatar) {
2124+
showType = '<img src="./sources/images/' + showType + '.png" class="icon sourcetype" data-icon-name="' + showType + '" onerror="this.style.display=\'none\'" />';
2125+
} else if (showType && showsource && !avatar) {
2126+
showType = '<img src="./sources/images/' + showType + '.png" class="icon sourcetype noavatar-source" data-icon-name="' + showType + '" onerror="this.style.display=\'none\'" />';
2127+
} else {
2128+
customSourceClass = "";
2129+
showType = "";
2130+
}
2131+
2132+
var resolvedSourceImg = data.sourceImg ? resolveSourceImageUrl(data.sourceImg) : "";
2133+
if (resolvedSourceImg && customSource && avatar) {
2134+
showType += '<img src="' + resolvedSourceImg + '" class="icon sourcetype ' + customSourceClass + '" onerror="this.style.display=\'none\'" />';
2135+
} else if (resolvedSourceImg && customSource && !avatar) {
2136+
showType += '<img src="' + resolvedSourceImg + '" class="icon sourcetype ' + customSourceClass + ' noavatar-source" onerror="this.style.display=\'none\'" />';
2137+
}
21332138

21342139
if (hideNames) {
21352140
data.chatname = "";

0 commit comments

Comments
 (0)