Blame view
sources/apps/files_sharing/js/public.js
1.76 KB
|
03e52840d
|
1 2 3 4 5 6 7 8 |
// Override download path to files_sharing/public.php
function fileDownloadPath(dir, file) {
var url = $('#downloadURL').val();
if (url.indexOf('&path=') != -1) {
url += '/'+file;
}
return url;
}
|
|
03e52840d
|
9 |
$(document).ready(function() {
|
|
03e52840d
|
10 11 12 |
if (typeof FileActions !== 'undefined') {
var mimetype = $('#mimetype').val();
// Show file preview if previewer is available, images are already handled by the template
|
|
31b7f2792
|
13 |
if (mimetype.substr(0, mimetype.indexOf('/')) != 'image' && $('.publicpreview').length === 0) {
|
|
03e52840d
|
14 15 |
// Trigger default action if not download TODO var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); |
|
a293d369c
|
16 |
if (typeof action !== 'undefined') {
|
|
03e52840d
|
17 18 19 20 |
action($('#filename').val());
}
}
FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function(filename) {
|
|
a293d369c
|
21 |
var tr = FileList.findFileEl(filename); |
|
03e52840d
|
22 23 24 25 26 |
if (tr.length > 0) {
window.location = $(tr).find('a.name').attr('href');
}
});
FileActions.register('file', 'Download', OC.PERMISSION_READ, '', function(filename) {
|
|
a293d369c
|
27 |
var tr = FileList.findFileEl(filename); |
|
03e52840d
|
28 29 30 31 32 |
if (tr.length > 0) {
window.location = $(tr).find('a.name').attr('href');
}
});
FileActions.register('dir', 'Download', OC.PERMISSION_READ, '', function(filename) {
|
|
a293d369c
|
33 |
var tr = FileList.findFileEl(filename); |
|
03e52840d
|
34 35 36 37 38 |
if (tr.length > 0) {
window.location = $(tr).find('a.name').attr('href')+'&download';
}
});
}
|
|
31b7f2792
|
39 40 41 42 43 44 45 46 47 |
var file_upload_start = $('#file_upload_start');
file_upload_start.on('fileuploadadd', function(e, data) {
// Add custom data to the upload handler
data.formData = {
requesttoken: $('#publicUploadRequestToken').val(),
dirToken: $('#dirToken').val(),
subdir: $('input#dir').val()
};
});
|
|
a293d369c
|
48 49 50 |
$(document).on('click', '#directLink', function() {
$(this).focus();
$(this).select();
|
|
31b7f2792
|
51 |
}); |
|
03e52840d
|
52 |
|
|
03e52840d
|
53 |
}); |