Skip to content

Commit 5b8c4bc

Browse files
Update index.js
1 parent bd2efa9 commit 5b8c4bc

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

js/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4673,13 +4673,18 @@ function updateTitle() {
46734673
if (isMobileDevice()) return;
46744674

46754675
let titlePrefix = '';
4676+
4677+
const truncate = (str) => {
4678+
if (!str) return str;
4679+
return str.length > 14 ? str.slice(0, 11) + '...' : str;
4680+
};
46764681

46774682
// 1. Check Live Activities
46784683
const liveActivityTexts = [];
46794684
if (typeof activeIslands !== 'undefined' && activeIslands.length > 0) {
46804685
activeIslands.forEach(i => {
46814686
if (i.type === 'live-activity' && i.data && i.data.text) {
4682-
liveActivityTexts.push(i.data.text.slice(0, 14));
4687+
liveActivityTexts.push(truncate(i.data.text));
46834688
}
46844689
});
46854690
}
@@ -4693,7 +4698,7 @@ function updateTitle() {
46934698
if (session && session.metadata) {
46944699
const { title, artist } = session.metadata;
46954700
if (title && title !== 'Unknown Title') {
4696-
titlePrefix = `${title.slice(0, 14)} | `;
4701+
titlePrefix = `${truncate(title)} | `;
46974702
}
46984703
}
46994704
}
@@ -4704,7 +4709,7 @@ function updateTitle() {
47044709
const url = openEmbed.dataset.embedUrl;
47054710
const appName = Object.keys(apps).find(name => apps[name].url === url);
47064711
if (appName) {
4707-
titlePrefix = `${appName.slice(0, 14)} | `;
4712+
titlePrefix = `${truncate(appName)} | `;
47084713
}
47094714
}
47104715
}

0 commit comments

Comments
 (0)