aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/public.js
blob: 92b626bba18510c5dce916dbd6119d838efdb8b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Override download path to files_sharing/public.php
function fileDownloadPath(dir, file) {
	return $('#downloadURL').val();
}

$(document).ready(function() {

	if (typeof FileActions !== 'undefined') {
		var mimetype = $('#mimetype').val();
		// Show file preview if previewer is available, images are already handled by the template
		if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') {
			// Trigger default action if not download TODO
			var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ);
			if (typeof action === 'undefined') {
				$('#noPreview').show();
			} else {
				action($('#filename').val());
			}
		}
	}

});