]> git.mxchange.org Git - friendica.git/commitdiff
reduce indentation
authorJakobus Schürz <jakobus.schuerz@schuerz.at>
Thu, 9 Mar 2023 16:43:14 +0000 (17:43 +0100)
committerJakobus Schürz <jakobus.schuerz@schuerz.at>
Tue, 14 Mar 2023 16:32:11 +0000 (17:32 +0100)
view/theme/frio/js/theme.js

index ba3831aa9b53235c3870240c2fd9d6541f78f5f6..f40c8d30691e1d9280ad41c8aa21750571c67fbc 100644 (file)
@@ -808,67 +808,64 @@ function doActivityItemAction(ident, verb, un) {
 
        // do request for activity
        $.post('item/' + ident.toString() + '/activity/' + _verb)
-       .success(
-               function(data){
-                       //$('#like-rotator-' + ident.toString()).hide();
-                       $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
-                       if (data.status == 'ok') {
-                               // response from server was ok
+       .success(function(data){
+               //$('#like-rotator-' + ident.toString()).hide();
+               $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
+               if (data.status == 'ok') {
+                       // response from server was ok
+                       if (data.verb == 'un' + verb) {
+                               // like/dislike buttons
+                               $('button[id^=' + verb + '-' + ident.toString() + ']' )
+                                       .removeClass('active')
+                                       .attr('onclick', 'doActivityItemAction(' + ident +', "' + verb + '",false )').change();
+                               // link in share-menu
+                               $('a[id^=' + verb + '-' + ident.toString() + ']' )
+                                       .removeClass('active')
+                                       .attr('href', 'javascript:doActivityItemAction(' + ident +', "' + verb + '",false )').change();
+                               $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child' ).addClass('fa-retweet').removeClass('fa-ban');
+                       } else {
+                               // like/dislike buttons
+                               $('button[id^=' + verb + '-' + ident.toString() + ']' )
+                                       .addClass('active')
+                                       .attr('onclick', 'doActivityItemAction(' + ident + ', "' + verb + '", true )').change();
+                               // link in share-menu
+                               $('a[id^=' + verb + '-' + ident.toString() + ']' )
+                                       .addClass('active')
+                                       .attr('href', 'javascript:doActivityItemAction(' + ident + ', "' + verb + '", true )').change();
+                               $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child' ).removeClass('fa-retweet').addClass('fa-ban');
+                       }
+                       $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass).show();
+                       if (verb.indexOf('announce') === 0 ) {
+                               // ShareMenuButton
+                               $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
                                if (data.verb == 'un' + verb) {
-                                       // like/dislike buttons
-                                       $('button[id^=' + verb + '-' + ident.toString() + ']' )
-                                               .removeClass('active')
-                                               .attr('onclick', 'doActivityItemAction(' + ident +', "' + verb + '",false )').change();
-                                       // link in share-menu
-                                       $('a[id^=' + verb + '-' + ident.toString() + ']' )
-                                               .removeClass('active')
-                                               .attr('href', 'javascript:doActivityItemAction(' + ident +', "' + verb + '",false )').change();
-                                       $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child' ).addClass('fa-retweet').removeClass('fa-ban');
+                                       $('button[id^=shareMenuOptions-' + ident.toString() + ']').removeClass('active');
                                } else {
-                                       // like/dislike buttons
-                                       $('button[id^=' + verb + '-' + ident.toString() + ']' )
-                                               .addClass('active')
-                                               .attr('onclick', 'doActivityItemAction(' + ident + ', "' + verb + '", true )').change();
-                                       // link in share-menu
-                                       $('a[id^=' + verb + '-' + ident.toString() + ']' )
-                                               .addClass('active')
-                                               .attr('href', 'javascript:doActivityItemAction(' + ident + ', "' + verb + '", true )').change();
-                                       $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child' ).removeClass('fa-retweet').addClass('fa-ban');
+                                       $('button[id^=shareMenuOptions-' + ident.toString() + ']').addClass('active');
                                }
-                               $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass).show();
-                               if (verb.indexOf('announce') === 0 ) {
-                                       // ShareMenuButton
-                                       $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
-                                       if (data.verb == 'un' + verb) {
-                                               $('button[id^=shareMenuOptions-' + ident.toString() + ']').removeClass('active');
-                                       } else {
-                                               $('button[id^=shareMenuOptions-' + ident.toString() + ']').addClass('active');
-                                       }
-
-                               } 
-                       } else {
-                               /* server-response was not ok. Database-problems or some changes in
-                                * data?
-                                * reset all buttons
-                                */
-                               $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
-                               $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
-                               $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
-                               $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
-                               $.jGrowl(verb + ' not successful (server error)', {sticky: false, theme: 'info', life: 5000});
                        }
-               })
-       .error(
-                       function(data){
-                               /* Server could not be reaches successfully */
-                               // remindert to remove the like-rotator from templates
-                               //$('#like-rotator-' + ident.toString()).hide();
-                               $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
-                               $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
-                               $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
-                               $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
-                               $.jGrowl(verb + ' not successful (network error)', {sticky: false, theme: 'info', life: 5000});
-               });
+               } else {
+                       /* server-response was not ok. Database-problems or some changes in
+                        * data?
+                        * reset all buttons
+                        */
+                       $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
+                       $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
+                       $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
+                       $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
+                       $.jGrowl(verb + ' not successful (server error)', {sticky: false, theme: 'info', life: 5000});
+               }
+       })
+       .error(function(data){
+                       /* Server could not be reaches successfully */
+                       // remindert to remove the like-rotator from templates
+                       //$('#like-rotator-' + ident.toString()).hide();
+                       $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
+                       $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
+                       $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
+                       $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
+                       $.jGrowl(verb + ' not successful (network error)', {sticky: false, theme: 'info', life: 5000});
+       });
 }
 
 // Decodes a hexadecimally encoded binary string