filestash/public/assets/pages/viewerpage/common.js
MickaelK 71b14e6eaf feature (3d): embed 3d viewer anywhere
This contains a bunch of things packaged in 1:

1) UI improvements for the 3D viewer to support all sort of file types
   and create a nice rendering in a clean way with all sort of options

2) enable people to use Filestash as an SDK so we can embed the 3d viewer
   elsewhere
2024-12-23 18:50:23 +11:00

20 lines
716 B
JavaScript

import { fromHref } from "../../lib/skeleton/router.js";
import { transition as transitionLib, slideYIn } from "../../lib/animate.js";
import { basename, forwardURLParams } from "../../lib/path.js";
export function transition($node) {
return transitionLib($node, { timeEnter: 150, enter: slideYIn(2) });
}
export function getFilename() {
return basename(getCurrentPath()) || " ";
}
export function getDownloadUrl() {
return forwardURLParams("api/files/cat?path=" + encodeURIComponent(getCurrentPath()), ["share"]);
}
export function getCurrentPath() {
const fullpath = fromHref(location.pathname + location.hash);
return decodeURIComponent(fullpath.replace(new RegExp("^/view"), ""));
}