Skip to content

Commit 245ec26

Browse files
authored
Merge pull request #390 from ComputerScienceHouse/tyler-dev
Packet zoom
2 parents 896433b + f42f653 commit 245ec26

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

packet/static/js/pfp-zoom.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
$(document).ready(function () {
2+
let photos = Array.from(document.querySelectorAll('.eval-user-img'))
3+
4+
top.onclick = function (e) {
5+
let tsib = e.target.previousElementSibling
6+
if (tsib != null) {
7+
if (tsib.classList.contains('eval-user-img')) {
8+
return;
9+
}
10+
}
11+
if (e.target.classList.contains('eval-user-img')) {
12+
return;
13+
}
14+
document.querySelector('#zoom-photo').remove()
15+
}
16+
17+
photos.forEach((photo) => {
18+
photo.addEventListener('click', (e) => {
19+
let other = document.querySelector('#zoom-photo')
20+
if (other != null) {
21+
other.remove()
22+
}
23+
photo.insertAdjacentHTML('afterend', `
24+
<div id="zoom-photo" style="position: fixed; z-index: 1050; display: block">
25+
<img class="eval-user-img"
26+
alt=${photo.alt}
27+
src=${photo.src}
28+
style="max-width: 200px; max-height: 200px; border: 1px solid #666"
29+
>
30+
</div>
31+
`)
32+
e.preventDefault();
33+
})
34+
})
35+
36+
})

packet/templates/active_packets.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ <h4 class="page-title">Active Packets</h4>
111111

112112
{% block scripts %}
113113
{{ super() }}
114+
<script src="{{ url_for('static', filename='js/pfp-zoom.min.js') }}"></script>
114115
{% if info.realm == "csh" %}
115116
<script src="{{ url_for('static', filename='js/tables.min.js') }}"></script>
116117
{% endif %}

packet/templates/packet.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,7 @@ <h5>Upperclassmen Score - {{ '%0.2f' % upper_score }}%</h5>
192192
</div>
193193
</div>
194194
{% endblock %}
195+
{% block scripts %}
196+
{{ super() }}
197+
<script src="{{ url_for('static', filename='js/pfp-zoom.min.js') }}"></script>
198+
{% endblock %}

0 commit comments

Comments
 (0)