-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
40 lines (31 loc) · 1.31 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function addPlayer() {
var firstNameBox = document.getElementById("firstnamebox");
var lastNameBox = document.getElementById("lastnamebox");
var firstName = firstNameBox.value;
var lastName = lastNameBox.value;
var fullName = firstName + " " + lastName;
var URLName = lastName.substring(0, 5).toLowerCase() + firstName.substring(0, 2).toLowerCase();
var div_playerRank = document.getElementById("player_ranker");
var bioTemplate = document.getElementById("template_player-bio");
var newBio = bioTemplate.content.cloneNode(true);
var namebox = newBio.getElementById("row-namebox");
var imgbox = newBio.getElementById("photo");
namebox.innerHTML = fullName;
imgbox.alt = fullName;
imgbox.src = imgbox.src + URLName + "01-2015.jpg";
div_playerRank.appendChild(newBio);
firstNameBox.value = "";
lastNameBox.value = "";
}
function Upvote(elem) {
var thisRow = elem.parentNode.parentNode;
var container = thisRow.parentNode; //the container for all playerRow objects
//container.removeChild(thisRow);
container.insertBefore(thisRow, thisRow.previousSibling);
}
function Downvote(elem) {
var thisRow = elem.parentNode.parentNode;
var container = thisRow.parentNode; //the container for all playerRow objects
//container.removeChild(thisRow);
container.insertBefore(thisRow, thisRow.nextSibling.nextSibling);
}