mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-11 08:24:58 +01:00
refs #136 Open link on the default browser in notifications
This commit is contained in:
parent
93e50f3143
commit
81fc81bf76
@ -25,7 +25,7 @@
|
||||
{{ parseDatetime(message.status.created_at) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" v-html="message.status.content"></div>
|
||||
<div class="content" v-html="message.status.content" @click.capture.prevent="tootClick"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { shell } from 'electron'
|
||||
|
||||
export default {
|
||||
name: 'favourite',
|
||||
@ -49,9 +50,25 @@ export default {
|
||||
},
|
||||
parseDatetime (datetime) {
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
},
|
||||
tootClick (e) {
|
||||
const link = findLink(e.target)
|
||||
if (link !== null) {
|
||||
shell.openExternal(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findLink (target) {
|
||||
if (target.localName === 'a') {
|
||||
return target.href
|
||||
}
|
||||
if (target.parentNode === undefined || target.parentNode === null) {
|
||||
return null
|
||||
}
|
||||
return findLink(target.parentNode)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -25,7 +25,7 @@
|
||||
{{ parseDatetime(message.status.created_at) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" v-html="message.status.content"></div>
|
||||
<div class="content" v-html="message.status.content" @click.capture.prevent="tootClick"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import { shell } from 'electron'
|
||||
|
||||
export default {
|
||||
name: 'reblog',
|
||||
@ -49,9 +50,25 @@ export default {
|
||||
},
|
||||
parseDatetime (datetime) {
|
||||
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
||||
},
|
||||
tootClick (e) {
|
||||
const link = findLink(e.target)
|
||||
if (link !== null) {
|
||||
shell.openExternal(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findLink (target) {
|
||||
if (target.localName === 'a') {
|
||||
return target.href
|
||||
}
|
||||
if (target.parentNode === undefined || target.parentNode === null) {
|
||||
return null
|
||||
}
|
||||
return findLink(target.parentNode)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user