/* * Copyright (c) 2015 Frank de Lange * Copyright (c) 2013-2014 Lukas Reschke * * This file is licensed under the Affero General Public License version 3 * or later. * * See the COPYING-README file. * */ (function(OCA) { OCA.FilesReader = OCA.FilesReader || {}; var isMobile = navigator.userAgent.match(/Mobi/i); var hasTouch = 'ontouchstart' in document.documentElement; /** * @namespace OCA.FilesReader.Plugin */ OCA.FilesReader.Plugin = { /** * @param fileList */ attach: function(fileList) { this._extendFileActions(fileList.fileActions); }, hideControls: function() { $('#app-content #controls').hide(); }, hide: function() { if ($('#fileList').length) { FileList.setViewerMode(false); } $("#controls").show(); $('#app-content #controls').removeClass('hidden'); if ($('#isPublic').val()) { $('#imgframe').show(); $('footer').show(); $('.directLink').show(); $('.directDownload').show(); } $('iframe').remove(); }, /** * @param downloadUrl * @param isFileList */ show: function(downloadUrl, isFileList) { var self = this; var $iframe; var viewer = OC.generateUrl('/apps/files_reader/?file={file}', {file: encodeURIComponent(downloadUrl)}); // launch in new window on mobile and touch devices... if (isMobile || hasTouch) { window.open(viewer, downloadUrl); } else { $iframe = '