From 37e6a4823047fad75d1b91dea95b306da2249396 Mon Sep 17 00:00:00 2001 From: Hamza Zia Date: Thu, 5 Jul 2012 08:28:29 -0700 Subject: [PATCH] name from path bug fixed --- js/script.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/js/script.js b/js/script.js index 43648dc..cf609c6 100755 --- a/js/script.js +++ b/js/script.js @@ -425,15 +425,8 @@ function getTemplateCtx(data) { percentage = percentage.toFixed(2); if(!percentage) percentage = 0; var name; - if(data.files[0].path && data.dir) { - name = data.files[0].path.replace(/^.*[\\\/\]]/, ''); - //name = data.files[0].path.replace(data.dir, '').substr(1); - //if(name.indexOf('/') !== -1) - //name = name.substring(0, name.indexOf('/')); - } - else { - name = data.files[0].uris[0].uri.replace(/^.*[\\\/]/, ''); - } + var seed = (data.files[0].path || data.files[0].uris[0].uri).split(/[/\\]/); + name = seed[seed.length - 1]; var eta = changeTime((data.totalLength-data.completedLength)/data.downloadSpeed); return {