-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
79 lines (70 loc) · 1.89 KB
/
script.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
var div = document.getElementsByClassName("row")[0]
var apps = [
{
name: "ScratchSuite",
repository: "scratchsuite/scratchsuite.github.io",
owner: "ScratchSuite",
url: "//scratchsuite.github.io",
tags: ["beta"]
},
{
name: "Frontend",
repository: "scratchsuite/frontend",
owner: "ScratchSuite",
url: "//scratchsuite.github.io/frontend",
tags: ["beta"]
},
{
name: "Backend",
repository: "scratchsuite/Backend",
owner: "FunctionalMetatable",
url: "//scratchsuite.github.io/backend",
tags: ["beta", "upptime"]
},
{
name: "Scratch 1.0 Forums",
repository: "scratchsuite/Backend",
owner: "Andrew Sun",
url: "//scratcharchive.asun.co/forums/",
tags: ["Forums", "Old"],
ownerPage: "//asun.co"
},
];
var tagSettings = {
beta: {
color: "#ffa500"
}
}
for (let i=0;i<apps.length;i++) {
var app = apps[i];
// Create the div
data = `
<div class="col" id="app-${app.name}">
<a href="${app.url}">
<h4>${app.name}</h4>
<a>by <a href="${app.ownerPage || "https://scratchsuite.github.io"}">${app.owner}</a></a>
</a>
<br>
</div>
`
div.innerHTML += data
app.div = document.getElementById(`app-${app.name}`)
// Add the tags
for (let tagI=0;tagI<app.tags.length;tagI++) {
var tag = document.createElement("span");
tag.setAttribute("class", "tag")
tag.style.borderColor = "#FFF"
tag.innerText = app.tags[tagI]
var settings = tagSettings[app.tags[tagI]]
if (settings && settings.color) tag.style.backgroundColor = settings.color
app.div.appendChild(tag)
if (app.tags.length >=2) app.div.innerHTML += "⠀⠀"
}
// create <br> el
app.div.appendChild(document.createElement("br"))
// create an anchor element for the br to work
ph=document.createElement("p");
ph.innerText=""
ph.setAttribute("class", "app-div-whitespace-border")
app.div.appendChild(ph)
}