Skip to content

Commit

Permalink
Fix Normalize url
Browse files Browse the repository at this point in the history
  • Loading branch information
LalleSX committed Mar 5, 2023
1 parent a249c32 commit 46bd5a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ The 4chan XT project is a migration of 4chan X from coffeescript to TypeScript/J
- [ ] run and debug
- [ ] port updates made to 4chan-X made since this was forked

### Checklist.

If all marked = ready to be merged.

- [x] Injects HTML and CSS properly. Basics, Showing the Header, settings menu and index
- [ ] JSON index works.
- [ ] Special themes, fappe, werk, threading(Reddit)
- [ ] Captcha works
- [ ] Quick reply posting.
- [ ] Thread watching works. With the automated settings like auto prunge etc
- [ ] It shows the (you) (OP)
- [ ] Image prefetching
- [ ] Archive redirect. [Example post](https://boards.4chan.org/b/thread/895362580)


## Other notes

- A lot of files have circular dependencies, but rollup can handle that
Expand Down
7 changes: 4 additions & 3 deletions src/Miscellaneous/NormalizeURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { Conf, g } from "../globals/globals";
*/
const NormalizeURL = {
init() {
var pathname;
if (!Conf['Normalize URL']) { return; }

let pathname = location.pathname.split(/\/+/);
pathname = location.pathname.split(/\/+/);
if (g.SITE.software === 'yotsuba') {
switch (g.VIEW) {
case 'thread':
Expand All @@ -21,8 +22,8 @@ const NormalizeURL = {
break;
}
}

if (location.pathname !== pathname.join('/')) {
pathname = pathname.join('/');
if (location.pathname !== pathname) {
return history.replaceState(history.state, '', `${location.protocol}//${location.host}${pathname}${location.hash}`);
}
}
Expand Down

0 comments on commit 46bd5a9

Please sign in to comment.