From 63bc2714d44a15320b6fbc6ec5df93064a73170e Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 10 Sep 2012 08:07:08 +0000 Subject: move js in separate file --- js/pkgsubmit.js | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 js/pkgsubmit.js (limited to 'js/pkgsubmit.js') 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($("", + { + class: "build-files-list", + id: elId, + html: 'loading' + } + )); + $.get( + "/log_files.php", + {"k": $(this).attr("href")}, + function (data) { + $("#" + elId).html('' + data + ''); + } + ); + } 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($("
", { + id: cId + }) + .append($("