40
|
40
|
|
*/
|
41
|
41
|
|
function vote (action, dom_element)
|
42
|
42
|
|
{
|
43
|
|
- |
let arrow_up = dom_element.children[0];
|
44
|
|
- |
let vote_counter = dom_element.children[1];
|
45
|
|
- |
let arrow_down = dom_element.children[2];
|
|
43
|
+ |
var arrow_up = dom_element.children[0];
|
|
44
|
+ |
var vote_counter = dom_element.children[1];
|
|
45
|
+ |
var arrow_down = dom_element.children[2];
|
46
|
46
|
|
|
47
|
47
|
|
// Voted/Upvoted
|
48
|
|
- |
let current_status = 0;
|
|
48
|
+ |
var current_status = 0;
|
49
|
49
|
|
|
50
|
50
|
|
if (arrow_up.classList.contains('upvoted'))
|
51
|
51
|
|
current_status = 1;
|
54
|
54
|
|
current_status = -1;
|
55
|
55
|
|
|
56
|
56
|
|
// Current vote
|
57
|
|
- |
let current_vote = Number (vote_counter.textContent);
|
|
57
|
+ |
var current_vote = Number (vote_counter.textContent);
|
58
|
58
|
|
|
59
|
59
|
|
// Remove class from arrows
|
60
|
60
|
|
arrow_up.classList.remove ('upvoted');
|
107
|
107
|
|
* However, if the user is not logged in, there's only a text
|
108
|
108
|
|
* with the sum of votes, eg. "2 votes" (no <tag> children).
|
109
|
109
|
|
*/
|
110
|
|
- |
let vote_sections = document.querySelectorAll ('.vote');
|
|
110
|
+ |
var vote_sections = document.querySelectorAll ('.vote');
|
111
|
111
|
|
|
112
|
112
|
|
// Bind vote() event to up/down vote arrows
|
113
|
|
- |
for (let i = 0; i < vote_sections.length; i++)
|
|
113
|
+ |
for (var i = 0; i < vote_sections.length; i++)
|
114
|
114
|
|
// See comment above on the "vote_sections" declaration.
|
115
|
115
|
|
if (vote_sections[i].children.length > 0)
|
116
|
116
|
|
{
|
128
|
128
|
|
if (pressed_key[17] && pressed_key[13])
|
129
|
129
|
|
{
|
130
|
130
|
|
// Select all forms in the current page with class "shortcut-submit"
|
131
|
|
- |
let forms = document.querySelectorAll ("form.shortcut-submit");
|
|
131
|
+ |
var forms = document.querySelectorAll ("form.shortcut-submit");
|
132
|
132
|
|
|
133
|
|
- |
for (let i = 0; i < forms.length; i++)
|
|
133
|
+ |
for (var i = 0; i < forms.length; i++)
|
134
|
134
|
|
forms[i].submit ();
|
135
|
135
|
|
}
|
136
|
136
|
|
}
|
137
|
137
|
|
|
138
|
|
- |
}); |
138
|
|
> |
\ No newline at end of file
|
|
138
|
+ |
});
|