From e9b2507ec5b1168588a34c7d9ee840d0cefed4d1 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 16 Oct 2021 18:16:04 -0700 Subject: [PATCH] + Category field on VideoMeta objects This is basically just used to build url's for video links --- ts/category.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ts/category.ts b/ts/category.ts index 2dfc975..146ab72 100644 --- a/ts/category.ts +++ b/ts/category.ts @@ -1,18 +1,21 @@ class VideoMeta { name: string|null thumbnail: string|null + category: string constructor(raw: any) { this.name = raw['name'] this.thumbnail = raw['thumbnail'] - } + let path = window.location.pathname + this.category = path.substring(path.lastIndexOf('/')+1) + } title_link() : HTMLHeadingElement { let container = document.createElement('h2') let link = document.createElement('a') if(this.name) { - link.href = `/clip/${this.name}` + link.href = `/clip/${this.category}/${this.name}` link.text = this.name.replace('.', ' ').replace('-', ' ') } else { link.href = '#'