-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
222 lines (191 loc) · 7.88 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
var navbar = `<nav class="navbar navbar-dark navbar-expand-sm navbar-static-top">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Navbar">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand mr-auto" href="#"><img src="/images/logo.PNG" height="30" width="30" style="margin-bottom: 0.2vw"></a>
<div class="collapse navbar-collapse" id="Navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="/index.html"><span class="fa fa-home fa-lg"></span> Home</a></li>
<li class="nav-item"><a class="nav-link" href="/divs_index.html"><span class="fa fa-info fa-lg"></span> Divs</a></li>
<li class="nav-item"><a class="nav-link" href="/patchandmaude_index.html"><span class="fa fa-list fa-lg"></span> Patch & Maude</a></li>
<li class="nav-item"><a class="nav-link" href="/don3ts_index.html"><span class="fa fa-address-card fa-lg"></span> don3ts</a></li>
<li class="nav-item"><a class="nav-link" href="/def_assetmanagement_terms/comic.html"><span class="fa fa-address-card fa-lg"></span> Asset Management</a></li>
</ul>
</div>
</div>`;
/* If this is not a key navigation window, just throw main nav locations */
console.log('location.pathname: ' + location.pathname);
if(location.pathname != '/'
&& location.pathname != '/index.html'
&& location.pathname != '/patchandmaude_index.html'
&& location.pathname != '/divs_index.html'
&& location.pathname != '/don3ts_index.html'
&& location.pathname != '/def_assetmanagement_terms/comic.html' ){
$('body').prepend(navbar);
}
// Add patch and maude items to the carousel
if(location.pathname == '/index.html'
|| location.pathname =='/'){
// Load mainpages.json into an object
jQuery.getJSON('/data/mainpages.json', function(data){
// For every item in mainpages.json, create a carousel-item
data.forEach(function(page, index){
let cItem = $('<div></div>')
cItem.addClass('carousel-item');
// If this is the first page, make it the active element
if(index==0){
cItem.addClass('active');
}
// Add the link
href = $('<a></a>')
href.attr('href', page.href);
// Add the image
img = $('<img />');
img.addClass('d-block');
img.addClass('img-fluid');
img.attr('src', page.src);
img.attr('alt', page.name);
// Add the caption.
cap = $('<div></div>');
cap.addClass('carousel-caption');
cap.addClass('d-none');
cap.addClass('d-md-block');
// Add the caption text
h2 = $('<h2></h2>');
h2.addClass('mt-0');
h2.text(page.name);
// Add the description
desc = $('<p></p>');
desc.addClass('d-none');
desc.addClass('d-sm-block');
desc.text(page.description);
// Assemble the objects
$('#patchmaudecarousel .carousel-inner').append(cItem);
cItem.append(href);
href.append(img);
href.append(cap);
cap.append(h2);
cap.append(desc);
});
});
// Add the controls to the carousel
$('#patchmaudecarousel .carousel-inner').append(
`<a class="carousel-control-prev" href="#patchmaudecarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#patchmaudecarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>`
);
}
// Add the Divs items to the carousel
if(location.pathname == '/index.html'
|| location.pathname =='/'){
// Load mainpages.json into an object
jQuery.getJSON('/data/divspages.json', function(data){
// For every item in mainpages.json, create a carousel-item
data.forEach(function(page, index){
let cItem = $('<div></div>')
cItem.addClass('carousel-item');
// If this is the first page, make it the active element
if(index==0){
cItem.addClass('active');
}
// Add the link
href = $('<a></a>')
href.attr('href', page.href);
// Add the image
img = $('<img />');
img.addClass('d-block');
img.addClass('img-fluid');
img.attr('src', page.src);
img.attr('alt', page.name);
// Add the caption.
cap = $('<div></div>');
cap.addClass('carousel-caption');
cap.addClass('d-none');
cap.addClass('d-md-block');
// Add the caption text
h2 = $('<h2></h2>');
h2.addClass('mt-0');
h2.text(page.name);
// Add the description
desc = $('<p></p>');
desc.addClass('d-none');
desc.addClass('d-sm-block');
desc.text(page.description);
// Assemble the objects
$('#thedivscarousel .carousel-inner').append(cItem);
cItem.append(href);
href.append(img);
href.append(cap);
cap.append(h2);
cap.append(desc);
});
});
// Add the controls to the carousel
$('#thedivscarousel .carousel-inner').append(
`<a class="carousel-control-prev" href="#thedivscarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#thedivscarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>`
);
}
// Add the don3ts items to the carousel
if(location.pathname == '/index.html'
|| location.pathname =='/'){
// Load mainpages.json into an object
jQuery.getJSON('/data/don3tspages.json', function(data){
// For every item in mainpages.json, create a carousel-item
data.forEach(function(page, index){
let cItem = $('<div></div>')
cItem.addClass('carousel-item');
// If this is the first page, make it the active element
if(index==0){
cItem.addClass('active');
}
// Add the link
href = $('<a></a>')
href.attr('href', page.href);
// Add the image
img = $('<img />');
img.addClass('d-block');
img.addClass('img-fluid');
img.attr('src', page.src);
img.attr('alt', page.name);
// Add the caption.
cap = $('<div></div>');
cap.addClass('carousel-caption');
cap.addClass('d-none');
cap.addClass('d-md-block');
// Add the caption text
h2 = $('<h2></h2>');
h2.addClass('mt-0');
h2.text(page.name);
// Add the description
desc = $('<p></p>');
desc.addClass('d-none');
desc.addClass('d-sm-block');
desc.text(page.description);
// Assemble the objects
$('#vizcarousel .carousel-inner').append(cItem);
cItem.append(href);
href.append(img);
href.append(cap);
cap.append(h2);
cap.append(desc);
});
});
// Add the controls to the carousel
$('#vizcarousel .carousel-inner').append(
`<a class="carousel-control-prev" href="#vizcarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#vizcarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>`
);
}