aboutsummaryrefslogtreecommitdiff
path: root/p
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2017-11-04 21:19:51 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-11-04 21:19:51 +0100
commitafffbfce0758391a52c8c0c5b9766643a49065e8 (patch)
tree0e9e37ab03d954672f45783d22c58c78876b0531 /p
parent05b1901fcdbb051077d12f776980484d3b782970 (diff)
Add a Mastodon share (#1674)
See #1521
Diffstat (limited to 'p')
-rw-r--r--p/scripts/main.js11
1 files changed, 11 insertions, 0 deletions
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 {