summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/reader/ShareView.js
blob: ab358e39a747cc177dfdf373f6194b2dda7fff7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var ShareView = View.extend({
  el: ".share",
  
  events: {
    "click #share_facebook": "facebook",
    "click #share_twitter": "twitter",
  }

	initialize: function(opt){
	  this.parent = opt.parent
	},

	facebook: function (e) {
	  e.preventDefault()
	  var msg = $(".roomName").html() + " on VValls"
		var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(window.location.origin + window.location.pathname) + "&t=" + encodeURIComponent(msg);
		window.open(url, "_blank")
	},

	twitter: function (e) {
	  e.preventDefault()
	  var msg = $(".roomName").html() + " on VValls"
		var url = "https://twitter.com/home?status=" + encodeURIComponent(window.location.origin + window.location.pathname + " " + msg);
		window.open(url, "_blank")
	}

}