2015-04-22 07:50:11 +09:00
|
|
|
Meteor.startup(function () {
|
2015-05-18 10:30:08 +09:00
|
|
|
Template.post_share.helpers({
|
2015-08-12 15:22:05 +09:00
|
|
|
encodedTitle: function () {
|
|
|
|
return encodeURIComponent(this.title);
|
|
|
|
},
|
|
|
|
sourceLink: function () {
|
2015-06-18 13:04:38 +09:00
|
|
|
return !!this.url ? this.url : Posts.getPageUrl(this);
|
2015-04-22 07:50:11 +09:00
|
|
|
},
|
|
|
|
viaTwitter: function () {
|
|
|
|
return !!Settings.get('twitterAccount') ? 'via='+Settings.get('twitterAccount') : '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-05-18 10:30:08 +09:00
|
|
|
Template.post_share.events({
|
2015-04-22 07:50:11 +09:00
|
|
|
'click .share-link': function(e){
|
|
|
|
var $this = $(e.target).parents('.post-share').find('.share-link');
|
|
|
|
var $share = $this.parents('.post-share').find('.share-options');
|
|
|
|
e.preventDefault();
|
|
|
|
$('.share-link').not($this).removeClass("active");
|
|
|
|
$(".share-options").not($share).addClass("hidden");
|
|
|
|
$this.toggleClass("active");
|
|
|
|
$share.toggleClass("hidden");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|