mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Increase precision in submission preview
This commit is contained in:
@@ -40,8 +40,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
<div style={style}>
|
<div style={style}>
|
||||||
<div id={"sponsorTimesContainer" + this.props.index + this.props.idSuffix}
|
<div id={"sponsorTimesContainer" + this.props.index + this.props.idSuffix}
|
||||||
className="sponsorTimeDisplay">
|
className="sponsorTimeDisplay">
|
||||||
{utils.getFormattedTime(this.props.contentContainer().sponsorTimesSubmitting[this.props.index][0])
|
{utils.getFormattedTime(this.props.contentContainer().sponsorTimesSubmitting[this.props.index][0], true)
|
||||||
+ " to " + utils.getFormattedTime(this.props.contentContainer().sponsorTimesSubmitting[this.props.index][1])}
|
+ " to " + utils.getFormattedTime(this.props.contentContainer().sponsorTimesSubmitting[this.props.index][1], true)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span id={"sponsorTimeDeleteButton" + this.props.index + this.props.idSuffix}
|
<span id={"sponsorTimeDeleteButton" + this.props.index + this.props.idSuffix}
|
||||||
|
|||||||
12
src/utils.ts
12
src/utils.ts
@@ -256,14 +256,18 @@ class Utils {
|
|||||||
xmlhttp.send();
|
xmlhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormattedTime(seconds) {
|
getFormattedTime(seconds: number, precise?: boolean) {
|
||||||
let minutes = Math.floor(seconds / 60);
|
let minutes = Math.floor(seconds / 60);
|
||||||
let secondsNum: number = Math.round(seconds - minutes * 60);
|
let secondsNum: number = seconds - minutes * 60;
|
||||||
let secondsDisplay: string = String(secondsNum);
|
if (!precise) {
|
||||||
|
secondsNum = Math.floor(secondsNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
let secondsDisplay: string = String(secondsNum.toFixed(3));
|
||||||
|
|
||||||
if (secondsNum < 10) {
|
if (secondsNum < 10) {
|
||||||
//add a zero
|
//add a zero
|
||||||
secondsDisplay = "0" + secondsNum;
|
secondsDisplay = "0" + secondsDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
let formatted = minutes + ":" + secondsDisplay;
|
let formatted = minutes + ":" + secondsDisplay;
|
||||||
|
|||||||
Reference in New Issue
Block a user