mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
highlight the selected when you go to folder
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user