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);
}
function get_cookie(cookie_name) {
function getCookie(cookie_name) {
var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if (results)
return (unescape(results[2]));
@ -240,12 +240,12 @@ function get_cookie(cookie_name) {
{% endraw %}
{% if config.dynamic_captcha %}
function is_dynamic_captcha_enabled() {
let cookie = get_cookie('captcha-required');
function isDynamicCaptchaEnabled() {
let cookie = getCookie('captcha-required');
return cookie === '1';
}
function get_captcha_pub_key() {
function getCaptchaPubKey() {
{% if config.recaptcha %}
return "{{ config.recaptcha_public }}";
{% elseif config.turnstile %}
@ -255,9 +255,9 @@ function get_captcha_pub_key() {
{% endif %}
}
function init_dynamic_captcha() {
if (is_dynamic_captcha_enabled()) {
let pub_key = get_captcha_pub_key();
function initDynamicCaptcha() {
if (isDynamicCaptchaEnabled()) {
let pub_key = getCaptchaPubKey();
if (!pub_key) {
console.error("Missing public captcha key!");
return;
@ -268,7 +268,7 @@ function init_dynamic_captcha() {
}
}
{% else %}
function init_dynamic_captcha() {}
function initDynamicCaptcha() {}
{% endif %}
{% raw %}
@ -389,9 +389,9 @@ function rememberStuff() {
if (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
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) {
saved[url] = null;
}
@ -424,7 +424,7 @@ var script_settings = function(script_name) {
function init() {
init_stylechooser();
init_dynamic_captcha();
initDynamicCaptcha();
{% endraw %}
{% if config.allow_delete %}