highlight the selected when you go to folder

This commit is contained in:
geoffrey45
2022-07-09 09:52:46 +03:00
parent 09c588c856
commit 4688665156
9 changed files with 135 additions and 45 deletions
+15 -3
View File
@@ -1,3 +1,5 @@
import { RouteLocationNormalized } from "vue-router";
const putCommas = (artists: string[]) => {
let result = [];
@@ -12,14 +14,14 @@ const putCommas = (artists: string[]) => {
return result;
};
function focusElem(className: string, delay?: number) {
function focusElem(className: string, delay?: number, pos?: any) {
const dom = document.getElementsByClassName(className)[0];
setTimeout(() => {
if (dom) {
dom.scrollIntoView({
behavior: "smooth",
block: "start",
block: `${pos ?? "start"}` as any,
inline: "center",
});
}
@@ -37,6 +39,16 @@ function getElem(id: string, type: string) {
}
}
type r = RouteLocationNormalized;
function isSameRoute(to: r, from: r) {
if (to.params.path == from.params.path) {
return true;
}
return false;
}
/**
* Converts seconds into minutes and hours.
* @param seconds The seconds to convert
@@ -80,4 +92,4 @@ function formatSeconds(seconds: number, long?: boolean) {
}
}
export { putCommas, focusElem, formatSeconds, getElem };
export { putCommas, focusElem, formatSeconds, getElem, isSameRoute };