diff options
author | Nicolas Wendling <nicolas.wendling1011@gmail.com> | 2021-03-25 14:01:07 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 23:17:31 +0200 |
commit | acd944a6ef5af09d523a8638009ca10d0a7a8e37 (patch) | |
tree | 419191f3853d6cb669ccbce14253d41d1e98076e /js | |
parent | b9fec49b66b895fb04dc35ad8bb19260f309a5b7 (diff) |
🎨 twitter / facebook / mail share - removed the mail intro and set sizes into vars
Signed-off-by: Nicolas Wendling <nicolas.wendling1011@gmail.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/controller/ShareController.js | 17 |
1 files changed, 12 insertions, 5 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}`); }; }); |