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; } /** * Inject elements with appropriate classes into given text * to allow for highlighting specific portions of a text file. * * Here, log files with ok|success|test|warning|info|error|fail|etc. * * @param string text * * @return string */ function highlight_text(text) { return text.replace(/.*(ok|succe|test|warn|info|deprecat|error|fail).*/gi, function (match, p1, p2, offset, string) { console.log([match, p1, offset, string]); var cl = 'none'; switch (p1.toLowerCase()) { case 'succe': case 'ok': cl = 'ok'; break case 'test': case 'info': cl = 'info'; break; case 'warn': case 'deprecat': cl = 'warn'; break; case 'error': case 'fail': cl = 'error'; break; } return '' + match + ''; }); } $(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($("