Merge from Appchan X: src/Miscellaneous
excluded: CatalogLinks.coffee deferred: Flash.coffee
This commit is contained in:
parent
eaec80f5a5
commit
7147ad0a01
@ -16,16 +16,15 @@ Banner =
|
||||
if g.BOARD.ID isnt 'f' and g.VIEW is 'thread' and Conf['Remove Thread Excerpt']
|
||||
Banner.setTitle children[1].textContent
|
||||
|
||||
i = 0
|
||||
while child = children[i++]
|
||||
if i is 1
|
||||
for child, i in children
|
||||
if i is 0
|
||||
child.title = "Click to change"
|
||||
$.on child, 'click', Banner.cb.toggle
|
||||
|
||||
continue
|
||||
|
||||
if Conf['Custom Board Titles']
|
||||
Banner.custom(child).title = "Ctrl/\u2318+click to edit board #{if i is 3
|
||||
Banner.custom(child).title = "Ctrl/\u2318+click to edit board #{if i is 2
|
||||
'sub'
|
||||
else
|
||||
''}title"
|
||||
|
||||
@ -13,5 +13,5 @@ CustomCSS =
|
||||
|
||||
update: ->
|
||||
unless @style
|
||||
@addStyle()
|
||||
return @addStyle()
|
||||
@style.textContent = Conf['usercss']
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
ExpandComment =
|
||||
init: ->
|
||||
return if g.VIEW isnt 'index' or !Conf['Comment Expansion']
|
||||
return if g.VIEW isnt 'index' or !Conf['Comment Expansion'] or Conf['JSON Navigation']
|
||||
|
||||
@callbacks.push Fourchan.code if g.BOARD.ID is 'g'
|
||||
@callbacks.push Fourchan.math if g.BOARD.ID is 'sci'
|
||||
|
||||
@ -1,28 +1,26 @@
|
||||
IDColor =
|
||||
init: ->
|
||||
return if g.VIEW not in ['index', 'thread'] or not Conf['Color User IDs']
|
||||
@ids = {}
|
||||
return unless g.VIEW in ['index', 'thread'] and Conf['Color User IDs']
|
||||
@ids = {
|
||||
Heaven: [0, 0, 0, '#fff']
|
||||
}
|
||||
|
||||
Post.callbacks.push
|
||||
name: 'Color User IDs'
|
||||
cb: @node
|
||||
|
||||
node: ->
|
||||
return if @isClone or not uid = @info.uniqueID
|
||||
span = $ '.hand', @nodes.uniqueID
|
||||
return unless span and span.nodeName is 'SPAN'
|
||||
rgb = IDColor.compute uid
|
||||
return if @isClone or !((uid = @info.uniqueID) and (span = $ 'span.hand', @nodes.uniqueID))
|
||||
|
||||
rgb = IDColor.ids[uid] or IDColor.compute uid
|
||||
|
||||
# Style the damn node.
|
||||
{style} = span
|
||||
style.color = rgb[3]
|
||||
style.backgroundColor = "rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]})"
|
||||
$.addClass span, 'painted'
|
||||
span.title = 'Highlight posts by this ID'
|
||||
|
||||
compute: (uid) ->
|
||||
return IDColor.ids[uid] if IDColor.ids[uid]
|
||||
|
||||
# Convert chars to integers, bitshift and math to create a larger integer
|
||||
# Create a nice string of binary
|
||||
hash = IDColor.hash uid
|
||||
@ -35,7 +33,7 @@ IDColor =
|
||||
]
|
||||
|
||||
# Weight color luminance values, assign a font color that should be readable.
|
||||
rgb[3] = if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
|
||||
rgb.push if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
|
||||
'#000'
|
||||
else
|
||||
'#fff'
|
||||
|
||||
@ -46,7 +46,7 @@ Keybinds =
|
||||
else if (notifications = $$ '.notification').length
|
||||
for notification in notifications
|
||||
$('.close', notification).click()
|
||||
else if QR.nodes and !QR.nodes.el.hidden and window.getComputedStyle(QR.nodes.form).display isnt 'none'
|
||||
else if QR.nodes and not (QR.nodes.el.hidden or window.getComputedStyle(QR.nodes.form).display is 'none')
|
||||
if Conf['Persistent QR']
|
||||
QR.hide()
|
||||
else
|
||||
@ -139,19 +139,19 @@ Keybinds =
|
||||
Index.cycleSortType()
|
||||
# Thread Navigation
|
||||
when Conf['Next thread']
|
||||
return if g.VIEW isnt 'index' or !threadRoot
|
||||
return unless g.VIEW is 'index' and threadRoot
|
||||
Nav.scroll +1
|
||||
when Conf['Previous thread']
|
||||
return if g.VIEW isnt 'index' or !threadRoot
|
||||
return unless g.VIEW is 'index' and threadRoot
|
||||
Nav.scroll -1
|
||||
when Conf['Expand thread']
|
||||
return if g.VIEW isnt 'index' or !threadRoot
|
||||
return unless g.VIEW is 'index' and threadRoot
|
||||
ExpandThread.toggle thread
|
||||
when Conf['Open thread']
|
||||
return if g.VIEW isnt 'index' or !threadRoot
|
||||
return unless g.VIEW is 'index' and threadRoot
|
||||
Keybinds.open thread
|
||||
when Conf['Open thread tab']
|
||||
return if g.VIEW isnt 'index' or !threadRoot
|
||||
return unless g.VIEW is 'index' and threadRoot
|
||||
Keybinds.open thread, true
|
||||
# Reply Navigation
|
||||
when Conf['Next reply']
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Time =
|
||||
init: ->
|
||||
return if g.VIEW not in ['index', 'thread'] or !Conf['Time Formatting']
|
||||
return unless g.VIEW in ['index', 'thread'] and Conf['Time Formatting']
|
||||
|
||||
Post.callbacks.push
|
||||
name: 'Time Formatting'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user