mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-25 16:00:22 +01:00
fix bug with quick-reply and make it nicer
This commit is contained in:
parent
7a86403ed0
commit
9ce0d60bba
@ -13,7 +13,9 @@
|
|||||||
|
|
||||||
var show_quick_reply = function(){
|
var show_quick_reply = function(){
|
||||||
if($('div.banner').length == 0)
|
if($('div.banner').length == 0)
|
||||||
return; // not index
|
return;
|
||||||
|
if($('#quick-reply').length != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
$('<style type="text/css">\
|
$('<style type="text/css">\
|
||||||
#quick-reply {\
|
#quick-reply {\
|
||||||
@ -148,7 +150,14 @@ var show_quick_reply = function(){
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).on('cite', function() {
|
$(window).on('cite', function(e, id, with_link) {
|
||||||
show_quick_reply();
|
show_quick_reply();
|
||||||
$('#quick-reply textarea').focus();
|
$('#quick-reply textarea').focus();
|
||||||
|
if (with_link) {
|
||||||
|
console.log(id, with_link);
|
||||||
|
setTimeout(function() {
|
||||||
|
highlightReply(id);
|
||||||
|
$(window).scrollTop($('#' + id).offset().top);
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -181,7 +181,7 @@ function dopost(form) {
|
|||||||
return form.elements['body'].value != "" || form.elements['file'].value != "" || (form.elements.file_url && form.elements['file_url'].value != "");
|
return form.elements['body'].value != "" || form.elements['file'].value != "" || (form.elements.file_url && form.elements['file_url'].value != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function citeReply(id) {
|
function citeReply(id, with_link) {
|
||||||
var body = document.getElementById('body');
|
var body = document.getElementById('body');
|
||||||
|
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
@ -199,7 +199,7 @@ function citeReply(id) {
|
|||||||
body.value += '>>' + id + '\n';
|
body.value += '>>' + id + '\n';
|
||||||
}
|
}
|
||||||
if ($) {
|
if ($) {
|
||||||
$(window).trigger('cite', id);
|
$(window).trigger('cite', [id, with_link]);
|
||||||
$(body).change();
|
$(body).change();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ function rememberStuff() {
|
|||||||
document.forms.post.elements['email'].value = localStorage.email;
|
document.forms.post.elements['email'].value = localStorage.email;
|
||||||
|
|
||||||
if (window.location.hash.indexOf('q') == 1)
|
if (window.location.hash.indexOf('q') == 1)
|
||||||
citeReply(window.location.hash.substring(2));
|
citeReply(window.location.hash.substring(2), true);
|
||||||
|
|
||||||
if (sessionStorage.body) {
|
if (sessionStorage.body) {
|
||||||
var saved = JSON.parse(sessionStorage.body);
|
var saved = JSON.parse(sessionStorage.body);
|
||||||
|
Loading…
Reference in New Issue
Block a user