From 44040201f9d28ea5ea78dfd847d2c72dafcef038 Mon Sep 17 00:00:00 2001 From: Fabien Basmaison Date: Tue, 6 Apr 2021 17:57:39 +0200 Subject: [PATCH] [assets] Move interact function. --- bookwyrm/static/js/bookwyrm.js | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index 0ec14336f..b3959e30e 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -174,30 +174,6 @@ let BookWyrm = new class { } } - /** - * Make a request and update the UI accordingly. - * This function is used for boosts and favourites. - * - * @todo Only update status if the promise is successful. - * - * @param {Event} event - * - * @return {undefined} - */ - interact(event) { - event.preventDefault(); - - this.ajaxPost(event.target); - - // @todo This probably should be done with IDs. - document.querySelectorAll(`.${event.target.dataset.id}`) - .forEach(node => this.addRemoveClass( - node, - 'hidden', - node.className.indexOf('hidden') == -1 - )); - } - /** * Show or hide menus. * @@ -260,6 +236,30 @@ let BookWyrm = new class { }, 0); } + /** + * Make a request and update the UI accordingly. + * This function is used for boosts and favourites. + * + * @todo Only update status if the promise is successful. + * + * @param {Event} event + * + * @return {undefined} + */ + interact(event) { + event.preventDefault(); + + this.ajaxPost(event.target); + + // @todo This probably should be done with IDs. + document.querySelectorAll(`.${event.target.dataset.id}`) + .forEach(node => this.addRemoveClass( + node, + 'hidden', + node.className.indexOf('hidden') == -1 + )); + } + /** * Submit a form using POST. *