One keybind, auto-hide and persistent QR.
This commit is contained in:
parent
6d2f082be3
commit
6b237dfa2f
@ -105,7 +105,7 @@
|
||||
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
|
||||
},
|
||||
Posting: {
|
||||
'Auto Noko': [true, 'Redirect to your post'],
|
||||
'Auto Noko': [true, 'Redirect to your thread'],
|
||||
'Cooldown': [true, 'Prevent `flood detected` errors'],
|
||||
'Quick Reply': [true, 'Reply without leaving the page'],
|
||||
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'],
|
||||
@ -891,7 +891,11 @@
|
||||
thread = nav.getThread();
|
||||
switch (key) {
|
||||
case conf.close:
|
||||
if (o = $('#overlay')) $.rm(o);
|
||||
if (o = $.id('overlay')) {
|
||||
$.rm(o);
|
||||
} else if (qr.el) {
|
||||
qr.close();
|
||||
}
|
||||
break;
|
||||
case conf.spoiler:
|
||||
ta = e.target;
|
||||
@ -1193,15 +1197,25 @@
|
||||
g.callbacks.push(function(root) {
|
||||
return $.on($('.quotejs + .quotejs', root), 'click', qr.quote);
|
||||
});
|
||||
if (conf['Persistent QR']) return qr.dialog();
|
||||
if (conf['Persistent QR']) {
|
||||
qr.dialog();
|
||||
return $.id('autohide').click();
|
||||
}
|
||||
},
|
||||
open: function() {
|
||||
var input;
|
||||
if (qr.el) {
|
||||
return qr.el.hidden = false;
|
||||
qr.el.hidden = false;
|
||||
input = $.id('autohide');
|
||||
input.checked = false;
|
||||
return qr.hide.call(input);
|
||||
} else {
|
||||
return qr.dialog();
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
return qr.el.lastChild.hidden = this.checked;
|
||||
},
|
||||
close: function() {
|
||||
return qr.el.hidden = true;
|
||||
},
|
||||
@ -1223,7 +1237,23 @@
|
||||
return ta.selectionEnd = ta.selectionStart = caretPos + text.length;
|
||||
},
|
||||
dialog: function() {
|
||||
qr.el = ui.dialog('qr', 'top:0;right:0;', '<div class=move><a class=close>⨯</a></div><textarea></textarea>');
|
||||
qr.el = ui.dialog('qr', 'top:0;right:0;', '\
|
||||
<style>\
|
||||
#qr > .move {\
|
||||
min-width: 300px;\
|
||||
text-align: right;\
|
||||
}\
|
||||
</style>\
|
||||
\
|
||||
<div class=move>\
|
||||
<input type=checkbox name=autohide id=autohide title=Auto-hide>\
|
||||
<a class=close>⨯</a>\
|
||||
</div>\
|
||||
<div>\
|
||||
<input name=name><input name=email><input name=subject>\
|
||||
<textarea></textarea>\
|
||||
</div>');
|
||||
$.on($('#autohide', qr.el), 'click', qr.hide);
|
||||
$.on($('.close', qr.el), 'click', qr.close);
|
||||
return $.add(d.body, qr.el);
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ config =
|
||||
'Auto Watch': [true, 'Automatically watch threads that you start']
|
||||
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
|
||||
Posting:
|
||||
'Auto Noko': [true, 'Redirect to your post']
|
||||
'Auto Noko': [true, 'Redirect to your thread']
|
||||
'Cooldown': [true, 'Prevent `flood detected` errors']
|
||||
'Quick Reply': [true, 'Reply without leaving the page']
|
||||
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
|
||||
@ -650,9 +650,10 @@ keybinds =
|
||||
thread = nav.getThread()
|
||||
switch key
|
||||
when conf.close
|
||||
if o = $ '#overlay'
|
||||
if o = $.id 'overlay'
|
||||
$.rm o
|
||||
# else close QR
|
||||
else if qr.el
|
||||
qr.close()
|
||||
when conf.spoiler
|
||||
ta = e.target
|
||||
return unless ta.nodeName is 'TEXTAREA'
|
||||
@ -870,13 +871,20 @@ qr =
|
||||
$.on $('.quotejs + .quotejs', root), 'click', qr.quote
|
||||
if conf['Persistent QR']
|
||||
qr.dialog()
|
||||
$.id('autohide').click()
|
||||
|
||||
open: ->
|
||||
if qr.el
|
||||
qr.el.hidden = false
|
||||
input = $.id 'autohide'
|
||||
input.checked = false
|
||||
qr.hide.call input
|
||||
else
|
||||
qr.dialog()
|
||||
|
||||
hide: ->
|
||||
qr.el.lastChild.hidden = this.checked
|
||||
|
||||
close: ->
|
||||
qr.el.hidden = true
|
||||
|
||||
@ -901,8 +909,24 @@ qr =
|
||||
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
||||
|
||||
dialog: ->
|
||||
qr.el = ui.dialog 'qr', 'top:0;right:0;', '<div class=move><a class=close>⨯</a></div><textarea></textarea>'
|
||||
$.on $('.close', qr.el), 'click', qr.close
|
||||
qr.el = ui.dialog 'qr', 'top:0;right:0;', '
|
||||
<style>
|
||||
#qr > .move {
|
||||
min-width: 300px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class=move>
|
||||
<input type=checkbox name=autohide id=autohide title=Auto-hide>
|
||||
<a class=close>⨯</a>
|
||||
</div>
|
||||
<div>
|
||||
<input name=name><input name=email><input name=subject>
|
||||
<textarea></textarea>
|
||||
</div>'
|
||||
$.on $('#autohide', qr.el), 'click', qr.hide
|
||||
$.on $('.close', qr.el), 'click', qr.close
|
||||
$.add d.body, qr.el
|
||||
|
||||
options =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user