From 5ca961b8d5130b54d3c5ec664574eac39a88de87 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 31 Dec 2020 00:13:29 +0100 Subject: Fix bugs in anomymous mode (#3305) * Fix bugs in anomymous mode Login bug (submit button not working) and refresh bug (JS null exception, and then 403). * Take advantage of existing variable --- p/scripts/extra.js | 2 +- p/scripts/main.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'p') diff --git a/p/scripts/extra.js b/p/scripts/extra.js index 4d4f3f171..3cb7b93aa 100644 --- a/p/scripts/extra.js +++ b/p/scripts/extra.js @@ -51,7 +51,7 @@ function init_crypto_form() { forgetOpenCategories(); - const submit_button = document.querySelector('button[type="submit"]'); + const submit_button = document.getElementById('loginButton'); submit_button.disabled = false; crypto_form.onsubmit = function (e) { diff --git a/p/scripts/main.js b/p/scripts/main.js index 21141f210..1a3b02c2a 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1170,7 +1170,12 @@ function updateFeed(feeds, feeds_count) { function init_actualize() { let auto = false; - document.getElementById('actualize').onclick = function () { + const actualize = document.getElementById('actualize'); + if (!actualize) { + return; + } + + actualize.onclick = function () { if (context.ajax_loading) { return false; } @@ -1226,7 +1231,7 @@ function init_actualize() { if (context.auto_actualize_feeds) { auto = true; - document.getElementById('actualize').click(); + actualize.click(); } } // -- cgit v1.2.3