From cc863fd9d68d718c7ce66dd3ee82ed3baf0d1712 Mon Sep 17 00:00:00 2001 From: zPlus Date: Mon, 4 Sep 2017 13:16:47 +0200 Subject: [PATCH] Fix #52 Javascript not working on Midori --- javascript/freepost.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/javascript/freepost.js b/javascript/freepost.js index 60e74b57..9283d41a 100755 --- a/javascript/freepost.js +++ b/javascript/freepost.js @@ -40,12 +40,12 @@ var pressed_key = []; */ function vote (action, dom_element) { - let arrow_up = dom_element.children[0]; - let vote_counter = dom_element.children[1]; - let arrow_down = dom_element.children[2]; + var arrow_up = dom_element.children[0]; + var vote_counter = dom_element.children[1]; + var arrow_down = dom_element.children[2]; // Voted/Upvoted - let current_status = 0; + var current_status = 0; if (arrow_up.classList.contains('upvoted')) current_status = 1; @@ -54,7 +54,7 @@ function vote (action, dom_element) current_status = -1; // Current vote - let current_vote = Number (vote_counter.textContent); + var current_vote = Number (vote_counter.textContent); // Remove class from arrows arrow_up.classList.remove ('upvoted'); @@ -107,10 +107,10 @@ document.addEventListener ('DOMContentLoaded', function() { * However, if the user is not logged in, there's only a text * with the sum of votes, eg. "2 votes" (no children). */ - let vote_sections = document.querySelectorAll ('.vote'); + var vote_sections = document.querySelectorAll ('.vote'); // Bind vote() event to up/down vote arrows - for (let i = 0; i < vote_sections.length; i++) + for (var i = 0; i < vote_sections.length; i++) // See comment above on the "vote_sections" declaration. if (vote_sections[i].children.length > 0) { @@ -128,11 +128,11 @@ document.addEventListener ('DOMContentLoaded', function() { if (pressed_key[17] && pressed_key[13]) { // Select all forms in the current page with class "shortcut-submit" - let forms = document.querySelectorAll ("form.shortcut-submit"); + var forms = document.querySelectorAll ("form.shortcut-submit"); - for (let i = 0; i < forms.length; i++) + for (var i = 0; i < forms.length; i++) forms[i].submit (); } } -}); \ No newline at end of file +});