Refactor templates, refresh design a bit
This commit is contained in:
parent
46ab5fe748
commit
8edd4a4179
9 changed files with 77 additions and 70 deletions
|
@ -19,6 +19,6 @@ This is in super early development and is incapable of handling getting dugg, ne
|
|||
On the immediate todo list:
|
||||
|
||||
* Use album release year for additional sanity check on matches
|
||||
* Maybe drop everything from the first special character in album names to improve matches **after** failing to get a good match
|
||||
* Maybe drop everything from the first left-hand bracket in album names to improve matches **after** failing to get a good match
|
||||
* Handle expected and unexpected errors better than the current crash-fest
|
||||
* Add some kind of persistence or caching so it could take a pummeling and not get me banned from the various services
|
||||
|
|
4
app.js
4
app.js
|
@ -45,11 +45,11 @@ app.get('*', function(req,res,next) {
|
|||
|
||||
app.get('/', function(req, res) {
|
||||
var samples = [
|
||||
{artist: "Aesop Rock", album: "None Shall Pass", url: '/google/album/Bpnz47tzvmp3p46ht3syerwyvva'},
|
||||
{artist: "Aesop Rock", album: "Skelethon", url: '/google/album/B3ppmqcekrmxln4bre33om3qife'},
|
||||
{artist: "Hozier", album: "self-titled album", url: '/google/album/Bd3mxcy3otokg4yc45qktq7l35q'},
|
||||
{artist: "Daft Punk", album: "Discovery", url: '/google/album/B4t6yqqvhnb2hy4st4uisjrcsrm'}
|
||||
];
|
||||
res.render('index', { samples: samples, error: req.flash('search-error') });
|
||||
res.render('index', { page: "home", samples: samples, error: req.flash('search-error') });
|
||||
});
|
||||
|
||||
app.post('/search', search);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
body {
|
||||
font-family: "Open Sans";
|
||||
color: #445470;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #e6832e;
|
||||
background: #FE4365;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
|
@ -18,25 +19,50 @@ header h1 a {
|
|||
color: #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #C04969;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #824F6D;
|
||||
}
|
||||
|
||||
header h1 a:hover, header h1 a:focus{
|
||||
color: #f2c4ad;
|
||||
color: #ffacc5;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.share header h1 {
|
||||
.home input[type="text"]:focus {
|
||||
border-color: rgba(255, 68, 109, 0.8);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 5px rgba(255, 68, 109, 0.8);
|
||||
outline: 0 none;
|
||||
}
|
||||
|
||||
.album header h1, .track header h1 {
|
||||
text-align: left;
|
||||
font-size: 1.5em;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.audio-lighten {
|
||||
color:#f2c4ad;
|
||||
color: #ffacc5;
|
||||
}
|
||||
|
||||
.artist-lighten {
|
||||
color: #8396b0;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
font-size: 1.8em;
|
||||
font-weight: 700;
|
||||
margin: 40px 0;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.5em;
|
||||
color: #8396b0;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.share-form {
|
||||
|
@ -46,7 +72,7 @@ h2 {
|
|||
}
|
||||
|
||||
.btn-custom {
|
||||
background-color: #e6832e;
|
||||
background-color: #FE4365;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = function(req, res) {
|
|||
var promises = [];
|
||||
|
||||
if (cache[serviceId][type + "-" + itemId]) {
|
||||
res.render(type, {items: cache[serviceId][type + "-" + itemId]});
|
||||
res.render(type, {page: type, items: cache[serviceId][type + "-" + itemId]});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,8 @@ module.exports = function(req, res) {
|
|||
});
|
||||
|
||||
items.unshift(item);
|
||||
cache[serviceId][item.type + "-" + item.id] = items;
|
||||
res.render(type, {items: items});
|
||||
cache[serviceId][type + "-" + itemId] = items;
|
||||
res.render(type, {page: type, items: items});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
<!doctype html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Match Audio</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/stylesheets/style.css">
|
||||
</head>
|
||||
<body class="album share">
|
||||
<% include header.ejs %>
|
||||
<header>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -24,14 +11,15 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2><%= items[0].artist.name %> - <%= items[0].name %></h2>
|
||||
<h3>Matched albums for</h3>
|
||||
<h2><%= items[0].name %> <span class="artist-lighten">- <%= items[0].artist.name %></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% for (var i=0;i < items.length;i++) { var album = items[i]; %>
|
||||
<div class="col-md-3 col-xs-6">
|
||||
<div class="service <%= i==0 ? "source-service" : "" %>">
|
||||
<div class="matching-from"><%= i==0 ? "Found matches for this link" : "" %></div>
|
||||
<div class="matching-from"><%= i==0 ? "Found matches using this link" : "" %></div>
|
||||
<% if (album.streamUrl) { %>
|
||||
<a href="<%= album.streamUrl %>"><img src="<%= album.artwork %>" class="img-rounded album-artwork" width="100%"></a>
|
||||
<div class="service-link">
|
||||
|
@ -42,7 +30,7 @@
|
|||
<div class="service-link">
|
||||
<a href="<%= album.purchaseUrl %>"><img src="/images/<%= album.service %>.png" class="img-rounded"></a>
|
||||
</div>
|
||||
<% }else { %>
|
||||
<% } else { %>
|
||||
<img src="<%= items[0].artwork %>" class="img-rounded album-artwork not-found" width="100%"></a>
|
||||
<div class="service-link">
|
||||
<img src="/images/<%= album.service %>.png" class="img-rounded not-found">
|
||||
|
@ -56,14 +44,4 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-66209-8', 'match.audio');
|
||||
ga('require', 'displayfeatures');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<% include footer.ejs %>
|
||||
|
|
11
views/footer.ejs
Normal file
11
views/footer.ejs
Normal file
|
@ -0,0 +1,11 @@
|
|||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-66209-8', 'match.audio');
|
||||
ga('require', 'displayfeatures');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
14
views/header.ejs
Normal file
14
views/header.ejs
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Match Audio</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/stylesheets/style.css">
|
||||
</head>
|
||||
<body class="<%= page %>">
|
|
@ -1,17 +1,4 @@
|
|||
<!doctype html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Match Audio</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/stylesheets/style.css">
|
||||
</head>
|
||||
<body class="home">
|
||||
<% include header.ejs %>
|
||||
<header>
|
||||
<h1><a href="/">match<span class="audio-lighten">.audio</span></a></h1>
|
||||
</header>
|
||||
|
@ -43,14 +30,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-66209-8', 'match.audio');
|
||||
ga('require', 'displayfeatures');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<% include footer.ejs %>
|
||||
|
|
|
@ -24,14 +24,15 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2><%= items[0].artist.name %> - <%= items[0].name %></h2>
|
||||
<h3>Matched tracks for</h3>
|
||||
<h2><%= items[0].name %> <span class="artist-lighten">- <%= items[0].artist.name %></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% for (var i=0;i < items.length;i++) { var track = items[i]; %>
|
||||
<% for (var i=0;i < items.length;i++) { var track = items[i]; %>
|
||||
<div class="col-md-3 col-xs-6">
|
||||
<div class="service <%= i==0 ? "source-service" : "" %>">
|
||||
<div class="matching-from"><%= i==0 ? "Found matches for this link" : "" %></div>
|
||||
<div class="matching-from"><%= i==0 ? "Found matches using this link" : "" %></div>
|
||||
<% if (track.streamUrl) { %>
|
||||
<a href="<%= track.streamUrl %>"><img src="<%= track.artwork %>" class="img-rounded album-artwork" width="100%"></a>
|
||||
<div class="service-link">
|
||||
|
@ -42,7 +43,7 @@
|
|||
<div class="service-link">
|
||||
<a href="<%= track.purchaseUrl %>"><img src="/images/<%= track.service %>.png" class="img-rounded"></a>
|
||||
</div>
|
||||
<% }else { %>
|
||||
<% } else { %>
|
||||
<img src="<%= items[0].artwork %>" class="img-rounded album-artwork not-found" width="100%"></a>
|
||||
<div class="service-link">
|
||||
<img src="/images/<%= track.service %>.png" class="img-rounded not-found">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue