Merge branch 'hotfix/21.56.9' into master
[gitter.git] / public / js / utils / social.js
bloba43b175bb6eda22ec53e13c9595516167fb9b716
1 'use strict';
3 var assertRoom = function(uri) {
4 if (!uri) {
5 throw new Error('share urls require a room uri');
7 };
9 module.exports = {
10 generateTwitterShareUrl: function(uri) {
11 assertRoom(uri);
13 return (
14 'https://twitter.com/share?' +
15 'text=' +
16 encodeURIComponent('Join the chat room on Gitter for ' + uri + ':') +
17 '&url=https://gitter.im/' +
18 uri +
19 '&related=gitchat' +
20 '&via=gitchat'
24 generateFacebookShareUrl: function(uri) {
25 assertRoom(uri);
27 return 'http://www.facebook.com/sharer/sharer.php?u=https://gitter.im/' + uri;
30 generateLinkedinShareUrl: function(uri) {
31 assertRoom(uri);
33 return (
34 'https://www.linkedin.com/shareArticle?' +
35 'mini=true' +
36 '&url=https://gitter.im/' +
37 uri +
38 '&title=' +
39 encodeURIComponent(uri + ' on Gitter') +
40 '&summary=' +
41 encodeURIComponent('Join the chat room on Gitter for ' + uri) +
42 '&source=Gitter'
46 generateGooglePlusShareUrl: function(uri) {
47 assertRoom(uri);
49 return 'https://plus.google.com/share?url=https://gitter.im/' + uri;