mirror of https://github.com/calzoneman/sync.git
Eliminate jQuery in index template microscript
This commit is contained in:
parent
119b6a62b8
commit
0f9d778a27
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue