summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-09-10 08:07:08 +0000
committerRomain d'Alverny <rda@mageia.org>2012-09-10 08:07:08 +0000
commit63bc2714d44a15320b6fbc6ec5df93064a73170e (patch)
treeb773ecf8cc3d40d408b3c9963cb9cf4ff5c0434d /js
parent3267fb13d7d77e1ae12dec93dbf90b009d8f137b (diff)
downloadpkgsubmit-63bc2714d44a15320b6fbc6ec5df93064a73170e.tar
pkgsubmit-63bc2714d44a15320b6fbc6ec5df93064a73170e.tar.gz
pkgsubmit-63bc2714d44a15320b6fbc6ec5df93064a73170e.tar.bz2
pkgsubmit-63bc2714d44a15320b6fbc6ec5df93064a73170e.tar.xz
pkgsubmit-63bc2714d44a15320b6fbc6ec5df93064a73170e.zip
move js in separate file
Diffstat (limited to 'js')
-rw-r--r--js/pkgsubmit.js91
1 files changed, 91 insertions, 0 deletions
diff --git a/js/pkgsubmit.js b/js/pkgsubmit.js
new file mode 100644
index 0000000..6f432fa
--- /dev/null
+++ b/js/pkgsubmit.js
@@ -0,0 +1,91 @@
+$(function () {
+
+ $('.status-link').on("click", function (ev) {
+ if (!ev.metaKey) {
+ ev.preventDefault();
+
+ var key = $(this).attr("href");
+ var elId = 'e' + key.replace(/\/|\./g, '-');
+ var el = $("#" + elId);
+
+ if (el.length == 0) {
+ $(this).parent().parent().after($("<tr />",
+ {
+ class: "build-files-list",
+ id: elId,
+ html: '<td colspan="4">loading</td>'
+ }
+ ));
+ $.get(
+ "/log_files.php",
+ {"k": $(this).attr("href")},
+ function (data) {
+ $("#" + elId).html('<td colspan="4">' + data + '</td>');
+ }
+ );
+ } else {
+ el.toggle();
+ }
+ }
+ });
+
+ $("table#submitted-packages tbody").on("click", "tr td li a.view-inline", function (ev) {
+
+ // only open text log files
+ var ext = $(this).attr("href").split(".").pop();
+ if (["log", "done", "youri"].indexOf(ext) < 0)
+ return true;
+
+ if (!ev.metaKey) {
+ ev.preventDefault();
+
+ var elId = 'view-' + $(this).attr("href").replace(/\/|\./g, '-');
+ var cId = elId + '-container';
+
+ var c = $("#" + cId);
+ var el = $("#" + elId);
+
+ if (c.length == 0) {
+ $(this).after($("<div />", {
+ id: cId
+ })
+ .append($("<textarea />", {
+ id: elId,
+ class: "file-view",
+ html: "loading..."
+ }))
+ );
+
+ $.get(
+ "/" + $(this).attr("href"),
+ {},
+ function (data) {
+ $("#" + elId).html(data)
+ .before(
+ $("<div />", {
+ class: "controls"
+ })
+ .append($("<button />", {
+ class: "gototop",
+ html: "top"
+ }).on("click", function (ev) {
+ $("#" + elId).animate({ scrollTop: 0 }, 200);
+ })
+ )
+ .append($("<button />", {
+ class: "gotobo",
+ html: "bottom"
+ }).on("click", function (ev) {
+ var d = $("#" + elId);
+ d.animate({ scrollTop: d.prop("scrollHeight") }, 200);
+ })
+ )
+ )
+ }
+ );
+ } else {
+ c.toggle();
+ }
+ }
+ });
+}); \ No newline at end of file