forked from leftypol/leftypol
main.js: unfuck dynamic captcha support
This commit is contained in:
parent
8f98665a1c
commit
6097849ea2
1 changed files with 6 additions and 3 deletions
|
@ -231,7 +231,7 @@ function init_stylechooser() {
|
|||
}
|
||||
|
||||
function get_cookie(cookie_name) {
|
||||
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
|
||||
var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
|
||||
if (results)
|
||||
return (unescape(results[2]));
|
||||
else
|
||||
|
@ -241,7 +241,7 @@ function get_cookie(cookie_name) {
|
|||
{% endraw %}
|
||||
{% if config.dynamic_captcha %}
|
||||
function is_dynamic_captcha_enabled() {
|
||||
let cookie = get_cookie('require-captcha');
|
||||
let cookie = get_cookie('captcha-required');
|
||||
return cookie === '1';
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ function get_captcha_pub_key() {
|
|||
}
|
||||
|
||||
function init_dynamic_captcha() {
|
||||
if (!is_dynamic_captcha_enabled()) {
|
||||
if (is_dynamic_captcha_enabled()) {
|
||||
let pub_key = get_captcha_pub_key();
|
||||
if (!pub_key) {
|
||||
console.error("Missing public captcha key!");
|
||||
|
@ -265,6 +265,8 @@ function init_dynamic_captcha() {
|
|||
captcha_hook.style = "";
|
||||
}
|
||||
}
|
||||
{% else %}
|
||||
function init_dynamic_captcha() {}
|
||||
{% endif %}
|
||||
{% raw %}
|
||||
|
||||
|
@ -420,6 +422,7 @@ var script_settings = function(script_name) {
|
|||
|
||||
function init() {
|
||||
init_stylechooser();
|
||||
init_dynamic_captcha();
|
||||
|
||||
{% endraw %}
|
||||
{% if config.allow_delete %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue