Merge pull request #990 from ae-utbm/jquery

Remove some jquery
This commit is contained in:
Bartuccio Antoine 2025-01-09 22:32:39 +01:00 committed by GitHub
commit 843ce2e3a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 36 deletions

View File

@ -125,15 +125,14 @@
navbar.style.setProperty("display", current === "none" ? "block" : "none"); navbar.style.setProperty("display", current === "none" ? "block" : "none");
} }
$(document).keydown(function (e) { document.addEventListener("keydown", (e) => {
if ($(e.target).is('input')) { return } // Looking at the `s` key when not typing in a form
if ($(e.target).is('textarea')) { return } if (e.keyCode !== 83 || ["INPUT", "TEXTAREA", "SELECT"].includes(e.target.nodeName)) {
if ($(e.target).is('select')) { return } return;
if (e.keyCode === 83) {
$("#search").focus();
return false;
} }
}); document.getElementById("search").focus();
e.preventDefault(); // Don't type the character in the focused search input
})
</script> </script>
{% endblock %} {% endblock %}
</body> </body>

View File

@ -57,13 +57,4 @@
{% endblock %} {% endblock %}
{% endif %} {% endif %}
{% block script %}
{{ super() }}
{% if popup %}
<script>
parent.$(".choose_file_widget").css("height", "75%");
</script>
{% endif %}
{% endblock %}
{% endblock %} {% endblock %}

View File

@ -244,27 +244,30 @@
{% block script %} {% block script %}
{{ super() }} {{ super() }}
<script> <script>
$(function () { // Image selection
var keys = []; for (const img of document.querySelectorAll("#small_pictures img")){
var pattern = "71,85,89,71,85,89"; img.addEventListener("click", (e) => {
$(document).keydown(function (e) { const displayed = document.querySelector("#big_picture img");
keys.push(e.keyCode); displayed.src = e.target.src;
if (keys.toString() == pattern) { displayed.alt = e.target.alt;
keys = []; displayed.title = e.target.title;
$("#big_picture img").attr("src", "{{ static('core/img/yug.jpg') }}");
}
if (keys.length == 6) {
keys.shift();
}
});
});
$(function () {
$("#small_pictures img").click(function () {
$("#big_picture img").attr("src", $(this)[0].src);
$("#big_picture img").attr("alt", $(this)[0].alt);
$("#big_picture img").attr("title", $(this)[0].title);
}) })
}
let keys = [];
const pattern = "71,85,89,71,85,89";
document.addEventListener("keydown", (e) => {
keys.push(e.keyCode);
if (keys.toString() === pattern) {
keys = [];
document.querySelector("#big_picture img").src = "{{ static('core/img/yug.jpg') }}";
}
if (keys.length === 6) {
keys.shift();
}
}); });
$(function () { $(function () {
$("#drop_gifts").accordion({ $("#drop_gifts").accordion({
heightStyle: "content", heightStyle: "content",