diff --git a/public/css/style.css b/public/css/style.css index 83ba31d..f9d35e9 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -257,15 +257,39 @@ main { background-color: #dbdbdb; } -.json { - display: block; - white-space: pre-wrap; +.text-truncate { + display: inline-block; + max-width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.json, +code { + white-space: pre-line; +} + +.indent h4, +.indent h5, +.indent h6 { + padding: 0; } .indent { padding-left: 2rem; - margin-top: -2rem; - line-height: 2; +} + +.indent * { + line-height: 1.5; /* If this value is changed, make sure it is atleast 1 to avoid clipping when text wraps */ + font-size: 1em; + margin: 0; + text-align: left; + font-weight: 400; +} + +.indent a { + font-weight: 700; } /* documentation */ diff --git a/public/js/main.js b/public/js/main.js index 56d876f..d915c2d 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -63,7 +63,17 @@ function renderMatches(matches) { // Create an element that looks like a JSON object for every match li.innerHTML = ` -
{

name: '${match.name}',
url: '${match.url}',
keywords: [${match.keywords.map(keyword => `'${keyword}'`).join(", ")}]
},
+
+					
+						{
+							
+

name: ${match.name},

+
url: '${match.url}',
+
keywords: [${match.keywords.map(keyword => `'${keyword}'`).join(", ")}]
+
+ }, +
+
`; list.appendChild(li); diff --git a/server.js b/server.js index f13c0b2..a8e45ec 100644 --- a/server.js +++ b/server.js @@ -10,14 +10,13 @@ app.use(express.static(__dirname + '/public')); app.use('/public', express.static(__dirname + '/public')); app.get('/', (req, res) => { - try { - if (resources) { - res.render('index.ejs', { resources }); - } else { - throw new Error('Resources not found.') - } - } catch (err) { - console.error(err); + if (resources) { + res.render('index.ejs', { resources }); + } else { + // respond with status 500 if the resources array could not be loaded from resources.js + res.status(500).json({ + error: 'Resources were not able to be loaded from "resources.js."' + }); } }); diff --git a/views/index.ejs b/views/index.ejs index 6f349c9..49d1311 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -60,7 +60,17 @@
  • -
    {

    name: '<%= resources[i].name %>',
    url: target="_blank">'<%= resources[i].url %>',
    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]
    },
    +
    +											
    +												{
    +													
    +

    name: '<%= resources[i].name %>',

    +
    url: ' target="_blank"><%= resources[i].url %>',
    +
    keywords: [<%= resources[i].keywords.map(keyword => `'${keyword}'`).join(", ") %>]
    +
    + }, +
    +
  • <% } %>