Commit 2353a7a4 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent 24cbe02c
{
"name": "mycard-mobile",
"version": "1.0.25",
"version": "1.0.26",
"license": "UNLISENCED",
"scripts": {
"ng": "ng",
......
......@@ -4,8 +4,8 @@
<button id="menu" mat-icon-button (click)="ygopro.openDrawer()">
<mat-icon>menu</mat-icon>
</button>
<form (submit)="search(key)">
<input type="search" placeholder="卡片搜索" name="key" [(ngModel)]="key" [matAutocomplete]="auto" [formControl]="searchCtrl">
<form (submit)="search(searchControl.value)">
<input type="search" placeholder="卡片搜索" name="key" [matAutocomplete]="auto" [formControl]="searchControl">
<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let card of suggestion | async" [value]="card" (onSelectionChange)="search(card)">
......@@ -173,7 +173,7 @@
<mat-card *ngFor="let item of ygopro.topics | async">
<a [href]="item.url" target="_blank">
<mat-card-header>
<img *ngIf="item.image_url" mat-card-avatar [src]="item.image_url">
<img *ngIf="item.image_url" mat-card-avatar [src]="item.image_url" referrerpolicy="no-referrer">
<mat-card-title>{{item.title}}</mat-card-title>
<mat-card-subtitle>by {{item.last_poster_username}} / {{item.last_posted_at | date}}
</mat-card-subtitle>
......
......@@ -7,7 +7,7 @@ import { StorageService } from '../storage.service';
import { YGOProService } from '../ygopro.service';
import { HttpClient } from '@angular/common/http';
import { filter, mergeMap } from 'rxjs/internal/operators';
import { distinctUntilChanged, filter, map, switchMap } from 'rxjs/internal/operators';
@Component({
selector: 'app-lobby',
......@@ -21,10 +21,12 @@ export class LobbyComponent {
version = environment.version;
build: BuildConfig;
searchCtrl = new FormControl();
suggestion = this.searchCtrl.valueChanges.pipe(
searchControl = new FormControl();
suggestion = this.searchControl.valueChanges.pipe(
distinctUntilChanged(),
filter(name => name),
mergeMap(name => this.http.get(`https://www.ourocg.cn/search/suggest/${name}`))
switchMap(name => this.http.get(`https://api.mycard.moe/ygopro/suggest/${name}`)),
map(data => data.map(item => item.value))
);
key: string;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment