forked from CCAppDevs/SmashGames-Master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
164 lines (149 loc) · 6.47 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// index.html Smash Games - Home
// blast.html Smash Games - Inferno Blast
const data = {
brandName: "Smash Games",
pages: [
{
name: "index",
pageName: "Home",
callToAction: {
src: "images/SmashGamesLogo-short.png",
altText: "Smash Games Logo"
}
},
{
name: "blast",
pageName: "Inferno Blast",
blocks: [
{
type: "call-to-action",
src: "images/Inferno-Jumbotron.png",
altText: "Inferno Blast Gameplay",
buttonLinkSrc: "https://steampowered.com",
buttonLinkText: "Buy now on Steam"
},
{
type: "description",
text: "Inferno Blast is an action-packed adventure game that takes players to a fiery realm of danger and excitement. In this game, you'll take on the role of a hero who must navigate through a series of treacherous levels filled with fiery obstacles and hordes of demons. With each level you complete, you'll unlock new weapons and power-ups to help you in your quest to defeat the ultimate demon boss. Can you survive the inferno and emerge victorious?",
},
{
type: "deck",
cards: [
{
type: "card",
src: "images/Inferno/Inferno-2-short.png",
altText: "Inferno Blast Gameplay",
title: "Dynamic Environments",
body: "Navigate through a variety of fiery landscapes, including lava pits, crumbling ruins, and demonic strongholds.",
},
{
type: "card",
src: "images/Inferno/Inferno-1-short.png",
altText: "Inferno Blast Gameplay",
title: "Upgradable Weapons",
body: "Customize your arsenal with a range of weapons and power-ups, including flamethrowers, rocket launchers, and more.",
},
{
type: "card",
src: "images/Inferno/Inferno-3-short.png",
altText: "Inferno Blast Gameplay",
title: "Epic Boss Battles",
body: "Face off against towering demon bosses, each with their own unique strengths and weaknesses.",
},
],
},
{
type: "requirements",
platforms: [
"steam",
"playstation",
"xbox",
"facebook",
"twitter",
"instagram",
"patreon",
"twitch",
"youtube",
],
requirements: [
{
type: "minimum-requirements",
title: "Minimum Requirements",
requirements: [
{ title: "OS", value: "Win7" },
{ title: "Processor", value: "Intel I3 or Ryzen 3" },
{ title: "RAM", value: "8gb" },
{ title: "Graphics", value: "Geforce GTX 570" },
{ title: "Storage", value: "1gb HDD" },
]
},
{
type: "recommended-requirements",
title: "Recommended Requirements",
requirements: [
{ title: "OS", value: "Win11" },
{ title: "Processor", value: "Intel I9 or Ryzen 7" },
{ title: "RAM", value: "16gb" },
{ title: "Graphics", value: "Geforce RTX 2080" },
{ title: "Storage", value: "5gb SSD" },
]
},
]
},
{
type: "wishlist"
},
{
type: "faq",
questions: [
{ question: "What does this do?", answer: "stuff" },
{ question: "What does that do?", answer: "that stuff" },
{ question: "What does any of this do?", answer: "stuff i think" },
]
}
],
}
]
}
let page = data.pages[1];
document.title = data.brandName + " - " + page.pageName;
// get access to the branding and change to data.brandName
document.getElementById("brand").innerHTML = data.brandName.toUpperCase();
// get access to the page title h1 and change it to page.pageName
document.getElementById("pageName").innerHTML = page.pageName;
// This is the code to create blocks
/* <div class="call-to-action">
<img src="images/Inferno-Jumbotron.png" alt="Inferno Blast Gameplay" />
<br />
<a class="btn" href="https://steampowered.com" target="_blank">Buy Now on Steam! <i class="fa-brands fa-steam-symbol"></i></a>
</div> */
createCallToAction(page.blocks[0]);
function createImage(imgData) {
let img = document.createElement("img");
img.src = imgData.src;
img.alt = imgData.alt;
return img;
}
function createButtonLink(linkData) {
let link = document.createElement("a");
link.classList.add("btn");
link.href = linkData.buttonLinkSrc;
link.target = "_blank";
link.innerHTML = linkData.buttonLinkText + ' <i class="fa-brands fa-steam-symbol"></i>';
return link;
}
function createCallToAction(blockData) {
// get the main container
let container = document.getElementById("main");
// create our block
let block = document.createElement("div");
block.classList.add("call-to-action");
// add our image
block.appendChild(createImage(blockData));
block.appendChild(createButtonLink(blockData));
// add our break
block.appendChild(document.createElement("br"));
// add our call to action button
// add our block to main
container.appendChild(block);
}