-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblob.js
53 lines (46 loc) · 2.9 KB
/
blob.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
41
42
43
44
45
46
47
48
49
50
51
52
53
let colorIndex = 0;
let blameAssociation = {};
const allColors = ["Red", "Blue", "BlueViolet", "Black", "Aqua", "Bisque",
"Brown", "BurlyWood", "CadetBlue", "Chartreuse", "Chocolate",
"Coral", "CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenRod",
"DarkGray", "DarkGrey", "DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "Darkorange",
"DarkOrchid", "DarkRed", "DarkSalmon", "DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkSlateGrey",
"DarkTurquoise", "DarkViolet", "DeepPink", "DeepSkyBlue", "DimGray", "DimGrey", "DodgerBlue",
"FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro", "GhostWhite", "Gold", "GoldenRod",
"Gray", "Grey", "Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed", "Indigo", "Ivory", "Khaki",
"Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral", "LightCyan",
"LightGoldenRodYellow", "LightGray", "LightGrey", "LightGreen", "LightPink", "LightSalmon",
"LightSeaGreen", "LightSkyBlue", "LightSlateGray", "LightSlateGrey", "LightSteelBlue", "LightYellow",
"Lime", "LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquaMarine", "MediumBlue", "MediumOrchid",
"MediumPurple", "MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise",
"MediumVioletRed", "MidnightBlue", "MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy",
"OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed", "Orchid", "PaleGoldenRod", "PaleGreen",
"PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink", "Plum", "PowderBlue",
"Purple", "AliceBlue", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown", "SeaGreen",
"SeaShell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGray", "SlateGrey", "Snow", "SpringGreen",
"SteelBlue", "Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke",
"Yellow", "YellowGreen"
]
const colorsLength = allColors.length;
function setBlames() {
blameAssociation = {};
colorIndex = 0;
let tbody = document.querySelector("#L1").parentElement.parentElement;
let trs = tbody.children;
for (let i = 0; i < trs.length; i++) {
const id = trs[i].children[0].id;
let blameDetails = getBlameDetails(id);
setBlameDetailsPopup(blameDetails, id);
if (!blameAssociation[blameDetails.user_link]) {
if (colorIndex === colorsLength) colorIndex = 0;
blameAssociation[blameDetails.user_link] = blameDetails;
blameAssociation[blameDetails.user_link].color = allColors[colorIndex++];
}
let blame = document.createElement("TD");
blame.style.backgroundColor = blameAssociation[blameDetails.user_link].color;
blame.classList.add("blame-details");
trs[i].prepend(blame);
}
document.getElementById("blameHTML").remove();
setTooltipListeners();
}