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

@ -147,8 +147,10 @@ button:active,
background: var(--accent-press);
cursor: pointer;
}
.switch.text-backdrop,
.switch.text-backdrop:hover,
.switch.text-backdrop:active,
.text-to-copy.text-backdrop,
.text-to-copy.text-backdrop:hover,
.text-to-copy.text-backdrop:active {
background: var(--accent);
@ -648,7 +650,13 @@ input[type="checkbox"] {
-webkit-user-select: text;
}
.expanded .collapse-body {
display: block
display: block;
}
#download-switcher .switches {
gap: var(--gap);
}
#pd-share {
display: none;
}
/* adapt the page according to screen size */
@media screen and (min-width: 2300px) {

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) {