Add sharing to track pages
This commit is contained in:
parent
e87dd27885
commit
9dd87c8d18
1 changed files with 45 additions and 9 deletions
|
@ -10,10 +10,18 @@
|
|||
</header>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Matched tracks for</h3>
|
||||
<div class="col-md-9 col-sm-8 col-xs-12">
|
||||
<h3>Matched albums for</h3>
|
||||
<h2><%= items[0].name %> <span class="artist-lighten">- <%= items[0].artist.name %></span></h2>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-4 hidden-xs">
|
||||
<ul class="list-inline share-tools">
|
||||
<li>Share this</li>
|
||||
<li><a href="http://twitter.com/intent/tweet/?text=Check out <%= items[0].name + " by " + items[0].artist.name %>&url=<%= thisUrl %>&via=MatchAudio" class="share-dialog"><img src="/images/twitter.png" alt="Twitter" /></a></li>
|
||||
<li><a href="http://www.facebook.com/sharer/sharer.php?p[url]=<%= thisUrl %>" class="share-dialog"><img src="/images/facebook.png" alt="Facebook" /></a></li>
|
||||
<li><a href="https://plus.google.com/share?url=<%= thisUrl %>" class="share-dialog"><img src="/images/googleplus.png" alt="Google+" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% for (var i=0;i < items.length;i++) { var track = items[i]; %>
|
||||
|
@ -21,11 +29,11 @@
|
|||
<div class="service <%= i==0 ? "source-service" : "" %>">
|
||||
<div class="matching-from"><%= i==0 ? "Found matches using this link" : "" %></div>
|
||||
<% if (track.type == "video") { %>
|
||||
<div class="js-video widescreen">
|
||||
<iframe width="100%" src="//www.youtube.com/embed/<%= track.id %>" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
<a href="https://www.youtube.com/results?search_query=<%= items[0].name %> <%= items[0].artist.name %>">More Youtube matches</a>
|
||||
<% } else if (track.streamUrl) { %>
|
||||
<div class="js-video widescreen">
|
||||
<iframe width="100%" src="//www.youtube.com/embed/<%= track.id %>" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
<a href="https://www.youtube.com/results?search_query=<%= items[0].name %> <%= items[0].artist.name %>">More Youtube matches</a>
|
||||
<% } else if (track.streamUrl) { %>
|
||||
<a href="<%= track.streamUrl %>"><img src="<%= track.artwork %>" class="img-rounded album-artwork" width="100%"></a>
|
||||
<div class="service-link">
|
||||
<a href="<%= track.streamUrl %>"><img src="/images/<%= track.service %>.png" class="img-rounded"></a>
|
||||
|
@ -45,8 +53,36 @@
|
|||
</div><% if((i+1)%4 == 0) { %></div><div class="row"><% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="row share">
|
||||
|
||||
<div class="row visible-xs-block">
|
||||
<div class="col-md-12">
|
||||
<ul class="list-inline share-tools">
|
||||
<li>Share this</li>
|
||||
<li><a href="http://twitter.com/intent/tweet/?text=Check out <%= items[0].name + " by " + items[0].artist.name %>&url=<%= thisUrl %>&via=MatchAudio" class="share-dialog"><img src="/images/twitter.png" alt="Twitter" /></a></li>
|
||||
<li><a href="http://www.facebook.com/sharer/sharer.php?p[url]=<%= thisUrl %>" class="share-dialog"><img src="/images/facebook.png" alt="Facebook" /></a></li>
|
||||
<li><a href="https://plus.google.com/share?url=<%= thisUrl %>" class="share-dialog"><img src="/images/googleplus.png" alt="Google+" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
Array.prototype.forEach.call(document.querySelectorAll(".share-dialog"), function(dialog){
|
||||
dialog.addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
var w = 845;
|
||||
var h = 670;
|
||||
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
|
||||
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
|
||||
|
||||
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
||||
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
||||
|
||||
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
|
||||
var top = ((height / 2) - (h / 2)) + dualScreenTop;
|
||||
var newWindow = window.open(dialog.href, "Share Music", 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
||||
if (window.focus) {
|
||||
newwindow.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% include footer.ejs %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue