mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(util) rm forEach
This commit is contained in:
parent
083817692a
commit
7dfcd38a05
5 changed files with 5 additions and 19 deletions
|
|
@ -128,7 +128,7 @@ var CloudCmd, Util, DOM, io;
|
|||
};
|
||||
}
|
||||
|
||||
Util.forEach(inputs, function(input) {
|
||||
[].forEach.call(inputs, function(input) {
|
||||
Events.addKey(input, onKey)
|
||||
.add('change', input, function(event) {
|
||||
onChange(event.target);
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
if (files.length) {
|
||||
func = func(files[0].name);
|
||||
|
||||
Util.forEach(files, function(file) {
|
||||
[].forEach.call(files, function(file) {
|
||||
func = Util.exec.with(load, file, func);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M
|
|||
|
||||
files = event.dataTransfer.files;
|
||||
|
||||
Util.forEach(files, function(file) {
|
||||
[].forEach.call(files, function(file) {
|
||||
reader = new FileReader();
|
||||
Events.addLoad(reader, onLoad);
|
||||
reader.readAsBinaryString(file);
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
event.preventDefault();
|
||||
},
|
||||
toggle = function () {
|
||||
Util.forEach(panels, function(panel) {
|
||||
[].forEach.call(panels, function(panel) {
|
||||
DOM.toggleClass(panel, 'selected-panel');
|
||||
});
|
||||
},
|
||||
|
|
@ -279,7 +279,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
|
||||
Events.add(['dragenter', 'dragleave', 'drop'], toggle);
|
||||
|
||||
Util.forEach(panels, function(panel) {
|
||||
[].forEach.call(panels, function(panel) {
|
||||
Events.add('dragover', panel, preventDefault)
|
||||
.add('drop', panel, onDrop);
|
||||
});
|
||||
|
|
|
|||
14
lib/util.js
14
lib/util.js
|
|
@ -444,20 +444,6 @@
|
|||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* function calls forEach for all array like variables
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
this.forEach = function(array, callback) {
|
||||
var ret = [];
|
||||
|
||||
if (array)
|
||||
ret = [].forEach.call(array, callback);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
this.exec = new ExecProto();
|
||||
|
||||
function ExecProto() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue