Make use of a few CoffeeScript filters.

This commit is contained in:
Mayhem 2013-08-05 23:30:39 +02:00
parent 6cf7373b93
commit b36cf54d83
5 changed files with 5 additions and 11 deletions

View File

@ -24,8 +24,7 @@ $.formData = (form) ->
if form instanceof HTMLFormElement if form instanceof HTMLFormElement
return new FormData form return new FormData form
fd = new FormData() fd = new FormData()
for key, val of form for key, val of form when val
continue unless val
# XXX GM bug # XXX GM bug
# if val instanceof Blob # if val instanceof Blob
if val.size and val.name if val.size and val.name

View File

@ -199,8 +199,7 @@ Header =
'#boardNavDesktopFoot a[href*="boards.4chan.org"]' '#boardNavDesktopFoot a[href*="boards.4chan.org"]'
].join ', ' ].join ', '
path = if useCatalog then 'catalog' else '' path = if useCatalog then 'catalog' else ''
for a in as for a in as when not a.dataset.only
continue if a.dataset.only
a.pathname = "/#{a.pathname.split('/')[1]}/#{path}" a.pathname = "/#{a.pathname.split('/')[1]}/#{path}"
return return
toggleCatalogLinks: -> toggleCatalogLinks: ->

View File

@ -167,8 +167,7 @@ class Post
return if file return if file
# Get quotelinks/backlinks to this post # Get quotelinks/backlinks to this post
# and paint them (Dead). # and paint them (Dead).
for quotelink in Get.allQuotelinksLinkingTo @ for quotelink in Get.allQuotelinksLinkingTo @ when not $.hasClass quotelink, 'deadlink'
continue if $.hasClass quotelink, 'deadlink'
$.add quotelink, $.tn '\u00A0(Dead)' $.add quotelink, $.tn '\u00A0(Dead)'
$.addClass quotelink, 'deadlink' $.addClass quotelink, 'deadlink'
return return

View File

@ -277,8 +277,7 @@ Settings =
'%board' '%board'
else else
c c
for key, val of Config.hotkeys for key, val of Config.hotkeys when key of data.Conf
continue unless 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) -> 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()}" "Shift+#{s[0...-1]}#{s[-1..].toLowerCase()}"
data.Conf.WatchedThreads = data.WatchedThreads data.Conf.WatchedThreads = data.WatchedThreads

View File

@ -176,9 +176,7 @@ QR =
types[type].push val types[type].push val
loadPersonas: (type, arr) -> loadPersonas: (type, arr) ->
list = $ "#list-#{type}", QR.nodes.el list = $ "#list-#{type}", QR.nodes.el
for val in arr for val in arr when val
# XXX Firefox displays empty <option>s in the completion list.
continue unless val
$.add list, $.el 'option', $.add list, $.el 'option',
textContent: val textContent: val
return return