From afffbfce0758391a52c8c0c5b9766643a49065e8 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 4 Nov 2017 21:19:51 +0100 Subject: Add a Mastodon share (#1674) See #1521 --- p/scripts/main.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'p') diff --git a/p/scripts/main.js b/p/scripts/main.js index 278ecfee9..ce8070008 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1172,6 +1172,14 @@ function init_print_action() { }); } +function init_post_action() { + $('.item.share > a[href="POST"]').click(function (event) { + event.preventDefault(); + var form = $(this).next('form'); + $.post(form.data('url'), form.serialize()); + }); +} + function init_share_observers() { shares = $('.group-share').length; @@ -1182,6 +1190,8 @@ function init_share_observers() { row = row.replace(/##type##/g, opt.val()); row = row.replace(/##help##/g, opt.data('help')); row = row.replace(/##key##/g, shares); + row = row.replace(/##method##/g, opt.data('method')); + row = row.replace(/##field##/g, opt.data('field')); $(this).parents('.form-group').before(row); shares++; @@ -1398,6 +1408,7 @@ function init_afterDOM() { init_posts(); init_nav_entries(); init_print_action(); + init_post_action(); init_notifs_html5(); window.setInterval(refreshUnreads, 120000); } else { -- cgit v1.2.3