diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2010-02-03 01:13:26 -0500 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2010-02-03 01:13:26 -0500 |
commit | 3ab468c6f06091e0af2412caff366d7a46652e6b (patch) | |
tree | bce94939c94e6d245888396e14951a49e02f4ed2 | |
parent | Playfirst fix. (diff) | |
download | oldgen-zmusic-3ab468c6f06091e0af2412caff366d7a46652e6b.tar.xz oldgen-zmusic-3ab468c6f06091e0af2412caff366d7a46652e6b.zip |
Lazy loading of songs to flash player.
-rw-r--r-- | musicajax.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/musicajax.js b/musicajax.js index 3597596..b0124e4 100644 --- a/musicajax.js +++ b/musicajax.js @@ -11,6 +11,7 @@ var downloads; var downloadsBox; var counter; var songList = null; +var flashIsDirty = true; var downloadBasket = new Array(); var tableComplete = true; var requestInProgress = false; @@ -82,15 +83,7 @@ function displayResults(offset, requestedValue) { songList = songList.concat(nextBatch[1]); } - if(player != null) - { - var urlList = new Array(); - for(var i = 0; i < songList.length; i++) - { - urlList.push("getsong.php?hash=" + songList[i][0] + (songList[i][5] == "mp3" ? "" : "&transcode=true")); - } - player.load(urlList.join(","), "", ""); - } + flashIsDirty = true; tableComplete = nextBatch[0] <= songList.length; if(songList.length == 0) { @@ -293,6 +286,16 @@ function playSong(index, hash, mp3) iframe.height = 1; iframe.style.visibility = "hidden"; iframe.src = ""; + if(flashIsDirty) + { + var urlList = new Array(); + for(var i = 0; i < songList.length; i++) + { + urlList.push("getsong.php?hash=" + songList[i][0] + (songList[i][5] == "mp3" ? "" : "&transcode=true")); + } + player.load(urlList.join(","), "", ""); + flashIsDirty = false; + } player.open(index); } else |