aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/fileactions.js2
-rw-r--r--apps/files/js/filelist.js35
-rw-r--r--apps/files/js/files.js8
-rw-r--r--apps/files/js/jquery-visibility.js101
4 files changed, 108 insertions, 38 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 1d0493f2140..f3f137a0537 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -616,7 +616,7 @@
name: 'Delete',
mime: 'all',
// permission is READ because we show a hint instead if there is no permission
- permissions: OC.PERMISSION_READ,
+ permissions: OC.PERMISSION_DELETE,
icon: function() {
return OC.imagePath('core', 'actions/delete');
},
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 4802e07e965..eb46f155269 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -608,6 +608,7 @@
* Event handler when dropping on a breadcrumb
*/
_onDropOnBreadCrumb: function( event, ui ) {
+ var self = this;
var $target = $(event.target);
if (!$target.is('.crumb')) {
$target = $target.closest('.crumb');
@@ -629,7 +630,9 @@
var files = this.getSelectedFiles();
if (files.length === 0) {
// single one selected without checkbox?
- files = _.map(ui.helper.find('tr'), this.elementToFile);
+ files = _.map(ui.helper.find('tr'), function(el) {
+ return self.elementToFile($(el));
+ });
}
this.move(_.pluck(files, 'name'), targetPath);
@@ -1748,7 +1751,7 @@
// no files passed, delete all in current dir
params.allfiles = true;
// show spinner for all files
- this.$fileList.find('tr').addClass('busy');
+ this.showFileBusyState(this.$fileList.find('tr'), true);
}
$.post(OC.filePath('files', 'ajax', 'delete.php'),
@@ -1791,7 +1794,7 @@
}
else {
$.each(files,function(index,file) {
- self.$fileList.find('tr').removeClass('busy');
+ self.showFileBusyState(file, false);
});
}
}
@@ -1930,6 +1933,8 @@
updateSelectionSummary: function() {
var summary = this._selectionSummary.summary;
var canDelete;
+ var selection;
+
if (summary.totalFiles === 0 && summary.totalDirs === 0) {
this.$el.find('#headerName a.name>span:first').text(t('files','Name'));
this.$el.find('#headerSize a>span:first').text(t('files','Size'));
@@ -1941,16 +1946,22 @@
canDelete = (this.getDirectoryPermissions() & OC.PERMISSION_DELETE) && this.isSelectedDeletable();
this.$el.find('.selectedActions').removeClass('hidden');
this.$el.find('#headerSize a>span:first').text(OC.Util.humanFileSize(summary.totalSize));
- var selection = '';
- if (summary.totalDirs > 0) {
- selection += n('files', '%n folder', '%n folders', summary.totalDirs);
- if (summary.totalFiles > 0) {
- selection += ' & ';
- }
- }
- if (summary.totalFiles > 0) {
- selection += n('files', '%n file', '%n files', summary.totalFiles);
+
+ var directoryInfo = n('files', '%n folder', '%n folders', summary.totalDirs);
+ var fileInfo = n('files', '%n file', '%n files', summary.totalFiles);
+
+ if (summary.totalDirs > 0 && summary.totalFiles > 0) {
+ var selectionVars = {
+ dirs: directoryInfo,
+ files: fileInfo
+ };
+ selection = t('files', '{dirs} and {files}', selectionVars);
+ } else if (summary.totalDirs > 0) {
+ selection = directoryInfo;
+ } else {
+ selection = fileInfo;
}
+
this.$el.find('#headerName a.name>span:first').text(selection);
this.$el.find('#modified a>span:first').text('');
this.$el.find('table').addClass('multiselect');
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 55fdb96ebda..245648a79e2 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -246,12 +246,12 @@
// Use jquery-visibility to de-/re-activate file stats sync
if ($.support.pageVisibility) {
$(document).on({
- 'show.visibility': function() {
+ 'show': function() {
if (!updateStorageStatisticsIntervalId) {
updateStorageStatisticsIntervalId = setInterval(func, updateStorageStatisticsInterval);
}
},
- 'hide.visibility': function() {
+ 'hide': function() {
clearInterval(updateStorageStatisticsIntervalId);
updateStorageStatisticsIntervalId = 0;
}
@@ -453,7 +453,9 @@ var folderDropOptions = {
var files = FileList.getSelectedFiles();
if (files.length === 0) {
// single one selected without checkbox?
- files = _.map(ui.helper.find('tr'), FileList.elementToFile);
+ files = _.map(ui.helper.find('tr'), function(el) {
+ return FileList.elementToFile($(el));
+ });
}
FileList.move(_.pluck(files, 'name'), targetPath);
diff --git a/apps/files/js/jquery-visibility.js b/apps/files/js/jquery-visibility.js
index 18f57d1f2bd..4d65e7771f9 100644
--- a/apps/files/js/jquery-visibility.js
+++ b/apps/files/js/jquery-visibility.js
@@ -1,31 +1,88 @@
-/*! http://mths.be/visibility v1.0.5 by @mathias */
-(function (window, document, $, undefined) {
+/*!
+ * jquery-visibility v1.0.11
+ * Page visibility shim for jQuery.
+ *
+ * Project Website: http://mths.be/visibility
+ *
+ * @version 1.0.11
+ * @license MIT.
+ * @author Mathias Bynens - @mathias
+ * @author Jan Paepke - @janpaepke
+ */
+;(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], function ($) {
+ return factory(root, $);
+ });
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS
+ module.exports = factory(root, require('jquery'));
+ } else {
+ // Browser globals
+ factory(root, jQuery);
+ }
+}(this, function(window, $, undefined) {
+ "use strict";
- var prefix,
- property,
- // In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior
- eventName = 'onfocusin' in document && 'hasFocus' in document ? 'focusin focusout' : 'focus blur',
- prefixes = ['', 'moz', 'ms', 'o', 'webkit'],
- $support = $.support,
- $event = $.event;
+ var
+ document = window.document,
+ property, // property name of document, that stores page visibility
+ vendorPrefixes = ['webkit', 'o', 'ms', 'moz', ''],
+ $support = $.support || {},
+ // In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior
+ eventName = 'onfocusin' in document && 'hasFocus' in document ?
+ 'focusin focusout' :
+ 'focus blur';
- while ((property = prefix = prefixes.pop()) != undefined) {
- property = (prefix ? prefix + 'H' : 'h') + 'idden';
- if ($support.pageVisibility = typeof document[property] == 'boolean') {
+ var prefix;
+ while ((prefix = vendorPrefixes.pop()) !== undefined) {
+ property = (prefix ? prefix + 'H': 'h') + 'idden';
+ $support.pageVisibility = document[property] !== undefined;
+ if ($support.pageVisibility) {
eventName = prefix + 'visibilitychange';
break;
}
}
- $(/blur$/.test(eventName) ? window : document).on(eventName, function (event) {
- var type = event.type,
- originalEvent = event.originalEvent;
- // If it’s a `{focusin,focusout}` event (IE), `fromElement` and `toElement` should both be `null` or `undefined`;
- // else, the page visibility hasn’t changed, but the user just clicked somewhere in the doc.
- // In IE9, we need to check the `relatedTarget` property instead.
- if (!/^focus./.test(type) || originalEvent == undefined || (originalEvent.toElement == undefined && originalEvent.fromElement == undefined && originalEvent.relatedTarget == undefined)) {
- $event.trigger((property && document[property] || /^(?:blur|focusout)$/.test(type) ? 'hide' : 'show') + '.visibility');
+ // normalize to and update document hidden property
+ function updateState() {
+ if (property !== 'hidden') {
+ document.hidden = $support.pageVisibility ? document[property] : undefined;
}
- });
+ }
+ updateState();
-}(this, document, jQuery));
+ $(/blur$/.test(eventName) ? window : document).on(eventName, function(event) {
+ var type = event.type;
+ var originalEvent = event.originalEvent;
+
+ // Avoid errors from triggered native events for which `originalEvent` is
+ // not available.
+ if (!originalEvent) {
+ return;
+ }
+
+ var toElement = originalEvent.toElement;
+
+ // If it’s a `{focusin,focusout}` event (IE), `fromElement` and `toElement`
+ // should both be `null` or `undefined`; else, the page visibility hasn’t
+ // changed, but the user just clicked somewhere in the doc. In IE9, we need
+ // to check the `relatedTarget` property instead.
+ if (
+ !/^focus./.test(type) || (
+ toElement === undefined &&
+ originalEvent.fromElement === undefined &&
+ originalEvent.relatedTarget === undefined
+ )
+ ) {
+ $(document).triggerHandler(
+ property && document[property] || /^(?:blur|focusout)$/.test(type) ?
+ 'hide' :
+ 'show'
+ );
+ }
+ // and update the current state
+ updateState();
+ });
+}));