in file-row getPath(), don't leak 'path' into the global namespace

This commit is contained in:
Jordan Lee 2012-09-23 17:21:19 +00:00
parent b4b7483f2e
commit 7b7da2d315
2 changed files with 6 additions and 5 deletions

View File

@ -174,10 +174,10 @@ function FileRow(torrent, i)
};
this.getPath = function () {
var file = torrent.getFile(i);
path = file.name.replace(/\/\/+/g,'/')
path = path.split('/').slice(0,-1)
path.push('t' + fields.torrent.getId() + 'f' + fields.index)
return path
var path = file.name.replace(/\/\/+/g,'/');
path = path.split('/').slice(0,-1);
path.push('t' + fields.torrent.getId() + 'f' + fields.index);
return path;
};
initialize(torrent, i);

View File

@ -513,7 +513,7 @@ function Inspector(controller) {
n = tor.getFileCount();
data.file_rows = [];
fragment = document.createDocumentFragment();
heirarchy = {'/':[]}
heirarchy = {'/':[]}
for (i=0; i<n; ++i) {
row = data.file_rows[i] = new FileRow(tor, i);
@ -537,6 +537,7 @@ function Inspector(controller) {
}
}
}
console.log(heirarchy);
/*
At this point we have a single object containing the whole
torrent heirarchy. The '/' key is file element ids as assigned above