Skip to content

Commit

Permalink
simplify frequency-list routing
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Sep 18, 2024
1 parent f7fb1c0 commit d45fd2c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 41 deletions.
52 changes: 26 additions & 26 deletions client/frequency-list/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,47 +71,47 @@
<ul>
<li>Literature:</li>
<ul>
<li><a href="/frequency-list/american-literature">American Literature</a></li>
<li><a href="/frequency-list/british-literature">British Literature</a></li>
<li><a href="/frequency-list/classical-literature">Classical Literature</a></li>
<li><a href="/frequency-list/european-literature">European Literature</a></li>
<li><a href="/frequency-list/world-literature">World Literature</a></li>
<li><a href="/frequency-list/other-literature">Other Literature</a></li>
<li><a href="/frequency-list/subcategory?american-literature">American Literature</a></li>
<li><a href="/frequency-list/subcategory?british-literature">British Literature</a></li>
<li><a href="/frequency-list/subcategory?classical-literature">Classical Literature</a></li>
<li><a href="/frequency-list/subcategory?european-literature">European Literature</a></li>
<li><a href="/frequency-list/subcategory?world-literature">World Literature</a></li>
<li><a href="/frequency-list/subcategory?other-literature">Other Literature</a></li>
</ul>
<li>History:</li>
<ul>
<li><a href="/frequency-list/american-history">American History</a></li>
<li><a href="/frequency-list/ancient-history">Ancient History</a></li>
<li><a href="/frequency-list/european-history">European History</a></li>
<li><a href="/frequency-list/world-history">World History</a></li>
<li><a href="/frequency-list/other-history">Other History</a></li>
<li><a href="/frequency-list/subcategory?american-history">American History</a></li>
<li><a href="/frequency-list/subcategory?ancient-history">Ancient History</a></li>
<li><a href="/frequency-list/subcategory?european-history">European History</a></li>
<li><a href="/frequency-list/subcategory?world-history">World History</a></li>
<li><a href="/frequency-list/subcategory?other-history">Other History</a></li>
</ul>
<li>Science:</li>
<ul>
<li><a href="/frequency-list/biology">Biology</a></li>
<li><a href="/frequency-list/chemistry">Chemistry</a></li>
<li><a href="/frequency-list/physics">Physics</a></li>
<li><a href="/frequency-list/other-science">Other Science</a></li>
<li><a href="/frequency-list/subcategory?biology">Biology</a></li>
<li><a href="/frequency-list/subcategory?chemistry">Chemistry</a></li>
<li><a href="/frequency-list/subcategory?physics">Physics</a></li>
<li><a href="/frequency-list/subcategory?other-science">Other Science</a></li>
</ul>
<li>Fine Arts:</li>
<ul>
<li><a href="/frequency-list/visual-fine-arts">Visual Fine Arts</a></li>
<li><a href="/frequency-list/auditory-fine-arts">Auditory Fine Arts</a></li>
<li><a href="/frequency-list/other-fine-arts">Other Fine Arts</a></li>
<li><a href="/frequency-list/subcategory?visual-fine-arts">Visual Fine Arts</a></li>
<li><a href="/frequency-list/subcategory?auditory-fine-arts">Auditory Fine Arts</a></li>
<li><a href="/frequency-list/subcategory?other-fine-arts">Other Fine Arts</a></li>
</ul>
<li>RMPSS:</li>
<ul>
<li><a href="/frequency-list/religion">Religion</a></li>
<li><a href="/frequency-list/mythology">Mythology</a></li>
<li><a href="/frequency-list/philosophy">Philosophy</a></li>
<li><a href="/frequency-list/social-science">Social Science</a></li>
<li><a href="/frequency-list/subcategory?religion">Religion</a></li>
<li><a href="/frequency-list/subcategory?mythology">Mythology</a></li>
<li><a href="/frequency-list/subcategory?philosophy">Philosophy</a></li>
<li><a href="/frequency-list/subcategory?social-science">Social Science</a></li>
</ul>
<li>Other:</li>
<ul>
<li><a href="/frequency-list/geography">Geography</a></li>
<li><a href="/frequency-list/current-events">Current Events</a></li>
<li><a href="/frequency-list/other-academic">Other Academic</a></li>
<li><a href="/frequency-list/trash">Trash (Pop Culture)</a></li>
<li><a href="/frequency-list/subcategory?geography">Geography</a></li>
<li><a href="/frequency-list/subcategory?current-events">Current Events</a></li>
<li><a href="/frequency-list/subcategory?other-academic">Other Academic</a></li>
<li><a href="/frequency-list/subcategory?trash">Trash (Pop Culture)</a></li>
</ul>
</div>

Expand Down
2 changes: 1 addition & 1 deletion client/frequency-list/subcategory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let level = 'all';
let limit = 50;
let questionType = 'all';
const subcategory = titleCase(window.location.pathname.split('/').at(-1));
const subcategory = titleCase(window.location.search.substring(1));

function titleCase (name) {
return name.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
Expand Down
12 changes: 0 additions & 12 deletions routes/frequency-list.js

This file was deleted.

2 changes: 0 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import adminRouter from './admin/index.js';
import apiRouter from './api/index.js';
import authRouter from './auth/index.js';
import frequencyListRouter from './frequency-list.js';
import geowordRouter from './geoword/index.js';
import multiplayerRouter from './multiplayer.js';
import userRouter from './user.js';
Expand Down Expand Up @@ -29,7 +28,6 @@ router.get('/user', (req, res) => res.redirect('/user/login'));
router.use('/admin', adminRouter);
router.use('/api', apiRouter);
router.use('/auth', authRouter);
router.use('/frequency-list', frequencyListRouter);
router.use('/geoword', geowordRouter);
router.use('/multiplayer', multiplayerRouter);
router.use('/user', userRouter);
Expand Down

0 comments on commit d45fd2c

Please sign in to comment.