Make use of a few CoffeeScript filters.
This commit is contained in:
parent
6cf7373b93
commit
b36cf54d83
@ -24,8 +24,7 @@ $.formData = (form) ->
|
||||
if form instanceof HTMLFormElement
|
||||
return new FormData form
|
||||
fd = new FormData()
|
||||
for key, val of form
|
||||
continue unless val
|
||||
for key, val of form when val
|
||||
# XXX GM bug
|
||||
# if val instanceof Blob
|
||||
if val.size and val.name
|
||||
|
||||
@ -199,8 +199,7 @@ Header =
|
||||
'#boardNavDesktopFoot a[href*="boards.4chan.org"]'
|
||||
].join ', '
|
||||
path = if useCatalog then 'catalog' else ''
|
||||
for a in as
|
||||
continue if a.dataset.only
|
||||
for a in as when not a.dataset.only
|
||||
a.pathname = "/#{a.pathname.split('/')[1]}/#{path}"
|
||||
return
|
||||
toggleCatalogLinks: ->
|
||||
|
||||
@ -167,8 +167,7 @@ class Post
|
||||
return if file
|
||||
# Get quotelinks/backlinks to this post
|
||||
# and paint them (Dead).
|
||||
for quotelink in Get.allQuotelinksLinkingTo @
|
||||
continue if $.hasClass quotelink, 'deadlink'
|
||||
for quotelink in Get.allQuotelinksLinkingTo @ when not $.hasClass quotelink, 'deadlink'
|
||||
$.add quotelink, $.tn '\u00A0(Dead)'
|
||||
$.addClass quotelink, 'deadlink'
|
||||
return
|
||||
|
||||
@ -277,8 +277,7 @@ Settings =
|
||||
'%board'
|
||||
else
|
||||
c
|
||||
for key, val of Config.hotkeys
|
||||
continue unless key of data.Conf
|
||||
for key, val of Config.hotkeys when key of data.Conf
|
||||
data.Conf[key] = data.Conf[key].replace(/ctrl|alt|meta/g, (s) -> "#{s[0].toUpperCase()}#{s[1..]}").replace /(^|.+\+)[A-Z]$/g, (s) ->
|
||||
"Shift+#{s[0...-1]}#{s[-1..].toLowerCase()}"
|
||||
data.Conf.WatchedThreads = data.WatchedThreads
|
||||
|
||||
@ -176,9 +176,7 @@ QR =
|
||||
types[type].push val
|
||||
loadPersonas: (type, arr) ->
|
||||
list = $ "#list-#{type}", QR.nodes.el
|
||||
for val in arr
|
||||
# XXX Firefox displays empty <option>s in the completion list.
|
||||
continue unless val
|
||||
for val in arr when val
|
||||
$.add list, $.el 'option',
|
||||
textContent: val
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user