From ccfc9f58895a1183b238d036226d4f5419ac0eee Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Fri, 14 Sep 2012 15:25:00 -0400 Subject: [PATCH] Only register the callback for subbing to a class once. (imported from commit a6c41f79ea8c6e2f6a6ff5a6b41b98fd53ad4e82) --- zephyr/static/js/zephyr.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 896646978c..35cee4cf69 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -19,6 +19,13 @@ $(function () { $("#class-message form").ajaxSubmit(); $('#class-dne').stop(true).fadeOut(500); }); + + // Prepare the click handler for subbing to an existing class. + $('#sub-it').click(function () { + sub(compose_class_name()); + $("#class-message form").ajaxSubmit(); + $('#class-nosub').stop(true).fadeOut(500); + }); }); $.ajaxSetup({ @@ -123,11 +130,7 @@ $(function () { send_status.toggle(); $('#class-nosub-name').text(zephyr_class); $('#class-nosub').show(); - $('#sub-it').focus().click(function () { - sub(compose_class_name()); - $("#class-message form").ajaxSubmit(); - $('#class-nosub').stop(true).fadeOut(500); - }); + $('#sub-it').focus(); buttons.removeAttr('disabled'); hide_compose(); }