mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-17 11:28:41 +01:00
patch ajax for qr;
implement support for only thread captchas;
This commit is contained in:
parent
7b6f005ca4
commit
15e99813fb
28
js/ajax.js
28
js/ajax.js
@ -82,20 +82,26 @@ $(window).ready(function() {
|
||||
$.ajax({
|
||||
url: document.location,
|
||||
success: function(data) {
|
||||
$(data).find('div.post.reply').each(function() {
|
||||
var id = $(this).attr('id');
|
||||
if($('#' + id).length == 0) {
|
||||
$(this).insertAfter($('div.post:last').next()).after('<br class="clear">');
|
||||
$(document).trigger('new_post', this);
|
||||
// watch.js & auto-reload.js retrigger
|
||||
setTimeout(function() { $(window).trigger("scroll"); }, 100);
|
||||
}
|
||||
$(data).find('div.thread').each(function(){
|
||||
var tr_id = $(this).attr('id');
|
||||
$(this).find('div.post.reply').each(function() {
|
||||
var id = $(this).attr('id');
|
||||
if($('#' + id).length == 0) {
|
||||
$(this).insertAfter($('#' + tr_id + ' div.post:last').next());
|
||||
$(document).trigger('new_post', this);
|
||||
// watch.js & auto-reload.js retrigger
|
||||
setTimeout(function() { $(window).trigger("scroll"); }, 100);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
highlightReply(post_response.id);
|
||||
window.location.hash = post_response.id;
|
||||
$(window).scrollTop($('div.post#reply_' + post_response.id).offset().top);
|
||||
|
||||
if ($(window).scrollTop($('div.post#reply_' + post_response.id))){
|
||||
$(window).scrollTop($('div.post#reply_' + post_response.id).offset().top);
|
||||
} else {
|
||||
window.scrollTo(0,document.body.offsetHeight);
|
||||
}
|
||||
$(form).find('input[type="submit"]').val(submit_txt);
|
||||
$(form).find('input[type="submit"]').removeAttr('disabled');
|
||||
$(form).find('input[name="subject"],input[name="file_url"],\
|
||||
@ -137,4 +143,4 @@ $(window).ready(function() {
|
||||
$('form#quick-reply').off('submit');
|
||||
setup_form($('form#quick-reply'));
|
||||
});
|
||||
});
|
||||
});
|
@ -311,10 +311,9 @@
|
||||
$(`<input type='hidden' name='board' value='${board}'></input>`).appendTo($("#quick-reply"));
|
||||
|
||||
// support if captcha is only enabled for threads
|
||||
// pass config variable to main.
|
||||
//if (post_captcha === 'false') {
|
||||
// $("#quick-reply .captcha").remove();
|
||||
//}
|
||||
if (post_captcha === 'false') {
|
||||
$("#quick-reply .captcha").remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronise body text with original post form
|
||||
|
@ -431,6 +431,7 @@ function ready() {
|
||||
var post_date = "{{ config.post_date }}";
|
||||
var max_images = {{ config.max_images }};
|
||||
var button_reply = "{{ config.button_reply }}";
|
||||
var post_captcha = "{{ config.captcha.native.new_thread_capt ? 'false' : 'true' }}"
|
||||
|
||||
onReady(init);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user