use css to show/hide fileactions
This commit is contained in:
parent
d9ef6da2e4
commit
fe6b987b3d
|
@ -63,7 +63,6 @@ var FileActions = {
|
||||||
},
|
},
|
||||||
display: function (parent) {
|
display: function (parent) {
|
||||||
FileActions.currentFile = parent;
|
FileActions.currentFile = parent;
|
||||||
$('#fileList span.fileactions, #fileList td.date a.action').remove();
|
|
||||||
var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
|
var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
|
||||||
var file = FileActions.getCurrentFile();
|
var file = FileActions.getCurrentFile();
|
||||||
if ($('tr').filterAttr('data-file', file).data('renaming')) {
|
if ($('tr').filterAttr('data-file', file).data('renaming')) {
|
||||||
|
@ -73,15 +72,15 @@ var FileActions = {
|
||||||
var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
|
var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
|
||||||
for (name in actions) {
|
for (name in actions) {
|
||||||
// NOTE: Temporary fix to prevent rename action in root of Shared directory
|
// NOTE: Temporary fix to prevent rename action in root of Shared directory
|
||||||
if (name == 'Rename' && $('#dir').val() == '/Shared') {
|
if (name === 'Rename' && $('#dir').val() === '/Shared') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((name == 'Download' || actions[name] != defaultAction) && name != 'Delete') {
|
if ((name === 'Download' || actions[name] !== defaultAction) && name !== 'Delete') {
|
||||||
var img = FileActions.icons[name];
|
var img = FileActions.icons[name];
|
||||||
if (img.call) {
|
if (img.call) {
|
||||||
img = img(file);
|
img = img(file);
|
||||||
}
|
}
|
||||||
var html = '<a href="#" class="action" style="display:none">';
|
var html = '<a href="#" class="action">';
|
||||||
if (img) {
|
if (img) {
|
||||||
html += '<img src="' + img + '"/> ';
|
html += '<img src="' + img + '"/> ';
|
||||||
}
|
}
|
||||||
|
@ -89,14 +88,13 @@ var FileActions = {
|
||||||
var element = $(html);
|
var element = $(html);
|
||||||
element.data('action', name);
|
element.data('action', name);
|
||||||
element.click(function (event) {
|
element.click(function (event) {
|
||||||
|
FileActions.currentFile = $(this).parent().parent().parent();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var action = actions[$(this).data('action')];
|
var action = actions[$(this).data('action')];
|
||||||
var currentFile = FileActions.getCurrentFile();
|
var currentFile = FileActions.getCurrentFile();
|
||||||
FileActions.hide();
|
|
||||||
action(currentFile);
|
action(currentFile);
|
||||||
});
|
});
|
||||||
element.hide();
|
|
||||||
parent.find('a.name>span.fileactions').append(element);
|
parent.find('a.name>span.fileactions').append(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,9 +105,9 @@ var FileActions = {
|
||||||
}
|
}
|
||||||
// NOTE: Temporary fix to allow unsharing of files in root of Shared folder
|
// NOTE: Temporary fix to allow unsharing of files in root of Shared folder
|
||||||
if ($('#dir').val() == '/Shared') {
|
if ($('#dir').val() == '/Shared') {
|
||||||
var html = '<a href="#" original-title="' + t('files', 'Unshare') + '" class="action delete" style="display:none" />';
|
var html = '<a href="#" original-title="' + t('files', 'Unshare') + '" class="action delete" />';
|
||||||
} else {
|
} else {
|
||||||
var html = '<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" style="display:none" />';
|
var html = '<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" />';
|
||||||
}
|
}
|
||||||
var element = $(html);
|
var element = $(html);
|
||||||
if (img) {
|
if (img) {
|
||||||
|
@ -121,22 +119,10 @@ var FileActions = {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var action = actions[$(this).data('action')];
|
var action = actions[$(this).data('action')];
|
||||||
var currentFile = FileActions.getCurrentFile();
|
var currentFile = FileActions.getCurrentFile();
|
||||||
FileActions.hide();
|
|
||||||
action(currentFile);
|
action(currentFile);
|
||||||
});
|
});
|
||||||
element.hide();
|
|
||||||
parent.parent().children().last().append(element);
|
parent.parent().children().last().append(element);
|
||||||
}
|
}
|
||||||
$('#fileList .action').css('-o-transition-property', 'none');//temporarly disable
|
|
||||||
$('#fileList .action').fadeIn(200, function () {
|
|
||||||
$('#fileList .action').css('-o-transition-property', 'opacity');
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
hide: function () {
|
|
||||||
$('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200, function () {
|
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getCurrentFile: function () {
|
getCurrentFile: function () {
|
||||||
return FileActions.currentFile.parent().attr('data-file');
|
return FileActions.currentFile.parent().attr('data-file');
|
||||||
|
@ -163,6 +149,10 @@ $(document).ready(function () {
|
||||||
}, function (filename) {
|
}, function (filename) {
|
||||||
window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val());
|
window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#fileList tr').each(function(){
|
||||||
|
FileActions.display($(this).children('td.filename'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
FileActions.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
|
FileActions.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
|
||||||
|
|
|
@ -62,14 +62,6 @@ $(document).ready(function() {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sets the file-action buttons behaviour :
|
|
||||||
$('tr').live('mouseenter',function(event) {
|
|
||||||
FileActions.display($(this).children('td.filename'));
|
|
||||||
});
|
|
||||||
$('tr').live('mouseleave',function(event) {
|
|
||||||
FileActions.hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
var lastChecked;
|
var lastChecked;
|
||||||
|
|
||||||
// Sets the file link behaviour :
|
// Sets the file link behaviour :
|
||||||
|
|
|
@ -112,10 +112,11 @@ label.infield { cursor: text !important; }
|
||||||
#notification { z-index:101; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position:fixed; left:50%; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
#notification { z-index:101; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position:fixed; left:50%; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
||||||
#notification span { cursor:pointer; font-weight:bold; margin-left:1em; }
|
#notification span { cursor:pointer; font-weight:bold; margin-left:1em; }
|
||||||
|
|
||||||
.action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter:alpha(opacity=50); opacity:.5; -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; }
|
tr .action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; }
|
||||||
.action { width: 16px; height: 16px; }
|
tr:hover .action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter:alpha(opacity=50); opacity:.5; }
|
||||||
|
tr .action { width: 16px; height: 16px; }
|
||||||
.header-action { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; }
|
.header-action { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; }
|
||||||
.action:hover, .selectedActions a:hover, .header-action:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
|
tr:hover .action:hover, .selectedActions a:hover, .header-action:hover { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
|
||||||
|
|
||||||
table:not(.nostyle) tr { -webkit-transition:background-color 200ms; -moz-transition:background-color 200ms; -o-transition:background-color 200ms; transition:background-color 200ms; }
|
table:not(.nostyle) tr { -webkit-transition:background-color 200ms; -moz-transition:background-color 200ms; -o-transition:background-color 200ms; transition:background-color 200ms; }
|
||||||
tbody tr:hover, tr:active { background-color:#f8f8f8; }
|
tbody tr:hover, tr:active { background-color:#f8f8f8; }
|
||||||
|
|
Loading…
Reference in New Issue