+ ns.add_enlarged_thumbnail = function(e) {
+ var file_id = $(e.target).data('file-id');
+ var file_version = $(e.target).data('file-version');
+ var overlay_img_id = 'enlarged_thumb_' + file_id;
+ if (file_version) { overlay_img_id = overlay_img_id + '_' + file_version };
+ var overlay_img = $('#' + overlay_img_id);
+
+ if (overlay_img.data('is-overlay-shown') == 1) return;
+
+ $('.thumbnail').off('mouseover');
+ overlay_img.data('is-overlay-shown', 1);
+ overlay_img.show();
+
+ if (overlay_img.data('is-overlay-loaded') == 1) return;
+
+ var data = {
+ action: 'File/ajax_get_thumbnail',
+ file_id: file_id,
+ file_version: file_version,
+ size: 512
+ };
+
+ $.post("controller.pl", data, kivi.eval_json_result);
+ };
+
+ ns.remove_enlarged_thumbnail = function(e) {
+ $(e.target).hide();
+ $(e.target).data('is-overlay-shown', 0);
+ $('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail);
+ };
+
+ ns.download = function(e) {
+ var file_id = $(e.target).data('file-id');
+ var file_version = $(e.target).data('file-version');
+
+ var data = {
+ action: 'File/download',
+ id: file_id,
+ version: file_version,
+ };
+
+ $.post("controller.pl", data, kivi.eval_json_result);
+
+ };
+