X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Ffrio%2Fjs%2Ftheme.js;h=4e8ede07fd965289a63c996aa1fec2f0e50e4948;hb=85144908fa9cf12594b568f4f0b2d37fa21b6be1;hp=62cd85df9b53975e96ced89b868c78a489cae9ff;hpb=88a69b93d57ea91223847f9a967841008aebaea2;p=friendica.git diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 62cd85df9b..4e8ede07fd 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -617,3 +617,24 @@ function htmlToText(htmlString) { return text; } + +/** + * Sends a /like API call and updates the display of the relevant action button + * before the update reloads the item. + * + * @param {string} ident The id of the relevant item + * @param {string} verb The verb of the action + * @returns {undefined} + */ +function doLikeAction(ident, verb) { + unpause(); + + if (verb.indexOf('attend') === 0) { + $('.item-' + ident + ' .button-event:not(#' + verb + '-' + ident + ')').removeClass('active'); + } + $('#' + verb + '-' + ident).toggleClass('active'); + $('#like-rotator-' + ident.toString()).show(); + $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate ); + liking = 1; + force_update = true; +} \ No newline at end of file