Support adjusting the length thresholds for 'Last Long Reply' order. Thresholds can be set separately for replies with and without images.
This commit is contained in:
parent
c731f3874e
commit
f06be36805
@ -112,6 +112,17 @@ Index =
|
|||||||
@selectRev.checked = /-rev$/.test Index.currentSort
|
@selectRev.checked = /-rev$/.test Index.currentSort
|
||||||
@selectSort.value = Index.currentSort.replace /-rev$/, ''
|
@selectSort.value = Index.currentSort.replace /-rev$/, ''
|
||||||
|
|
||||||
|
# Last Long Reply options
|
||||||
|
@lastLongOptions = $ '#lastlong-options', @navLinks
|
||||||
|
@lastLongInputs = $$ 'input', @lastLongOptions
|
||||||
|
@lastLongThresholds = [0, 0]
|
||||||
|
@lastLongOptions.hidden = (@selectSort.value isnt 'lastlong')
|
||||||
|
for input, i in @lastLongInputs
|
||||||
|
$.on input, 'change', @cb.lastLongThresholds
|
||||||
|
tRaw = Conf["Last Long Reply Thresholds #{i}"]
|
||||||
|
input.value = @lastLongThresholds[i] =
|
||||||
|
if typeof tRaw is 'object' then (tRaw[g.BOARD.ID] ? 100) else tRaw
|
||||||
|
|
||||||
# Thread container
|
# Thread container
|
||||||
@root = $.el 'div', className: 'board json-index'
|
@root = $.el 'div', className: 'board json-index'
|
||||||
$.on @root, 'click', @cb.hoverToggle
|
$.on @root, 'click', @cb.hoverToggle
|
||||||
@ -269,6 +280,21 @@ Index =
|
|||||||
perBoardSort: ->
|
perBoardSort: ->
|
||||||
Conf['Index Sort'] = if @checked then {} else ''
|
Conf['Index Sort'] = if @checked then {} else ''
|
||||||
Index.saveSort()
|
Index.saveSort()
|
||||||
|
for i in [0...2]
|
||||||
|
Conf["Last Long Reply Thresholds #{i}"] = if @checked then {} else ''
|
||||||
|
Index.saveLastLongThresholds i
|
||||||
|
return
|
||||||
|
|
||||||
|
lastLongThresholds: ->
|
||||||
|
i = [@parentNode.children...].indexOf @
|
||||||
|
value = +@value
|
||||||
|
unless Number.isFinite(value)
|
||||||
|
@value = Index.lastLongThresholds[i]
|
||||||
|
return
|
||||||
|
Index.lastLongThresholds[i] = value
|
||||||
|
Index.saveLastLongThresholds i
|
||||||
|
Index.changed.order = true
|
||||||
|
Index.pageLoad false
|
||||||
|
|
||||||
size: (e) ->
|
size: (e) ->
|
||||||
if Conf['Index Mode'] isnt 'catalog'
|
if Conf['Index Mode'] isnt 'catalog'
|
||||||
@ -439,12 +465,18 @@ Index =
|
|||||||
if hash?
|
if hash?
|
||||||
Index.changed.hash = true
|
Index.changed.hash = true
|
||||||
|
|
||||||
saveSort: ->
|
savePerBoard: (key, value) ->
|
||||||
if typeof Conf['Index Sort'] is 'object'
|
if typeof Conf[key] is 'object'
|
||||||
Conf['Index Sort'][g.BOARD.ID] = Index.currentSort
|
Conf[key][g.BOARD.ID] = value
|
||||||
else
|
else
|
||||||
Conf['Index Sort'] = Index.currentSort
|
Conf[key] = value
|
||||||
$.set 'Index Sort', Conf['Index Sort']
|
$.set key, Conf[key]
|
||||||
|
|
||||||
|
saveSort: ->
|
||||||
|
Index.savePerBoard 'Index Sort', Index.currentSort
|
||||||
|
|
||||||
|
saveLastLongThresholds: (i) ->
|
||||||
|
Index.savePerBoard "Last Long Reply Thresholds #{i}", Index.lastLongThresholds[i]
|
||||||
|
|
||||||
pageLoad: (scroll=true) ->
|
pageLoad: (scroll=true) ->
|
||||||
return unless Index.liveThreadData
|
return unless Index.liveThreadData
|
||||||
@ -473,6 +505,7 @@ Index =
|
|||||||
setupSort: ->
|
setupSort: ->
|
||||||
Index.selectRev.checked = /-rev$/.test Index.currentSort
|
Index.selectRev.checked = /-rev$/.test Index.currentSort
|
||||||
Index.selectSort.value = Index.currentSort.replace /-rev$/, ''
|
Index.selectSort.value = Index.currentSort.replace /-rev$/, ''
|
||||||
|
Index.lastLongOptions.hidden = (Index.selectSort.value isnt 'lastlong')
|
||||||
|
|
||||||
getPagesNum: ->
|
getPagesNum: ->
|
||||||
if Index.search
|
if Index.search
|
||||||
@ -776,7 +809,9 @@ Index =
|
|||||||
when 'lastlong'
|
when 'lastlong'
|
||||||
lastlong = (thread) ->
|
lastlong = (thread) ->
|
||||||
for r, i in (thread.last_replies or []) by -1
|
for r, i in (thread.last_replies or []) by -1
|
||||||
return r if r.com and Build.parseComment(r.com).replace(/[^a-z]/ig, '').length >= 100
|
len = if r.com then Build.parseComment(r.com).replace(/[^a-z]/ig, '').length else 0
|
||||||
|
if len >= Index.lastLongThresholds[+!!r.ext]
|
||||||
|
return r
|
||||||
thread
|
thread
|
||||||
[liveThreadData...].sort((a, b) ->
|
[liveThreadData...].sort((a, b) ->
|
||||||
lastlong(b).no - lastlong(a).no
|
lastlong(b).no - lastlong(a).no
|
||||||
|
|||||||
@ -8,6 +8,10 @@
|
|||||||
<span id="hidden-label" hidden> — <span id="hidden-count"></span> <span id="hidden-toggle">[<a href="javascript:;">Show</a>]</span></span>
|
<span id="hidden-label" hidden> — <span id="hidden-count"></span> <span id="hidden-toggle">[<a href="javascript:;">Show</a>]</span></span>
|
||||||
<span id="index-options">
|
<span id="index-options">
|
||||||
<input type="checkbox" id="index-rev" name="Reverse Sort" title="Reverse sort order">
|
<input type="checkbox" id="index-rev" name="Reverse Sort" title="Reverse sort order">
|
||||||
|
<span id="lastlong-options" hidden>
|
||||||
|
<input type="text" title="Minimum letter count (without image)">
|
||||||
|
<input type="text" title="Minimum letter count (with image)">
|
||||||
|
</span>
|
||||||
<select id="index-sort" name="Index Sort">
|
<select id="index-sort" name="Index Sort">
|
||||||
<option disabled>Index Sort</option>
|
<option disabled>Index Sort</option>
|
||||||
<option value="bump">Bump order</option>
|
<option value="bump">Bump order</option>
|
||||||
|
|||||||
@ -730,6 +730,23 @@ div[data-checked="false"] > .suboption-list {
|
|||||||
#index-options {
|
#index-options {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
#lastlong-options {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 28px;
|
||||||
|
margin: -14px 0;
|
||||||
|
}
|
||||||
|
#lastlong-options > input {
|
||||||
|
padding: 0;
|
||||||
|
border: 0 !important;
|
||||||
|
text-align: center;
|
||||||
|
background: transparent;
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
height: 12px;
|
||||||
|
width: 30px;
|
||||||
|
margin: 1px 0;
|
||||||
|
}
|
||||||
.summary {
|
.summary {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ Main =
|
|||||||
Conf['selectedArchives'] = {}
|
Conf['selectedArchives'] = {}
|
||||||
Conf['cooldowns'] = {}
|
Conf['cooldowns'] = {}
|
||||||
Conf['Index Sort'] = {}
|
Conf['Index Sort'] = {}
|
||||||
|
Conf["Last Long Reply Thresholds #{i}"] = {} for i in [0...2]
|
||||||
|
|
||||||
# XXX old key names
|
# XXX old key names
|
||||||
Conf['Except Archives from Encryption'] = false
|
Conf['Except Archives from Encryption'] = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user