From 13bde8785f6b10a615e642639290165eb7b3226e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 22 May 2019 15:43:39 +0200 Subject: [PATCH] wait #2786 @0:20 --- js/libs/fluidbook/fluidbook.share.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.share.js b/js/libs/fluidbook/fluidbook.share.js index aaeaba83..df8bdc3a 100644 --- a/js/libs/fluidbook/fluidbook.share.js +++ b/js/libs/fluidbook/fluidbook.share.js @@ -234,11 +234,20 @@ FluidbookShare.prototype = { this.fluidbook.stats.track(5); }, sendTwitter: function (url) { - var tweet = this.fluidbook.datas.twitter_description.replace('%title%', this.getShareTitle(url)) - tweet = tweet.replace('%short%', ''); - tweet = tweet.replace('%url%', ''); + var tweet = this.fluidbook.datas.twitter_description.replace('%title%', this.getShareTitle(url)); + var hasUrlInTweet = tweet.indexOf('%url%') >= 0 || tweet.indexOf('%short%') >= 0; - this.fluidbook.wopen('http://twitter.com/intent/tweet?source=webclient&url=' + encodeURIComponent(this.getShareURL(url)) + '&text=' + encodeURIComponent(tweet), 'share_twitter', 'width=650,height=400'); + url = this.getShareURL(url); + var escaped_url = encodeURIComponent(url); + tweet = tweet.replace('%short%', url); + tweet = tweet.replace('%url%', url); + + var urlshare = ''; + if (!hasUrlInTweet) { + urlshare = '&url=' + escaped_url; + } + + this.fluidbook.wopen('http://twitter.com/intent/tweet?source=webclient' + urlshare + '&text=' + encodeURIComponent(tweet), 'share_twitter', 'width=650,height=400'); this.fluidbook.stats.track(13); }, sendFacebook: function (url) { -- 2.39.5