Skip to content

Commit

Permalink
v2.4.14 Providing bug center selection
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoloveFeng committed Feb 11, 2023
1 parent ba41d4f commit 51305b5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/userscript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spxx/userscript",
"version": "2.4.13",
"version": "2.4.14",
"description": "The userscript of spxx, the ultimate MCBBS newslord utility.",
"main": "dist/bundle.user.js",
"type": "module",
Expand Down
41 changes: 35 additions & 6 deletions packages/userscript/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ GM_config.init({
type: 'text',
default: 'SPXX User',
},
bugSource: {
label: 'Translation Source',
type: 'select',
options: ['Guangyao', 'Github', 'Custom'],
default: 'Guangyao',
},
bugCenterTranslation: {
label: 'Bugs Center translation source',
label: 'Custom translation source',
type: 'text',
default: 'https://bugs.guangyaostore.com/translations',
},
bugCenterTranslator: {
label: 'Bugs Center translator source',
label: 'Custom translator source',
type: 'text',
default: 'https://bugs.guangyaostore.com/translator',
},
bugCenterColor: {
label: 'Bugs Center color source',
label: 'Custom color source',
type: 'text',
default: 'https://bugs.guangyaostore.com/color',
},
Expand All @@ -27,12 +33,35 @@ GM_config.init({

GM_registerMenuCommand('Edit Configuration', () => GM_config.open())

const src = GM_config.get('bugSource') as string
let tr = ""
let tor = ""
let c = ""
if (src == "Guangyao"){
console.log("[SPXX] Using Guangyao bug center")
tr = 'https://bugs.guangyaostore.com/translations'
tor = 'https://bugs.guangyaostore.com/translator'
c = 'https://bugs.guangyaostore.com/color'
}
else if (src == "Github"){
console.log("[SPXX] Using Github bug center")
tr = 'https://raw.githubusercontent.com/SPXFellow/spxx-translation-database/crowdin/zh-CN/zh_CN.json'
tor = 'https://raw.githubusercontent.com/SPXFellow/spxx-translation-database/master/translator.json'
c = 'https://raw.githubusercontent.com/SPXFellow/spxx-translation-database/master/color.json'
}
else{
console.log("[SPXX] Using custom bug center")
tr = GM_config.get('bugCenterTranslation') as string
tor = GM_config.get('bugCenterTranslator') as string
c = GM_config.get('bugCenterColor') as string
}

const config = {
translator: GM_config.get('translator') as string,
bugCenter: {
translation: GM_config.get('bugCenterTranslation') as string,
translator: GM_config.get('bugCenterTranslator') as string,
color: GM_config.get('bugCenterColor') as string,
translation: tr,
translator: tor,
color: c,
},
}

Expand Down

0 comments on commit 51305b5

Please sign in to comment.