mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
20 lines
736 B
JavaScript
20 lines
736 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(start = "/view/") {
|
|
const fullpath = fromHref(location.pathname + location.hash);
|
|
return decodeURIComponent(fullpath.replace(new RegExp("^" + start), "/"));
|
|
}
|