[enh] Make frontend nicer + don't use external sources

This commit is contained in:
Alban Crommer 2020-05-21 10:30:34 +00:00 committed by root
parent e60d280be2
commit 69734ba649
4 changed files with 23 additions and 5 deletions

7
public/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -19,6 +19,15 @@ escape = function(string) {
return htmlEscapes[match]; return htmlEscapes[match];
}); });
}; };
var urlRegex = /(https?://[^\s]+)/g;
url = function(string){
return ''+string.replace(urlRegex, '<a target="_blank" href="$1">$1</a>')
}
var titleRegex = /^(.*\n)/;
title = function(string){
var str=''+string.replace(titleRegex, '<b>$1</b>');
return ''+string.replace(titleRegex, '<b>$1</b>');
}
function updatePage(data){ function updatePage(data){
@ -31,7 +40,7 @@ function updatePage(data){
<div class="log row-fluid"> <div class="log row-fluid">
<div class="span9"> <div class="span9">
<p>${escape(item.created_at)} -- ${escape(item.author)} -- ${escape(item.server)} <p>${escape(item.created_at)} -- ${escape(item.author)} -- ${escape(item.server)}
<h4> ${escape(item.content)}</h4> <pre> ${title(url(escape(item.content)))}</pre>
</span> </span>
</div> </div>
`; `;
@ -60,4 +69,4 @@ $("input").on("keyup",function(e){
}); });
}); });
updatePage( initData ); updatePage( initData );

2
public/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,9 +5,9 @@ html(lang="en")
title= title title= title
meta(charset='utf-8') meta(charset='utf-8')
meta(name='viewport', content='width=device-width, initial-scale=1') meta(name='viewport', content='width=device-width, initial-scale=1')
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css') link(rel='stylesheet', href='/css/bootstrap.min.css')
link(rel='stylesheet', href='css/site.css') link(rel='stylesheet', href='/css/site.css')
script(type = "text/javascript",src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js') script(type = "text/javascript",src='/js/jquery.min.js')
body body
<nav class="navbar navbar-expand-lg navbar-light bg-light justify-content-between"> <nav class="navbar navbar-expand-lg navbar-light bg-light justify-content-between">
<a class="navbar-brand" href="#">Changelog Server</a> <a class="navbar-brand" href="#">Changelog Server</a>