mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-16 00:25:31 +01:00
Moved all of the ajax functions over to use the cache rather than last.fm/amazon
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<div class="table_wrapper">
|
||||
<div id="albumheader" class="clearfix">
|
||||
<div id="albumImg">
|
||||
<img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.LZZZZZZZ.jpg" height="200" width="200" alt="albumart" class="albumArt" rel="dialog">
|
||||
<img id="albumImg" height="200" width="200" alt="albumart" class="albumArt" rel="dialog">
|
||||
</div>
|
||||
|
||||
<h1><a href="http://musicbrainz.org/release-group/${album['AlbumID']}">${album['AlbumTitle']}</a></h1>
|
||||
@@ -41,9 +41,7 @@
|
||||
|
||||
%>
|
||||
<div class="albuminfo">
|
||||
%if description:
|
||||
<p>${description['Summary']}</p>
|
||||
%endif
|
||||
<div id="albumInfo"></div>
|
||||
<ul>
|
||||
<li>Tracks: <span>${totaltracks}</span></li>
|
||||
<li>Duration: <span>${albumduration}</span></li>
|
||||
@@ -128,8 +126,25 @@
|
||||
<%def name="javascriptIncludes()">
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
<script>
|
||||
|
||||
function getAlbumArt() {
|
||||
var id = "${album['AlbumID']}";
|
||||
var image = $("div#albumImg img#albumImg");
|
||||
if ( !image.hasClass('done') ) {
|
||||
image.addClass('done');
|
||||
getArtwork(image,id,'album');
|
||||
}
|
||||
}
|
||||
|
||||
function getAlbumInfo() {
|
||||
var id = "${album['AlbumID']}";
|
||||
var elem = $("#albumInfo");
|
||||
getInfo(elem,id,'album');
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
getAlbumInfo("${album['ArtistName']}","${album['AlbumTitle']}","#albumheader .albumArt",3);
|
||||
getAlbumInfo();
|
||||
getAlbumArt();
|
||||
initActions();
|
||||
|
||||
$('#track_table').dataTable({
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
function getArtistBio() {
|
||||
var id = "${artist['ArtistID']}";
|
||||
var elem = $("div#artistBio")
|
||||
var elem = $("#artistBio");
|
||||
getInfo(elem,id,'artist');
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function getThumb(imgElem,id,type) {
|
||||
else {
|
||||
var imageUrl = data;
|
||||
}
|
||||
$(imgElem).attr("src",imageUrl).removeAttr("width").removeAttr("height").hide().fadeIn();
|
||||
$(imgElem).attr("src",imageUrl).hide().fadeIn();
|
||||
$(imgElem).wrap('<a href="'+ imageLarge +'" rel="dialog" title="' + name + '"></a>');
|
||||
}
|
||||
});
|
||||
@@ -51,17 +51,37 @@ function getInfo(elem,id,type) {
|
||||
} else {
|
||||
var infoURL = "getInfo?AlbumID=" + id;
|
||||
}
|
||||
// Get Data from the cache by Artist ID
|
||||
// Get Data from the cache by ID
|
||||
$.ajax({
|
||||
url: infoURL,
|
||||
data_type: "jsonp",
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
var summary = data['Summary'];
|
||||
var summary = data.Summary;
|
||||
$(elem).append(summary);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getImageLinks(elem,id,type) {
|
||||
|
||||
if ( type == 'artist' ) {
|
||||
var infoURL = "getImageLinks?ArtistID=" + id;
|
||||
} else {
|
||||
var infoURL = "getImageLinks?AlbumID=" + id;
|
||||
}
|
||||
// Get Data from the cache by ID
|
||||
$.ajax({
|
||||
url: infoURL,
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
var thumbnail = data.thumbnail;
|
||||
var artwork = data.artwork;
|
||||
|
||||
$(elem).attr("src", thumbnail);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getOriginalWidthOfImg(img_element) {
|
||||
var t = new Image();
|
||||
t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src;
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
%>
|
||||
<tr class="grade${grade}">
|
||||
<td id="select"><input type="checkbox" name="${artist['ArtistID']}" class="checkbox" /></td>
|
||||
<td id="albumart"><div id="artistImg"><img class="albumArt" src="http://ec1.images-amazon.com/images/P/${artist['AlbumID']}.01.MZZZZZZZ.jpg" height="50" width="50"></div></td>
|
||||
<td id="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}">${artist['ArtistName']}</a></td>
|
||||
<td id="albumart"><div id="artistImg"><img class="albumArt" height="50" width="50"></div></td>
|
||||
<td id="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}" title="${artist['ArtistID']}">${artist['ArtistName']}</a></td>
|
||||
<td id="status">${artist['Status']}</td>
|
||||
<td id="album"><span title="${releasedate}"></span><a href="albumPage?AlbumID=${artist['AlbumID']}">${albumdisplay}</a></td>
|
||||
</tr>
|
||||
@@ -78,13 +78,19 @@
|
||||
<%def name="javascriptIncludes()">
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
<script>
|
||||
function getArtistArt() {
|
||||
$("table#artist_table tr td#name").each(function(){
|
||||
var id = $(this).children('a').attr('title');
|
||||
var image = $(this).parent().find("td#albumart img");
|
||||
if ( !image.hasClass('done') ) {
|
||||
image.addClass('done');
|
||||
getThumb(image,id,'artist');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initThisPage() {
|
||||
$("table#artist_table tr td#name").each(function(){
|
||||
var artist = $(this).children('a').text();
|
||||
var image = $(this).parent().find("td#albumart img");
|
||||
getArtistInfo(artist,image,1);
|
||||
});
|
||||
getArtistArt();
|
||||
$('#artist_table').dataTable({
|
||||
"bDestroy":true,
|
||||
"aoColumns": [
|
||||
@@ -108,4 +114,4 @@
|
||||
initFancybox();
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
</%def>
|
||||
|
||||
@@ -26,8 +26,12 @@
|
||||
else:
|
||||
grade = 'Z'
|
||||
%>
|
||||
<tr class="grade${grade}">
|
||||
<td id="albumart"><div id="artistImg"><img class="albumArt" src="http://ec1.images-amazon.com/images/P/${result['uniquename']}.01.MZZZZZZZ.jpg" height="50" width="50"></div></td>
|
||||
<tr class="grade${grade}">
|
||||
%if type == 'album':
|
||||
<td id="albumart"><div id="artistImg"><img title="${result['albumid']}" class="albumArt" height="50" width="50"></div></td>
|
||||
%else:
|
||||
<td id="albumart"><div id="artistImg"><img title="${result['id']}" class="albumArt" height="50" width="50"></div></td>
|
||||
%endif
|
||||
%if type == 'album':
|
||||
<td id="albumname"><a href="${result['albumurl']}">${result['title']}</a></td>
|
||||
%endif
|
||||
@@ -55,20 +59,18 @@
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
|
||||
<script>
|
||||
function initThisPage() {
|
||||
$("table#searchresults_table tr td#artistname").each(function(){
|
||||
var artist = $(this).children('a').attr('title');
|
||||
var image = $(this).parent().find("td#albumart img");
|
||||
var album = $(this).prev().text();
|
||||
var getId = $(this).children('a').attr('href');
|
||||
var id = getId.substr(30);
|
||||
%if type == 'artist':
|
||||
getArtistInfo(artist,image,1,id);
|
||||
%endif
|
||||
%if type == 'album':
|
||||
getAlbumInfo(artist,album,image,1);
|
||||
%endif
|
||||
function getArt() {
|
||||
$("table#searchresults_table tr td#albumart img").each(function(){
|
||||
var id = $(this).attr('title');
|
||||
var image = $(this);
|
||||
if ( !image.hasClass('done') ) {
|
||||
image.addClass('done');
|
||||
getImageLinks(image,id,"${type}");
|
||||
}
|
||||
});
|
||||
}
|
||||
function initThisPage() {
|
||||
getArt();
|
||||
$('#searchresults_table').dataTable(
|
||||
{
|
||||
"bDestroy": true,
|
||||
@@ -95,4 +97,4 @@
|
||||
initFancybox();
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
</%def>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
%for album in wanted:
|
||||
<tr class="gradeZ">
|
||||
<td id="select"><input type="checkbox" name="${album['AlbumID']}" class="checkbox" /></th>
|
||||
<td id="albumart"><img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" height="50" width="50"></td>
|
||||
<td id="albumart"><img title="${album['AlbumID']}" height="50" width="50"></td>
|
||||
<td id="artistname">${album['ArtistName']}</td>
|
||||
<td id="albumname"><a href="albumPage?AlbumID=${album['AlbumID']}">${album['AlbumTitle']}</a></td>
|
||||
<td id="reldate">${album['ReleaseDate']}</td>
|
||||
@@ -70,7 +70,7 @@
|
||||
<tbody>
|
||||
%for album in upcoming:
|
||||
<tr class="gradeZ">
|
||||
<td id="albumart"><img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" height="50" width="50"></td>
|
||||
<td id="albumart"><img title="${album['AlbumID']}" height="50" width="50"></td>
|
||||
<td id="artistname">${album['ArtistName']}</td>
|
||||
<td id="albumname"><a href="albumPage?AlbumID=${album['AlbumID']}">${album['AlbumTitle']}</a></td>
|
||||
<td id="reldate">${album['ReleaseDate']}</td>
|
||||
@@ -90,7 +90,19 @@
|
||||
<%def name="javascriptIncludes()">
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
<script>
|
||||
|
||||
function getAlbumArt() {
|
||||
$("td#albumart img").each(function(){
|
||||
var id = $(this).attr('title');
|
||||
var image = $(this);
|
||||
if ( !image.hasClass('done') ) {
|
||||
image.addClass('done');
|
||||
getThumb(image,id,'album');
|
||||
}
|
||||
});
|
||||
}
|
||||
function initThisPage() {
|
||||
getAlbumArt();
|
||||
$('#wanted_table').dataTable({
|
||||
"bDestroy":true,
|
||||
"bFilter": false,
|
||||
@@ -103,8 +115,5 @@
|
||||
$(document).ready(function() {
|
||||
initThisPage();
|
||||
});
|
||||
$(window).load(function(){
|
||||
replaceEmptyAlbum("table#wanted_table td#albumart img","interfaces/default/images/no-cover-art.png");
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
</%def>
|
||||
|
||||
Reference in New Issue
Block a user