diff options
author | Brice Maron <brice@bmaron.net> | 2011-10-20 23:02:38 +0200 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2011-10-20 23:03:05 +0200 |
commit | 2906ea3d78d2ff8ebfa3ceebe1c8cb5afa43225a (patch) | |
tree | 86db83fabc78d1fb99a69c510b2f5eead0b3f911 /apps/files_sharing/js/share.js | |
parent | 3a937f79f72117be16d905d1fa421d93130a48a3 (diff) | |
download | nextcloud-server-2906ea3d78d2ff8ebfa3ceebe1c8cb5afa43225a.tar.gz nextcloud-server-2906ea3d78d2ff8ebfa3ceebe1c8cb5afa43225a.zip |
Add caching for filelist sharing icon status to avoid many http req.
Diffstat (limited to 'apps/files_sharing/js/share.js')
-rw-r--r-- | apps/files_sharing/js/share.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index aaffc3824ea..c0fc91e92ad 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -1,8 +1,11 @@ $(document).ready(function() { + var shared_status = {}; if (typeof FileActions !== 'undefined') { FileActions.register('all', 'Share', function(filename) { var icon; var file = $('#dir').val()+'/'+filename; + if(shared_status[file]) + return shared_status[file].icon; $.ajax({ type: 'GET', url: OC.linkTo('files_sharing', 'ajax/getitem.php'), @@ -20,6 +23,7 @@ $(document).ready(function() { } else { icon = OC.imagePath('core', 'actions/share'); } + shared_status[file]= { timestamp: new Date().getTime(), icon: icon }; } }); return icon; @@ -54,6 +58,7 @@ $(document).ready(function() { $(this).click(function(event) { if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) { if ($('#dropdown').is(':visible')) { + delete shared_status[$('#dropdown').data('file')]; //Remove File from icon cache $('#dropdown').hide('blind', function() { $('#dropdown').remove(); $('tr').removeClass('mouseOver'); |