diff options
| author | Michael Save <savetheinternet@tinyboard.org> | 2012-03-14 19:41:56 +1100 |
|---|---|---|
| committer | Michael Save <savetheinternet@tinyboard.org> | 2012-03-14 19:41:56 +1100 |
| commit | 28c2dd9d065c20c2a8a70d62aa7b6e79b66cd2e7 (patch) | |
| tree | 7c8706b35375bf44c44befc34ac4d322b5d0373f /js/quick-reply.js | |
| parent | a79b8c473b8ac136ede9f1333be891b11d068f76 (diff) | |
quick reply
Diffstat (limited to 'js/quick-reply.js')
| -rw-r--r-- | js/quick-reply.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/js/quick-reply.js b/js/quick-reply.js new file mode 100644 index 00000000..e963ca6e --- /dev/null +++ b/js/quick-reply.js @@ -0,0 +1,45 @@ +/* + * quick-reply.js + * https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/quick-reply.js + * + * Released under the MIT license + * Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> + * + * Usage: + * $config['additional_javascript'][] = $config['root'] . 'jquery.min.js'; + * $config['additional_javascript'][] = $config['root'] . 'quick-reply.js'; + * + */ + +$(document).ready(function(){ + if($('div.banner').length != 0) + return; // not index + + txt_new_topic = $('form[name=post] input[type=submit]').val(); + txt_new_reply = 'New Reply'; + + 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() { + var id = $(this).children('p.intro').children('a.post_no:eq(1)').text(); + $('<a href="?/b/res/69.html">[Quick reply]</a>').insertAfter($(this).children('p.intro').children('a:last')).click(function() { + $('div.banner').remove(); + $('<div class="banner">Posting mode: Replying to <small>>>' + id + '</small> <a class="unimportant" onclick="undo_quick_reply()" href="javascript:void(0)">[Return]</a></div>') + .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; + }); + }); +}); + |
