@@ -209,8 +209,8 @@ function InitAchievements( items, isPersonal )
209
209
if ( oldContainer . classList . contains ( 'compare_view' ) )
210
210
{
211
211
isCompareView = true ;
212
- leftAvatarUrl = document . querySelector ( '.topAvatarsLeft img' ) . src ;
213
- rightAvatarUrl = document . querySelector ( '.topAvatarsRight img' ) . src ;
212
+ leftAvatarUrl = /** @type { HTMLImageElement } */ ( document . querySelector ( '.topAvatarsLeft img' ) ) . src ;
213
+ rightAvatarUrl = /** @type { HTMLImageElement } */ ( document . querySelector ( '.topAvatarsRight img' ) ) . src ;
214
214
}
215
215
}
216
216
else
@@ -435,7 +435,7 @@ function InitAchievements( items, isPersonal )
435
435
progressText = progress . querySelector ( '.progressText' ) . textContent . trim ( ) ;
436
436
}
437
437
438
- progressWidth = progress . querySelector ( '.progress' ) . style . width ;
438
+ progressWidth = /** @type { HTMLElement } */ ( progress . querySelector ( '.progress' ) ) . style . width ;
439
439
}
440
440
441
441
let foundAchievement = false ;
@@ -800,7 +800,10 @@ function InitAchievements( items, isPersonal )
800
800
{
801
801
for ( const group of achievementGroups )
802
802
{
803
- for ( const achievement of group . querySelectorAll ( '.steamdb_achievement' ) )
803
+ /** @type {NodeListOf<HTMLElement> } */
804
+ const achievementElements = group . querySelectorAll ( '.steamdb_achievement' ) ;
805
+
806
+ for ( const achievement of achievementElements )
804
807
{
805
808
achievement . hidden = false ;
806
809
}
@@ -815,7 +818,10 @@ function InitAchievements( items, isPersonal )
815
818
{
816
819
let count = 0 ;
817
820
818
- for ( const achievement of group . querySelectorAll ( '.steamdb_achievement' ) )
821
+ /** @type {NodeListOf<HTMLElement> } */
822
+ const achievementElements = group . querySelectorAll ( '.steamdb_achievement' ) ;
823
+
824
+ for ( const achievement of achievementElements )
819
825
{
820
826
const title = achievement . querySelector ( 'h3' ) . textContent ;
821
827
const description = achievement . querySelector ( 'h5' ) . textContent ;
@@ -840,7 +846,7 @@ function InitAchievements( items, isPersonal )
840
846
return ;
841
847
}
842
848
843
- if ( [ 'INPUT' , 'TEXTAREA' , 'SELECT' , 'BUTTON' ] . includes ( e . target . tagName ) )
849
+ if ( e . target instanceof Element && [ 'INPUT' , 'TEXTAREA' , 'SELECT' , 'BUTTON' ] . includes ( e . target . tagName ) )
844
850
{
845
851
return ;
846
852
}
@@ -1338,7 +1344,7 @@ function ParseApplicationConfig()
1338
1344
}
1339
1345
1340
1346
// Game logo cdn
1341
- const gameLogoUrl = document . querySelector ( '.profile_small_header_additional .gameLogo img' ) . src ;
1347
+ const gameLogoUrl = /** @type { HTMLImageElement } */ ( document . querySelector ( '.profile_small_header_additional .gameLogo img' ) ) . src ;
1342
1348
const gameLogoUrlAppsIndex = gameLogoUrl . lastIndexOf ( '/apps/' ) ;
1343
1349
1344
1350
if ( gameLogoUrlAppsIndex > 0 )
@@ -1414,7 +1420,7 @@ function HookSortButton( sortButton, achievementUpdates, oldAchievementRows, Cre
1414
1420
sortButton . setAttribute ( 'disabled' , 'true' ) ;
1415
1421
1416
1422
// Request the same page in finnish because it has an easier date format to parse
1417
- const url = new URL ( window . location ) ;
1423
+ const url = new URL ( window . location . href ) ;
1418
1424
url . searchParams . set ( 'l' , 'finnish' ) ;
1419
1425
1420
1426
fetch ( url , {
@@ -1503,7 +1509,15 @@ function HookSortButton( sortButton, achievementUpdates, oldAchievementRows, Cre
1503
1509
}
1504
1510
1505
1511
const c = parsedTime . groups ;
1506
- const date = new Date ( c . year || currentYear , c . month - 1 , c . day , c . hour , c . minute , 0 , 0 ) ;
1512
+ const date = new Date (
1513
+ c . year ? Number . parseInt ( c . year , 10 ) : currentYear ,
1514
+ Number . parseInt ( c . month , 10 ) - 1 ,
1515
+ Number . parseInt ( c . day , 10 ) ,
1516
+ Number . parseInt ( c . hour , 10 ) ,
1517
+ Number . parseInt ( c . minute , 10 ) ,
1518
+ 0 ,
1519
+ 0
1520
+ ) ;
1507
1521
1508
1522
const achievement = achievementDataMap [ id ] ;
1509
1523
achievement . player . unlockTimestamp = date . getTime ( ) ;
0 commit comments