diff options
author | Max Kostikov <max@kostikov.co> | 2019-12-02 17:07:12 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-12-02 17:07:12 +0100 |
commit | 4958e3b42c6ef1a36332debee581d1016a4cff41 (patch) | |
tree | 5831c2bf9a9487f549148d9700f8f8c98c2ff7a9 /view | |
parent | cc3edeb6f50c5648f65283e7525d33a174eb7a1b (diff) | |
download | volse-hubzilla-4958e3b42c6ef1a36332debee581d1016a4cff41.tar.gz volse-hubzilla-4958e3b42c6ef1a36332debee581d1016a4cff41.tar.bz2 volse-hubzilla-4958e3b42c6ef1a36332debee581d1016a4cff41.zip |
Unpin item on drop
Diffstat (limited to 'view')
-rw-r--r-- | view/js/main.js | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/view/js/main.js b/view/js/main.js index 94f290fae..24840ca98 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1124,21 +1124,20 @@ function doscrollback(pos) { function dopin(id) { id = id.toString(); $('#like-rotator-' + id).show(); - $.post('pin', { 'id' : id } ) + $.post('pin', { 'id' : id }) .done(function() { var i = $('#wall-item-pinned-' + id); var me = $('#item-pinnable-' + id); if($('#pinned-wrapper-' + id).length) { $('html, body').animate({ scrollTop: $('#region_2').offset().top }, 'slow', function() { - $('#pinned-wrapper-' + id).fadeOut(function() { this.remove(); - }); + $('#pinned-wrapper-' + id).fadeTo('fast', 0.33, function() { this.remove(); }); }); }; $('.wall-item-pinned').remove(); if(i.length) me.html(me.html().replace(aStr['unpin_item'],aStr['pin_item'])); else { - $('<span class="float-right wall-item-pinned" title="' + aStr['pinned'] + '" id="wall-item-pinned-' + id + '"><i class="fa fa-thumb-tack"> </i></span>') + $('<span class="float-right wall-item-pinned" title="' + aStr['pinned'] + '" id="wall-item-pinned-' + id + '"><i class="fa fa-thumb-tack"> </i></span>').insertBefore('#wall-item-info-' + id); me.html(me.html().replace(aStr['pin_item'],aStr['unpin_item'])); }; }) @@ -1150,22 +1149,24 @@ function dopin(id) { }); } -function dropItem(url, object) { +function dropItem(url, object) { - var confirm = confirmDelete(); - if(confirm) { - $('body').css('cursor', 'wait'); - $(object).fadeTo('fast', 0.33, function () { - $.get(url).done(function() { - $(object).remove(); - $('body').css('cursor', 'auto'); - }); - }); - return true; - } - else { - return false; - } + var confirm = confirmDelete(); + if(confirm) { + var id = url.split('/')[2]; + $('body').css('cursor', 'wait'); + $(object + ', #pinned-wrapper-' + id).fadeTo('fast', 0.33, function () { + $.post('pin', { 'id' : id }); + $.get(url).done(function() { + $(object + ', #pinned-wrapper-' + id).remove(); + $('body').css('cursor', 'auto'); + }); + }); + return true; + } + else { + return false; + } } function dosubthread(ident) { |