From 30e81c76998799795c1e8be8661bdda93c2b999e Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 23 May 2016 15:15:52 -0700 Subject: [PATCH] Cleanup for PR #571 --- renderer/index.js | 2 +- renderer/views/torrent-list.js | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/renderer/index.js b/renderer/index.js index 82d89d3a..226e0d9f 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -1015,7 +1015,7 @@ function openPlayer (infoHash, index, cb) { var timeout = setTimeout(function () { torrentSummary.playStatus = 'timeout' /* no seeders available? */ sound.play('ERROR') - cb(new Error('playback timed out')) + cb(new Error('Playback timed out. Try again.')) update() }, 10000) /* give it a few seconds */ diff --git a/renderer/views/torrent-list.js b/renderer/views/torrent-list.js index 4ce7458a..258078c0 100644 --- a/renderer/views/torrent-list.js +++ b/renderer/views/torrent-list.js @@ -193,8 +193,14 @@ function TorrentList (state) { filesElement = hx`
${message}
` } else { // We do know the files. List them and show download stats for each one - var fileRows = torrentSummary.files.sort(fileSortHelper).map( - (file, index) => renderFileRow(torrentSummary, file, index)) + var fileRows = torrentSummary.files + .sort(function (a, b) { + if (a.name < b.name) return -1 + if (b.name < a.name) return 1 + return 0 + }) + .map((file, index) => renderFileRow(torrentSummary, file, index)) + filesElement = hx`
@@ -211,15 +217,6 @@ function TorrentList (state) { ` } - function fileSortHelper (a, b) { - var result = 0 - if (a.name > b.name) { - result = 1 - } else if (a.name < b.name) { - result = -1 - } - return result - } // Show a single torrentSummary file in the details view for a single torrent function renderFileRow (torrentSummary, file, index) { // First, find out how much of the file we've downloaded