-
Notifications
You must be signed in to change notification settings - Fork 0
/
myjs.js
108 lines (92 loc) · 29.1 KB
/
myjs.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// function sleep(ms) {
// return new Promise(resolve => setTimeout(resolve, ms));
// }
// Milliseconds
function sleep(millisecs) {
var initiation = new Date().getTime();
while ((new Date().getTime() - initiation) < millisecs);
}
function xy_id(x,y) {
return x + "_" + y
}
function createCell(X, Y, eclass, atomicNumber, symbol, name, atomicWeight) {
return html="<div class=\"cell " + eclass +
"\" name=\""+ name + "\"" +
"\" id=\""+ xy_id(X, Y) + "\">" +
"<h5>" + atomicNumber + "</h5>" +
"<h3>" + symbol + "</h3>" +
"<h6>" + atomicWeight + "</h6>" +
"</div>";
}
function colorTable() {
for (x = 1; x <= 18; x++) {
// populate row
for (y = 1; y <= 9; y++) {
// populate elements
//console.log("("+x+","+y+") ");
if (y in elements[x]) {
$("#" + xy_id(x,y)).addClass("foo");
console.log("color me crazy:" + elements[x][y] );
sleep(100)
}
//console.log(elements[x][y] );
continue;
if (x < 3 /* and element */) {
// set background color #689BFF
} else if (y > 7 /* and element */) {
// set background color #1FCA21
} else if (x < 13 /* and element */) {
// set background color #FD9A98
} else /* if ( element ) */ {
// set background color #FECB00
}
e = elements[x][y];
$("#col"+x).append(createCell(x,y,"element",e["atomicNumber"],e["Sym"],e["name"],e["atomicWeight"]));// populate table header
}
}
}
var elements={"13": {"2": {"Sym": "B", "Y": "2", "X": "13", "name": "Boron", "atomicNumber": "5", "atomicWeight": "10.811\n"}, "5": {"Sym": "In", "Y": "5", "X": "13", "name": "Indium", "atomicNumber": "49", "atomicWeight": "114.818\n"}, "6": {"Sym": "Tl", "Y": "6", "X": "13", "name": "Thallium", "atomicNumber": "81", "atomicWeight": "204.383\n"}, "8": {"Sym": "Ho", "Y": "8", "X": "13", "name": "Holmium", "atomicNumber": "67", "atomicWeight": "164.93\n"}, "7": {"Sym": "Uut", "Y": "7", "X": "13", "name": "gotmeum?", "atomicNumber": "113", "atomicWeight": "?\n"}, "3": {"Sym": "Al", "Y": "3", "X": "13", "name": "Aluminum", "atomicNumber": "13", "atomicWeight": "26.982\n"}, "9": {"Sym": "Es", "Y": "9", "X": "13", "name": "Einsteinium", "atomicNumber": "99", "atomicWeight": "252\n"}, "4": {"Sym": "Ga", "Y": "4", "X": "13", "name": "Gallium", "atomicNumber": "31", "atomicWeight": "69.723\n"}}, "3": {"6": {"Sym": "Lu", "Y": "6", "X": "3", "name": "Lutetium", "atomicNumber": "71", "atomicWeight": "174.967\n"}, "5": {"Sym": "Y", "Y": "5", "X": "3", "name": "Yttrium", "atomicNumber": "39", "atomicWeight": "88.906\n"}, "8": {"Sym": "La", "Y": "8", "X": "3", "name": "Lanthanum", "atomicNumber": "57", "atomicWeight": "138.906\n"}, "7": {"Sym": "Lr", "Y": "7", "X": "3", "name": "Lawrencium", "atomicNumber": "103", "atomicWeight": "262\n"}, "9": {"Sym": "Ac", "Y": "9", "X": "3", "name": "Actinium", "atomicNumber": "89", "atomicWeight": "227\n"}, "4": {"Sym": "Sc", "Y": "4", "X": "3", "name": "Scandium", "atomicNumber": "21", "atomicWeight": "44.956\n"}}, "5": {"6": {"Sym": "Ta", "Y": "6", "X": "5", "name": "Tantalum", "atomicNumber": "73", "atomicWeight": "180.948\n"}, "5": {"Sym": "Nb", "Y": "5", "X": "5", "name": "Niobium", "atomicNumber": "41", "atomicWeight": "92.906\n"}, "8": {"Sym": "Pr", "Y": "8", "X": "5", "name": "Praseodymium", "atomicNumber": "59", "atomicWeight": "140.908\n"}, "7": {"Sym": "Db", "Y": "7", "X": "5", "name": "Dubnium", "atomicNumber": "105", "atomicWeight": "262\n"}, "9": {"Sym": "Pa", "Y": "9", "X": "5", "name": "Protactinium", "atomicNumber": "91", "atomicWeight": "231.036\n"}, "4": {"Sym": "V", "Y": "4", "X": "5", "name": "Vanadium", "atomicNumber": "23", "atomicWeight": "50.942\n"}}, "6": {"6": {"Sym": "W", "Y": "6", "X": "6", "name": "Tungsten", "atomicNumber": "74", "atomicWeight": "183.84\n"}, "5": {"Sym": "Mo", "Y": "5", "X": "6", "name": "Molybdenum", "atomicNumber": "42", "atomicWeight": "95.94\n"}, "8": {"Sym": "Nd", "Y": "8", "X": "6", "name": "Neodymium", "atomicNumber": "60", "atomicWeight": "144.24\n"}, "7": {"Sym": "Sg", "Y": "7", "X": "6", "name": "Seaborgium", "atomicNumber": "106", "atomicWeight": "266\n"}, "9": {"Sym": "U", "Y": "9", "X": "6", "name": "Uranium", "atomicNumber": "92", "atomicWeight": "238.029\n"}, "4": {"Sym": "Cr", "Y": "4", "X": "6", "name": "Chromium", "atomicNumber": "24", "atomicWeight": "51.996\n"}}, "7": {"6": {"Sym": "Re", "Y": "6", "X": "7", "name": "Rhenium", "atomicNumber": "75", "atomicWeight": "186.207\n"}, "5": {"Sym": "Tc", "Y": "5", "X": "7", "name": "Technetium", "atomicNumber": "43", "atomicWeight": "98\n"}, "8": {"Sym": "Pm", "Y": "8", "X": "7", "name": "Promethium", "atomicNumber": "61", "atomicWeight": "145\n"}, "7": {"Sym": "Bh", "Y": "7", "X": "7", "name": "Bohrium", "atomicNumber": "107", "atomicWeight": "264\n"}, "9": {"Sym": "Np", "Y": "9", "X": "7", "name": "Neptunium", "atomicNumber": "93", "atomicWeight": "237\n"}, "4": {"Sym": "Mn", "Y": "4", "X": "7", "name": "Manganese", "atomicNumber": "25", "atomicWeight": "54.938\n"}}, "16": {"2": {"Sym": "O", "Y": "2", "X": "16", "name": "Oxygen", "atomicNumber": "8", "atomicWeight": "15.999\n"}, "5": {"Sym": "Te", "Y": "5", "X": "16", "name": "Tellurium", "atomicNumber": "52", "atomicWeight": "127.6\n"}, "6": {"Sym": "Po", "Y": "6", "X": "16", "name": "Polonium", "atomicNumber": "84", "atomicWeight": "209\n"}, "8": {"Sym": "Yb", "Y": "8", "X": "16", "name": "Ytterbium", "atomicNumber": "70", "atomicWeight": "173.04\n"}, "7": {"Sym": "Lv", "Y": "7", "X": "16", "name": "gotmeum?", "atomicNumber": "116", "atomicWeight": "?\n"}, "3": {"Sym": "S", "Y": "3", "X": "16", "name": "Sulfur", "atomicNumber": "16", "atomicWeight": "32.065\n"}, "9": {"Sym": "No", "Y": "9", "X": "16", "name": "Nobelium", "atomicNumber": "102", "atomicWeight": "259\n"}, "4": {"Sym": "Se", "Y": "4", "X": "16", "name": "Selenium", "atomicNumber": "34", "atomicWeight": "78.96\n"}}, "11": {"6": {"Sym": "Au", "Y": "6", "X": "11", "name": "Gold", "atomicNumber": "79", "atomicWeight": "196.967\n"}, "5": {"Sym": "Ag", "Y": "5", "X": "11", "name": "Silver", "atomicNumber": "47", "atomicWeight": "107.868\n"}, "8": {"Sym": "Tb", "Y": "8", "X": "11", "name": "Terbium", "atomicNumber": "65", "atomicWeight": "158.925\n"}, "7": {"Sym": "Rg", "Y": "7", "X": "11", "name": "gotmeum?", "atomicNumber": "111", "atomicWeight": "[280.16]\n"}, "9": {"Sym": "Bk", "Y": "9", "X": "11", "name": "Berkelium", "atomicNumber": "97", "atomicWeight": "247\n"}, "4": {"Sym": "Cu", "Y": "4", "X": "11", "name": "Copper", "atomicNumber": "29", "atomicWeight": "63.546\n"}}, "15": {"2": {"Sym": "N", "Y": "2", "X": "15", "name": "Nitrogen", "atomicNumber": "7", "atomicWeight": "14.007\n"}, "5": {"Sym": "Sb", "Y": "5", "X": "15", "name": "Antimony", "atomicNumber": "51", "atomicWeight": "121.76\n"}, "6": {"Sym": "Bi", "Y": "6", "X": "15", "name": "Bismuth", "atomicNumber": "83", "atomicWeight": "208.98\n"}, "8": {"Sym": "Tm", "Y": "8", "X": "15", "name": "Thulium", "atomicNumber": "69", "atomicWeight": "168.934\n"}, "7": {"Sym": "Uup", "Y": "7", "X": "15", "name": "gotmeum?", "atomicNumber": "115", "atomicWeight": "?\n"}, "3": {"Sym": "P", "Y": "3", "X": "15", "name": "Phosphorus", "atomicNumber": "15", "atomicWeight": "30.974\n"}, "9": {"Sym": "Md", "Y": "9", "X": "15", "name": "Mendelevium", "atomicNumber": "101", "atomicWeight": "258\n"}, "4": {"Sym": "As", "Y": "4", "X": "15", "name": "Arsenic", "atomicNumber": "33", "atomicWeight": "74.922\n"}}, "10": {"6": {"Sym": "Pt", "Y": "6", "X": "10", "name": "Platinum", "atomicNumber": "78", "atomicWeight": "195.078\n"}, "5": {"Sym": "Pd", "Y": "5", "X": "10", "name": "Palladium", "atomicNumber": "46", "atomicWeight": "106.42\n"}, "8": {"Sym": "Gd", "Y": "8", "X": "10", "name": "Gadolinium", "atomicNumber": "64", "atomicWeight": "157.25\n"}, "7": {"Sym": "Ds", "Y": "7", "X": "10", "name": "gotmeum?", "atomicNumber": "110", "atomicWeight": "[281.16]\n"}, "9": {"Sym": "Cm", "Y": "9", "X": "10", "name": "Curium", "atomicNumber": "96", "atomicWeight": "247\n"}, "4": {"Sym": "Ni", "Y": "4", "X": "10", "name": "Nickel", "atomicNumber": "28", "atomicWeight": "58.693\n"}}, "18": {"2": {"Sym": "Ne", "Y": "2", "X": "18", "name": "Neon", "atomicNumber": "10", "atomicWeight": "20.18\n"}, "5": {"Sym": "Xe", "Y": "5", "X": "18", "name": "Xenon", "atomicNumber": "54", "atomicWeight": "131.293\n"}, "6": {"Sym": "Rn", "Y": "6", "X": "18", "name": "Radon", "atomicNumber": "86", "atomicWeight": "222\n"}, "7": {"Sym": "Uuo", "Y": "7", "X": "18", "name": "gotmeum?", "atomicNumber": "118", "atomicWeight": "?"}, "1": {"Sym": "He", "Y": "1", "X": "18", "name": "Helium", "atomicNumber": "2", "atomicWeight": "4.003\n"}, "3": {"Sym": "Ar", "Y": "3", "X": "18", "name": "Argon", "atomicNumber": "18", "atomicWeight": "39.948\n"}, "4": {"Sym": "Kr", "Y": "4", "X": "18", "name": "Krypton", "atomicNumber": "36", "atomicWeight": "83.8\n"}}, "2": {"2": {"Sym": "Be", "Y": "2", "X": "2", "name": "Beryllium", "atomicNumber": "4", "atomicWeight": "9.012\n"}, "5": {"Sym": "Sr", "Y": "5", "X": "2", "name": "Strontium", "atomicNumber": "38", "atomicWeight": "87.62\n"}, "7": {"Sym": "Ra", "Y": "7", "X": "2", "name": "Radium", "atomicNumber": "88", "atomicWeight": "226\n"}, "6": {"Sym": "Ba", "Y": "6", "X": "2", "name": "Barium", "atomicNumber": "56", "atomicWeight": "137.327\n"}, "3": {"Sym": "Mg", "Y": "3", "X": "2", "name": "Magnesium", "atomicNumber": "12", "atomicWeight": "24.305\n"}, "4": {"Sym": "Ca", "Y": "4", "X": "2", "name": "Calcium", "atomicNumber": "20", "atomicWeight": "40.078\n"}}, "17": {"2": {"Sym": "F", "Y": "2", "X": "17", "name": "Fluorine", "atomicNumber": "9", "atomicWeight": "18.998\n"}, "5": {"Sym": "I", "Y": "5", "X": "17", "name": "Iodine", "atomicNumber": "53", "atomicWeight": "126.905\n"}, "7": {"Sym": "Uus", "Y": "7", "X": "17", "name": "gotmeum?", "atomicNumber": "117", "atomicWeight": "?\n"}, "6": {"Sym": "At", "Y": "6", "X": "17", "name": "Astatine", "atomicNumber": "85", "atomicWeight": "210\n"}, "3": {"Sym": "Cl", "Y": "3", "X": "17", "name": "Chlorine", "atomicNumber": "17", "atomicWeight": "35.453\n"}, "4": {"Sym": "Br", "Y": "4", "X": "17", "name": "Bromine", "atomicNumber": "35", "atomicWeight": "79.904\n"}}, "12": {"6": {"Sym": "Hg", "Y": "6", "X": "12", "name": "Mercury", "atomicNumber": "80", "atomicWeight": "200.59\n"}, "5": {"Sym": "Cd", "Y": "5", "X": "12", "name": "Cadmium", "atomicNumber": "48", "atomicWeight": "112.411\n"}, "8": {"Sym": "Dy", "Y": "8", "X": "12", "name": "Dysprosium", "atomicNumber": "66", "atomicWeight": "162.5\n"}, "7": {"Sym": "Cn", "Y": "7", "X": "12", "name": "gotmeum?", "atomicNumber": "112", "atomicWeight": "?\n"}, "9": {"Sym": "Cf", "Y": "9", "X": "12", "name": "Californium", "atomicNumber": "98", "atomicWeight": "251\n"}, "4": {"Sym": "Zn", "Y": "4", "X": "12", "name": "Zinc", "atomicNumber": "30", "atomicWeight": "65.39\n"}}, "1": {"2": {"Sym": "Li", "Y": "2", "X": "1", "name": "Lithium", "atomicNumber": "3", "atomicWeight": "6.941\n"}, "5": {"Sym": "Rb", "Y": "5", "X": "1", "name": "Rubidium", "atomicNumber": "37", "atomicWeight": "85.468\n"}, "6": {"Sym": "Cs", "Y": "6", "X": "1", "name": "Cesium", "atomicNumber": "55", "atomicWeight": "132.906\n"}, "7": {"Sym": "Fr", "Y": "7", "X": "1", "name": "Francium", "atomicNumber": "87", "atomicWeight": "223\n"}, "1": {"Sym": "H", "Y": "1", "X": "1", "name": "Hydrogen", "atomicNumber": "1", "atomicWeight": "1.008\n"}, "3": {"Sym": "Na", "Y": "3", "X": "1", "name": "Sodium", "atomicNumber": "11", "atomicWeight": "22.99\n"}, "4": {"Sym": "K", "Y": "4", "X": "1", "name": "Potassium", "atomicNumber": "19", "atomicWeight": "39.098\n"}}, "9": {"6": {"Sym": "Ir", "Y": "6", "X": "9", "name": "Iridium", "atomicNumber": "77", "atomicWeight": "192.217\n"}, "5": {"Sym": "Rh", "Y": "5", "X": "9", "name": "Rhodium", "atomicNumber": "45", "atomicWeight": "102.906\n"}, "8": {"Sym": "Eu", "Y": "8", "X": "9", "name": "Europium", "atomicNumber": "63", "atomicWeight": "151.964\n"}, "7": {"Sym": "Mt", "Y": "7", "X": "9", "name": "Meitnerium", "atomicNumber": "109", "atomicWeight": "268\n"}, "9": {"Sym": "Am", "Y": "9", "X": "9", "name": "Americium", "atomicNumber": "95", "atomicWeight": "243\n"}, "4": {"Sym": "Co", "Y": "4", "X": "9", "name": "Cobalt", "atomicNumber": "27", "atomicWeight": "58.933\n"}}, "X": {"Y": {"Sym": "sym", "Y": "Y", "X": "X", "name": "name", "atomicNumber": "atomNumber", "atomicWeight": "weight\n"}}, "14": {"2": {"Sym": "C", "Y": "2", "X": "14", "name": "Carbon", "atomicNumber": "6", "atomicWeight": "12.011\n"}, "5": {"Sym": "Sn", "Y": "5", "X": "14", "name": "Tin", "atomicNumber": "50", "atomicWeight": "118.71\n"}, "6": {"Sym": "Pb", "Y": "6", "X": "14", "name": "Lead", "atomicNumber": "82", "atomicWeight": "207.2\n"}, "8": {"Sym": "Er", "Y": "8", "X": "14", "name": "Erbium", "atomicNumber": "68", "atomicWeight": "167.259\n"}, "7": {"Sym": "Fl", "Y": "7", "X": "14", "name": "gotmeum?", "atomicNumber": "114", "atomicWeight": "?\n"}, "3": {"Sym": "Si", "Y": "3", "X": "14", "name": "Silicon", "atomicNumber": "14", "atomicWeight": "28.086\n"}, "9": {"Sym": "Fm", "Y": "9", "X": "14", "name": "Fermium", "atomicNumber": "100", "atomicWeight": "257\n"}, "4": {"Sym": "Ge", "Y": "4", "X": "14", "name": "Germanium", "atomicNumber": "32", "atomicWeight": "72.64\n"}}, "4": {"6": {"Sym": "Hf", "Y": "6", "X": "4", "name": "Hafnium", "atomicNumber": "72", "atomicWeight": "178.49\n"}, "5": {"Sym": "Zr", "Y": "5", "X": "4", "name": "Zirconium", "atomicNumber": "40", "atomicWeight": "91.224\n"}, "8": {"Sym": "Ce", "Y": "8", "X": "4", "name": "Cerium", "atomicNumber": "58", "atomicWeight": "140.116\n"}, "7": {"Sym": "Rf", "Y": "7", "X": "4", "name": "Rutherfordium", "atomicNumber": "104", "atomicWeight": "261\n"}, "9": {"Sym": "Th", "Y": "9", "X": "4", "name": "Thorium", "atomicNumber": "90", "atomicWeight": "232.038\n"}, "4": {"Sym": "Ti", "Y": "4", "X": "4", "name": "Titanium", "atomicNumber": "22", "atomicWeight": "47.867\n"}}, "8": {"6": {"Sym": "Os", "Y": "6", "X": "8", "name": "Osmium", "atomicNumber": "76", "atomicWeight": "190.23\n"}, "5": {"Sym": "Ru", "Y": "5", "X": "8", "name": "Ruthenium", "atomicNumber": "44", "atomicWeight": "101.07\n"}, "8": {"Sym": "Sm", "Y": "8", "X": "8", "name": "Samarium", "atomicNumber": "62", "atomicWeight": "150.36\n"}, "7": {"Sym": "Hs", "Y": "7", "X": "8", "name": "Hassium", "atomicNumber": "108", "atomicWeight": "277\n"}, "9": {"Sym": "Pu", "Y": "9", "X": "8", "name": "Plutonium", "atomicNumber": "94", "atomicWeight": "244\n"}, "4": {"Sym": "Fe", "Y": "4", "X": "8", "name": "Iron", "atomicNumber": "26", "atomicWeight": "55.845\n"}}}
function drawPage() {
// insert Group Period box
$("#col0").append(createCell(0,0,"header", "Group Period","", "",""));
for (x = 1; x <= 18; x++) {
// populate table header
$("#col" + x).append(createCell(x,0,"header", x,"","",""));
}
// populate table left border
for (y = 1; y <= 9; y++) {
if (y==8){
$("#col0").append(createCell(0,-y,"vspace","","","",""));
}
$("#col0").append(createCell(0,y,"header",y,"","",""));
}
// load elements
//var elements={"13": {"2": {"Sym": "B", "Y": "2", "X": "13", "name": "Boron", "atomicNumber": "5", "atomicWeight": "10.811\n"}, "5": {"Sym": "In", "Y": "5", "X": "13", "name": "Indium", "atomicNumber": "49", "atomicWeight": "114.818\n"}, "6": {"Sym": "Tl", "Y": "6", "X": "13", "name": "Thallium", "atomicNumber": "81", "atomicWeight": "204.383\n"}, "8": {"Sym": "Ho", "Y": "8", "X": "13", "name": "Holmium", "atomicNumber": "67", "atomicWeight": "164.93\n"}, "7": {"Sym": "Uut", "Y": "7", "X": "13", "name": "gotmeum?", "atomicNumber": "113", "atomicWeight": "?\n"}, "3": {"Sym": "Al", "Y": "3", "X": "13", "name": "Aluminum", "atomicNumber": "13", "atomicWeight": "26.982\n"}, "9": {"Sym": "Es", "Y": "9", "X": "13", "name": "Einsteinium", "atomicNumber": "99", "atomicWeight": "252\n"}, "4": {"Sym": "Ga", "Y": "4", "X": "13", "name": "Gallium", "atomicNumber": "31", "atomicWeight": "69.723\n"}}, "3": {"6": {"Sym": "Lu", "Y": "6", "X": "3", "name": "Lutetium", "atomicNumber": "71", "atomicWeight": "174.967\n"}, "5": {"Sym": "Y", "Y": "5", "X": "3", "name": "Yttrium", "atomicNumber": "39", "atomicWeight": "88.906\n"}, "8": {"Sym": "La", "Y": "8", "X": "3", "name": "Lanthanum", "atomicNumber": "57", "atomicWeight": "138.906\n"}, "7": {"Sym": "Lr", "Y": "7", "X": "3", "name": "Lawrencium", "atomicNumber": "103", "atomicWeight": "262\n"}, "9": {"Sym": "Ac", "Y": "9", "X": "3", "name": "Actinium", "atomicNumber": "89", "atomicWeight": "227\n"}, "4": {"Sym": "Sc", "Y": "4", "X": "3", "name": "Scandium", "atomicNumber": "21", "atomicWeight": "44.956\n"}}, "5": {"6": {"Sym": "Ta", "Y": "6", "X": "5", "name": "Tantalum", "atomicNumber": "73", "atomicWeight": "180.948\n"}, "5": {"Sym": "Nb", "Y": "5", "X": "5", "name": "Niobium", "atomicNumber": "41", "atomicWeight": "92.906\n"}, "8": {"Sym": "Pr", "Y": "8", "X": "5", "name": "Praseodymium", "atomicNumber": "59", "atomicWeight": "140.908\n"}, "7": {"Sym": "Db", "Y": "7", "X": "5", "name": "Dubnium", "atomicNumber": "105", "atomicWeight": "262\n"}, "9": {"Sym": "Pa", "Y": "9", "X": "5", "name": "Protactinium", "atomicNumber": "91", "atomicWeight": "231.036\n"}, "4": {"Sym": "V", "Y": "4", "X": "5", "name": "Vanadium", "atomicNumber": "23", "atomicWeight": "50.942\n"}}, "6": {"6": {"Sym": "W", "Y": "6", "X": "6", "name": "Tungsten", "atomicNumber": "74", "atomicWeight": "183.84\n"}, "5": {"Sym": "Mo", "Y": "5", "X": "6", "name": "Molybdenum", "atomicNumber": "42", "atomicWeight": "95.94\n"}, "8": {"Sym": "Nd", "Y": "8", "X": "6", "name": "Neodymium", "atomicNumber": "60", "atomicWeight": "144.24\n"}, "7": {"Sym": "Sg", "Y": "7", "X": "6", "name": "Seaborgium", "atomicNumber": "106", "atomicWeight": "266\n"}, "9": {"Sym": "U", "Y": "9", "X": "6", "name": "Uranium", "atomicNumber": "92", "atomicWeight": "238.029\n"}, "4": {"Sym": "Cr", "Y": "4", "X": "6", "name": "Chromium", "atomicNumber": "24", "atomicWeight": "51.996\n"}}, "7": {"6": {"Sym": "Re", "Y": "6", "X": "7", "name": "Rhenium", "atomicNumber": "75", "atomicWeight": "186.207\n"}, "5": {"Sym": "Tc", "Y": "5", "X": "7", "name": "Technetium", "atomicNumber": "43", "atomicWeight": "98\n"}, "8": {"Sym": "Pm", "Y": "8", "X": "7", "name": "Promethium", "atomicNumber": "61", "atomicWeight": "145\n"}, "7": {"Sym": "Bh", "Y": "7", "X": "7", "name": "Bohrium", "atomicNumber": "107", "atomicWeight": "264\n"}, "9": {"Sym": "Np", "Y": "9", "X": "7", "name": "Neptunium", "atomicNumber": "93", "atomicWeight": "237\n"}, "4": {"Sym": "Mn", "Y": "4", "X": "7", "name": "Manganese", "atomicNumber": "25", "atomicWeight": "54.938\n"}}, "16": {"2": {"Sym": "O", "Y": "2", "X": "16", "name": "Oxygen", "atomicNumber": "8", "atomicWeight": "15.999\n"}, "5": {"Sym": "Te", "Y": "5", "X": "16", "name": "Tellurium", "atomicNumber": "52", "atomicWeight": "127.6\n"}, "6": {"Sym": "Po", "Y": "6", "X": "16", "name": "Polonium", "atomicNumber": "84", "atomicWeight": "209\n"}, "8": {"Sym": "Yb", "Y": "8", "X": "16", "name": "Ytterbium", "atomicNumber": "70", "atomicWeight": "173.04\n"}, "7": {"Sym": "Lv", "Y": "7", "X": "16", "name": "gotmeum?", "atomicNumber": "116", "atomicWeight": "?\n"}, "3": {"Sym": "S", "Y": "3", "X": "16", "name": "Sulfur", "atomicNumber": "16", "atomicWeight": "32.065\n"}, "9": {"Sym": "No", "Y": "9", "X": "16", "name": "Nobelium", "atomicNumber": "102", "atomicWeight": "259\n"}, "4": {"Sym": "Se", "Y": "4", "X": "16", "name": "Selenium", "atomicNumber": "34", "atomicWeight": "78.96\n"}}, "11": {"6": {"Sym": "Au", "Y": "6", "X": "11", "name": "Gold", "atomicNumber": "79", "atomicWeight": "196.967\n"}, "5": {"Sym": "Ag", "Y": "5", "X": "11", "name": "Silver", "atomicNumber": "47", "atomicWeight": "107.868\n"}, "8": {"Sym": "Tb", "Y": "8", "X": "11", "name": "Terbium", "atomicNumber": "65", "atomicWeight": "158.925\n"}, "7": {"Sym": "Rg", "Y": "7", "X": "11", "name": "gotmeum?", "atomicNumber": "111", "atomicWeight": "[280.16]\n"}, "9": {"Sym": "Bk", "Y": "9", "X": "11", "name": "Berkelium", "atomicNumber": "97", "atomicWeight": "247\n"}, "4": {"Sym": "Cu", "Y": "4", "X": "11", "name": "Copper", "atomicNumber": "29", "atomicWeight": "63.546\n"}}, "15": {"2": {"Sym": "N", "Y": "2", "X": "15", "name": "Nitrogen", "atomicNumber": "7", "atomicWeight": "14.007\n"}, "5": {"Sym": "Sb", "Y": "5", "X": "15", "name": "Antimony", "atomicNumber": "51", "atomicWeight": "121.76\n"}, "6": {"Sym": "Bi", "Y": "6", "X": "15", "name": "Bismuth", "atomicNumber": "83", "atomicWeight": "208.98\n"}, "8": {"Sym": "Tm", "Y": "8", "X": "15", "name": "Thulium", "atomicNumber": "69", "atomicWeight": "168.934\n"}, "7": {"Sym": "Uup", "Y": "7", "X": "15", "name": "gotmeum?", "atomicNumber": "115", "atomicWeight": "?\n"}, "3": {"Sym": "P", "Y": "3", "X": "15", "name": "Phosphorus", "atomicNumber": "15", "atomicWeight": "30.974\n"}, "9": {"Sym": "Md", "Y": "9", "X": "15", "name": "Mendelevium", "atomicNumber": "101", "atomicWeight": "258\n"}, "4": {"Sym": "As", "Y": "4", "X": "15", "name": "Arsenic", "atomicNumber": "33", "atomicWeight": "74.922\n"}}, "10": {"6": {"Sym": "Pt", "Y": "6", "X": "10", "name": "Platinum", "atomicNumber": "78", "atomicWeight": "195.078\n"}, "5": {"Sym": "Pd", "Y": "5", "X": "10", "name": "Palladium", "atomicNumber": "46", "atomicWeight": "106.42\n"}, "8": {"Sym": "Gd", "Y": "8", "X": "10", "name": "Gadolinium", "atomicNumber": "64", "atomicWeight": "157.25\n"}, "7": {"Sym": "Ds", "Y": "7", "X": "10", "name": "gotmeum?", "atomicNumber": "110", "atomicWeight": "[281.16]\n"}, "9": {"Sym": "Cm", "Y": "9", "X": "10", "name": "Curium", "atomicNumber": "96", "atomicWeight": "247\n"}, "4": {"Sym": "Ni", "Y": "4", "X": "10", "name": "Nickel", "atomicNumber": "28", "atomicWeight": "58.693\n"}}, "18": {"2": {"Sym": "Ne", "Y": "2", "X": "18", "name": "Neon", "atomicNumber": "10", "atomicWeight": "20.18\n"}, "5": {"Sym": "Xe", "Y": "5", "X": "18", "name": "Xenon", "atomicNumber": "54", "atomicWeight": "131.293\n"}, "6": {"Sym": "Rn", "Y": "6", "X": "18", "name": "Radon", "atomicNumber": "86", "atomicWeight": "222\n"}, "7": {"Sym": "Uuo", "Y": "7", "X": "18", "name": "gotmeum?", "atomicNumber": "118", "atomicWeight": "?"}, "1": {"Sym": "He", "Y": "1", "X": "18", "name": "Helium", "atomicNumber": "2", "atomicWeight": "4.003\n"}, "3": {"Sym": "Ar", "Y": "3", "X": "18", "name": "Argon", "atomicNumber": "18", "atomicWeight": "39.948\n"}, "4": {"Sym": "Kr", "Y": "4", "X": "18", "name": "Krypton", "atomicNumber": "36", "atomicWeight": "83.8\n"}}, "2": {"2": {"Sym": "Be", "Y": "2", "X": "2", "name": "Beryllium", "atomicNumber": "4", "atomicWeight": "9.012\n"}, "5": {"Sym": "Sr", "Y": "5", "X": "2", "name": "Strontium", "atomicNumber": "38", "atomicWeight": "87.62\n"}, "7": {"Sym": "Ra", "Y": "7", "X": "2", "name": "Radium", "atomicNumber": "88", "atomicWeight": "226\n"}, "6": {"Sym": "Ba", "Y": "6", "X": "2", "name": "Barium", "atomicNumber": "56", "atomicWeight": "137.327\n"}, "3": {"Sym": "Mg", "Y": "3", "X": "2", "name": "Magnesium", "atomicNumber": "12", "atomicWeight": "24.305\n"}, "4": {"Sym": "Ca", "Y": "4", "X": "2", "name": "Calcium", "atomicNumber": "20", "atomicWeight": "40.078\n"}}, "17": {"2": {"Sym": "F", "Y": "2", "X": "17", "name": "Fluorine", "atomicNumber": "9", "atomicWeight": "18.998\n"}, "5": {"Sym": "I", "Y": "5", "X": "17", "name": "Iodine", "atomicNumber": "53", "atomicWeight": "126.905\n"}, "7": {"Sym": "Uus", "Y": "7", "X": "17", "name": "gotmeum?", "atomicNumber": "117", "atomicWeight": "?\n"}, "6": {"Sym": "At", "Y": "6", "X": "17", "name": "Astatine", "atomicNumber": "85", "atomicWeight": "210\n"}, "3": {"Sym": "Cl", "Y": "3", "X": "17", "name": "Chlorine", "atomicNumber": "17", "atomicWeight": "35.453\n"}, "4": {"Sym": "Br", "Y": "4", "X": "17", "name": "Bromine", "atomicNumber": "35", "atomicWeight": "79.904\n"}}, "12": {"6": {"Sym": "Hg", "Y": "6", "X": "12", "name": "Mercury", "atomicNumber": "80", "atomicWeight": "200.59\n"}, "5": {"Sym": "Cd", "Y": "5", "X": "12", "name": "Cadmium", "atomicNumber": "48", "atomicWeight": "112.411\n"}, "8": {"Sym": "Dy", "Y": "8", "X": "12", "name": "Dysprosium", "atomicNumber": "66", "atomicWeight": "162.5\n"}, "7": {"Sym": "Cn", "Y": "7", "X": "12", "name": "gotmeum?", "atomicNumber": "112", "atomicWeight": "?\n"}, "9": {"Sym": "Cf", "Y": "9", "X": "12", "name": "Californium", "atomicNumber": "98", "atomicWeight": "251\n"}, "4": {"Sym": "Zn", "Y": "4", "X": "12", "name": "Zinc", "atomicNumber": "30", "atomicWeight": "65.39\n"}}, "1": {"2": {"Sym": "Li", "Y": "2", "X": "1", "name": "Lithium", "atomicNumber": "3", "atomicWeight": "6.941\n"}, "5": {"Sym": "Rb", "Y": "5", "X": "1", "name": "Rubidium", "atomicNumber": "37", "atomicWeight": "85.468\n"}, "6": {"Sym": "Cs", "Y": "6", "X": "1", "name": "Cesium", "atomicNumber": "55", "atomicWeight": "132.906\n"}, "7": {"Sym": "Fr", "Y": "7", "X": "1", "name": "Francium", "atomicNumber": "87", "atomicWeight": "223\n"}, "1": {"Sym": "H", "Y": "1", "X": "1", "name": "Hydrogen", "atomicNumber": "1", "atomicWeight": "1.008\n"}, "3": {"Sym": "Na", "Y": "3", "X": "1", "name": "Sodium", "atomicNumber": "11", "atomicWeight": "22.99\n"}, "4": {"Sym": "K", "Y": "4", "X": "1", "name": "Potassium", "atomicNumber": "19", "atomicWeight": "39.098\n"}}, "9": {"6": {"Sym": "Ir", "Y": "6", "X": "9", "name": "Iridium", "atomicNumber": "77", "atomicWeight": "192.217\n"}, "5": {"Sym": "Rh", "Y": "5", "X": "9", "name": "Rhodium", "atomicNumber": "45", "atomicWeight": "102.906\n"}, "8": {"Sym": "Eu", "Y": "8", "X": "9", "name": "Europium", "atomicNumber": "63", "atomicWeight": "151.964\n"}, "7": {"Sym": "Mt", "Y": "7", "X": "9", "name": "Meitnerium", "atomicNumber": "109", "atomicWeight": "268\n"}, "9": {"Sym": "Am", "Y": "9", "X": "9", "name": "Americium", "atomicNumber": "95", "atomicWeight": "243\n"}, "4": {"Sym": "Co", "Y": "4", "X": "9", "name": "Cobalt", "atomicNumber": "27", "atomicWeight": "58.933\n"}}, "X": {"Y": {"Sym": "sym", "Y": "Y", "X": "X", "name": "name", "atomicNumber": "atomNumber", "atomicWeight": "weight\n"}}, "14": {"2": {"Sym": "C", "Y": "2", "X": "14", "name": "Carbon", "atomicNumber": "6", "atomicWeight": "12.011\n"}, "5": {"Sym": "Sn", "Y": "5", "X": "14", "name": "Tin", "atomicNumber": "50", "atomicWeight": "118.71\n"}, "6": {"Sym": "Pb", "Y": "6", "X": "14", "name": "Lead", "atomicNumber": "82", "atomicWeight": "207.2\n"}, "8": {"Sym": "Er", "Y": "8", "X": "14", "name": "Erbium", "atomicNumber": "68", "atomicWeight": "167.259\n"}, "7": {"Sym": "Fl", "Y": "7", "X": "14", "name": "gotmeum?", "atomicNumber": "114", "atomicWeight": "?\n"}, "3": {"Sym": "Si", "Y": "3", "X": "14", "name": "Silicon", "atomicNumber": "14", "atomicWeight": "28.086\n"}, "9": {"Sym": "Fm", "Y": "9", "X": "14", "name": "Fermium", "atomicNumber": "100", "atomicWeight": "257\n"}, "4": {"Sym": "Ge", "Y": "4", "X": "14", "name": "Germanium", "atomicNumber": "32", "atomicWeight": "72.64\n"}}, "4": {"6": {"Sym": "Hf", "Y": "6", "X": "4", "name": "Hafnium", "atomicNumber": "72", "atomicWeight": "178.49\n"}, "5": {"Sym": "Zr", "Y": "5", "X": "4", "name": "Zirconium", "atomicNumber": "40", "atomicWeight": "91.224\n"}, "8": {"Sym": "Ce", "Y": "8", "X": "4", "name": "Cerium", "atomicNumber": "58", "atomicWeight": "140.116\n"}, "7": {"Sym": "Rf", "Y": "7", "X": "4", "name": "Rutherfordium", "atomicNumber": "104", "atomicWeight": "261\n"}, "9": {"Sym": "Th", "Y": "9", "X": "4", "name": "Thorium", "atomicNumber": "90", "atomicWeight": "232.038\n"}, "4": {"Sym": "Ti", "Y": "4", "X": "4", "name": "Titanium", "atomicNumber": "22", "atomicWeight": "47.867\n"}}, "8": {"6": {"Sym": "Os", "Y": "6", "X": "8", "name": "Osmium", "atomicNumber": "76", "atomicWeight": "190.23\n"}, "5": {"Sym": "Ru", "Y": "5", "X": "8", "name": "Ruthenium", "atomicNumber": "44", "atomicWeight": "101.07\n"}, "8": {"Sym": "Sm", "Y": "8", "X": "8", "name": "Samarium", "atomicNumber": "62", "atomicWeight": "150.36\n"}, "7": {"Sym": "Hs", "Y": "7", "X": "8", "name": "Hassium", "atomicNumber": "108", "atomicWeight": "277\n"}, "9": {"Sym": "Pu", "Y": "9", "X": "8", "name": "Plutonium", "atomicNumber": "94", "atomicWeight": "244\n"}, "4": {"Sym": "Fe", "Y": "4", "X": "8", "name": "Iron", "atomicNumber": "26", "atomicWeight": "55.845\n"}}}
for (x = 1; x <= 18; x++) {
// populate row
for (y = 1; y <= 9; y++) {
// populate elements
console.log("("+x+","+y+") ");
if (y==8){
$("#col"+x).append(createCell(x,-y,"vspace","","","",""));
}
if (x ==1 && y==8) {
$("#col"+x).append(createCell(x,y,"header","*Lanthanoids","","",""));
continue;
}
if (x ==1 && y==9) {
$("#col"+x).append(createCell(x,y,"header","**Actinoids","","",""));
continue;
}
if (!(y in elements[x])) {
$("#col"+x).append(createCell(x,y,"blank","","","",""));
continue;
}
//console.log(elements[x][y]);
e = elements[x][y];
$("#col"+x).append(createCell(x,y,"element",e["atomicNumber"],e["Sym"],e["name"],e["atomicWeight"]));// populate table header
}
}
$("addColor").click(colorTable);
}
$( document ).ready(drawPage)