legacy mode list

This commit is contained in:
b1ek 2023-03-18 17:16:00 +10:00
parent 937828dd91
commit 91227c128a
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 20 additions and 9 deletions

View File

@ -19,10 +19,11 @@ router.use(minify({
})); }));
// TODO: Maybe move all regexes into one file? Idk // TODO: Maybe move all regexes into one file? Idk
const legacy_re = /(Firefox\/[0-5]\d{0,1}|Mozilla\/[0-4]|MSIE \d{1,2}\.\d{1,2}|Windows (NT|9\d)|Linux i686|(198\d|199\d|200\d|201[0-6])|Opera|Dillo|Naenara|Navscape|Lynx[1-5]|QtWeb|Prism|Tencent|i(Phone|Pad|Pod)( OS [1-6]|))/g; const legacy_re = /(Firefox\/[0-5]\d{0,1}|Mozilla\/[0-4]|MSIE \d{1,2}\.\d{1,2}|Windows (NT|9\d)|Linux i686|(198\d|199\d|200\d|201[0-6])|Dillo|Naenara|Navscape|Netscape|QtWeb|Prism|Tencent|i(Phone|Pad|Pod)( OS [1-5]|))/g;
router.use((req, res, next) => { router.use((req, res, next) => {
req.legacymode = req.headers['user-agent'].match(legacy_re); req.legacymode = req.headers['user-agent'].match(legacy_re);
// res.send(req.headers['user-agent']);return;
next(); next();
}); });

View File

@ -65,16 +65,26 @@ html(style='overflow-y:auto' lang='en_US')
h1 h1
a(href='/') blek! Site a(href='/') blek! Site
hr(class='flag_hr') hr(class='flag_hr')
ul if (!req.legacymode)
each route, name in routes ul
if (route == 'hr') each route, name in routes
li <hr/> if (route == 'hr')
else li <hr/>
li(style='padding-left:4px') else
if current_route == route li(style='padding-left:4px')
if current_route == route
| > #{name}
else
a(href=route) #{name}
else
p(style='font-size:7pt')
each route, name in routes
if (route != 'hr')
if (current_route == router)
| > #{name} | > #{name}
else else
a(href=route) #{name} a(href=router)= name
br
hr hr
p(class='nojs_hide') This site is also available in: p(class='nojs_hide') This site is also available in: