summaryrefslogtreecommitdiff
path: root/js/quick-reply-old.js
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-09-17 10:43:44 -0400
committerczaks <marcin@6irc.net>2013-09-17 10:43:44 -0400
commit6cb7eb939e549f978ca6dd7d2afe2dabc0f18025 (patch)
tree8b2342bbf5c15847717db733ecf4f2f46718dacb /js/quick-reply-old.js
parent069f1def9bf8c8d769afdc5740e9ff13271065bd (diff)
parent803f0c8ce1487ea791824197de9d1ee140127838 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard into vichan-devel-4.5
Conflicts: inc/config.php inc/display.php inc/mod/pages.php install.php js/quick-reply.js post.php templates/index.html
Diffstat (limited to 'js/quick-reply-old.js')
-rw-r--r--js/quick-reply-old.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/js/quick-reply-old.js b/js/quick-reply-old.js
new file mode 100644
index 00000000..ea504b48
--- /dev/null
+++ b/js/quick-reply-old.js
@@ -0,0 +1,46 @@
+/*
+ * quick-reply.js
+ * https://github.com/savetheinternet/Tinyboard/blob/master/js/quick-reply.js
+ *
+ * Released under the MIT license
+ * Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
+ *
+ * Usage:
+ * $config['quick_reply'] = true;
+ * $config['additional_javascript'][] = 'js/jquery.min.js';
+ * $config['additional_javascript'][] = 'js/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 = txt_new_topic == _('Submit') ? txt_new_topic : new_reply_string;
+
+ 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="#">['+_("Quick reply")+']</a>').insertAfter($(this).children('p.intro').children('a:last')).click(function() {
+ $('div.banner').remove();
+ $('<div class="banner">'+fmt(_("Posting mode: Replying to <small>&gt;&gt;{0}</small>"), [id])+' <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;
+ });
+ });
+});
+