+ Category field on VideoMeta objects
This is basically just used to build url's for video links
This commit is contained in:
parent
e54314a629
commit
e9b2507ec5
@ -1,18 +1,21 @@
|
|||||||
class VideoMeta {
|
class VideoMeta {
|
||||||
name: string|null
|
name: string|null
|
||||||
thumbnail: string|null
|
thumbnail: string|null
|
||||||
|
category: string
|
||||||
|
|
||||||
constructor(raw: any) {
|
constructor(raw: any) {
|
||||||
this.name = raw['name']
|
this.name = raw['name']
|
||||||
this.thumbnail = raw['thumbnail']
|
this.thumbnail = raw['thumbnail']
|
||||||
}
|
|
||||||
|
|
||||||
|
let path = window.location.pathname
|
||||||
|
this.category = path.substring(path.lastIndexOf('/')+1)
|
||||||
|
}
|
||||||
title_link() : HTMLHeadingElement {
|
title_link() : HTMLHeadingElement {
|
||||||
let container = document.createElement('h2')
|
let container = document.createElement('h2')
|
||||||
|
|
||||||
let link = document.createElement('a')
|
let link = document.createElement('a')
|
||||||
if(this.name) {
|
if(this.name) {
|
||||||
link.href = `/clip/${this.name}`
|
link.href = `/clip/${this.category}/${this.name}`
|
||||||
link.text = this.name.replace('.', ' ').replace('-', ' ')
|
link.text = this.name.replace('.', ' ').replace('-', ' ')
|
||||||
} else {
|
} else {
|
||||||
link.href = '#'
|
link.href = '#'
|
||||||
|
Loading…
Reference in New Issue
Block a user