From 1d5a144cb2b7d74f892551fab454f5db4595a8bf Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 23 Oct 2015 17:34:18 -0700 Subject: [PATCH] Update captcha cleanup. --- src/Posting/Captcha.v2.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Posting/Captcha.v2.coffee b/src/Posting/Captcha.v2.coffee index 86cbfbfcf..57dfe0ffa 100644 --- a/src/Posting/Captcha.v2.coffee +++ b/src/Posting/Captcha.v2.coffee @@ -154,9 +154,11 @@ Captcha.v2 = $.rm @nodes.container if @nodes.container delete @nodes.container # Clean up abandoned iframes. - for garbage in $$ 'div > .gc-bubbleDefault' - $.rm ins if (ins = garbage.parentNode.nextSibling) and ins.nodeName is 'INS' - $.rm garbage.parentNode + garbage = $.X '//iframe[starts-with(@src, "https://www.google.com/recaptcha/api2/frame")]/ancestor-or-self::*[parent::body]' + i = 0 + while node = garbage.snapshotItem i++ + $.rm ins if (ins = node.nextSibling)?.nodeName is 'INS' + $.rm node return sync: (captchas=[]) ->