summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2018-08-09 04:21:25 +0900
committerGitHub <noreply@github.com>2018-08-09 04:21:25 +0900
commit6a92c192277a15061582bd3862c9b768de1f787b (patch)
tree5a3e0ebc63498052040967a0f77b7b881343f677 /src/client
parentUpdate url-preview.vue (diff)
downloadmisskey-6a92c192277a15061582bd3862c9b768de1f787b.tar.gz
misskey-6a92c192277a15061582bd3862c9b768de1f787b.tar.bz2
misskey-6a92c192277a15061582bd3862c9b768de1f787b.zip
Update url-preview.vue
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/common/views/components/url-preview.vue33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue
index a61e9fd817..4f1e34c6ca 100644
--- a/src/client/app/common/views/components/url-preview.vue
+++ b/src/client/app/common/views/components/url-preview.vue
@@ -67,13 +67,20 @@ export default Vue.extend({
if (url.hostname == 'www.youtube.com') {
this.youtubeId = url.searchParams.get('v');
+ return;
} else if (url.hostname == 'youtu.be') {
this.youtubeId = url.pathname;
+ return;
} else if (url.hostname == 'open.spotify.com') {
this.spotifyId = url.pathname.split('/').reverse().filter(x => x !== '')[0];
+ return;
} else if (['nicovideo.jp', 'www.nicovideo.jp', 'nico.ms'].includes(url.hostname)) {
- this.nicovideoId = url.pathname.split('/').reverse().filter(x => x !== '')[0];
- this.position = url.searchParams.get('from');
+ const id = url.pathname.split('/').reverse().filter(x => x !== '')[0];
+ if (['sm', 'nm', 'ax', 'ca', 'cd', 'cw', 'fx', 'ig', 'na', 'om', 'sd', 'sk', 'yk', 'yo', 'za', 'zb', 'zc', 'zd', 'ze', 'nl', 'so', ...Array(10).keys()].some(x => id.startsWith(x)) {
+ this.nicovideoId = id;
+ this.position = url.searchParams.get('from');
+ return;
+ }
} else if (this.detail && url.hostname == 'twitter.com' && /^\/.+\/status(es)?\/\d+/.test(url.pathname)) {
this.tweetUrl = url;
const twttr = (window as any).twttr || {};
@@ -93,19 +100,19 @@ export default Vue.extend({
twttr.ready = loadTweet;
(window as any).twttr = twttr;
}
- } else {
- fetch('/url?url=' + encodeURIComponent(this.url)).then(res => {
- res.json().then(info => {
- this.title = info.title;
- this.description = info.description;
- this.thumbnail = info.thumbnail;
- this.icon = info.icon;
- this.sitename = info.sitename;
+ return;
+ }
+ fetch('/url?url=' + encodeURIComponent(this.url)).then(res => {
+ res.json().then(info => {
+ this.title = info.title;
+ this.description = info.description;
+ this.thumbnail = info.thumbnail;
+ this.icon = info.icon;
+ this.sitename = info.sitename;
- this.fetching = false;
- });
+ this.fetching = false;
});
- }
+ });
}
});
</script>