MisskeyPagesをホームUIに統合

This commit is contained in:
syuilo
2019-05-24 19:19:43 +09:00
parent 358bb0fc06
commit 36c2d0082f
26 changed files with 58 additions and 241 deletions

View File

@ -9,7 +9,7 @@
</blockquote>
</div>
<div v-else class="mk-url-preview">
<a :class="{ mini: narrow, compact }" :href="url" rel="nofollow noopener" target="_blank" :title="url" v-if="!fetching">
<component :is="self ? 'router-link' : 'a'" :class="{ mini: narrow, compact }" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="self ? null : '_blank'" :title="url" v-if="!fetching">
<div class="thumbnail" v-if="thumbnail" :style="`background-image: url('${thumbnail}')`">
<button v-if="!playerEnabled && player.url" @click.prevent="playerEnabled = true" :title="$t('enable-player')"><fa :icon="['far', 'play-circle']"/></button>
</div>
@ -23,17 +23,18 @@
<p :title="sitename">{{ sitename }}</p>
</footer>
</article>
</a>
</component>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import { url as misskeyUrl } from '../../../config';
import { url as local } from '../../../config';
export default Vue.extend({
i18n: i18n('common/views/components/url-preview.vue'),
props: {
url: {
type: String,
@ -74,7 +75,9 @@ export default Vue.extend({
},
tweetUrl: null,
playerEnabled: false,
misskeyUrl,
local,
self: this.url.startsWith(local),
attr: this.url.startsWith(local) ? 'to' : 'href'
};
},