From 9b482ddc9699cccee7db13de0663ec887fb8fc33 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 24 Jan 2012 03:49:13 +0100 Subject: [PATCH] WTF? Fix normal captcha automatic focus prevention. Chrome only issue? This happened since I injected the messaging code using the window.location too. --- 4chan_x.user.js | 8 ++++---- script.coffee | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index d9705a476..e088be313 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1205,7 +1205,6 @@ qr = { init: function() { if (!$('form[name=post]')) return; - qr.spoiler = !!$('#com_submit + label'); g.callbacks.push(function(root) { return $.on($('.quotejs + .quotejs', root), 'click', qr.quote); }); @@ -1219,7 +1218,8 @@ if (conf['Auto Hide QR']) $.id('autohide').click(); } $.on(d, 'dragover', qr.fileDrop); - return $.on(d, 'drop', qr.fileDrop); + $.on(d, 'drop', qr.fileDrop); + return window.location = 'javascript:void(Recaptcha.focus_response_field=function(){})'; }, open: function() { if (qr.el) { @@ -1438,8 +1438,7 @@ } }); this.count($.get('captchas', []).length); - this.load(); - return window.location = 'javascript:(function(){Recaptcha.focus_response_field=function(){}})()'; + return this.load(); }, save: function() { var captcha, captchas, response; @@ -1507,6 +1506,7 @@ } }); qr.mimeTypes = mimeTypes.split(', '); + qr.spoiler = !!$('#com_submit + label'); qr.el = ui.dialog('qr', 'top:0;right:0;', "
Quick Reply " + (g.REPLY ? '' : threads) + " x
+
Spoiler Image?
"); if (!g.REPLY) { $.on($('select', qr.el), 'mousedown', function(e) { diff --git a/script.coffee b/script.coffee index 0fd447a6e..cd12b1bd8 100644 --- a/script.coffee +++ b/script.coffee @@ -875,7 +875,6 @@ nav = qr = init: -> return unless $ 'form[name=post]' - qr.spoiler = !!$ '#com_submit + label' g.callbacks.push (root) -> $.on $('.quotejs + .quotejs', root), 'click', qr.quote $.add d.body, $.el 'iframe', @@ -887,6 +886,8 @@ qr = $.id('autohide').click() if conf['Auto Hide QR'] $.on d, 'dragover', qr.fileDrop $.on d, 'drop', qr.fileDrop + # prevent original captcha input from being focused on reload + window.location = 'javascript:void(Recaptcha.focus_response_field=function(){})' open: -> if qr.el @@ -1065,8 +1066,6 @@ qr = $.on window, 'storage', (e) => @count JSON.parse(e.newValue).length if e.key is "#{NAMESPACE}captchas" @count $.get('captchas', []).length @load() - # prevent original captcha input from being focused on reload - window.location = 'javascript:(function(){Recaptcha.focus_response_field=function(){}})()' save: -> return unless response = @input.value captchas = $.get 'captchas', [] @@ -1118,6 +1117,7 @@ qr = else 'image/' + type qr.mimeTypes = mimeTypes.split ', ' + qr.spoiler = !!$ '#com_submit + label' qr.el = ui.dialog 'qr', 'top:0;right:0;', "
Quick Reply