Normalize URL feature should remove excess slashes. #499

This commit is contained in:
ccd0 2015-10-04 15:40:29 -07:00
parent 430302f1de
commit f00327a70d

View File

@ -133,11 +133,17 @@ Main =
ImageCommon.addControls video
return
if Conf['Normalize URL'] and g.VIEW is 'thread'
if Conf['Normalize URL']
pathname = location.pathname.split /\/+/
if pathname[2] isnt 'thread' or pathname.length > 4
pathname[2] = 'thread'
history.replaceState null, '', "#{location.protocol}//#{location.host}#{pathname[0...4].join('/')}#{location.hash}"
switch g.VIEW
when 'thread'
pathname[2] = 'thread'
pathname = pathname[0...4]
when 'index'
pathname = pathname[0...3]
pathname = pathname.join '/'
if location.pathname isnt pathname
history.replaceState history.state, '', "#{location.protocol}//#{location.host}#{pathname}#{location.hash}"
# c.time 'All initializations'
for [name, feature] in Main.features