-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgallery.html
144 lines (121 loc) · 5.69 KB
/
gallery.html
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
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<div id="nav"></div>
<div class="content">
<div id="picture-header"></div>
<div class="title-container">
<div class="w3-center title">
<h1 class="blue">Gamma Pi Photo Gallery</h1>
</div>
</div>
<div class="w3-container w3-padding-32" style="background-color: #DFDFDF; border-top: 2px solid #09268a; border-bottom: 2px solid #09268a;">
<div class="w3-center">
<h2 class="blue" style="font-weight: bold; align-content: center;">2023-2024</h2>
</div>
<div id="2324" class="w3-container">
<div id="2324-bdiv" class="gallery-bdiv">
</div>
</div>
</div>
<div class="w3-container w3-padding-32" style="background-color: #DFDFDF; border-top: 2px solid #09268a; border-bottom: 2px solid #09268a;">
<div class="w3-center">
<h2 class="blue" style="font-weight: bold; align-content: center;">2022-2023</h2>
</div>
<div id="2223" class="w3-container">
<div id="2223-bdiv" class="gallery-bdiv">
</div>
</div>
</div>
</div>
<div id="footer"></div>
</body>
<script src="static/script.js"></script>
<script type="text/javascript">
//THE FOLLOWING LISTS MUST BE KEPT IN ORDER, WITH THE FIRST ENTRY AT TOP OF PAGE. ADD TO BEGINNING OF LISTS
var names = ["misc", "wrench", "ireland", "trivia", "2223formal", "2223service"]; //Name of file
var titles = ["Misc.", "Dodgeball Fundraiser", "Brothers in Ireland", "MC Trivia Night", "2023 KKY/TBS Formal", "Service Projects"]; //title displayed
var num = [2, 12, 6, 11, 12, 6]; //number of images in each gallery set
var year = ["2324", "2223", "2223", "2223", "2223", "2223"]; //year ID, must create new one for every year that passes, see template below
for (let i = 0; i < names.length; i++) {
//Creates the title div and h2, adds the title and adds that to the year div
const bdiv = document.getElementById(year[i] + "-bdiv");
const button = document.createElement("button");
button.setAttribute("onclick", "showgal('"+names[i]+"')");
button.classList.add("w3-button");
button.classList.add("gal-button");
button.classList.add("w3-col");
button.append(titles[i]);
bdiv.appendChild(button);
const galdiv = document.createElement("div");
galdiv.setAttribute("id", names[i]);
/*galdiv.classList.add("w3-container");*/
const title = document.createElement("h2");
title.classList.add("blue");
const galtitle = titles[i];
title.append(galtitle);
const titlediv = document.createElement("div");
titlediv.classList.add("w3-left", "title-gallery");
titlediv.append(title);
galdiv.appendChild(titlediv);
//puts the images into the image div
const imgdiv = document.createElement("div");
imgdiv.classList.add("w3-left");
imgdiv.classList.add("imgdiv");
for (let j = 0; j < num[i]; j++) {
const a = document.createElement("a");
a.setAttribute("href", "static/images/gallery/"+ names[i] + j.toString() + ".jpg");
a.setAttribute("target", "_blank");
a.classList.add("gallery-a");
const img = document.createElement("img");
img.setAttribute("src", "static/images/gallery/"+ names[i] + j.toString() + ".jpg");
img.classList.add("gallery-img");
img.setAttribute("loading", "lazy");
a.appendChild(img);
imgdiv.appendChild(a);
}
galdiv.appendChild(imgdiv);
const hidediv = document.createElement("div");
hidediv.setAttribute("style", "postition: relative; margin: 0px; width: 100%;");
/*hidediv.classList.add("w3-container");*/
const hide_button = document.createElement("button")
hide_button.setAttribute("onclick", "hidegal('"+names[i]+"')");
hide_button.append("Hide");
hidediv.appendChild(hide_button);
galdiv.appendChild(hidediv);
galdiv.classList.add("w3-hide");
const yeardiv = document.getElementById(year[i]);
yeardiv.appendChild(galdiv);
//creates a line if necessary
if (i != names.length - 1) {
const hr = document.createElement("hr");
hr.classList.add("gallery-line");
galdiv.append(hr);
}
}
function showgal(name){
const gallery = document.getElementById(name);
gallery.classList.add("w3-show");
gallery.classList.remove("w3-hide");
}
function hidegal(name){
const gallery = document.getElementById(name);
gallery.classList.add("w3-hide");
gallery.classList.remove("w3-show");
}
</script>
</html>
<!--
TEMPLATE FOR NEW YEARS, ADD AT TOP OF GALLERY
<div class="w3-container w3-padding-32" style="background-color: #DFDFDF; border-top: 2px solid #09268a; border-bottom: 2px solid #09268a;">
<div class="w3-center">
<h2 class="blue" style="font-weight: bold; align-content: center;">20XX-20XX</h2>
</div>
<div id="XXXX" class="w3-container">
<div id="-bdiv" class="gallery-bdiv">
</div>
</div>
</div>