-
Notifications
You must be signed in to change notification settings - Fork 9
/
kancepts.es
37 lines (33 loc) · 933 Bytes
/
kancepts.es
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import _ from 'lodash'
const urlGitHub = 'https://javran.github.io/kancepts/'
const urlKcWiki = 'https://box.kcwiki.org/kancepts/'
const getActualUrl = kanceptsUrl =>
kanceptsUrl === 'github' ? urlGitHub :
kanceptsUrl === 'kcwiki' ? urlKcWiki :
console.error(`invalid kanceptsUrl: ${kanceptsUrl}`)
const makeLink = kanceptsUrl => {
const kanceptsAddr = getActualUrl(kanceptsUrl) || urlGitHub
return exportShipList => {
if (exportShipList) {
const {getStore} = window
const slVal = encodeURIComponent(
_.flatMap(
Object.values(getStore().info.ships),
rawInfo =>
rawInfo.api_locked === 1 ? [
`${rawInfo.api_lv>99?'r':''}${rawInfo.api_ship_id}`,
] : []
).join(',')
)
return `${kanceptsAddr}?sl=${slVal}`
} else {
return kanceptsAddr
}
}
}
export {
urlGitHub,
urlKcWiki,
getActualUrl,
makeLink,
}