Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
b852f384
Commit
b852f384
authored
May 13, 2022
by
Hotaru
Committed by
Melledy
May 12, 2022
Browse files
Fix broken time formatting on gacha records
parent
92b103d5
Changes
1
Show whitespace changes
Inline
Side-by-side
data/gacha_records.html
View file @
b852f384
...
@@ -53,47 +53,14 @@
...
@@ -53,47 +53,14 @@
}
}
</style>
</style>
<title>
Gacha Records
</title>
<title>
Gacha Records
</title>
<script>
// Debug entry
// record = [
// {"time": 10000341, "item": 1041},
// {"time": 10000342, "item": 1032},
// {"time": 10000343, "item": 1035},
// ];
// maxPage = 5;
// in production environment
record
=
{{
REPLACE_RECORD
}};
maxPage
=
{{
REPLACE_MAXPAGE
}};
// TODO: implement this mapper by yourself
// I don't want to put real items' name here to avoid being DMCA'd
mappings
=
{
'
en-us
'
:
{
200
:
"
Standard
"
,
301
:
"
Event Avatar
"
,
302
:
"
Event Weapon
"
,
1041
:
[
"
M0n4
"
,
"
blue
"
],
1032
:
[
"
B4nn477
"
,
"
purple
"
],
1035
:
[
"
77
"
,
"
yellow
"
]
},
'
zh-cn
'
:
{
// encoding issues here, maybe we should consider load mappings remotely
// will display as "锟斤铐锟斤铐锟斤铐", lmao
// 200: "常驻",
// 301: "角色UP-1",
// 302: "武器UP"
200
:
"
Standard
"
,
301
:
"
Event Avatar
"
,
302
:
"
Event Weapon
"
,
}
};
</script>
<!-- This file could be generated automatically using `java -jar grasscutter.jar -gachamap` -->
<!-- This file could be generated automatically using `java -jar grasscutter.jar -gachamap` -->
<!-- You can also modify the file manually to customize it -->
<!-- You can also modify the file manually to customize it -->
<!-- Otherwise you may onle see number IDs in the gacha record -->
<!-- Otherwise you may onle see number IDs in the gacha record -->
<script
type=
"text/javascript"
src=
"/gacha/mappings"
></script>
<script
type=
"text/javascript"
src=
"/gacha/mappings"
></script>
<script>
<script>
record
=
{{
REPLACE_RECORD
}};
maxPage
=
{{
REPLACE_MAXPAGE
}};
mappings
[
'
default
'
]
=
mappings
[
'
en-us
'
];
// make en-us as default/fallback option
mappings
[
'
default
'
]
=
mappings
[
'
en-us
'
];
// make en-us as default/fallback option
</script>
</script>
</head>
</head>
...
@@ -161,32 +128,12 @@
...
@@ -161,32 +128,12 @@
}
}
return
"
<span class='blue'>
"
+
itemID
+
"
</span>
"
;
return
"
<span class='blue'>
"
+
itemID
+
"
</span>
"
;
}
}
function
dateFormatter
(
timeStamp
)
{
var
date
=
new
Date
(
timeStamp
);
if
(
lang
==
"
en-us
"
||
lang
==
null
)
{
// MM/DD/YYYY hh:mm:ss.SSS
return
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
/
"
+
String
(
date
.
getDate
()).
padStart
(
2
,
"
0
"
)
+
"
/
"
+
date
.
getFullYear
()
+
"
"
+
String
(
date
.
getHours
()).
padStart
(
2
,
"
0
"
)
+
"
:
"
+
String
(
date
.
getMinutes
()).
padStart
(
2
,
"
0
"
)
+
"
:
"
+
String
(
date
.
getSeconds
()).
padStart
(
2
,
"
0
"
)
+
"
.
"
+
String
(
date
.
getMilliseconds
()).
padStart
(
3
,
"
0
"
);
}
else
if
(
lang
==
"
zh-cn
"
)
{
// YYYY/MM/DD hh:mm:ss.SSS
return
date
.
getFullYear
()
+
"
/
"
+
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
/
"
+
String
(
date
.
getDate
()).
padStart
(
2
,
"
0
"
)
+
"
"
+
String
(
date
.
getHours
()).
padStart
(
2
,
"
0
"
)
+
"
:
"
+
String
(
date
.
getMinutes
()).
padStart
(
2
,
"
0
"
)
+
"
:
"
+
String
(
date
.
getSeconds
()).
padStart
(
2
,
"
0
"
)
+
"
.
"
+
String
(
date
.
getMilliseconds
()).
padStart
(
3
,
"
0
"
);
}
}
(
function
(){
(
function
(){
var
container
=
document
.
getElementById
(
"
container
"
);
var
container
=
document
.
getElementById
(
"
container
"
);
record
.
forEach
(
element
=>
{
record
.
forEach
(
element
=>
{
var
e
=
document
.
createElement
(
"
tr
"
);
var
e
=
document
.
createElement
(
"
tr
"
);
e
.
innerHTML
=
"
<td>
"
+
dateFormat
te
r
(
element
.
time
)
+
"
</td><td>
"
+
itemMapper
(
element
.
item
)
+
"
</td>
"
;
e
.
innerHTML
=
"
<td>
"
+
(
new
Da
te
(
element
.
time
)
.
toLocaleString
(
lang
))
+
"
</td><td>
"
+
itemMapper
(
element
.
item
)
+
"
</td>
"
;
container
.
appendChild
(
e
);
container
.
appendChild
(
e
);
});
});
// setup pagenation buttons
// setup pagenation buttons
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment