diff --git a/templates/zephyr/index.html b/templates/zephyr/index.html index 6c2abd5056..71ef7146dd 100644 --- a/templates/zephyr/index.html +++ b/templates/zephyr/index.html @@ -31,32 +31,39 @@ $.ajaxSetup({ }); $(document).keyup(function(event) { -if (event.keyCode == 38 || event.keyCode == 40) { - p = $("#selected"); - tr = $(p).closest("tr"); - td = $(p).closest("td"); + if (event.keyCode == 38 || event.keyCode == 40) { + p = $("#selected"); + tr = $(p).closest("tr"); + td = $(p).closest("td"); - if (event.keyCode == 40) { - offset = 1; - } else { - offset = -1; - } - new_index = parseInt(tr.attr("id").substr(3), 10) + offset; - if ($("#tr_" + new_index).length > 0) { - new_td = $("#tr_" + new_index).children(".pointer"); - new_td.html('
->
'); - td.empty(); - $.post('update', {pointer: new_td.attr("id")}); - - if ($(new_td).offset().top < $("#main_div").offset().top) { - $("#main_div").scrollTop($("#main_div").scrollTop() - 75); + if (event.keyCode == 40) { + offset = 1; + } else { + offset = -1; } + new_index = parseInt(tr.attr("id").substr(3), 10) + offset; + if ($("#tr_" + new_index).length > 0) { + new_td = $("#tr_" + new_index).children(".pointer"); + new_td.html('->
'); + td.empty(); + $.post('update', {pointer: new_td.attr("id")}); - if ($(new_td).offset().top + $(new_td).height() > $("#main_div").offset().top + $("#main_div").height()) { - $("#main_div").scrollTop($("#main_div").scrollTop() + 75); + if ($(new_td).offset().top < $("#main_div").offset().top) { + $("#main_div").scrollTop($("#main_div").scrollTop() - 75); + } + + if ($(new_td).offset().top + $(new_td).height() > $("#main_div").offset().top + $("#main_div").height()) { + $("#main_div").scrollTop($("#main_div").scrollTop() + 75); + } } + } else if (event.keyCode == 82) { // 'r' keypress, for responding to a zephyr + var parent = $("#selected").parents("tr"); + var zephyr_class = parent.find("span.zephyr_class").text(); + var instance = parent.find("span.zephyr_instance").text(); + $("#class").val(zephyr_class); + $("#instance").val(instance); + $("#new_zephyr").focus(); } -} }); function narrow(class_name) { @@ -115,7 +122,7 @@ zephyr.content + {% csrf_token %} Class: Instance: