summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Wendling <nicolas.wendling1011@gmail.com>2021-03-25 14:01:07 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commitacd944a6ef5af09d523a8638009ca10d0a7a8e37 (patch)
tree419191f3853d6cb669ccbce14253d41d1e98076e
parentb9fec49b66b895fb04dc35ad8bb19260f309a5b7 (diff)
🎨 twitter / facebook / mail share - removed the mail intro and set sizes into vars
Signed-off-by: Nicolas Wendling <nicolas.wendling1011@gmail.com>
-rw-r--r--js/controller/ShareController.js17
-rw-r--r--templates/part.content.php2
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 + '&quote=' + intro.substring(0,100)+'...';
+ return `https://www.facebook.com/sharer/sharer.php?u=${url}&quote=${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 @@
</div>
<div ng-if="Share.isSocialAppEnabled('email')" class="col-4">
<a class="icon-dropdown icon-mail pr-5"
- ng-href="{{ Share.getEmailUrl(item.url, '<?php p($l->t('I wanted you to see this article')) ?>', '<?php p($l->t('Check out this article')) ?>', item.intro)}}"></a>
+ ng-href="{{ Share.getEmailUrl(item.url, '<?php p($l->t('I wanted you to see this article')) ?>', item.intro) }}"></a>
</div>
</div>
</div>