Eliminate jQuery in index template microscript

This commit is contained in:
Xaekai 2022-02-09 13:42:47 -08:00 committed by Calvin Montgomery
parent 119b6a62b8
commit 0f9d778a27

View file

@ -21,8 +21,15 @@ block content
append footer
script(type="text/javascript").
$("#channelname").keydown(function (ev) {
const entrance = document.querySelector('#channelname');
entrance.addEventListener('keydown', function (ev) {
if (ev.keyCode === 13) {
location.href = "/#{channelPath}/" + $("#channelname").val();
const channel = `/${CHANNELPATH}/${entrance.value}`;
if (ev.shiftKey || ev.ctrlKey) {
window.open(channel, '_blank');
entrance.value = '';
} else {
location.href = channel;
}
}
});