From 6145259db82f5245692a8905aa6932957254909c Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Fri, 12 Jan 2024 23:43:26 +0000 Subject: [PATCH 01/16] page: remove useless trailing slash on meta elements --- src/modules/pageRender/page.js | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index c3722f0d..f198fbb8 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -44,35 +44,38 @@ export default function(obj) { - + ${t("AppTitleCobalt")} - - - - - - - - + + + + + + + + - - - + + + - + + + + + - - - - + ${multiPagePopup({ name: "about", closeAria: t('AccessibilityGoBack'), From b5952f1ef93bb9c67b323cad3712214f0527590c Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Fri, 12 Jan 2024 23:44:30 +0000 Subject: [PATCH 02/16] page: fix invalid style preload --- src/modules/pageRender/page.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index f198fbb8..877c3f18 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -68,7 +68,8 @@ export default function(obj) { - + + From e5045df9afd9a0f3fc05876c9e76ff6c5e73f1f2 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Fri, 12 Jan 2024 23:51:15 +0000 Subject: [PATCH 03/16] emoji: add space after style attribute if added --- src/modules/emoji.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/emoji.js b/src/modules/emoji.js index f2bab1b9..f4793cb5 100644 --- a/src/modules/emoji.js +++ b/src/modules/emoji.js @@ -62,5 +62,5 @@ export default function(emoji, size, disablePadding, fluent) { let filePath = `emoji/${names[emoji]}.svg`; if (fluent) filePath = `emoji/3d/${names[emoji]}.svg`; - return `` + return `` } From b0996b85fbd21a60eef4aa383b22718e261036bc Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 13 Jan 2024 00:01:31 +0000 Subject: [PATCH 04/16] page, stream: drop leftover selfURL usage --- src/modules/pageRender/page.js | 4 ++-- src/modules/stream/manage.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index 877c3f18..9e3d509c 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -48,10 +48,10 @@ export default function(obj) { ${t("AppTitleCobalt")} - + - + diff --git a/src/modules/stream/manage.js b/src/modules/stream/manage.js index 1faaa38c..459e5a6b 100644 --- a/src/modules/stream/manage.js +++ b/src/modules/stream/manage.js @@ -43,7 +43,7 @@ export function createStream(obj) { exp = streamInfo.exp; ghmac = streamInfo.hmac; } - return `${process.env.apiURL || process.env.selfURL}api/stream?t=${streamID}&e=${exp}&h=${ghmac}`; + return `${process.env.apiURL}api/stream?t=${streamID}&e=${exp}&h=${ghmac}`; } export function verifyStream(id, hmac, exp) { From 6f5bb80b3a50b7c5df65a647d2988c9c9a7cc0da Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 13 Jan 2024 00:20:36 +0000 Subject: [PATCH 05/16] page: remove invalid attributes, closing tags, useless trailing slashes --- src/front/cobalt.js | 5 +++++ src/modules/pageRender/page.js | 27 ++++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/front/cobalt.js b/src/front/cobalt.js index 31196215..509e54cb 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -614,6 +614,11 @@ window.onload = () => { window.history.replaceState(null, '', window.location.pathname); notificationCheck(); + + // fix for animations not working in Safari + if (isIOS) { + document.addEventListener('touchstart', () => {}, true); + } } eid("url-input-area").addEventListener("keydown", (e) => { button(); diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index 9e3d509c..7d754717 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -43,7 +43,7 @@ export default function(obj) { - + ${t("AppTitleCobalt")} @@ -73,7 +73,7 @@ export default function(obj) { - + @@ -149,10 +149,10 @@ export default function(obj) { body: `${t("SupportSelfTroubleshooting")}` + `${socialLink(emoji("📢"), t("StatusPage"), links.statusPage)}` + `${socialLink(emoji("🔧"), t("TroubleshootingGuide"), links.troubleshootingGuide)}` - + `
` + + `
` + `${t("FollowSupport")}` + `${socialLinks(obj.lang)}` - + `
` + + `
` + `${t("SourceCode")}` + `${socialLink(emoji("🐙"), repo.replace("https://github.com/", ''), repo)}` }, { @@ -196,7 +196,7 @@ export default function(obj) { `width="${changelogManager("banner")["width"]}" ` + `height="${changelogManager("banner")["height"]}" ` + `onerror="this.style.opacity=0" loading="lazy">`+ - ` + ` `: '', raw: true }, { @@ -246,13 +246,14 @@ export default function(obj) { text: `
${t('DonateSub')}
`, raw: true }, { - text: `
+ text: ` +
`+ - ` + `onerror="this.style.opacity=0" loading="lazy">
`, raw: true }, { @@ -572,9 +573,9 @@ export default function(obj) {
- + - +
@@ -612,7 +613,7 @@ export default function(obj) { }])}
- - + ` From c04c37a5486f1472b8ece47860cdea268d02d8cc Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 13 Jan 2024 00:25:18 +0000 Subject: [PATCH 06/16] page: deduplicate tiktok settings element id --- src/modules/pageRender/page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index 7d754717..7b1fb262 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -324,7 +324,7 @@ export default function(obj) { }) }) + settingsCategory({ - name: "tiktok", + name: "tiktok-watermark", title: "tiktok", body: checkbox([{ action: "disableTikTokWatermark", @@ -400,7 +400,7 @@ export default function(obj) { }) }) + settingsCategory({ - name: "tiktok", + name: "tiktok-audio", title: "tiktok", body: checkbox([{ action: "fullTikTokAudio", From 4680582ce9aadadbb544fa19c770cfdb07ea4801 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 13 Jan 2024 00:35:07 +0000 Subject: [PATCH 07/16] frontend: use `class` instead of `id` for reoccurring elements --- src/front/cobalt.css | 64 +++++++++++++++--------------- src/modules/pageRender/elements.js | 46 ++++++++++----------- src/modules/pageRender/onDemand.js | 8 ++-- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/front/cobalt.css b/src/front/cobalt.css index ebc77223..a9aeca1e 100644 --- a/src/front/cobalt.css +++ b/src/front/cobalt.css @@ -107,7 +107,7 @@ a { color: var(--accent-subtext); } .switches::-webkit-scrollbar, -#popup-content::-webkit-scrollbar { +.popup-content::-webkit-scrollbar { display: none; } :focus-visible { @@ -450,22 +450,22 @@ button:active, .popup.small.visible { transform: translate(-50%, -50%); } -.popup.small #popup-header-contents, +.popup.small .popup-header-contents, .popup.small .popup-content-inner, -.popup.small #popup-header { +.popup.small .popup-header { padding: 0; } -.popup.small #popup-header { +.popup.small .popup-header { position: relative; border: none; } -.popup.small #popup-title { +.popup.small .popup-title { margin-bottom: 0.6rem; } .popup.small .explanation { margin-bottom: 0.9rem; } -#close-error { +.close-error { background: var(--accent); color: var(--background); } @@ -520,7 +520,7 @@ button:active, font-size: 1.1rem; padding-bottom: var(--padding-1); } -#popup-desc, +.popup-desc, .desc-error, #popup-info-desc { width: 100%; @@ -533,7 +533,7 @@ button:active, .desc-error { padding-bottom: 1.5rem; } -#popup-title { +.popup-title { font-size: 1.5rem; line-height: 1.2em; display: flex; @@ -541,11 +541,11 @@ button:active, margin-bottom: 0.4rem; margin-top: 0.4rem; } -#popup-above-title { +.popup-above-title { color: var(--accent-subtext); font-size: 0.8rem; } -#popup-content { +.popup-content { overflow-x: scroll; overflow-y: auto; height: 100%; @@ -564,7 +564,7 @@ button:active, .bullpadding { padding-left: 0.58rem; } -#popup-header { +.popup-header { position: absolute; z-index: 999; padding-top: calc(env(safe-area-inset-top)/2 + 1.7rem); @@ -646,16 +646,16 @@ button:active, .switch:focus { box-shadow: var(--inset-focus) inset; } -#popup-tabs .switch { +.popup-tabs .switch { background: none; } -.desktop #popup-tabs .switch:hover, -#popup-tabs .switch:active { +.desktop .popup-tabs .switch:hover, +.popup-tabs .switch:active { background: var(--accent-hover-transparent); box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; } .switch[data-enabled="true"], -#popup-tabs .switch[data-enabled="true"] { +.popup-tabs .switch[data-enabled="true"] { color: var(--background); background: var(--accent)!important; cursor: default; @@ -693,20 +693,20 @@ button:active, padding: var(--gap-no-icon); overflow: clip; } -#back-button { +.back-button { padding: 0; background: none; max-width: 4rem; font-size: 1rem; } -#back-button svg path, +.back-button svg path, .collapse-indicator svg path { fill: var(--accent); } .popup-tab-content[data-enabled="false"] { display: none; } -#popup-tabs { +.popup-tabs { z-index: 999; bottom: 0; position: absolute; @@ -823,7 +823,7 @@ button:active, } .popup-content-inner, .tab-content-settings, -#popup-header-contents { +.popup-header-contents { padding-left: 1rem; padding-right: 1rem; } @@ -947,15 +947,15 @@ button:active, #bottom #paste, #footer .switch, #audioMode, -#popup-content .switches, +.popup-content .switches, .checkbox, .changelog-img, .changelog-banner, -#close-error, +.close-error, .changelog-tag-version, #download-switcher .switch, #popup-about .switch, -#popup-tabs .switch, +.popup-tabs .switch, .text-to-copy, .text-to-copy.text-backdrop, #filename-preview { @@ -965,16 +965,16 @@ button:active, border-radius: 3px / 4px; } .popup, -.scrollable #popup-content { +.scrollable .popup-content { border-radius: 8px; } -#popup-header .glass-bkg { +.popup-header .glass-bkg { border-top-left-radius: 8px 9px; border-top-right-radius: 8px 9px; border-bottom: var(--accent-highlight) solid 0.1rem; top: -1px; } -#popup-tabs .glass-bkg { +.popup-tabs .glass-bkg { border-bottom-left-radius: 8px 9px; border-bottom-right-radius: 8px 9px; border-top: var(--accent-highlight) solid 0.1rem; @@ -1103,12 +1103,12 @@ button:active, padding-top: calc(env(safe-area-inset-bottom)/2 + 1rem); } .popup, - #popup-header .glass-bkg, - #popup-tabs .glass-bkg, + .popup-header .glass-bkg, + .popup-tabs .glass-bkg, .glass-bkg.small { border-radius: 0; } - #popup-tabs .glass-bkg { + .popup-tabs .glass-bkg { bottom: 0; } .switches { @@ -1141,13 +1141,13 @@ button:active, transform: none; transition: transform 210ms cubic-bezier(0.062, 0.82, 0.165, 1), opacity 130ms ease-in-out; } - .popup.small #popup-header { + .popup.small .popup-header { background: none; } .no-animation .popup.small { transition: none; } - #close-error { + .close-error { bottom: 3rem; } #picker-holder::-webkit-scrollbar { @@ -1166,13 +1166,13 @@ button:active, max-height: 100%; box-shadow: none; } - #popup-tabs { + .popup-tabs { padding-bottom: calc(env(safe-area-inset-bottom)/2 + 1.5rem); } .popup-content-inner, .tab-content-settings, .popup-tabs-child, - #popup-header-contents { + .popup-header-contents { padding-left: 0.7rem; padding-right: 0.7rem; } diff --git a/src/modules/pageRender/elements.js b/src/modules/pageRender/elements.js index 308f9748..a677d2bc 100644 --- a/src/modules/pageRender/elements.js +++ b/src/modules/pageRender/elements.js @@ -59,27 +59,27 @@ export function popup(obj) { body = `` for (let i = 0; i < obj.body.length; i++) { if (obj.body[i]["text"].length > 0) { - classes = obj.body[i]["classes"] ? obj.body[i]["classes"] : [] + classes = obj.body[i]["classes"] ?? [] if (i !== obj.body.length - 1 && !obj.body[i]["nopadding"]) { classes.push("desc-padding") } - body += obj.body[i]["raw"] ? obj.body[i]["text"] : `` + body += obj.body[i]["raw"] ? obj.body[i]["text"] : `
${obj.body[i]["text"]}
` } } } return ` ${obj.standalone ? `