diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 30caf19fa..9827fa7ac 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -97,6 +97,10 @@ Config = true 'Warn if your browser or configuration is unsupported and may cause 4chan X to not operate correctly.' ] + 'Normalize URL': [ + true + 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.' + ] 'Linkification': 'Linkify': [ diff --git a/src/General/Main.coffee b/src/General/Main.coffee index ab27d75b3..3cddd156a 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -16,9 +16,6 @@ Main = 'index' if g.VIEW is 'thread' g.THREADID = +pathname[3] - if pathname[2] isnt 'thread' or pathname.length > 4 - pathname[2] = 'thread' - history.replaceState null, '', pathname.slice(0,4).join('/') + location.hash # flatten Config into Conf # and get saved or default values @@ -65,6 +62,12 @@ Main = if video.paused then video.play() else video.pause() return + if Conf['Normalize URL'] and g.VIEW is 'thread' + pathname = location.pathname.split '/' + if pathname[2] isnt 'thread' or pathname.length > 4 + pathname[2] = 'thread' + history.replaceState null, '', pathname.slice(0,4).join('/') + location.hash + # c.time 'All initializations' for [name, feature] in Main.features # c.time "#{name} initialization" diff --git a/src/General/lib/post.class b/src/General/lib/post.class index bf9d388e4..cb995a06e 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -119,7 +119,7 @@ class Post return unless match = quotelink.href.match /// boards\.4chan\.org/ ([^/]+) # boardID - /(?:res|thread)/\d+#p + /(?:res|thread)/\d+(?:\/[^#]*)?#p (\d+) # postID $ ///