Fix captcha caching across threads

This commit is contained in:
Jordan Bates 2013-07-22 07:52:02 -07:00
parent b3db117d71
commit 3e35ced05e
5 changed files with 26 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.19 - 2013-07-15
* 4chan X - Version 1.2.19 - 2013-07-22
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.19 - 2013-07-15
* 4chan X - Version 1.2.19 - 2013-07-22
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -5641,8 +5641,11 @@
$.on(input, 'blur', function() {
return $.rmClass(QR.nodes.el, 'focus');
});
$.get('captchas', [], function(item) {
return _this.sync(item['captchas']);
$.get('captchas', [], function(_arg) {
var captchas;
captchas = _arg.captchas;
return _this.sync(captchas);
});
$.sync('captchas', this.sync);
this.reload();
@ -5650,7 +5653,7 @@
return $.after(QR.nodes.com.parentNode, [imgContainer, input]);
},
sync: function(captchas) {
this.captchas = captchas;
QR.captcha.captchas = captchas;
return QR.captcha.count();
},
getOne: function() {

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.19 - 2013-07-15
* 4chan X - Version 1.2.19 - 2013-07-22
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -5631,8 +5631,11 @@
$.on(input, 'blur', function() {
return $.rmClass(QR.nodes.el, 'focus');
});
$.get('captchas', [], function(item) {
return _this.sync(item['captchas']);
$.get('captchas', [], function(_arg) {
var captchas;
captchas = _arg.captchas;
return _this.sync(captchas);
});
$.sync('captchas', this.sync);
this.reload();
@ -5642,7 +5645,7 @@
return $.after(QR.nodes.com.parentNode, [imgContainer, input]);
},
sync: function(captchas) {
this.captchas = captchas;
QR.captcha.captchas = captchas;
return QR.captcha.count();
},
getOne: function() {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.2.19 - 2013-07-15
* 4chan X - Version 1.2.19 - 2013-07-22
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -5632,8 +5632,11 @@
$.on(input, 'blur', function() {
return $.rmClass(QR.nodes.el, 'focus');
});
$.get('captchas', [], function(item) {
return _this.sync(item['captchas']);
$.get('captchas', [], function(_arg) {
var captchas;
captchas = _arg.captchas;
return _this.sync(captchas);
});
$.sync('captchas', this.sync);
this.reload();
@ -5641,7 +5644,7 @@
return $.after(QR.nodes.com.parentNode, [imgContainer, input]);
},
sync: function(captchas) {
this.captchas = captchas;
QR.captcha.captchas = captchas;
return QR.captcha.count();
},
getOne: function() {

View File

@ -790,8 +790,8 @@ QR =
$.on input, 'keydown', @keydown.bind @
$.on input, 'focus', -> $.addClass QR.nodes.el, 'focus'
$.on input, 'blur', -> $.rmClass QR.nodes.el, 'focus'
$.get 'captchas', [], (item) =>
@sync item['captchas']
$.get 'captchas', [], ({captchas}) =>
@sync captchas
$.sync 'captchas', @sync
# start with an uncached captcha
@reload()
@ -805,7 +805,8 @@ QR =
$.addClass QR.nodes.el, 'has-captcha'
$.after QR.nodes.com.parentNode, [imgContainer, input]
sync: (@captchas) ->
sync: (captchas) ->
QR.captcha.captchas = captchas
QR.captcha.count()
getOne: ->