Add speedtest page
This commit is contained in:
@@ -30,6 +30,24 @@ export const formatDataVolume = (amt, precision) => {
|
||||
}
|
||||
return amt + " B"
|
||||
}
|
||||
export const formatDataVolumeBits = (amt, precision) => {
|
||||
amt = amt*8
|
||||
if (precision < 3) { precision = 3; }
|
||||
if (amt >= 1e18-1e15) {
|
||||
return (amt/1e18).toPrecision(precision) + " Eb";
|
||||
}else if (amt >= 1e15-1e12) {
|
||||
return (amt/1e15).toPrecision(precision) + " Pb";
|
||||
}else if (amt >= 1e12-1e9) {
|
||||
return (amt/1e12).toPrecision(precision) + " Tb";
|
||||
} else if (amt >= 1e9-1e6) {
|
||||
return (amt/1e9).toPrecision(precision) + " Gb";
|
||||
} else if (amt >= 1e6-1e3) {
|
||||
return (amt/1e6).toPrecision(precision) + " Mb";
|
||||
} else if (amt >= 1e3-1) {
|
||||
return (amt/1e3).toPrecision(precision) + " kb";
|
||||
}
|
||||
return amt + " b"
|
||||
}
|
||||
|
||||
const second = 1000
|
||||
const minute = second*60
|
||||
|
@@ -3,6 +3,8 @@ export let total = 0
|
||||
export let used = 0
|
||||
export let animation = "ease"
|
||||
export let speed = 1000
|
||||
export let no_animation = false
|
||||
export let style = ""
|
||||
let percent = 0
|
||||
$: {
|
||||
// Avoid division by 0
|
||||
@@ -19,9 +21,10 @@ $: {
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="progress_bar_outer">
|
||||
<div class="progress_bar_outer" style={style}>
|
||||
<div
|
||||
class="progress_bar_inner"
|
||||
class:no_animation
|
||||
style="width: {percent}%; transition-timing-function: {animation}; transition-duration: {speed}ms;">
|
||||
</div>
|
||||
</div>
|
||||
@@ -34,7 +37,7 @@ $: {
|
||||
height: 6px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
margin: 6px 0 12px 0;
|
||||
margin: 6px 0;
|
||||
}
|
||||
.progress_bar_inner {
|
||||
background: var(--highlight_background);
|
||||
@@ -43,4 +46,7 @@ $: {
|
||||
border-radius: 6px;
|
||||
transition-property: width;
|
||||
}
|
||||
.no_animation {
|
||||
transition-property: none;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user