Move existence check into $.rm.

This commit is contained in:
ccd0 2015-07-30 21:52:44 -07:00
parent c5eb74ba5f
commit 5ffc7f4bd4
4 changed files with 5 additions and 5 deletions

View File

@ -105,7 +105,7 @@ Index =
d.implementation.createDocument(null, null, null).appendChild board
$.rm el for el in $$ '.navLinks'
$.id('search-box')?.parentNode.remove()
$.rm $.id('search-box')?.parentNode
topNavPos = $.id('delform').previousElementSibling
$.before topNavPos, $.el 'hr'
$.before topNavPos, Index.navLinks

View File

@ -156,7 +156,7 @@ $.hasClass = (el, className) ->
className in el.classList
$.rm = (el) ->
el.remove()
el?.remove()
$.rmAll = (root) ->
# https://gist.github.com/MayhemYDG/8646194

View File

@ -121,7 +121,7 @@ ImageExpand =
$.rmClass post.nodes.root, 'expanded-image'
$.rmClass file.thumb, 'expanding'
$.rm file.videoControls if file.videoControls
$.rm file.videoControls
file.thumb.parentNode.href = file.url
file.thumb.parentNode.target = '_blank'
for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView']

View File

@ -117,9 +117,9 @@ Captcha.noscript =
destroy: ->
return unless @isEnabled
$.rm @nodes.img if @nodes.img
$.rm @nodes.img
delete @nodes.img
$.rm @nodes.iframe if @nodes.iframe
$.rm @nodes.iframe
delete @nodes.iframe
delete @occupied
@beforeSetup()