(trunk web) minor tweaks to r12702 for clarity.

This commit is contained in:
Jordan Lee 2011-08-20 22:30:34 +00:00
parent b36c648b31
commit 825706b823
1 changed files with 13 additions and 23 deletions

View File

@ -65,16 +65,6 @@ Torrent._DynamicFields = [
'seedRatioMode', 'sizeWhenDone', 'status', 'trackerStats',
'uploadedEver', 'uploadRatio', 'webseedsSendingToUs' ]
// tracker stats fields whose values change all the time
Torrent._TrackerStatFields = [
'announce', 'announceState', 'downloadCount', 'hasAnnounced',
'hasScraped', 'host', 'isBackup', 'lastAnnouncePeerCount',
'lastAnnounceResult', 'lastAnnounceSucceeded', 'lastAnnounceTime',
'lastScrapeResult', 'lastScrapeSucceeded', 'lastScrapeTime',
'leecherCount', 'nextAnnounceTime', 'seederCount'
]
/***
****
**** Methods
@ -85,8 +75,8 @@ Torrent.prototype =
{
initialize: function(controller, data)
{
this.fields = { }
this._files = [ ]
this.fields = {}
this._files = []
// these fields are set in the ctor and never change
for(var i=0, key; key=Torrent._StaticFields[i]; ++i)
@ -102,7 +92,7 @@ Torrent.prototype =
result = []
for(var i=0, tracker; tracker=trackerStats[i]; ++i) {
tier = result[tracker.tier] || []
tier[tier.length] = tracker
tier.push(tracker)
result[tracker.tier] = tier
}
return result
@ -116,7 +106,7 @@ Torrent.prototype =
for(var i=0, key; key=Torrent._MetaDataFields[i]; ++i) {
if(key in data) {
f[key] = data[key]
if(key == 'name')
if(key === 'name')
f.collatedName = data.name.toLowerCase()
}
}
@ -134,11 +124,6 @@ Torrent.prototype =
}
},
fireDataChanged: function()
{
$(this).trigger('dataChanged',[])
},
refreshMetaData: function(data)
{
this.initMetaData(data)
@ -178,6 +163,11 @@ Torrent.prototype =
}
},
fireDataChanged: function()
{
$(this).trigger('dataChanged',[])
},
/****
*****
****/
@ -296,10 +286,10 @@ Torrent.prototype =
|| this.isChecking()
break
case Prefs._FilterSeeding:
pass = (s == Torrent._StatusSeed) || (s == Torrent._StatusSeedWait)
pass = (s === Torrent._StatusSeed) || (s === Torrent._StatusSeedWait)
break
case Prefs._FilterDownloading:
pass = (s == Torrent._StatusDownload) || (s == Torrent._StatusDownloadWait)
pass = (s === Torrent._StatusDownload) || (s === Torrent._StatusDownloadWait)
break
case Prefs._FilterPaused:
pass = this.isStopped()
@ -335,8 +325,8 @@ Torrent.compareById = function(ta, tb)
}
Torrent.compareByName = function(ta, tb)
{
var i = ta.getCollatedName().compareTo(tb.getCollatedName())
return i || Torrent.compareById(ta, tb)
return ta.getCollatedName().compareTo(tb.getCollatedName())
|| Torrent.compareById(ta, tb)
}
Torrent.compareByQueue = function(ta, tb)
{