Skip to content

Commit 69acace

Browse files
committed
Initial attempt at modals
1 parent cc71703 commit 69acace

File tree

3 files changed

+67
-6
lines changed

3 files changed

+67
-6
lines changed

index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,13 @@ <h4>Office Hours</h4>
377377
</ul>
378378

379379
<!-- Scripts placed at the bottom of the page for faster loading -->
380-
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
381-
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
380+
<script
381+
src="https://code.jquery.com/jquery-3.4.1.min.js"
382+
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
383+
crossorigin="anonymous"></script>
384+
385+
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
386+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
382387
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
383388
<script type="text/javascript" src="/js/gtag_helper.js"></script>
384389
<script type="text/javascript" src="js/resources.js"></script>

js/resources.js

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function create_showcase_card(project) {
228228
id="{ project.uid }-modal"
229229
tabindex="-1"
230230
role="dialog"
231-
aria-labelledby="{ project.uid }-title"
231+
aria-labelledby="{ project.uid }-modalTitle"
232232
aria-hidden="true"
233233
>
234234
<div class="modal-dialog" role="document">
@@ -250,7 +250,7 @@ function create_showcase_card(project) {
250250
</div>
251251
252252
*/
253-
var $card = $('<div>').attr('class', 'col mb-2')
253+
var $card = $('<div>').attr({'class': 'col mb-2'})
254254
.append(
255255
$('<div>').attr({
256256
'class': 'card',
@@ -270,12 +270,68 @@ function create_showcase_card(project) {
270270
'class': 'mr-3',
271271
'data-toggle': 'modal',
272272
'data-target': `#${project.uid}-modal`,
273-
'href': '#'
273+
'href': `#${ project.uid }-modal`
274274
}).append('Video') : null)
275275
).append(
276276
(project.ext ? '<br />' + project.ext : null)
277277
)
278278
)
279+
).append(
280+
(project.rightColMedia ?
281+
$('<div>').attr({
282+
'class': 'modal',
283+
'id': `${ project.uid }-modal`,
284+
'tabindex': '-1',
285+
'role': 'dialog',
286+
'aria-labelledby': `${ project.uid }-modalTitle`,
287+
'aria-hidden': 'true'
288+
})
289+
.append(
290+
$('<div>').attr({'class': 'modal-dialog modal-dialog-centered', 'role': 'document'})
291+
.append(
292+
$('<div>').attr('class', 'modal-content')
293+
.append(
294+
/* BEGIN MODAL HEADER */
295+
$('<div>').attr('class', 'modal-header')
296+
.append(
297+
$('<h5>').attr({'class': 'modal-title', 'id': `${ project.uid }-modalTitle`})
298+
.append(`Video for "${project.title}"`)
299+
)
300+
.append(
301+
$('<button>').attr({
302+
'type': 'button',
303+
'class': 'close',
304+
'data-dismiss': 'modal',
305+
'aria-label': "Close"
306+
})
307+
.append(
308+
$('<span>').attr('aria-hidden', 'true')
309+
.append('&times;')
310+
)
311+
)
312+
/* END MODAL HEADER */
313+
)
314+
.append(
315+
/* BEGIN MODAL BODY */
316+
$('<div>').attr('class', 'modal-body')
317+
.append(project.rightColMedia)
318+
/* END MODAL BODY */
319+
)
320+
.append(
321+
/* BEGIN MODAL FOOTER */
322+
$('<div>').attr('class', 'modal-footer')
323+
.append(
324+
$('<button>').attr({
325+
'type': 'button',
326+
'class': 'btn btn-secondary',
327+
'data-dismiss': 'modal'
328+
}).append('Close')
329+
)
330+
/* END MODAL FOOTER */
331+
)
332+
)
333+
)
334+
: null)
279335
);
280336

281337
// if (project.rightColMedia.length > 0) {

res/projects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"ext": ""
2020
},
2121
{
22-
"uid": "b8a41718-5458-43ae-aa77-d5523b0a0432",
22+
"uid": "f4577760-e010-4725-a5d4-45ba45f14444",
2323
"title": "Reddit Wallscraper",
2424
"authors": "Elizabeth Fitzgerald, Chris Moffitt",
2525
"codeSource": "GitHub",

0 commit comments

Comments
 (0)