added gifv support #38

This commit is contained in:
Nicolas Constant 2019-02-27 20:19:47 -05:00
parent 9b2710a99f
commit 9167cbd4da
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 34 additions and 30 deletions

View File

@ -11,7 +11,6 @@ import { AccountInfo } from '../../../../states/accounts.state';
import { Status } from '../../../../services/models/mastodon.interfaces';
import { ToolsService } from '../../../../services/tools.service';
import { NotificationService } from '../../../../services/notification.service';
import { st } from '@angular/core/src/render3';
@Component({
selector: 'app-action-bar',

View File

@ -1,57 +1,53 @@
<div class="galery" *ngIf="isImage">
<div class="galery__image">
<a *ngIf="attachments.length === 1" class="galery__image--link" title="{{ attachments[0].text_url }}"
<a *ngIf="attachments.length === 1" class="galery__image--link" title="{{ attachments[0].text_url }}"
(click)="attachmentSelected(0)">
<img class="galery__image--1" src="{{ attachments[0].preview_url }}" />
</a>
<a *ngIf="attachments.length === 2" class="galery__image--link galery__image--link-2"
title="{{ attachments[0].text_url }}"
(click)="attachmentSelected(0)">
<a *ngIf="attachments.length === 2" class="galery__image--link galery__image--link-2"
title="{{ attachments[0].text_url }}" (click)="attachmentSelected(0)">
<img src="{{ attachments[0].preview_url }}" />
</a>
<a *ngIf="attachments.length === 2" class="galery__image--link galery__image--link-2"
title="{{ attachments[1].text_url }}"
(click)="attachmentSelected(1)">
<a *ngIf="attachments.length === 2" class="galery__image--link galery__image--link-2"
title="{{ attachments[1].text_url }}" (click)="attachmentSelected(1)">
<img src="{{ attachments[1].preview_url }}" />
</a>
<a *ngIf="attachments.length === 3" class="galery__image--link galery__image--link-3-1"
title="{{ attachments[0].text_url }}"
(click)="attachmentSelected(0)">
<a *ngIf="attachments.length === 3" class="galery__image--link galery__image--link-3-1"
title="{{ attachments[0].text_url }}" (click)="attachmentSelected(0)">
<img src="{{ attachments[0].preview_url }}" />
</a>
<a *ngIf="attachments.length === 3" class="galery__image--link galery__image--link-3-2"
title="{{ attachments[1].text_url }}"
(click)="attachmentSelected(1)">
<a *ngIf="attachments.length === 3" class="galery__image--link galery__image--link-3-2"
title="{{ attachments[1].text_url }}" (click)="attachmentSelected(1)">
<img src="{{ attachments[1].preview_url }}" />
</a>
<a *ngIf="attachments.length === 3" class="galery__image--link galery__image--link-3-2"
title="{{ attachments[2].text_url }}"
(click)="attachmentSelected(2)">
<a *ngIf="attachments.length === 3" class="galery__image--link galery__image--link-3-2"
title="{{ attachments[2].text_url }}" (click)="attachmentSelected(2)">
<img src="{{ attachments[2].urpreview_urll }}" />
</a>
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[0].text_url }}"
(click)="attachmentSelected(0)">
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[0].text_url }}" (click)="attachmentSelected(0)">
<img src="{{ attachments[0].preview_url }}" />
</a>
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[1].text_url }}"
(click)="attachmentSelected(1)">
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[1].text_url }}" (click)="attachmentSelected(1)">
<img src="{{ attachments[1].preview_url }}" />
</a>
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[2].text_url }}"
(click)="attachmentSelected(2)">
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[2].text_url }}" (click)="attachmentSelected(2)">
<img src="{{ attachments[2].preview_url }}" />
</a>
<a *ngIf="attachments.length === 4" class="galery__image--link galery__image--link-4"
title="{{ attachments[3].text_url }}"
(click)="attachmentSelected(3)">
title="{{ attachments[3].text_url }}" (click)="attachmentSelected(3)">
<img src="{{ attachments[3].preview_url }}" />
</a>
</div>
</div>
<div class="galery" *ngIf="isGifv">
<!-- <video width="480" height="320" controls="controls"> -->
<video class="galery__gifv" role="application" loop autoplay>
<source src="{{ attachments[0].url }}" type="video/mp4">
</video>
</div>

View File

@ -71,4 +71,10 @@
}
}
}
&__gifv{
width: 100%;
height: 100%;
object-fit: cover;
}
}

View File

@ -12,6 +12,7 @@ import { OpenMediaEvent } from '../../../../models/common.model';
export class AttachementsComponent implements OnInit {
private _attachments: Attachment[];
isImage: boolean;
isGifv: boolean;
imageUrls: string[];
@Input('attachments')
@ -20,7 +21,9 @@ export class AttachementsComponent implements OnInit {
if (this._attachments[0].type === 'image') {
this.isImage = true;
// this.imageUrls = this._attachments.map(x => x.url);
} else if(this._attachments[0].type === 'gifv'){
console.warn(value);
this.isGifv = true;
}
}
get attachments(): Attachment[] {