2012-03-14 04:41:56 -04:00
|
|
|
/*
|
|
|
|
* quick-reply.js
|
2012-03-30 20:13:11 -04:00
|
|
|
* https://github.com/savetheinternet/Tinyboard/blob/master/js/quick-reply.js
|
2012-03-14 04:41:56 -04:00
|
|
|
*
|
|
|
|
* Released under the MIT license
|
|
|
|
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
|
|
|
|
*
|
|
|
|
* Usage:
|
2012-03-14 05:19:35 -04:00
|
|
|
* $config['quick_reply'] = true;
|
2012-03-15 01:19:26 -04:00
|
|
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
|
|
|
* $config['additional_javascript'][] = 'js/quick-reply.js';
|
2012-03-14 04:41:56 -04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
if($('div.banner').length != 0)
|
|
|
|
return; // not index
|
|
|
|
|
|
|
|
txt_new_topic = $('form[name=post] input[type=submit]').val();
|
2013-07-20 00:07:28 -04:00
|
|
|
txt_new_reply = txt_new_topic == 'Submit' ? txt_new_topic : 'Reply';
|
2012-03-14 04:41:56 -04:00
|
|
|
|
|
|
|
undo_quick_reply = function() {
|
|
|
|
$('div.banner').remove();
|
|
|
|
$('form[name=post] input[type=submit]').val(txt_new_topic);
|
|
|
|
$('form[name=post] input[name=quick-reply]').remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
$('div.post.op').each(function() {
|
2013-07-20 00:07:28 -04:00
|
|
|
var id = $(this).children('p.intro').children('a.post_no:eq(2)').text();
|
|
|
|
$('<a href="#">[Quick Reply]</a>').insertAfter($(this).children('p.intro').children('a:last')).click(function() {
|
2012-03-14 04:41:56 -04:00
|
|
|
$('div.banner').remove();
|
2013-07-20 00:07:28 -04:00
|
|
|
$('<div class="banner">Post Mode: Quick Reply to <small>>>' + id + '</small> <a class="unimportant" onclick="undo_quick_reply()" href="javascript:void(0)">[Return]</a></div>')
|
2012-03-14 04:41:56 -04:00
|
|
|
.insertBefore('form[name=post]');
|
|
|
|
$('form[name=post] input[type=submit]').val(txt_new_reply);
|
|
|
|
|
|
|
|
$('<input type="hidden" name="quick-reply" value="' + id + '">').appendTo($('form[name=post]'));
|
|
|
|
|
|
|
|
$('form[name=post] textarea').select();
|
|
|
|
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|