Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x | import { isPlatformBrowser } from '@angular/common'; import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { environment } from '../../../environments/environment'; import { AlertService, PageService } from '../../services'; /** * Search Component */ @Component({ selector: 'app-search', templateUrl: './search.component.html', styleUrls: ['./search.component.scss'] }) export class SearchComponent implements OnInit { /** safe html of google custom search API box */ gcseSearchBox: SafeHtml; /** safe html of google custom search API result */ gcseSearchResult: SafeHtml; /** * constructor of SearchComponent * @param platformId: PLATFORM_ID * @param pageService: PageService * @param alert: AlertService * @param sanitizer: DomSanitizer */ constructor(@Inject(PLATFORM_ID) private readonly platformId: string, public pageService: PageService, public alert: AlertService, private readonly sanitizer: DomSanitizer) { } /** * ngOnInit */ ngOnInit(): void { this.pageService.initPage({ title: 'Search Result', description: 'Search Result' // seo: {names: {robots: 'noindex, nofollow'}} }); this.gcseSearchBox = this.sanitizer.bypassSecurityTrustHtml( '<gcse:searchbox-only resultsUrl="/search"></gcse:searchbox-only>' ); this.gcseSearchResult = this.sanitizer.bypassSecurityTrustHtml('<gcse:searchresults-only></gcse:searchresults-only>'); if (isPlatformBrowser(this.platformId) && environment.cse.cx) { const gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = `https://cse.google.com/cse.js?cx=${environment.cse.cx}`; const s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); } } } |