From 46bd5a923af535ed79693bee66e6c51e195d78c7 Mon Sep 17 00:00:00 2001 From: Victor Risgaard <29478339+LalleSX@users.noreply.github.com> Date: Sun, 5 Mar 2023 04:08:53 +0100 Subject: [PATCH] Fix Normalize url --- README.md | 15 +++++++++++++++ src/Miscellaneous/NormalizeURL.js | 7 ++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 145644ef3..86e619e8b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/Miscellaneous/NormalizeURL.js b/src/Miscellaneous/NormalizeURL.js index 4df37c601..6c9ab6c25 100644 --- a/src/Miscellaneous/NormalizeURL.js +++ b/src/Miscellaneous/NormalizeURL.js @@ -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': @@ -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}`); } }