refs #358 Open tag timeline page when click reblogged
This commit is contained in:
parent
685851e72c
commit
e6704d5807
|
@ -36,6 +36,7 @@
|
|||
<script>
|
||||
import moment from 'moment'
|
||||
import { shell } from 'electron'
|
||||
import { findLink, isTag } from '../../../../utils/link'
|
||||
|
||||
export default {
|
||||
name: 'reblog',
|
||||
|
@ -52,9 +53,14 @@ export default {
|
|||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
},
|
||||
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)
|
||||
if (link !== null) {
|
||||
shell.openExternal(link)
|
||||
return shell.openExternal(link)
|
||||
}
|
||||
},
|
||||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
Loading…
Reference in New Issue