Add all-pages index navigation. Close #1133

This commit is contained in:
Mayhem 2013-10-30 02:45:18 +01:00
parent a5d72fe515
commit 1996fc4351
5 changed files with 38 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Index navigation improvements: Index navigation improvements:
- You can now refresh the index page you are on with the same keybind for refreshing threads. - You can now refresh the index page you are on with the same keybind for refreshing threads.
- You can now switch between single-page and all-pages navigation via the "Index Navigation" header sub-menu.
Added a keybind to open the catalog search field on index pages. Added a keybind to open the catalog search field on index pages.
### 3.11.5 - *2013-10-03* ### 3.11.5 - *2013-10-03*

View File

@ -238,7 +238,7 @@ Build =
else else
"/#{boardID}/res/#{threadID}#q#{postID}" "/#{boardID}/res/#{threadID}#q#{postID}"
}' title='Quote this post'>#{postID}</a>" + }' title='Quote this post'>#{postID}</a>" +
replyLink + replyLink +
'</span>' + '</span>' +
'</div>' + '</div>' +

View File

@ -139,6 +139,7 @@ Config =
#//archive.foolz.us/%board/search/image/%MD5/;text:View same on foolz /%board/ #//archive.foolz.us/%board/search/image/%MD5/;text:View same on foolz /%board/
#//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/ #//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/
""" """
'Index Mode': 'paged'
'Custom CSS': false 'Custom CSS': false
Header: Header:
'Header auto-hide': false 'Header auto-hide': false

View File

@ -208,7 +208,7 @@ Main =
try try
localStorage.getItem '4chan-settings' localStorage.getItem '4chan-settings'
catch err catch err
new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30 new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to operate properly.', 30
Main.disableReports = true Main.disableReports = true
$.event '4chanXInitFinished' $.event '4chanXInitFinished'

View File

@ -2,6 +2,33 @@ Index =
init: -> init: ->
return if g.VIEW isnt 'index' return if g.VIEW isnt 'index'
label = $.el 'label',
innerHTML: """
<select name='Index Mode' title='Change the index view mode.'>
<option disabled>Index Mode</option>
<option value='paged'>Paged</option>
<option value='all pages'>All threads</option>
<select>
"""
select = label.firstChild
select.value = Conf['Index Mode']
$.on select, 'change', $.cb.value
$.on select, 'change', @update
$.event 'AddMenuEntry',
type: 'header'
el: $.el 'span',
textContent: 'Index Navigation'
order: 90
subEntries: [el: label]
$.on d, '4chanXInitFinished', @initReady
initReady: ->
$.off d, '4chanXInitFinished', Index.initReady
return if Conf['Index Mode'] is 'paged'
Index.update()
update: -> update: ->
return unless navigator.onLine return unless navigator.onLine
Index.req?.abort() Index.req?.abort()
@ -38,8 +65,13 @@ Index =
Header.scrollTo $.id 'delform' Header.scrollTo $.id 'delform'
parse: (pages) -> parse: (pages) ->
pageNum = +window.location.pathname.split('/')[2] if Conf['Index Mode'] is 'paged'
dataThr = pages[pageNum].threads pageNum = +window.location.pathname.split('/')[2]
dataThr = pages[pageNum].threads
else
dataThr = []
for page in pages
dataThr.push page.threads...
nodes = [] nodes = []
threads = [] threads = []