5.3.2: link sharing and nanoid

- you can now share video links directly from cobalt!
- cobalt is now using nanoid for stream ids instead of giant sha256 hashes
- one more fix to address the copy animation, this time on pc
This commit is contained in:
wukko
2023-04-08 22:55:44 +06:00
parent 307da3dce4
commit 68703ae300
8 changed files with 38 additions and 18 deletions

View File

@@ -91,6 +91,9 @@ function copy(id, data) {
setTimeout(() => { e.classList.remove("text-backdrop") }, 600);
data ? navigator.clipboard.writeText(data) : navigator.clipboard.writeText(e.innerText);
}
async function share(url) {
try { await navigator.share({url: url}) } catch (e) {}
}
function detectColorScheme() {
let theme = "auto";
let localTheme = sGet("theme");
@@ -174,6 +177,8 @@ function popup(type, action, text) {
case "download":
eid("pd-download").href = text;
eid("pd-copy").setAttribute("onClick", `copy('pd-copy', '${text}')`);
eid("pd-share").setAttribute("onClick", `share('${text}')`);
if (navigator.canShare) eid("pd-share").style.display = "flex";
break;
case "picker":
switch (text.type) {