Use string interpolation
This commit is contained in:
@ -80,7 +80,7 @@ export default Vue.extend({
|
||||
accepted() {
|
||||
this.state = 'accepted';
|
||||
if (this.session.app.callbackUrl) {
|
||||
location.href = this.session.app.callbackUrl + '?token=' + this.session.token;
|
||||
location.href = `${this.session.app.callbackUrl}?token=${this.session.token}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@
|
||||
|
||||
// Get salt query
|
||||
const salt = localStorage.getItem('salt')
|
||||
? '?salt=' + localStorage.getItem('salt')
|
||||
? `?salt=${localStorage.getItem('salt')}`
|
||||
: '';
|
||||
|
||||
// Load an app script
|
||||
|
@ -44,11 +44,11 @@ export default class Connection extends EventEmitter {
|
||||
|
||||
const query = params
|
||||
? Object.keys(params)
|
||||
.map(k => encodeURIComponent(k) + '=' + encodeURIComponent(params[k]))
|
||||
.map(k => `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`)
|
||||
.join('&')
|
||||
: null;
|
||||
|
||||
this.socket = new ReconnectingWebsocket(`${wsUrl}/${endpoint}${query ? '?' + query : ''}`);
|
||||
this.socket = new ReconnectingWebsocket(`${wsUrl}/${endpoint}${query ? `?${query}` : ''}`);
|
||||
this.socket.addEventListener('open', this.onOpen);
|
||||
this.socket.addEventListener('close', this.onClose);
|
||||
this.socket.addEventListener('message', this.onMessage);
|
||||
|
@ -125,7 +125,7 @@ export default Vue.extend({
|
||||
}
|
||||
|
||||
if (this.type == 'user') {
|
||||
const cacheKey = 'autocomplete:user:' + this.q;
|
||||
const cacheKey = `autocomplete:user:${this.q}`;
|
||||
const cache = sessionStorage.getItem(cacheKey);
|
||||
if (cache) {
|
||||
const users = JSON.parse(cache);
|
||||
@ -148,7 +148,7 @@ export default Vue.extend({
|
||||
this.hashtags = JSON.parse(localStorage.getItem('hashtags') || '[]');
|
||||
this.fetching = false;
|
||||
} else {
|
||||
const cacheKey = 'autocomplete:hashtag:' + this.q;
|
||||
const cacheKey = `autocomplete:hashtag:${this.q}`;
|
||||
const cache = sessionStorage.getItem(cacheKey);
|
||||
if (cache) {
|
||||
const hashtags = JSON.parse(cache);
|
||||
|
@ -57,7 +57,7 @@ export default Vue.extend({
|
||||
}
|
||||
|
||||
// Check internet connection
|
||||
fetch('https://google.com?rand=' + Math.random(), {
|
||||
fetch(`https://google.com?rand=${Math.random()}`, {
|
||||
mode: 'no-cors'
|
||||
}).then(() => {
|
||||
this.internet = true;
|
||||
|
@ -170,7 +170,7 @@ export default Vue.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
fetch('/url?url=' + encodeURIComponent(this.url)).then(res => {
|
||||
fetch(`/url?url=${encodeURIComponent(this.url)}`).then(res => {
|
||||
res.json().then(info => {
|
||||
if (info.url == null) return;
|
||||
this.title = info.title;
|
||||
|
@ -191,7 +191,7 @@ class Autocomplete {
|
||||
const acct = renderAcct(value);
|
||||
|
||||
// 挿入
|
||||
this.text = trimmedBefore + '@' + acct + ' ' + after;
|
||||
this.text = `${trimmedBefore}@${acct} ${after}`;
|
||||
|
||||
// キャレットを戻す
|
||||
this.vm.$nextTick(() => {
|
||||
@ -207,7 +207,7 @@ class Autocomplete {
|
||||
const after = source.substr(caret);
|
||||
|
||||
// 挿入
|
||||
this.text = trimmedBefore + '#' + value + ' ' + after;
|
||||
this.text = `${trimmedBefore}#${value} ${after}`;
|
||||
|
||||
// キャレットを戻す
|
||||
this.vm.$nextTick(() => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
Vue.filter('notePage', note => {
|
||||
return '/notes/' + note.id;
|
||||
return `/notes/${note.id}`;
|
||||
});
|
||||
|
@ -11,5 +11,5 @@ Vue.filter('userName', user => {
|
||||
});
|
||||
|
||||
Vue.filter('userPage', (user, path?) => {
|
||||
return '/@' + Vue.filter('acct')(user) + (path ? '/' + path : '');
|
||||
return `/@${Vue.filter('acct')(user)}${(path ? `/${path}` : '')}`;
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="syxhndwprovvuqhmyvveewmbqayniwkv" v-if="!fetching" :data-darkmode="$store.state.device.darkmode">
|
||||
<div class="signed-in-as" v-html="'%i18n:@signed-in-as%'.replace('{}', '<b>' + myName + '</b>')"></div>
|
||||
<div class="signed-in-as" v-html="'%i18n:@signed-in-as%'.replace('{}', `<b>${myName}`)"></div>
|
||||
|
||||
<main>
|
||||
<div class="banner" :style="bannerStyle"></div>
|
||||
|
@ -163,7 +163,7 @@ export default Vue.extend({
|
||||
});
|
||||
break;
|
||||
default:
|
||||
alert('%i18n:@unhandled-error% ' + err);
|
||||
alert(`%i18n:@unhandled-error% ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ export default Vue.extend({
|
||||
});
|
||||
break;
|
||||
default:
|
||||
alert('%i18n:@unhandled-error% ' + err);
|
||||
alert(`%i18n:@unhandled-error% ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -404,7 +404,7 @@ export default Vue.extend({
|
||||
folder: folder
|
||||
});
|
||||
} else {
|
||||
window.open(url + '/i/drive/folder/' + folder.id,
|
||||
window.open(`${url}/i/drive/folder/${folder.id}`,
|
||||
'drive_window',
|
||||
'height=500, width=800');
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export default Vue.extend({
|
||||
const mouseY = e.clientY - rect.top;
|
||||
const xp = mouseX / this.$el.offsetWidth * 100;
|
||||
const yp = mouseY / this.$el.offsetHeight * 100;
|
||||
this.$el.style.backgroundPosition = xp + '% ' + yp + '%';
|
||||
this.$el.style.backgroundPosition = `${xp}% ${yp}%';
|
||||
this.$el.style.backgroundImage = `url("${this.image.url}")`;
|
||||
},
|
||||
|
||||
|
@ -110,9 +110,9 @@ export default Vue.extend({
|
||||
computed: {
|
||||
draftId(): string {
|
||||
return this.renote
|
||||
? 'renote:' + this.renote.id
|
||||
? `renote:${this.renote.id}`
|
||||
: this.reply
|
||||
? 'reply:' + this.reply.id
|
||||
? `reply:${this.reply.id}`
|
||||
: 'note';
|
||||
},
|
||||
|
||||
@ -313,7 +313,7 @@ export default Vue.extend({
|
||||
this.geo = pos.coords;
|
||||
this.$emit('geo-attached', this.geo);
|
||||
}, err => {
|
||||
alert('%i18n:@error%: ' + err.message);
|
||||
alert(`%i18n:@error%: ${err.message}`);
|
||||
}, {
|
||||
enableHighAccuracy: true
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ export default Vue.extend({
|
||||
const title = folder.name + ' | %i18n:@title%';
|
||||
|
||||
// Rewrite URL
|
||||
history.pushState(null, title, '/i/drive/folder/' + folder.id);
|
||||
history.pushState(null, title, `/i/drive/folder/${folder.id}`);
|
||||
|
||||
document.title = title;
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ export default Vue.extend({
|
||||
methods: {
|
||||
nav(game, actualNav) {
|
||||
if (actualNav) {
|
||||
this.$router.push('/reversi/' + game.id);
|
||||
this.$router.push(`/reversi/${game.id}`);
|
||||
} else {
|
||||
// TODO: https://github.com/vuejs/vue-router/issues/703
|
||||
this.$router.push('/reversi/' + game.id);
|
||||
this.$router.push(`/reversi/${game.id}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export default Vue.extend({
|
||||
this.user = user;
|
||||
this.fetching = false;
|
||||
|
||||
document.title = 'メッセージ: ' + getUserName(this.user);
|
||||
document.title = `メッセージ: ${getUserName(this.user)}`;
|
||||
|
||||
Progress.done();
|
||||
});
|
||||
|
@ -105,9 +105,9 @@ export default Vue.extend({
|
||||
computed: {
|
||||
draftId(): string {
|
||||
return this.renote
|
||||
? 'renote:' + this.renote.id
|
||||
? `renote:${this.renote.id}`
|
||||
: this.reply
|
||||
? 'reply:' + this.reply.id
|
||||
? `reply:${this.reply.id}`
|
||||
: 'note';
|
||||
},
|
||||
|
||||
@ -229,7 +229,7 @@ export default Vue.extend({
|
||||
navigator.geolocation.getCurrentPosition(pos => {
|
||||
this.geo = pos.coords;
|
||||
}, err => {
|
||||
alert('%i18n:@error%: ' + err.message);
|
||||
alert(`%i18n:@error%: ${err.message}`);
|
||||
}, {
|
||||
enableHighAccuracy: true
|
||||
});
|
||||
|
@ -82,7 +82,7 @@ export default Vue.extend({
|
||||
search() {
|
||||
const query = window.prompt('%i18n:@search%');
|
||||
if (query == null || query == '') return;
|
||||
this.$router.push('/search?q=' + encodeURIComponent(query));
|
||||
this.$router.push(`/search?q=${encodeURIComponent(query)}`);
|
||||
},
|
||||
onReversiInvited() {
|
||||
this.hasGameInvitation = true;
|
||||
|
@ -80,7 +80,7 @@ export default Vue.extend({
|
||||
|
||||
if (!silent) {
|
||||
// Rewrite URL
|
||||
history.pushState(null, title, '/i/drive/folder/' + folder.id);
|
||||
history.pushState(null, title, `/i/drive/folder/${folder.id}`);
|
||||
}
|
||||
|
||||
document.title = title;
|
||||
@ -93,7 +93,7 @@ export default Vue.extend({
|
||||
|
||||
if (!silent) {
|
||||
// Rewrite URL
|
||||
history.pushState(null, title, '/i/drive/file/' + file.id);
|
||||
history.pushState(null, title, `/i/drive/file/${file.id}`);
|
||||
}
|
||||
|
||||
document.title = title;
|
||||
|
@ -49,7 +49,7 @@ export default Vue.extend({
|
||||
this.user = user;
|
||||
this.fetching = false;
|
||||
|
||||
document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | ' + (this as any).os.instanceName;
|
||||
document.title = `${'%i18n:@followers-of%'.replace('{}', this.name)} | ${(this as any).os.instanceName}`;
|
||||
});
|
||||
},
|
||||
onLoaded() {
|
||||
|
@ -48,7 +48,7 @@ export default Vue.extend({
|
||||
this.user = user;
|
||||
this.fetching = false;
|
||||
|
||||
document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | ' + (this as any).os.instanceName;
|
||||
document.title = `${'%i18n:@followers-of%'.replace('{}', this.name)} | ${(this as any).os.instanceName}`;
|
||||
});
|
||||
},
|
||||
onLoaded() {
|
||||
|
@ -16,10 +16,10 @@ export default Vue.extend({
|
||||
methods: {
|
||||
nav(game, actualNav) {
|
||||
if (actualNav) {
|
||||
this.$router.push('/reversi/' + game.id);
|
||||
this.$router.push(`/reversi/${game.id}`);
|
||||
} else {
|
||||
// TODO: https://github.com/vuejs/vue-router/issues/703
|
||||
this.$router.push('/reversi/' + game.id);
|
||||
this.$router.push(`/reversi/${game.id}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<mk-ui>
|
||||
<span slot="header">%fa:cog%%i18n:@settings%</span>
|
||||
<main :data-darkmode="$store.state.device.darkmode">
|
||||
<div class="signin-as" v-html="'%i18n:@signed-in-as%'.replace('{}', '<b>' + name + '</b>')"></div>
|
||||
<div class="signin-as" v-html="'%i18n:@signed-in-as%'.replace('{}', `<b>${name}</b>`)"></div>
|
||||
|
||||
<div>
|
||||
<x-profile/>
|
||||
|
@ -43,7 +43,7 @@ export default Vue.extend({
|
||||
title
|
||||
});
|
||||
|
||||
this.$router.push('/i/lists/' + list.id);
|
||||
this.$router.push(`/i/lists/${list.id}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ export default Vue.extend({
|
||||
this.fetching = false;
|
||||
|
||||
Progress.done();
|
||||
document.title = Vue.filter('userName')(this.user) + ' | ' + (this as any).os.instanceName;
|
||||
document.title = `${Vue.filter('userName')(this.user)} | ${(this as any).os.instanceName}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user