Skip to content
Snippets Groups Projects
Commit d8ee2873 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Add share button

parent 0d657899
No related branches found
No related tags found
No related merge requests found
......@@ -9,10 +9,7 @@
<span v-else>
<button class="share_button">
<ShareNetwork network="facebook"
:url="share_link"
title="TITLE"
description="DESCRIPTION"
quote="QUOTE">
:url="share_link">
<font-awesome-icon :icon="['fab', 'facebook-square']" size="lg" />
</ShareNetwork>
</button>
......@@ -20,9 +17,8 @@
<ShareNetwork
network="twitter"
:url="share_link"
title="TITLE"
description="DESCRIPTION"
hashtags="Ordbøkene.no">
:title="dict_label"
hashtags="#ordbøkene">
<font-awesome-icon :icon="['fab', 'twitter-square']" size="lg" />
</ShareNetwork>
</button>
......@@ -39,20 +35,26 @@ export default {
article: Object
},
computed: {
dict_label: function() { // TODO: reuse code used in header
return {
'bob': 'Fra bokmålsordboka',
'nob': 'Frå nynorskordboka'
}[this.article.dictionary] + ': ' + this.article.lemmas[0].lemma || ''
},
webShareApiSupported() {
return navigator.share && !(navigator.platform==="Win64" || navigator.platform==="Win32")
},
share_link: function() {
let host = window.location.hostname === 'localhost'? 'https://dev.ordbok.uib.no' : 'https://' + window.location.host
return host + "/" + this.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma)
let host = window.location.hostname === 'localhost'? 'https://dev.ordbok.uib.no/' : window.location.href
return host + this.article.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma)
}
},
methods: {
shareViaWebShare() {
navigator.share({
title: 'Title to be shared',
text: 'Text to be shared',
url: 'URL to be shared'
title: "Ordbøkene.no: " + encodeURIComponent(this.article.lemmas[0].lemma),
text: "",
url: "/" + this.article.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma)
})
}
}
......
......@@ -2,5 +2,8 @@ module.exports = {
runtimeCompiler: true,
transpileDependencies: [
'vuetify'
]
],
devServer: {
https: false
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment