refactor(listeners) setOnPanel

This commit is contained in:
coderaiser 2014-05-23 10:47:46 -04:00
parent e105fb493d
commit 1b943cff28

View file

@ -80,12 +80,11 @@ var Util, DOM, CloudCmd;
};
this.setOnPanel = function(panelId) {
var i, n, ai, link, load,
url = CloudCmd.HOST,
var url = CloudCmd.HOST,
panel = DOM.getById(panelId),
filesElement = DOM.getByDataName('js-files', panel),
pathElement = DOM.getByDataName('js-path', panel),
pathLinks = DOM.getByDataName('js-links', pathElement).children,
pathLinks = DOM.getByDataName('js-links', pathElement),
clearStorage = DOM.getByDataName('js-clear-storage', pathElement),
refresh = DOM.getByDataName('js-refresh', pathElement),
loadDir = function(params, event) {
@ -97,18 +96,17 @@ var Util, DOM, CloudCmd;
Events.addClick(onRefreshClick, refresh);
Events.addClick(Storage.clear, clearStorage);
n = pathLinks.length;
for (i = 0; i < n; i++) {
ai = pathLinks[i];
link = Util.rmStr(ai.href, url),
load = Util.exec.with(loadDir, {
path : link,
isRefresh : false,
panel : panel
}),
pathLinks.children.forEach(function(ai) {
var link = Util.rmStr(ai.href, url),
load = Util.exec.with(loadDir, {
path : link,
isRefresh : false,
panel : panel
});
Events.addClick(load, ai);
OnPathLinks.push(load);
}
});
Events.add(EventsFiles, filesElement);
};