$(document).ready(function() {

	var disableSharing = $('#disableSharing').data('status'),
		sharesLoaded = false;

	if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined'  && !disableSharing) {
		$('#fileList').on('fileActionsReady',function(){

			var allShared = $('*[data-share-owner]').find('[data-Action="Share"]');
			allShared.addClass('permanent');
			allShared.find('span').text(function(){
				$owner = $(this).closest('tr').attr('data-share-owner');
				return ' ' + t('files_sharing', 'shared by {owner}', {owner: $owner});
			});

			if (!sharesLoaded){
				OC.Share.loadIcons('file');
				// assume that we got all shares, so switching directories
				// will not invalidate that list
				sharesLoaded = true;
			}
			else{
				OC.Share.updateIcons('file');
			}
		});

		FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
			if ($('#dir').val() == '/') {
				var item = $('#dir').val() + filename;
			} else {
				var item = $('#dir').val() + '/' + filename;
			}
			var tr = FileList.findFileEl(filename);
			if ($(tr).data('type') == 'dir') {
				var itemType = 'folder';
			} else {
				var itemType = 'file';
			}
			var possiblePermissions = $(tr).data('permissions');
			var appendTo = $(tr).find('td.filename');
			// Check if drop down is already visible for a different file
			if (OC.Share.droppedDown) {
				if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
					OC.Share.hideDropDown(function () {
						$(tr).addClass('mouseOver');
						OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
					});
				} else {
					OC.Share.hideDropDown();
				}
			} else {
				$(tr).addClass('mouseOver');
				OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
			}
		});
	}
});

@@ -919,20 +919,26 @@
 e) %7B%0A%09%09%09
-if (
+var dir = 
 $('#dir'
@@ -948,20 +948,10 @@
 al()
- == '/') %7B%0A%09
+;%0A
 %09%09%09v
@@ -961,30 +961,25 @@
 item = $
-('#dir').val()
+dir + '/'
  + filen
@@ -990,33 +990,39 @@
 %0A%09%09%09
-%7D else
+if ($dir == '/')
  %7B%0A%09%09%09%09
-var 
 item = $
 ('#d
@@ -1021,28 +1021,11 @@
  = $
-('#dir').val() + '/'
+dir
  + f
@@ -1081,16 +1081,42 @@
 ename);%0A
+%09%09%09var itemType = 'file';%0A
 %09%09%09if ($
@@ -1145,28 +1145,24 @@
 dir') %7B%0A%09%09%09%09
-var 
 itemType = '
@@ -1174,47 +1174,8 @@
 r';%0A
-%09%09%09%7D else %7B%0A%09%09%09%09var itemType = 'file';%0A
 %09%09%09%7D

remove duplicate selectors and declaration