Change tab when changing follow url
This commit is contained in:
parent
80958c78fd
commit
a434c46545
|
@ -1,11 +1,12 @@
|
||||||
import { AfterViewInit, Component, ViewChild } from '@angular/core'
|
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'
|
||||||
|
import { NavigationEnd, Router } from '@angular/router'
|
||||||
import { TabsetComponent } from 'ngx-bootstrap/tabs'
|
import { TabsetComponent } from 'ngx-bootstrap/tabs'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './follows.component.html',
|
templateUrl: './follows.component.html',
|
||||||
styleUrls: [ './follows.component.scss' ]
|
styleUrls: [ './follows.component.scss' ]
|
||||||
})
|
})
|
||||||
export class FollowsComponent implements AfterViewInit {
|
export class FollowsComponent implements OnInit, AfterViewInit {
|
||||||
@ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent
|
@ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent
|
||||||
|
|
||||||
links = [
|
links = [
|
||||||
|
@ -23,6 +24,18 @@ export class FollowsComponent implements AfterViewInit {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
constructor (private router: Router) {}
|
||||||
|
|
||||||
|
ngOnInit () {
|
||||||
|
this.router.events.subscribe(
|
||||||
|
event => {
|
||||||
|
if (event instanceof NavigationEnd) {
|
||||||
|
this.updateActiveTab()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
ngAfterViewInit () {
|
ngAfterViewInit () {
|
||||||
// Avoid issue with change detector
|
// Avoid issue with change detector
|
||||||
setTimeout(() => this.updateActiveTab())
|
setTimeout(() => this.updateActiveTab())
|
||||||
|
|
|
@ -51,16 +51,16 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
|
||||||
const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName()
|
const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName()
|
||||||
const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
|
const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
|
||||||
|
|
||||||
const videoName = escapeHTML(video.name)
|
const videoNameEscaped = escapeHTML(video.name)
|
||||||
const videoDescription = escapeHTML(video.description)
|
const videoDescriptionEscaped = escapeHTML(video.description)
|
||||||
const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath()
|
const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath()
|
||||||
|
|
||||||
const openGraphMetaTags = {
|
const openGraphMetaTags = {
|
||||||
'og:type': 'video',
|
'og:type': 'video',
|
||||||
'og:title': videoName,
|
'og:title': videoNameEscaped,
|
||||||
'og:image': previewUrl,
|
'og:image': previewUrl,
|
||||||
'og:url': videoUrl,
|
'og:url': videoUrl,
|
||||||
'og:description': videoDescription,
|
'og:description': videoDescriptionEscaped,
|
||||||
|
|
||||||
'og:video:url': embedUrl,
|
'og:video:url': embedUrl,
|
||||||
'og:video:secure_url': embedUrl,
|
'og:video:secure_url': embedUrl,
|
||||||
|
@ -68,14 +68,14 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
|
||||||
'og:video:width': EMBED_SIZE.width,
|
'og:video:width': EMBED_SIZE.width,
|
||||||
'og:video:height': EMBED_SIZE.height,
|
'og:video:height': EMBED_SIZE.height,
|
||||||
|
|
||||||
'name': videoName,
|
'name': videoNameEscaped,
|
||||||
'description': videoDescription,
|
'description': videoDescriptionEscaped,
|
||||||
'image': previewUrl,
|
'image': previewUrl,
|
||||||
|
|
||||||
'twitter:card': 'summary_large_image',
|
'twitter:card': 'summary_large_image',
|
||||||
'twitter:site': '@Chocobozzz',
|
'twitter:site': '@Chocobozzz',
|
||||||
'twitter:title': videoName,
|
'twitter:title': videoNameEscaped,
|
||||||
'twitter:description': videoDescription,
|
'twitter:description': videoDescriptionEscaped,
|
||||||
'twitter:image': previewUrl,
|
'twitter:image': previewUrl,
|
||||||
'twitter:player': embedUrl,
|
'twitter:player': embedUrl,
|
||||||
'twitter:player:width': EMBED_SIZE.width,
|
'twitter:player:width': EMBED_SIZE.width,
|
||||||
|
@ -86,7 +86,7 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
|
||||||
{
|
{
|
||||||
type: 'application/json+oembed',
|
type: 'application/json+oembed',
|
||||||
href: CONFIG.WEBSERVER.URL + '/services/oembed?url=' + encodeURIComponent(videoUrl),
|
href: CONFIG.WEBSERVER.URL + '/services/oembed?url=' + encodeURIComponent(videoUrl),
|
||||||
title: videoName
|
title: videoNameEscaped
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue