Aquarius.component.define('Frontend/Share', function ($element, options) { var defaults = { googlePlus: 'http://plus.google.com/share?url=', twitter: 'http://www.twitter.com/share?url=', }; function Share() { } Share.prototype = { init: function () { var self = this; this.$element = $element; this.defaults = defaults; this.options = Aquarius.extend(this.defaults, options); this.share(); }, share: function () { var self = this; self.$element.on('click', function (e) { switch (e.target.id) { case 'google': { var open = window.open(self.options.googlePlus + self.options.url, "google", "width=500,height=400"); break; } case 'twitter': { var open = window.open(self.options.twitter + self.options.url, "twitter", "width=500,height=400"); break; } case "facebook": { FB.ui({ method: 'share', href: self.options.url, picture: self.options.picture, title: self.options.title }, function (response) { }); break; } } } ); } }; return Share; });