From 0a9d1ed3a645efda56ae757f45aa7efb5a35ce4f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 27 Aug 2012 15:46:05 -0400 Subject: Initial previewer for public links --- apps/files_sharing/js/public.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 apps/files_sharing/js/public.js (limited to 'apps/files_sharing/js') diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js new file mode 100644 index 00000000000..755382e0736 --- /dev/null +++ b/apps/files_sharing/js/public.js @@ -0,0 +1,18 @@ +// 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', FileActions.PERMISSION_READ); + action($('#filename').val()); + } + } + +}); \ No newline at end of file -- cgit v1.2.3