Changeset View
Changeset View
Standalone View
Standalone View
src/app/createPost/createPost.component.ts
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | dialogRef.afterClosed() | ||||
result.url = result.url | result.url = result.url | ||||
.replace('https://', '') | .replace('https://', '') | ||||
.replace('http://', '') | .replace('http://', '') | ||||
.replace('http://', '') | .replace('http://', '') | ||||
.replace('www.', '') | .replace('www.', '') | ||||
.replace('m.', '') | .replace('m.', '') | ||||
.replace('youtube.com/watch?v=', '') | .replace('youtube.com/watch?v=', '') | ||||
.replace('youtu.be/', '') | .replace('youtu.be/', '') | ||||
.replace('youtube.com/', '') | .replace('youtube.com/', ''); | ||||
if (result.url.indexOf('?') !== -1) { | if (result.url.indexOf('?') !== -1) { | ||||
result.url = result.url.slice(0, result.url.indexOf('?')); | result.url = result.url.slice(0, result.url.indexOf('?')); | ||||
} | } | ||||
this.post.text = this.post.text === undefined ? | this.post.text = this.post.text === undefined ? | ||||
`[](https://www.youtube.com/watch?v=${result.url})\n` | `[](https://www.youtube.com/watch?v=${result.url})\n` | ||||
: | : | ||||
`[](https://www.youtube.com/watch?v=${result.url})\n${this.post.text}` | `[](https://www.youtube.com/watch?v=${result.url})\n${this.post.text}`; | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
publishDraft() { | publishDraft() { | ||||
this.loading = true; | this.loading = true; | ||||
this.cdRef.detectChanges(); | this.cdRef.detectChanges(); | ||||
if (this.post.text !== '' && this.runImageCheck()) { | if (this.post.text !== '' && this.runImageCheck()) { | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |