Skip to content

Commit 8ad074f

Browse files
committed
🤘 dependency injection of window and jquery
1 parent f6eeac8 commit 8ad074f

File tree

10 files changed

+32
-24
lines changed

10 files changed

+32
-24
lines changed

assets/js/angular-filemanager.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Licensed under MIT (https://github.com/joni2back/angular-filemanager/blob/master/LICENSE)
55
*/
66

7-
(function() {
7+
(function(window, angular, $) {
8+
"use strict";
89
var app = angular.module('FileManagerApp', ['pascalprecht.translate', 'ngCookies']);
910

1011
app.directive('ngFile', ['$parse', function($parse) {
@@ -70,4 +71,4 @@
7071
e.preventDefault();
7172
});
7273

73-
})();
74+
})(window, angular, jQuery);

assets/js/chmod.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
;(function() {
1+
(function(angular) {
2+
"use strict";
23
angular.module('FileManagerApp').service('chmod', function () {
34

45
var Chmod = function(initValue) {
5-
66
this.owner = this.getRwxObj();
77
this.group = this.getRwxObj();
88
this.others = this.getRwxObj();
@@ -110,4 +110,4 @@
110110

111111
return Chmod;
112112
});
113-
})();
113+
})(angular);

assets/js/config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
;(function() {
1+
(function(angular) {
2+
"use strict";
23
angular.module('FileManagerApp').constant("$config", {
34
appName: "https://github.com/joni2back/angular-filemanager",
45
defaultLang: "en",
@@ -25,4 +26,4 @@
2526
isImageFilePattern: '\\.(jpg|jpeg|gif|bmp|png|svg|tiff)$',
2627
isExtractableFilePattern: '\\.(zip|gz|tar|rar|gzip)$'
2728
});
28-
})();
29+
})(angular);

assets/js/controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
;(function() {
1+
(function(window, angular, $) {
2+
"use strict";
23
angular.module('FileManagerApp').controller('FileManagerCtrl', [
34
'$scope', '$translate', '$cookies', '$config', 'item', 'fileNavigator', 'fileUploader',
45
function($scope, $translate, $cookies, $config, Item, FileNavigator, FileUploader) {
@@ -111,7 +112,7 @@
111112
};
112113

113114
$scope.createFolder = function(item) {
114-
name = item.tempModel.name && item.tempModel.name.trim();
115+
var name = item.tempModel.name && item.tempModel.name.trim();
115116
item.tempModel.type = 'dir';
116117
item.tempModel.path = $scope.fileNavigator.currentPath;
117118
if (name && !$scope.fileNavigator.fileNameExists(name)) {
@@ -148,4 +149,4 @@
148149
$scope.fileNavigator.refresh();
149150

150151
}]);
151-
})();
152+
})(window, angular, jQuery);

assets/js/filenavigator.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
;(function() {
1+
(function(angular) {
2+
"use strict";
23
angular.module('FileManagerApp').service('fileNavigator', [
34
'$http', '$config', 'item', function ($http, $config, Item) {
45

@@ -121,4 +122,4 @@
121122

122123
return FileNavigator;
123124
}]);
124-
})();
125+
})(angular);

assets/js/fileuploader.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
;(function() {
1+
(function(window, angular) {
2+
"use strict";
23
angular.module('FileManagerApp').service('fileUploader', ['$http', '$config', function ($http, $config) {
3-
var self = this;
44

5+
var self = this;
56
self.requesting = false;
67
self.upload = function(fileList, path, success, error) {
7-
var form = new FormData();
8+
var form = new window.FormData();
89

910
form.append('destination', '/' + path.join('/'));
1011
for (var file in fileList) {
@@ -25,4 +26,4 @@
2526
});
2627
};
2728
}]);
28-
})();
29+
})(window, angular);

assets/js/item.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
;(function() {
1+
(function(window, angular, $) {
2+
"use strict";
23
angular.module('FileManagerApp').factory('item', ['$http', '$translate', '$config', 'chmod', function($http, $translate, $config, Chmod) {
34

45
var Item = function(model, path) {
@@ -7,7 +8,7 @@
78
path: path || [],
89
type: 'file',
910
size: 0,
10-
date: model && new Date(model.date),
11+
date: new Date(model && model.date || null),
1112
perms: new Chmod(model && model.rights),
1213
content: '',
1314
recursive: false,
@@ -307,4 +308,4 @@
307308

308309
return Item;
309310
}]);
310-
})();
311+
})(window, angular, jQuery);

assets/js/selector-controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
;(function() {
1+
(function(angular, $) {
2+
"use strict";
23
angular.module('FileManagerApp').controller('ModalFileManagerCtrl', [
34
'$scope', '$rootScope', '$config', 'fileNavigator',
45
function($scope, $rootScope, $config, FileNavigator) {
@@ -19,4 +20,4 @@
1920
};
2021

2122
}]);
22-
})();
23+
})(angular, jQuery);

assets/js/translations.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
;(function() {
1+
(function(angular) {
2+
"use strict";
23
angular.module('FileManagerApp').config(['$translateProvider', function($translateProvider) {
34
$translateProvider.translations('en', {
45
filemanager: "File Manager",
@@ -237,4 +238,4 @@
237238
recursive: "Recursivo"
238239
});
239240
}]);
240-
})();
241+
})(angular);

0 commit comments

Comments
 (0)