Sentry/assets/coffee/sentry.coffee
Gregory Ballantine ae155b2d7e
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Made the tabs look better
2022-10-29 01:14:08 -04:00

33 lines
792 B
CoffeeScript

@openTab = (tab) ->
# show the component info that's selected
tabs = document.querySelectorAll('.tab-button')
displays = document.querySelectorAll('.component-display')
i = 0
while i < displays.length
if displays[i].getAttribute('data-component') == tab
displays[i].classList.add('active')
tabs[i].classList.add('active')
else
displays[i].classList.remove('active')
tabs[i].classList.remove('active')
i++
@formatBytes = (bytes, decimals = 2) ->
if bytes == 0
return '0 Bytes'
k = 1024
dm = if decimals < 0 then 0 else decimals
sizes = [
'Bytes'
'KB'
'MB'
'GB'
'TB'
'PB'
'EB'
'ZB'
'YB'
]
i = Math.floor(Math.log(bytes) / Math.log(k))
parseFloat((bytes / k ** i).toFixed(dm)) + ' ' + sizes[i]