From 4a8e222763244ee919261f26bb30a4e1e12aa1cf Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Wed, 4 Dec 2019 11:11:39 +0100 Subject: Fix update pin / unpin button text on pinned item replace --- view/js/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 78ed8a6c9..f45a06b24 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1128,15 +1128,15 @@ function dopin(id) { .done(function() { var i = $('#wall-item-pinned-' + id); var me = $('#item-pinnable-' + id); - if($('#pinned-wrapper-' + id).length) { + if($('.pinned-item').length) { $('html, body').animate({ scrollTop: $('#region_2').offset().top }, 'slow', function() { - $('#pinned-wrapper-' + id).fadeTo('fast', 0.33, function() { this.remove(); }); + $('.pinned-item').fadeTo('fast', 0.33, function() { this.remove(); }); }); }; - if(i.length) - me.html(me.html().replace(aStr['unpin_item'],aStr['pin_item'])); - else { - $(' ').insertBefore('#wall-item-info-' + id); + $('.wall-item-pinned').remove(); + $('.dropdown-item-pinnable').html($('.dropdown-item-pinnable').html().replace(aStr['unpin_item'],aStr['pin_item'])); + if(i.length == 0) { + $(' ') me.html(me.html().replace(aStr['pin_item'],aStr['unpin_item'])); }; }) -- cgit v1.2.3