From 744cbe4e7342e9a3e43e3777404b1088542b62ee Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 13 Mar 2018 12:49:49 +0100 Subject: [PATCH] done #1979 @0.5 --- js/libs/fluidbook/fluidbook.share.js | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/js/libs/fluidbook/fluidbook.share.js b/js/libs/fluidbook/fluidbook.share.js index 5023fdbd..c32b1581 100644 --- a/js/libs/fluidbook/fluidbook.share.js +++ b/js/libs/fluidbook/fluidbook.share.js @@ -101,6 +101,33 @@ FluidbookShare.prototype = { return this.fluidbook.datas.title; }, + getEmailSubject: function () { + if (this.fluidbook.datas.email_title == '') { + return this.fluidbook.datas.title; + } + return this.fluidbook.datas.email_title; + }, + + getEmailBody: function (url) { + var body; + var u = this.getShareURL(url); + if (this.fluidbook.datas.email_body == '') { + body = this.fluidbook.l10n.__('Veuillez cliquer sur le lien suivant pour ouvrir %title%\n%link%'); + } else { + body = this.fluidbook.datas.email_body; + } + body = body.trim(); + body = body.replace(/\%title\%/g, this.fluidbook.datas.title); + + if (body.indexOf('%link%') === -1) { + body += "\n\n" + u; + } else { + body = body.replace(/\%link\%/g, u); + } + + return body; + }, + getSEOArticle: function (title) { return this.fluidbook.datas.seoArticles[title]; }, @@ -200,7 +227,7 @@ FluidbookShare.prototype = { sendEmail: function (url) { - window.location = 'mailto:?subject=' + encodeURIComponent(this.getShareTitle(url)) + '&body=' + encodeURIComponent(this.getShareTitle(url) + ' : ' + this.getShareURL(url)); + window.location = 'mailto:?subject=' + encodeURIComponent(this.getEmailSubject()) + '&body=' + encodeURIComponent(this.getEmailBody(url)); this.fluidbook.stats.track(5); }, sendTwitter: function (url) { -- 2.39.5