| OLD | NEW |
| (Empty) | |
| 1 var graphPainter = (function () { |
| 2 "use strict"; |
| 3 var graphPainter = {}; |
| 4 |
| 5 function updateBufferGraph(playerInfo, bufferGraph) { |
| 6 bufferGraph.setWidth(400); |
| 7 |
| 8 var p = playerInfo.properties; |
| 9 |
| 10 bufferGraph.plot(p.buffer_start, p.buffer_end); |
| 11 bufferGraph.plot(p.buffer_start, p.buffer_current); |
| 12 bufferGraph.draw(); |
| 13 } |
| 14 |
| 15 graphPainter.paintNew = function (playerInfo, div, options) { |
| 16 removeChildren(div); |
| 17 |
| 18 var p = playerInfo.properties; |
| 19 |
| 20 // If we can, make a new graph for the buffer status |
| 21 if (p.buffer_start !== undefined && p.buffer_current !== undefined && |
| 22 p.buffer_end !== undefined && p.total_bytes !== undefined) { |
| 23 |
| 24 var bufferGraph = new RangeGraph(p.total_bytes); |
| 25 updateBufferGraph(playerInfo, bufferGraph); |
| 26 bufferGraph.element.setAttribute('id', "buffer-graph"); |
| 27 bufferGraph.element.setAttribute('style', "vertical-align:middle;"); |
| 28 |
| 29 |
| 30 div.appendChild(document.createTextNode("Buffer\u00a0")); |
| 31 div.appendChild(bufferGraph.element); |
| 32 } |
| 33 |
| 34 }; |
| 35 graphPainter.paintExist = function (playerInfo, div, options) { |
| 36 var bufferGraphElem = div.querySelector("#buffer-graph"); |
| 37 |
| 38 if (bufferGraphElem) { |
| 39 // Use the 'existing' constructor for RangeGraph to |
| 40 // build it off of the existing bufferGraphElem |
| 41 var bufferGraph = new RangeGraph(playerInfo.properties.total_bytes, |
| 42 bufferGraphElem); |
| 43 updateBufferGraph(playerInfo, bufferGraph); |
| 44 } |
| 45 }; |
| 46 graphPainter.invalidate = function () { |
| 47 }; |
| 48 |
| 49 return graphPainter; |
| 50 }()); |
| OLD | NEW |