From 60970291b73f687a887276580612081fc7130d99 Mon Sep 17 00:00:00 2001 From: zPlus <-> Date: Mon, 27 Mar 2017 20:07:14 +0200 Subject: [PATCH] freepost.js: Replace var with let --- javascript/freepost.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/javascript/freepost.js b/javascript/freepost.js index bce08069..7bc62b6f 100644 --- a/javascript/freepost.js +++ b/javascript/freepost.js @@ -38,12 +38,12 @@ */ function vote (action, dom_element) { - var arrow_up = dom_element.children[0]; - var vote_counter = dom_element.children[1]; - var arrow_down = dom_element.children[2]; + let arrow_up = dom_element.children[0]; + let vote_counter = dom_element.children[1]; + let arrow_down = dom_element.children[2]; // Voted/Upvoted - var current_status = 0; + let current_status = 0; if (arrow_up.classList.contains('upvoted')) current_status = 1; @@ -52,7 +52,7 @@ function vote (action, dom_element) current_status = -1; // Current vote - var current_vote = Number (vote_counter.textContent); + let current_vote = Number (vote_counter.textContent); // Remove class from arrows arrow_up.classList.remove ('upvoted'); @@ -105,7 +105,7 @@ document.addEventListener ('DOMContentLoaded', function() { let vote_sections = document.getElementsByClassName ('vote'); // Bind vote() event to up/down vote arrows - for (var i = 0; i < vote_sections.length; i++) + for (let i = 0; i < vote_sections.length; i++) { vote_sections[i].children[0].addEventListener ('click', function () { vote ('up', this.parentNode) }); vote_sections[i].children[2].addEventListener ('click', function () { vote ('down', this.parentNode) });