Make 4chan X tolerant of redundant slashes in 4chan URLs. #499
This commit is contained in:
parent
29a35817d3
commit
2379b0f31d
@ -263,7 +263,7 @@ Index =
|
||||
return
|
||||
return if a.textContent is 'Catalog'
|
||||
e.preventDefault()
|
||||
Index.userPageNav +a.pathname.split('/')[2] or 1
|
||||
Index.userPageNav +a.pathname.split(/\/+/)[2] or 1
|
||||
|
||||
refreshFront: ->
|
||||
Index.update Index.pushState {page: 1, scroll: true}
|
||||
@ -275,7 +275,7 @@ Index =
|
||||
if Conf['Index Mode'] in ['all pages', 'catalog']
|
||||
1
|
||||
else
|
||||
+window.location.pathname.split('/')[2] or 1
|
||||
+window.location.pathname.split(/\/+/)[2] or 1
|
||||
|
||||
userPageNav: (page) ->
|
||||
state = Index.pushState {page, scroll: true}
|
||||
@ -323,7 +323,7 @@ Index =
|
||||
mode: Conf['Index Mode']
|
||||
searched: Index.search
|
||||
oldpage: pageBeforeSearch
|
||||
, '', pathname + hash
|
||||
, '', "#{location.protocol}//#{location.host}#{pathname}#{hash}"
|
||||
state
|
||||
|
||||
saveMode: (mode) ->
|
||||
|
||||
@ -21,7 +21,7 @@ Main =
|
||||
g.threads = new SimpleDict()
|
||||
g.posts = new SimpleDict()
|
||||
|
||||
pathname = location.pathname.split '/'
|
||||
pathname = location.pathname.split /\/+/
|
||||
g.BOARD = new Board pathname[1]
|
||||
return if g.BOARD.ID in ['z', 'fk']
|
||||
g.VIEW =
|
||||
@ -119,7 +119,7 @@ Main =
|
||||
when 'i.4cdn.org'
|
||||
$.asap (-> d.readyState isnt 'loading'), ->
|
||||
if Conf['404 Redirect'] and d.title in ['4chan - Temporarily Offline', '4chan - 404 Not Found']
|
||||
pathname = location.pathname.split '/'
|
||||
pathname = location.pathname.split /\/+/
|
||||
Redirect.navigate 'file',
|
||||
boardID: g.BOARD.ID
|
||||
filename: pathname[pathname.length - 1]
|
||||
@ -134,10 +134,10 @@ Main =
|
||||
return
|
||||
|
||||
if Conf['Normalize URL'] and g.VIEW is 'thread'
|
||||
pathname = location.pathname.split '/'
|
||||
pathname = location.pathname.split /\/+/
|
||||
if pathname[2] isnt 'thread' or pathname.length > 4
|
||||
pathname[2] = 'thread'
|
||||
history.replaceState null, '', pathname[0...4].join('/') + location.hash
|
||||
history.replaceState null, '', "#{location.protocol}//#{location.host}#{pathname[0...4].join('/')}#{location.hash}"
|
||||
|
||||
# c.time 'All initializations'
|
||||
for [name, feature] in Main.features
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user