refs #543 Start focus with j key in timeline

This commit is contained in:
AkiraFukushima 2018-08-22 19:17:35 +09:00
parent cdf5f108cc
commit 76a83320d1
5 changed files with 50 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<template>
<div id="favourites">
<div id="favourites" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
<div class="fav" v-for="message in favourites" v-bind:key="message.id">
@ -167,6 +167,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.id
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.favourites[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div name="tag">
<div name="tag" v-shortkey="{next:['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -205,6 +205,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="home">
<div id="home" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -172,6 +172,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="local">
<div id="local" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -171,6 +171,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="public">
<div id="public" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -194,6 +194,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}