Skip to content
Browse files

showing links in logs

  • Loading branch information...
1 parent 67351e9 commit 588a8c42b0f57f4c3e8bc8c77c0359847b54e42f @bobrik committed Aug 13, 2012
Showing with 9 additions and 2 deletions.
  1. +1 −1 package.json
  2. +8 −1 public/index.html
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "pupergrep",
- "version": "0.3.4",
+ "version": "0.3.5",
"description": "Real-time grep for your logs right in your favorite modern browser made with Twitter Bootstrap.",
"main": "index.js",
"dependencies": {
View
9 public/index.html
@@ -396,7 +396,14 @@
container = jQuery("<tr>");
line = jQuery("<td>");
- line.text(text);
+ // escaping html
+ text = text.split("&").join("&amp;").split( "<").join("&lt;").split(">").join("&gt;");
+ // making some links
+ text = text.replace(/(https?:\/\/[^\s]+)/g, function(url) {
+ return '<a href="' + url + '">' + url + '</a>';
+ });
+
+ line.html(text);
if (!isGrepAcceptedLine(text)) {
return;

0 comments on commit 588a8c4

Please sign in to comment.
Something went wrong with that request. Please try again.