From cf16eec875de2a1dc13d569729c8565e9ade9fa5 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 10 Sep 2012 08:07:10 +0000 Subject: smaller preview box for short log files --- js/pkgsubmit.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/pkgsubmit.js b/js/pkgsubmit.js index 6f432fa..d5f6931 100644 --- a/js/pkgsubmit.js +++ b/js/pkgsubmit.js @@ -1,3 +1,26 @@ +function isLogFile(path) { + + var ext = path.split(".").pop(); + if (["log", "done", "youri"].indexOf(ext) < 0) { + return true; + } + + return false; +} + +function isShortFile(path) { + + var ext = path.split(".").pop(); + var file = path.split("/").pop(); + + if (["done"].indexOf(ext) >= 0 + || ["status.log"].indexOf(file) >= 0) { + return true; + } + + return false; +} + $(function () { $('.status-link').on("click", function (ev) { @@ -31,17 +54,15 @@ $(function () { $("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) + if (isLogFile($(this).attr("href"))) { 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); @@ -49,6 +70,7 @@ $(function () { $(this).after($("
", { id: cId }) + .addClass(isShortFile($(this).attr("href")) ? "short" : "") .append($("