-
Notifications
You must be signed in to change notification settings - Fork 578
/
Copy pathapp.js
58 lines (50 loc) · 1.79 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(function(window, angular) {
'use strict';
angular.module('FileManagerApp', ['pascalprecht.translate', 'ngFileUpload']);
/**
* jQuery inits
*/
angular.element(window.document).on('shown.bs.modal', '.modal', function() {
window.setTimeout(function() {
angular.element('[autofocus]', this).focus();
}.bind(this), 100);
});
angular.element(window.document).on('click', function() {
angular.element('#context-menu').hide();
});
angular.element(window.document).on('contextmenu', '.main-navigation .table-files tr.item-list:has("td"), .item-list', function(e) {
var menu = angular.element('#context-menu');
if (e.pageX >= window.innerWidth - menu.width()) {
e.pageX -= menu.width();
}
if (e.pageY >= window.innerHeight - menu.height()) {
e.pageY -= menu.height();
}
menu.hide().css({
left: e.pageX,
top: e.pageY
}).appendTo('body').show();
e.preventDefault();
});
if (! Array.prototype.find) {
Array.prototype.find = function(predicate) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
};
}
})(window, angular);