| OLD | NEW |
| (Empty) | |
| 1 var playerListPainter = (function () { |
| 2 "use strict"; |
| 3 var playerListPainter = {}; |
| 4 |
| 5 playerListPainter.paintNew = function (playerInfo, div, opt_properties) { |
| 6 var ul = document.createElement('ul'); |
| 7 var playerManager = opt_properties.playerManager; |
| 8 |
| 9 goog.object.forEach(playerManager.players, function (player, id) { |
| 10 // If we have the opportunity to name it |
| 11 // something human readable, do so. |
| 12 |
| 13 var name; |
| 14 // If we have a url, use the file name (but not path) as the |
| 15 // name that is displayed |
| 16 if (player.properties.url) { |
| 17 var split = player.properties.url.split("/"); |
| 18 name = split[split.length - 1]; |
| 19 } |
| 20 |
| 21 name = name || player.properties.name || "player " + id; |
| 22 var li = document.createElement('li'); |
| 23 var btn = document.createElement('button'); |
| 24 |
| 25 btn.onclick = function () { |
| 26 playerManager.selectPlayer(id); |
| 27 }; |
| 28 |
| 29 btn.appendChild(document.createTextNode(name)); |
| 30 li.appendChild(btn); |
| 31 ul.appendChild(li); |
| 32 }); |
| 33 |
| 34 removeChildren(div); |
| 35 div.appendChild(ul); |
| 36 }; |
| 37 |
| 38 playerListPainter.paintExist = playerListPainter.paintNew; |
| 39 |
| 40 playerListPainter.invalidate = function () { |
| 41 }; |
| 42 |
| 43 return playerListPainter; |
| 44 }()); |
| OLD | NEW |