Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 485 | muzer | 1 | function updateResult(box, text) { |
| 2 | box.find(".tcp_inner_result").html("<i>Loading...</i>"); |
||
| 3 | $.get('http://tim32.org/~freddie/VOSLookup/tcppop.php?totr=' + text, function(data) { |
||
| 4 | box.find(".tcp_inner_result").html(data); |
||
| 5 | }); |
||
| 6 | } |
||
| 7 | |||
| 8 | function openBox(box) { |
||
| 9 | var text = box.attr("data-text"); |
||
| 10 | box.append("<div class=\"tcp_inner\"><input type=\"text\" value=\"" + text + "\" /><input type=\"submit\" value=\"Parse\" /><br /><div class=\"tcp_inner_result\"></div></div>"); |
||
| 11 | box.children(".tcp_inner").hide().fadeIn(); |
||
| 12 | updateResult(box, text); |
||
| 13 | |||
| 14 | box.find("input[type=submit]").click(function() { |
||
| 15 | updateResult(box, box.find("input[type=text]").val()); |
||
| 16 | return false; |
||
| 17 | }); |
||
| 18 | |||
| 19 | box.find("input[type=text]").change(function() { |
||
| 20 | updateResult(box, $(this).val()); |
||
| 21 | }); |
||
| 22 | } |
||
| 23 | |||
| 24 | function closeBox(box) { |
||
| 25 | $(box).children(".tcp_inner").fadeOut(function() { |
||
| 26 | $(this).remove(); |
||
| 27 | }); |
||
| 28 | } |
||
| 29 | |||
| 30 | $(document).ready(function() { |
||
| 31 | |||
| 32 | $(".tcp .tcp_button").on("click", function() { |
||
| 33 | |||
| 34 | var box = $(this).parent(); |
||
| 35 | var s = box.attr("data-status"); |
||
| 36 | if (s == "closed") { |
||
| 37 | box.attr("data-status", "open"); |
||
| 38 | $(this).attr("src", "http://tim32.org/~freddie/timlan/noTCP.png"); |
||
| 39 | $(this).attr("title", "Close TCP Editor"); |
||
| 40 | openBox(box); |
||
| 41 | } else { |
||
| 42 | box.attr("data-status", "closed"); |
||
| 43 | $(this).attr("src", "http://tim32.org/~freddie/timlan/goTCP.png"); |
||
| 44 | $(this).attr("title", "Open TCP Editor"); |
||
| 45 | closeBox(box); |
||
| 46 | } |
||
| 47 | |||
| 48 | }); |
||
| 49 | |||
| 50 | }); |
||
| 51 |