From 79874afbd0a2e5e5edaf8ab0094efadd2e4e4a2e Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 18 Sep 2013 15:00:47 +1000 Subject: forgot to commit js/settings.js. and new quick reply setting --- js/quick-reply.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'js/quick-reply.js') diff --git a/js/quick-reply.js b/js/quick-reply.js index a3cf1404..1934c4c7 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -326,6 +326,7 @@ $postForm.find('th .close-btn').click(function() { $origPostForm.find('textarea[name="body"]').attr('id', 'body'); $postForm.remove(); + floating_link(); }); // Fix bug when table gets too big for form. Shouldn't exist, but crappy CSS etc. @@ -372,4 +373,48 @@ }); } }); + + var floating_link = function() { + if (!settings.get('floating_link', false)) + return; + $('Quick Reply') + .click(function() { + show_quick_reply(); + $(this).remove(); + }).prependTo($('body')); + + $(window).on('quick-reply', function() { + $('.quick-reply-btn').remove(); + }); + }; + + if (settings.get('floating_link', false)) { + $(window).ready(function() { + $('').appendTo($('head')); + + floating_link(); + + if (settings.get('hide_at_top', true)) { + $('.quick-reply-btn').hide(); + + $(window).scroll(function() { + if ($(this).width() <= 800) + return; + if ($(this).scrollTop() < $('form[name="post"]:first').offset().top + $('form[name="post"]:first').height() - 100) + $('.quick-reply-btn').fadeOut(100); + else + $('.quick-reply-btn').fadeIn(100); + }).scroll(); + } + }); + } })(); -- cgit v1.3