mirror of
https://github.com/Metastem/wikiless
synced 2024-12-06 19:16:58 +01:00
improve korean layout (#76)
This commit is contained in:
+5
-3
@@ -62,9 +62,11 @@ module.exports = (app, utils) => {
|
||||
return res.sendFile(wikilessFavicon())
|
||||
}
|
||||
|
||||
// fr logos
|
||||
if(req.url.startsWith('/static/images/mobile/copyright/')) {
|
||||
return res.sendFile(frLogo(req.url))
|
||||
// custom wikipedia logos for different languages
|
||||
if(req.url.startsWith('/static/images/mobile/copyright/')) {
|
||||
if(customLogos(req.url)) {
|
||||
return res.sendFile(custom_logo)
|
||||
}
|
||||
}
|
||||
|
||||
return next()
|
||||
|
||||
+33
-8
@@ -69,19 +69,24 @@ module.exports = function(redis) {
|
||||
* cookie specific modifications to it yet. Let's do it.
|
||||
*/
|
||||
|
||||
// load fr style, issue #12
|
||||
const langSuffix = (lang === 'fr') ? `_${lang}` : '';
|
||||
// load custom language specific languages
|
||||
let lang_suffix = '';
|
||||
let load_custom_styles = ['fr', 'ko'];
|
||||
|
||||
if(load_custom_styles.includes(lang)) {
|
||||
lang_suffix = '_' + lang;
|
||||
}
|
||||
|
||||
if(theme === 'white') {
|
||||
// if the user has chosen the white theme from the preferences
|
||||
data = data.replace('</head>', `<link rel="stylesheet" href="/wikipedia_styles_light${langSuffix}.css"></head>`)
|
||||
data = data.replace('</head>', `<link rel="stylesheet" href="/wikipedia_styles_light${lang_suffix}.css"></head>`)
|
||||
} else if(theme === 'dark') {
|
||||
// if the user has chosen the dark theme from the preferences
|
||||
data = data.replace('</head>', `<link rel="stylesheet" href="/wikipedia_styles_light${langSuffix}.css">
|
||||
data = data.replace('</head>', `<link rel="stylesheet" href="/wikipedia_styles_light${lang_suffix}.css">
|
||||
<link rel="stylesheet" href="/wikipedia_styles_dark.css"></head>`)
|
||||
} else {
|
||||
// default, auto theme
|
||||
data = data.replace('</head>', `<link rel="stylesheet" href="/styles${langSuffix}.css"></head>`)
|
||||
data = data.replace('</head>', `<link rel="stylesheet" href="/styles${lang_suffix}.css"></head>`)
|
||||
}
|
||||
|
||||
return data
|
||||
@@ -293,7 +298,7 @@ module.exports = function(redis) {
|
||||
}
|
||||
|
||||
this.handleWikiPage = async (req, res, prefix) => {
|
||||
let lang = req.query.lang || req.cookies.default_lang || config.default_lang
|
||||
let lang = getLang(req)
|
||||
|
||||
if(lang) {
|
||||
if(Array.isArray(lang)) {
|
||||
@@ -444,8 +449,28 @@ module.exports = function(redis) {
|
||||
return `${static_path}/wikiless-favicon.ico`
|
||||
}
|
||||
|
||||
this.frLogo = (reqUrl) => {
|
||||
return path.join(__dirname, '..', 'static', 'fr', path.basename(reqUrl))
|
||||
this.customLogos = (req) => {
|
||||
const lang = getLang(req);
|
||||
if(lang === 'fr') {
|
||||
return path.join(__dirname, '..', 'static', 'fr', path.basename(req.url))
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.getLang = (req=false) => {
|
||||
if(!req) {
|
||||
return config.default_lang
|
||||
}
|
||||
|
||||
if(req.query && req.query.lang) {
|
||||
return req.query.lang
|
||||
}
|
||||
|
||||
if(req.cookies && req.cookies.default_lang) {
|
||||
return req.cookies.default_lang
|
||||
}
|
||||
|
||||
return config.default_lang
|
||||
}
|
||||
|
||||
this.preferencesPage = (req, res) => {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
@import "wikipedia_styles_light_ko.css";
|
||||
@import "wikipedia_styles_dark.css" (prefers-color-scheme: dark);
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user