|
|
@ -1,4 +1,4 @@ |
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core' |
|
|
|
import { Component, OnInit, ViewChild, ViewEncapsulation} from '@angular/core' |
|
|
|
import { Router, NavigationEnd, NavigationStart, ActivatedRoute } from '@angular/router' |
|
|
|
import { DomSanitizer } from '@angular/platform-browser' |
|
|
|
import { Location } from '@angular/common' |
|
|
@ -9,7 +9,8 @@ import { environment } from '../../environments/environment' |
|
|
|
@Component({ |
|
|
|
selector: 'app-detail', |
|
|
|
templateUrl: './detail.component.html', |
|
|
|
styleUrls: ['./detail.component.scss'] |
|
|
|
styleUrls: ['./detail.component.scss'], |
|
|
|
encapsulation: ViewEncapsulation.None, |
|
|
|
}) |
|
|
|
export class DetailComponent implements OnInit { |
|
|
|
|
|
|
@ -45,6 +46,7 @@ export class DetailComponent implements OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
showDetails(section, id): void { |
|
|
|
this.galleryImages = [] |
|
|
|
this.apisService.getDetails(section, id).toPromise().then((response) => { |
|
|
|
if(this.history[this.history.length - 1] != `/detail/${section}/${id}`) { |
|
|
|
this.history.push(`/detail/${section}/${id}`) |
|
|
@ -54,17 +56,30 @@ export class DetailComponent implements OnInit { |
|
|
|
detail.videos = detail.videos ? JSON.parse(detail.videos) : [] |
|
|
|
detail.videos.forEach((e) => { |
|
|
|
e.code = e.url.split('/').pop() |
|
|
|
switch(e.type) { |
|
|
|
case 'youtube': |
|
|
|
e.embed = this.sanitizer.bypassSecurityTrustResourceUrl(`https://www.youtube.com/embed/${e.code}`) |
|
|
|
break |
|
|
|
case 'vimeo': |
|
|
|
e.embed = this.sanitizer.bypassSecurityTrustResourceUrl(`https://player.vimeo.com/video/${e.code}`) |
|
|
|
break |
|
|
|
case 'embed': |
|
|
|
e.embed = this.sanitizer.bypassSecurityTrustHtml(e.url) |
|
|
|
break |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
detail.gallery = detail.gallery ? JSON.parse(detail.gallery) : [] |
|
|
|
|
|
|
|
detail.gallery.forEach((e) => { |
|
|
|
if(!e.main) { |
|
|
|
this.galleryImages.push({ |
|
|
|
url: e.url, |
|
|
|
url: `${e.url}`, |
|
|
|
altText: e.title, |
|
|
|
title: e.title, |
|
|
|
thumbnailUrl: e.url |
|
|
|
thumbnailUrl: `${this.basePath}${e.url}` |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.details = detail |
|
|
|
|
|
|
|