]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frio/js/theme.js
Merge develop into 20170321_-_frio-fbbrowser
[friendica.git] / view / theme / frio / js / theme.js
index 09f96da36c757d9438bc4b608531fe1e89375a73..8a3bd4110972ff4235224098dad9f78976368328 100644 (file)
@@ -618,6 +618,27 @@ 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;
+}
+
 // Decodes a hexadecimally encoded binary string
 function hex2bin (s) {
        //  discuss at: http://locutus.io/php/hex2bin/
@@ -666,4 +687,4 @@ function bin2hex (s) {
        }
 
        return o;
-}
\ No newline at end of file
+}