Share button on the videos list

Sharing from here is the common case — you are looking at the thing you want to
send. Uses the native share sheet where there is one, otherwise copies, and the
link carries a filename so it ends in .mp4 for clients that read the URL rather
than the headers.
This commit is contained in:
gator 2026-09-09 01:08:23 +00:00
parent e0db55e0db
commit 9801f1a8d1

View file

@ -66,12 +66,25 @@ function card(p) {
if (p.video_url) { if (p.video_url) {
// A finished video was a dead end here: watch or download, and no way back // A finished video was a dead end here: watch or download, and no way back
// into the shots, the cutaways or the cut without knowing the URL. // into the shots, the cutaways or the cut without knowing the URL.
cta += '<a class="btn" style="display:inline-block;text-decoration:none;margin-top:10px;margin-left:8px" href="/script.html?id=' cta += '<button type="button" class="btn" style="margin-top:10px;margin-left:8px" '
+ 'data-share="' + encodeURIComponent(p.id) + '">Share</button>';
cta += '<a class="btn ghost" style="display:inline-block;text-decoration:none;margin-top:10px;margin-left:8px" href="/script.html?id='
+ encodeURIComponent(p.id) + '">Edit</a>'; + encodeURIComponent(p.id) + '">Edit</a>';
cta += '<a class="btn ghost" style="display:inline-block;text-decoration:none;margin-top:10px;margin-left:8px" href="' cta += '<a class="btn ghost" style="display:inline-block;text-decoration:none;margin-top:10px;margin-left:8px" href="'
+ esc(p.video_url) + '" download>Download</a>'; + esc(p.video_url) + '" download>Download</a>';
} }
// The file URL ends in /public with no filename. Headers are already right
// (video/mp4), but clients that sniff the URL string are not, and a filename
// query is accepted and ignored by the file service.
window.__shareUrl = window.__shareUrl || function (p) {
var u = p.cut_url || p.video_url || "";
if (!u) return "";
var slug = ((p.pet_name || "video") + " " + (p.title || "")).toLowerCase()
.replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "video";
return u + (u.indexOf("?") < 0 ? "?" : "&") + "v=" + slug + ".mp4";
};
return '<div class="item">' return '<div class="item">'
+ '<div>' + media + '</div>' + '<div>' + media + '</div>'
+ '<div>' + '<div>'