Author
|
zPlus <->
2017-03-27 18:07:14
|
Committer
|
zPlus <->
2017-03-27 18:07:14
|
Commit
|
6097029
(patch)
|
Tree
|
893d541
|
Parent(s)
|
|
freepost.js: Replace var with let
commits diff:
679cccc..6097029
1 file changed,
6 insertions,
6 deletions
—
download
Diffstat
Diff options
+6/-6
M javascript/freepost.js
38
|
38
|
|
*/
|
39
|
39
|
|
function vote (action, dom_element)
|
40
|
40
|
|
{
|
41
|
|
- |
var arrow_up = dom_element.children[0];
|
42
|
|
- |
var vote_counter = dom_element.children[1];
|
43
|
|
- |
var arrow_down = dom_element.children[2];
|
|
41
|
+ |
let arrow_up = dom_element.children[0];
|
|
42
|
+ |
let vote_counter = dom_element.children[1];
|
|
43
|
+ |
let arrow_down = dom_element.children[2];
|
44
|
44
|
|
|
45
|
45
|
|
// Voted/Upvoted
|
46
|
|
- |
var current_status = 0;
|
|
46
|
+ |
let current_status = 0;
|
47
|
47
|
|
|
48
|
48
|
|
if (arrow_up.classList.contains('upvoted'))
|
49
|
49
|
|
current_status = 1;
|
52
|
52
|
|
current_status = -1;
|
53
|
53
|
|
|
54
|
54
|
|
// Current vote
|
55
|
|
- |
var current_vote = Number (vote_counter.textContent);
|
|
55
|
+ |
let current_vote = Number (vote_counter.textContent);
|
56
|
56
|
|
|
57
|
57
|
|
// Remove class from arrows
|
58
|
58
|
|
arrow_up.classList.remove ('upvoted');
|
105
|
105
|
|
let vote_sections = document.getElementsByClassName ('vote');
|
106
|
106
|
|
|
107
|
107
|
|
// Bind vote() event to up/down vote arrows
|
108
|
|
- |
for (var i = 0; i < vote_sections.length; i++)
|
|
108
|
+ |
for (let i = 0; i < vote_sections.length; i++)
|
109
|
109
|
|
{
|
110
|
110
|
|
vote_sections[i].children[0].addEventListener ('click', function () { vote ('up', this.parentNode) });
|
111
|
111
|
|
vote_sections[i].children[2].addEventListener ('click', function () { vote ('down', this.parentNode) });
|