main.js: use camelCase for captcha javascript

This commit is contained in:
Zankaria 2024-08-03 23:56:25 +02:00
parent 7b98295dcf
commit be69385fef

View file

@ -230,7 +230,7 @@ function init_stylechooser() {
document.getElementById('bottom-hud').before(newElement); document.getElementById('bottom-hud').before(newElement);
} }
function get_cookie(cookie_name) { function getCookie(cookie_name) {
var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if (results) if (results)
return (unescape(results[2])); return (unescape(results[2]));
@ -240,12 +240,12 @@ function get_cookie(cookie_name) {
{% endraw %} {% endraw %}
{% if config.dynamic_captcha %} {% if config.dynamic_captcha %}
function is_dynamic_captcha_enabled() { function isDynamicCaptchaEnabled() {
let cookie = get_cookie('captcha-required'); let cookie = getCookie('captcha-required');
return cookie === '1'; return cookie === '1';
} }
function get_captcha_pub_key() { function getCaptchaPubKey() {
{% if config.recaptcha %} {% if config.recaptcha %}
return "{{ config.recaptcha_public }}"; return "{{ config.recaptcha_public }}";
{% elseif config.turnstile %} {% elseif config.turnstile %}
@ -255,9 +255,9 @@ function get_captcha_pub_key() {
{% endif %} {% endif %}
} }
function init_dynamic_captcha() { function initDynamicCaptcha() {
if (is_dynamic_captcha_enabled()) { if (isDynamicCaptchaEnabled()) {
let pub_key = get_captcha_pub_key(); let pub_key = getCaptchaPubKey();
if (!pub_key) { if (!pub_key) {
console.error("Missing public captcha key!"); console.error("Missing public captcha key!");
return; return;
@ -268,7 +268,7 @@ function init_dynamic_captcha() {
} }
} }
{% else %} {% else %}
function init_dynamic_captcha() {} function initDynamicCaptcha() {}
{% endif %} {% endif %}
{% raw %} {% raw %}
@ -389,9 +389,9 @@ function rememberStuff() {
if (sessionStorage.body) { if (sessionStorage.body) {
var saved = JSON.parse(sessionStorage.body); var saved = JSON.parse(sessionStorage.body);
if (get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')) { if (getCookie('{% endraw %}{{ config.cookies.js }}{% raw %}')) {
// Remove successful posts // Remove successful posts
var successful = JSON.parse(get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')); var successful = JSON.parse(getCookie('{% endraw %}{{ config.cookies.js }}{% raw %}'));
for (var url in successful) { for (var url in successful) {
saved[url] = null; saved[url] = null;
} }
@ -424,7 +424,7 @@ var script_settings = function(script_name) {
function init() { function init() {
init_stylechooser(); init_stylechooser();
init_dynamic_captcha(); initDynamicCaptcha();
{% endraw %} {% endraw %}
{% if config.allow_delete %} {% if config.allow_delete %}