refs #358 Open tag timeline page when click reblogged

This commit is contained in:
AkiraFukushima 2018-06-03 01:08:05 +09:00
parent 685851e72c
commit e6704d5807
1 changed files with 7 additions and 14 deletions

View File

@ -36,6 +36,7 @@
<script> <script>
import moment from 'moment' import moment from 'moment'
import { shell } from 'electron' import { shell } from 'electron'
import { findLink, isTag } from '../../../../utils/link'
export default { export default {
name: 'reblog', name: 'reblog',
@ -52,9 +53,14 @@ export default {
return moment(datetime).format('YYYY-MM-DD HH:mm:ss') return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
}, },
tootClick (e) { tootClick (e) {
if (isTag(e.target)) {
const tag = `/${this.$route.params.id}/hashtag/${e.target.innerText}`
this.$router.push({ path: tag })
return tag
}
const link = findLink(e.target) const link = findLink(e.target)
if (link !== null) { if (link !== null) {
shell.openExternal(link) return shell.openExternal(link)
} }
}, },
openUser (account) { openUser (account) {
@ -64,19 +70,6 @@ export default {
} }
} }
} }
function findLink (target) {
if (target.localName === 'a') {
return target.href
}
if (target.parentNode === undefined || target.parentNode === null) {
return null
}
if (target.parentNode.getAttribute('class') === 'reblog') {
return null
}
return findLink(target.parentNode)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>