Add captcha refresh on backspace and one-word captcha in the report window. #932
This commit is contained in:
parent
df81ea3815
commit
e8012a38da
@ -43,7 +43,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, AutoGIF, Board, Build, Clone, Conf, Config, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, Keybinds, Main, Menu, Misc, Nav, Notification, Polyfill, Post, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, ReplyHiding, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, AutoGIF, Board, Build, Clone, Conf, Config, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, Keybinds, Main, Menu, Misc, Nav, Notification, Polyfill, Post, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, ReplyHiding, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, d, doc, g,
|
||||||
__slice = [].slice,
|
__slice = [].slice,
|
||||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
||||||
__hasProp = {}.hasOwnProperty,
|
__hasProp = {}.hasOwnProperty,
|
||||||
@ -6788,6 +6788,34 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Report = {
|
||||||
|
init: function() {
|
||||||
|
if (!/report/.test(location.search)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return $.ready(this.ready);
|
||||||
|
},
|
||||||
|
ready: function() {
|
||||||
|
var field, form;
|
||||||
|
form = $('form');
|
||||||
|
field = $.id('recaptcha_response_field');
|
||||||
|
$.on(field, 'keydown', function(e) {
|
||||||
|
if (e.keyCode === 8 && !field.value) {
|
||||||
|
return $.unsafeWindow.Recaptcha.reload('t');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $.on(form, 'submit', function(e) {
|
||||||
|
var response;
|
||||||
|
e.preventDefault();
|
||||||
|
response = field.value.trim();
|
||||||
|
if (!/\s/.test(response)) {
|
||||||
|
field.value = "" + response + " " + response;
|
||||||
|
}
|
||||||
|
return form.submit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Board = (function() {
|
Board = (function() {
|
||||||
|
|
||||||
Board.prototype.toString = function() {
|
Board.prototype.toString = function() {
|
||||||
@ -7159,6 +7187,7 @@
|
|||||||
}
|
}
|
||||||
switch (location.hostname) {
|
switch (location.hostname) {
|
||||||
case 'sys.4chan.org':
|
case 'sys.4chan.org':
|
||||||
|
Report.init();
|
||||||
return;
|
return;
|
||||||
case 'images.4chan.org':
|
case 'images.4chan.org':
|
||||||
$.ready(function() {
|
$.ready(function() {
|
||||||
|
|||||||
@ -16,6 +16,7 @@ module.exports = function(grunt) {
|
|||||||
'lib/polyfill.coffee',
|
'lib/polyfill.coffee',
|
||||||
'src/features.coffee',
|
'src/features.coffee',
|
||||||
'src/qr.coffee',
|
'src/qr.coffee',
|
||||||
|
'src/report.coffee',
|
||||||
'src/main.coffee'
|
'src/main.coffee'
|
||||||
],
|
],
|
||||||
dest: 'tmp/script.coffee'
|
dest: 'tmp/script.coffee'
|
||||||
@ -65,6 +66,7 @@ module.exports = function(grunt) {
|
|||||||
interrupt: true
|
interrupt: true
|
||||||
},
|
},
|
||||||
files: [
|
files: [
|
||||||
|
'Gruntfile.js',
|
||||||
'package.json',
|
'package.json',
|
||||||
'lib/**/*.coffee',
|
'lib/**/*.coffee',
|
||||||
'src/**/*.coffee',
|
'src/**/*.coffee',
|
||||||
|
|||||||
@ -289,6 +289,7 @@ Main =
|
|||||||
|
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
when 'sys.4chan.org'
|
when 'sys.4chan.org'
|
||||||
|
Report.init()
|
||||||
return
|
return
|
||||||
when 'images.4chan.org'
|
when 'images.4chan.org'
|
||||||
$.ready ->
|
$.ready ->
|
||||||
|
|||||||
14
src/report.coffee
Normal file
14
src/report.coffee
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Report =
|
||||||
|
init: ->
|
||||||
|
return unless /report/.test location.search
|
||||||
|
$.ready @ready
|
||||||
|
ready: ->
|
||||||
|
form = $ 'form'
|
||||||
|
field = $.id 'recaptcha_response_field'
|
||||||
|
$.on field, 'keydown', (e) ->
|
||||||
|
$.unsafeWindow.Recaptcha.reload 't' if e.keyCode is 8 and not field.value
|
||||||
|
$.on form, 'submit', (e) ->
|
||||||
|
e.preventDefault()
|
||||||
|
response = field.value.trim()
|
||||||
|
field.value = "#{response} #{response}" unless /\s/.test response
|
||||||
|
form.submit()
|
||||||
Loading…
x
Reference in New Issue
Block a user