From acd944a6ef5af09d523a8638009ca10d0a7a8e37 Mon Sep 17 00:00:00 2001 From: Nicolas Wendling Date: Thu, 25 Mar 2021 14:01:07 +0100 Subject: =?UTF-8?q?=F0=9F=8E=A8=20twitter=20/=20facebook=20/=20mail=20shar?= =?UTF-8?q?e=20-=20removed=20the=20mail=20intro=20and=20set=20sizes=20into?= =?UTF-8?q?=20vars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Wendling --- js/controller/ShareController.js | 17 ++++++++++++----- templates/part.content.php | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js index 21f30608f..0edab4a27 100644 --- a/js/controller/ShareController.js +++ b/js/controller/ShareController.js @@ -21,6 +21,11 @@ app.controller('ShareController', function (ShareResource, Loading) { /** True if the most recent request failed */ this.searchUsersFailed = false; + /** */ + this.facebookLimit = 180; + this.twitterLimit = 100; + this.emailLimit = 180; + /** * @param search Username search query * @@ -174,14 +179,16 @@ app.controller('ShareController', function (ShareResource, Loading) { }; this.getFacebookUrl = function(url, intro){ - return 'https://www.facebook.com/sharer/sharer.php?u='+url + '"e=' + intro.substring(0,100)+'...'; + return `https://www.facebook.com/sharer/sharer.php?u=${url}"e=${intro.substring(0,this.facebookLimit)}`+ + `...`; }; this.getTwitterUrl = function(url, intro){ - return 'https://twitter.com/intent/tweet?url='+url+'&text=' +'\n'+ intro.substring(0,100)+'...'; - }; + return `https://twitter.com/intent/tweet?url=${url}&text=${intro.substring(0,this.twitterLimit)}`+ + `...`; + }; - this.getEmailUrl = function(url, object, body, intro){ - return encodeURI('mailto:?subject=' + object + '&body='+intro+'...\n'+ body + '\n' + url); + this.getEmailUrl = function(url, object, intro){ + return encodeURI(`mailto:?subject=${object}&body=${intro.substring(0,this.emailLimit)}...\n\n${url}`); }; }); diff --git a/templates/part.content.php b/templates/part.content.php index 3183991f9..3dcb3b00a 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -168,7 +168,7 @@
+ ng-href="{{ Share.getEmailUrl(item.url, 't('I wanted you to see this article')) ?>', item.intro) }}">
-- cgit v1.2.3