diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-09-09 22:37:25 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-09-09 22:37:25 +0000 |
commit | 7029b74e14336f50c76b40cdfb1a1af1f5832693 (patch) | |
tree | 492815a026fc82d853fd404a33d740f6f8ba899a /test_index.php | |
parent | 23556c841724aa8152537d3675ff68b9a3b6261b (diff) | |
download | pkgsubmit-7029b74e14336f50c76b40cdfb1a1af1f5832693.tar pkgsubmit-7029b74e14336f50c76b40cdfb1a1af1f5832693.tar.gz pkgsubmit-7029b74e14336f50c76b40cdfb1a1af1f5832693.tar.bz2 pkgsubmit-7029b74e14336f50c76b40cdfb1a1af1f5832693.tar.xz pkgsubmit-7029b74e14336f50c76b40cdfb1a1af1f5832693.zip |
wrap textarea+controls into a div
Diffstat (limited to 'test_index.php')
-rw-r--r-- | test_index.php | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/test_index.php b/test_index.php index 5865f36..dd91ea9 100644 --- a/test_index.php +++ b/test_index.php @@ -317,10 +317,11 @@ else if (!ev.metaKey) { ev.preventDefault(); - var key = $(this).attr("href"); + var key = $(this).attr("href"); var elId = 'e' + key.replace(/\/|\./g, '-'); + var el = $("#" + elId); - if ($("#" + elId).length == 0) { + if (el.length == 0) { $(this).parent().parent().after($("<tr />", { class: "build-files-list", @@ -336,7 +337,7 @@ else } ); } else { - $("#" + elId).toggle(); + el.toggle(); } } }); @@ -352,13 +353,21 @@ else ev.preventDefault(); var elId = 'view-' + $(this).attr("href").replace(/\/|\./g, '-'); + var cId = elId + '-container'; + + var c = $("#" + cId); var el = $("#" + elId); - if (el.length == 0) { - $(this).after($("<textarea />", { - id: elId, - class: "file-view", - html: "loading..." - })); + + if (c.length == 0) { + $(this).after($("<div />", { + id: cId + }) + .append($("<textarea />", { + id: elId, + class: "file-view", + html: "loading..." + })) + ); $.get( "/" + $(this).attr("href"), @@ -373,8 +382,7 @@ else class: "gototop", html: "top" }).on("click", function (ev) { - var d = $("#" + elId); - d.animate({ scrollTop: 0 }, 200); + $("#" + elId).animate({ scrollTop: 0 }, 200); }) ) .append($("<button />", { @@ -389,7 +397,7 @@ else } ); } else { - el.toggle(); + c.toggle(); } } }); |