transition from javascript to typescript

This commit is contained in:
Spedon
2023-03-14 01:01:23 +08:00
parent b05c475841
commit 211e2fd4fb
9 changed files with 343 additions and 236 deletions

17
assets/ts/indexDisp.ts Normal file
View File

@@ -0,0 +1,17 @@
import { duper } from './utils'
// update index of displaying image
export function imgIndexSpanUpdate(numOne: number, numTwo: number): void {
// footer index number display module
const footerIndexDisp = document.getElementsByClassName('ftid')
const numOneString: string = duper(numOne)
const numTwoString: string = duper(numTwo)
for (let i: number = 0; i <= 7; i++) {
const footerIndex = footerIndexDisp[i] as HTMLSpanElement
if (i > 3) {
footerIndex.innerText = numTwoString[i - 4]
} else {
footerIndex.innerText = numOneString[i]
}
}
}