createEl: function () {
const div = document.createElement('div')
+ const subDiv = document.createElement('div')
+ div.appendChild(subDiv)
const downloadIcon = document.createElement('span')
downloadIcon.classList.add('icon', 'icon-download')
- div.appendChild(downloadIcon)
+ subDiv.appendChild(downloadIcon)
const downloadSpeedText = document.createElement('span')
downloadSpeedText.classList.add('download-speed-text')
const downloadSpeedUnit = document.createElement('span')
downloadSpeedText.appendChild(downloadSpeedNumber)
downloadSpeedText.appendChild(downloadSpeedUnit)
- div.appendChild(downloadSpeedText)
+ subDiv.appendChild(downloadSpeedText)
const uploadIcon = document.createElement('span')
uploadIcon.classList.add('icon', 'icon-upload')
- div.appendChild(uploadIcon)
+ subDiv.appendChild(uploadIcon)
const uploadSpeedText = document.createElement('span')
uploadSpeedText.classList.add('upload-speed-text')
const uploadSpeedUnit = document.createElement('span')
uploadSpeedText.appendChild(uploadSpeedNumber)
uploadSpeedText.appendChild(uploadSpeedUnit)
- div.appendChild(uploadSpeedText)
+ subDiv.appendChild(uploadSpeedText)
const peersText = document.createElement('span')
peersText.textContent = ' peers'
peersText.classList.add('peers-text')
const peersNumber = document.createElement('span')
peersNumber.classList.add('peers-number')
- div.appendChild(peersNumber)
- div.appendChild(peersText)
+ subDiv.appendChild(peersNumber)
+ subDiv.appendChild(peersText)
div.className = 'vjs-webtorrent'
// Hide the stats before we get the info
- div.style.display = 'none'
+ subDiv.style.display = 'none'
this.player_.on('torrentInfo', (event, data) => {
const downloadSpeed = bytes(data.downloadSpeed)
peersNumber.textContent = numPeers
- div.style.display = 'block'
+ subDiv.style.display = 'block'
})
return div