prevent default
This commit is contained in:
parent
ed6a58d130
commit
68e27a83f4
@ -750,14 +750,13 @@
|
|||||||
var range, selEnd, selStart, ta, valEnd, valMid, valStart, value;
|
var range, selEnd, selStart, ta, valEnd, valMid, valStart, value;
|
||||||
switch (keybinds.key) {
|
switch (keybinds.key) {
|
||||||
case keybinds.close:
|
case keybinds.close:
|
||||||
e.preventDefault();
|
$.rm($('#qr'));
|
||||||
return $.rm($('#qr'));
|
break;
|
||||||
case keybinds.spoiler:
|
case keybinds.spoiler:
|
||||||
ta = d.activeElement;
|
ta = d.activeElement;
|
||||||
if (ta.nodeName !== 'TEXTAREA') {
|
if (ta.nodeName !== 'TEXTAREA') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
|
||||||
value = ta.value;
|
value = ta.value;
|
||||||
selStart = ta.selectionStart;
|
selStart = ta.selectionStart;
|
||||||
selEnd = ta.selectionEnd;
|
selEnd = ta.selectionEnd;
|
||||||
@ -766,50 +765,71 @@
|
|||||||
valEnd = '[/spoiler]' + value.slice(selEnd);
|
valEnd = '[/spoiler]' + value.slice(selEnd);
|
||||||
ta.value = valStart + valMid + valEnd;
|
ta.value = valStart + valMid + valEnd;
|
||||||
range = valStart.length + valMid.length;
|
range = valStart.length + valMid.length;
|
||||||
return ta.setSelectionRange(range, range);
|
ta.setSelectionRange(range, range);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
return e.preventDefault();
|
||||||
},
|
},
|
||||||
normal: function(e) {
|
normal: function(e) {
|
||||||
var o, thread;
|
var o, thread;
|
||||||
thread = nav.getThread();
|
thread = nav.getThread();
|
||||||
switch (keybinds.key) {
|
switch (keybinds.key) {
|
||||||
case keybinds.close:
|
case keybinds.close:
|
||||||
e.preventDefault();
|
|
||||||
if (o = $('#overlay')) {
|
if (o = $('#overlay')) {
|
||||||
return $.rm(o);
|
$.rm(o);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case keybinds.zero:
|
case keybinds.zero:
|
||||||
return window.location = "/" + g.BOARD + "/0#0";
|
window.location = "/" + g.BOARD + "/0#0";
|
||||||
|
break;
|
||||||
case keybinds.openEmptyQR:
|
case keybinds.openEmptyQR:
|
||||||
return keybinds.qr(thread);
|
keybinds.qr(thread);
|
||||||
|
break;
|
||||||
case keybinds.nextReply:
|
case keybinds.nextReply:
|
||||||
return keybinds.hl.next(thread);
|
keybinds.hl.next(thread);
|
||||||
|
break;
|
||||||
case keybinds.previousReply:
|
case keybinds.previousReply:
|
||||||
return keybinds.hl.prev(thread);
|
keybinds.hl.prev(thread);
|
||||||
|
break;
|
||||||
case keybinds.expandAllImages:
|
case keybinds.expandAllImages:
|
||||||
return keybinds.img(thread, true);
|
keybinds.img(thread, true);
|
||||||
|
break;
|
||||||
case keybinds.openThread:
|
case keybinds.openThread:
|
||||||
return keybinds.open(thread);
|
keybinds.open(thread);
|
||||||
|
break;
|
||||||
case keybinds.expandThread:
|
case keybinds.expandThread:
|
||||||
return expandThread.toggle(thread);
|
expandThread.toggle(thread);
|
||||||
|
break;
|
||||||
case keybinds.openQR:
|
case keybinds.openQR:
|
||||||
return keybinds.qr(thread, true);
|
keybinds.qr(thread, true);
|
||||||
|
break;
|
||||||
case keybinds.expandImages:
|
case keybinds.expandImages:
|
||||||
return keybinds.img(thread);
|
keybinds.img(thread);
|
||||||
|
break;
|
||||||
case keybinds.nextThread:
|
case keybinds.nextThread:
|
||||||
return nav.next();
|
nav.next();
|
||||||
|
break;
|
||||||
case keybinds.openThreadTab:
|
case keybinds.openThreadTab:
|
||||||
return keybinds.open(thread, true);
|
keybinds.open(thread, true);
|
||||||
|
break;
|
||||||
case keybinds.previousThread:
|
case keybinds.previousThread:
|
||||||
return nav.prev();
|
nav.prev();
|
||||||
|
break;
|
||||||
case keybinds.update:
|
case keybinds.update:
|
||||||
return updater.update();
|
updater.update();
|
||||||
|
break;
|
||||||
case keybinds.watch:
|
case keybinds.watch:
|
||||||
return watcher.toggle(thread);
|
watcher.toggle(thread);
|
||||||
|
break;
|
||||||
case keybinds.hide:
|
case keybinds.hide:
|
||||||
return threadHiding.toggle(thread);
|
threadHiding.toggle(thread);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
return e.preventDefault();
|
||||||
},
|
},
|
||||||
img: function(thread, all) {
|
img: function(thread, all) {
|
||||||
var root, thumb;
|
var root, thumb;
|
||||||
|
|||||||
@ -537,14 +537,11 @@ keybinds =
|
|||||||
insert: (e) ->
|
insert: (e) ->
|
||||||
switch keybinds.key
|
switch keybinds.key
|
||||||
when keybinds.close
|
when keybinds.close
|
||||||
e.preventDefault()
|
|
||||||
$.rm $ '#qr'
|
$.rm $ '#qr'
|
||||||
when keybinds.spoiler
|
when keybinds.spoiler
|
||||||
ta = d.activeElement
|
ta = d.activeElement
|
||||||
return unless ta.nodeName is 'TEXTAREA'
|
return unless ta.nodeName is 'TEXTAREA'
|
||||||
|
|
||||||
e.preventDefault()
|
|
||||||
|
|
||||||
value = ta.value
|
value = ta.value
|
||||||
selStart = ta.selectionStart
|
selStart = ta.selectionStart
|
||||||
selEnd = ta.selectionEnd
|
selEnd = ta.selectionEnd
|
||||||
@ -556,12 +553,14 @@ keybinds =
|
|||||||
ta.value = valStart + valMid + valEnd
|
ta.value = valStart + valMid + valEnd
|
||||||
range = valStart.length + valMid.length
|
range = valStart.length + valMid.length
|
||||||
ta.setSelectionRange range, range
|
ta.setSelectionRange range, range
|
||||||
|
else
|
||||||
|
return
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
normal: (e) ->
|
normal: (e) ->
|
||||||
thread = nav.getThread()
|
thread = nav.getThread()
|
||||||
switch keybinds.key
|
switch keybinds.key
|
||||||
when keybinds.close
|
when keybinds.close
|
||||||
e.preventDefault()
|
|
||||||
$.rm o if o = $ '#overlay'
|
$.rm o if o = $ '#overlay'
|
||||||
when keybinds.zero
|
when keybinds.zero
|
||||||
window.location = "/#{g.BOARD}/0#0"
|
window.location = "/#{g.BOARD}/0#0"
|
||||||
@ -593,6 +592,9 @@ keybinds =
|
|||||||
watcher.toggle thread
|
watcher.toggle thread
|
||||||
when keybinds.hide
|
when keybinds.hide
|
||||||
threadHiding.toggle thread
|
threadHiding.toggle thread
|
||||||
|
else
|
||||||
|
return
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
img: (thread, all) ->
|
img: (thread, all) ->
|
||||||
if all
|
if all
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user