function getThumb(imgElem,id,type) { if ( type == 'artist' ) { var thumbURL = "getThumb?ArtistID=" + id; // var imgURL = "getArtwork?ArtistID=" + id; } else { var thumbURL = "getThumb?AlbumID=" + id; // var imgURL = "getArtwork?AlbumID=" + id; } // Get Data from the cache by Artist ID $.ajax({ url: thumbURL, cache: true, success: function(data){ if ( data == "" ) { var imageUrl = "interfaces/default/images/no-cover-artist.png"; } else { var imageUrl = data; } $(imgElem).attr("src",imageUrl).hide().fadeIn(); // $(imgElem).wrap(''); } }); } function getArtwork(imgElem,id,name,type) { if ( type == 'artist' ) { var artworkURL = "getArtwork?ArtistID=" + id; } else { var artworkURL = "getArtwork?AlbumID=" + id; } // Get Data from the cache by Artist ID $.ajax({ url: artworkURL, cache: true, success: function(data){ if ( data == "" || data == undefined ) { var imageUrl = "interfaces/default/images/no-cover-artist.png"; } else { var imageUrl = data; } $(imgElem).attr("src",imageUrl).hide().fadeIn(); $(imgElem).wrap(''); } }); } function getInfo(elem,id,type) { if ( type == 'artist' ) { var infoURL = "getInfo?ArtistID=" + id; } else { var infoURL = "getInfo?AlbumID=" + id; } // Get Data from the cache by ID $.ajax({ url: infoURL, cache: true, dataType: "json", success: function(data){ 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, cache: true, dataType: "json", success: function(data){ if ( data.thumbnail == "" || data.thumbnail == undefined ) { var thumbnail = "interfaces/default/images/no-cover-artist.png"; } else { var thumbnail = data.thumbnail; } if ( data.artwork == "" || data.artwork == undefined ) { var artwork = "interfaces/default/images/no-cover-artist.png"; } else { var artwork = data.artwork; } $(elem).attr("src", thumbnail); } }); } function initHeader() { //settings var header = $("#container header"); var fadeSpeed = 100, fadeTo = 0.5, topDistance = 20; var topbarME = function() { $(header).fadeTo(fadeSpeed,1); }, topbarML = function() { $(header).fadeTo(fadeSpeed,fadeTo); }; var inside = false; //do $(window).scroll(function() { position = $(window).scrollTop(); if(position > topDistance && !inside) { //add events topbarML(); $(header).bind('mouseenter',topbarME); $(header).bind('mouseleave',topbarML); $("#toTop").fadeIn(); inside = true; } else if (position < topDistance){ topbarME(); $(header).unbind('mouseenter',topbarME); $(header).unbind('mouseleave',topbarML); $("#toTop").fadeOut(); inside = false; } }); } function initConfigCheckbox(elem) { var config = $(elem).parent().next(); if ( $(elem).is(":checked") ) { config.show(); } else { config.hide(); } $(elem).click(function(){ var config = $(this).parent().next(); if ( $(this).is(":checked") ) { config.slideDown(); } else { config.slideUp(); } }); } function initActions() { $("#subhead_menu #menu_link_refresh").button({ icons: { primary: "ui-icon-refresh" } }); $("#subhead_menu #menu_link_edit").button({ icons: { primary: "ui-icon-pencil" } }); $("#subhead_menu #menu_link_delete" ).button({ icons: { primary: "ui-icon-trash" } }); $("#subhead_menu #menu_link_pauze").button({ icons: { primary: "ui-icon-pause"} }); $("#subhead_menu #menu_link_resume").button({ icons: { primary: "ui-icon-play"} }); $("#subhead_menu #menu_link_getextra").button({ icons: { primary: "ui-icon-plus"} }); $("#subhead_menu #menu_link_removeextra").button({ icons: { primary: "ui-icon-minus" } }); $("#subhead_menu #menu_link_wanted" ).button({ icons: { primary: "ui-icon-heart" } }); $("#subhead_menu #menu_link_check").button({ icons: { primary: "ui-icon-arrowrefresh-1-w"} }); $("#subhead_menu #menu_link_skipped").button({ icons: { primary: "ui-icon-seek-end"} }); $("#subhead_menu #menu_link_retry").button({ icons: { primary: "ui-icon-arrowrefresh-1-e"} }); $("#subhead_menu #menu_link_new").button({ icons: { primary: "ui-icon-arrowreturnthick-1-s" } }); $("#subhead_menu #menu_link_shutdown").button({ icons: { primary: "ui-icon-power"} }); $("#subhead_menu #menu_link_scan").button({ icons: { primary: "ui-icon-search"} }); $("#subhead_menu #menu_link_addalltoRL").button({ icons: { primary: "ui-icon-plus"} }); } function refreshSubmenu() { var url = $(location).attr('href'); $("#subhead_container").load(url + " #subhead_menu",function(){ initActions(); }); } function refreshTable() { var url = $(location).attr('href'); $("table.display").load(url + " table.display tbody, table.display thead", function() { initThisPage(); }); } function refreshLoadArtist() { if ( $(".gradeL").length > 0 ) { var url = $(location).attr('href'); var loadingRow = $("table.display tr.gradeL") loadingRow.each(function(){ var row = $(this).index() + 1; var rowLoad = $("table.display tbody tr:nth-child("+row+")"); $(rowLoad).load(url + " table.display tbody tr:nth-child("+ row +") td", function() { if ( $(rowLoad).children("#status").text() == 'Active' ) { // Active $(rowLoad).removeClass('gradeL').addClass('gradeZ'); initThisPage(); } else { // Still loading setTimeout(function(){ refreshLoadArtist(); },3000); } }); }); } } function refreshTab() { var url = $(location).attr('href'); var tabId = $('.ui-tabs-panel:visible').attr("id"); $('.ui-tabs-panel:visible').load(url + " #"+ tabId, function() { initThisPage(); }); } function showMsg(msg,loader,timeout,ms) { var feedback = $("#ajaxMsg"); update = $("#updatebar"); if ( update.is(":visible") ) { var height = update.height() + 35; feedback.css("bottom",height + "px"); } else { feedback.removeAttr("style"); } feedback.fadeIn(); var message = $("