diff --git a/html/etherpads.html b/html/etherpads.html index 40b9aad..b512c09 100644 --- a/html/etherpads.html +++ b/html/etherpads.html @@ -24,7 +24,7 @@
diff --git a/html/index.html b/html/index.html index 8dab677..e308dcb 100644 --- a/html/index.html +++ b/html/index.html @@ -24,7 +24,7 @@ diff --git a/html/motd.js b/html/motd.js index c2b45d1..9ceeeeb 100644 --- a/html/motd.js +++ b/html/motd.js @@ -4,6 +4,14 @@ var dsource = document.getElementById("MOTDTemplate").innerHTML; // Handlebars compiles the above source into a template var dtemplate = Handlebars.compile(dsource); +Handlebars.registerHelper('linkify', function(str) { + var pattern1 = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; + var str1 = str.replace(pattern1, '$1'); + var pattern2 =/(^|[^\/])(www\.[\S]+(\b|$))/gim; + var str2 = str1.replace(pattern2, '$1$2'); + return new Handlebars.SafeString(str2); +}); + $.getJSON("ptg.json", function(json) { document.getElementById("MOTD").innerHTML = dtemplate(json); }); diff --git a/html/ptg.html b/html/ptg.html index dc96e29..5071cb5 100644 --- a/html/ptg.html +++ b/html/ptg.html @@ -24,7 +24,7 @@