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, unveil) { 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) { // Invalid response return; } if (!data.thumbnail) { var thumbnail = "interfaces/default/images/no-cover-artist.png"; } else { var thumbnail = data.thumbnail; } if (!data.artwork) { var artwork = "interfaces/default/images/no-cover-artist.png"; } else { var artwork = data.artwork; } if (unveil) { $(elem).attr("data-src", thumbnail); $(elem).unveil(); } else { $(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(); $("#subhead_menu #menu_link_edit").button(); $("#subhead_menu .menu_link_edit").button(); $("#subhead_menu #menu_link_delete").button(); $("#subhead_menu #menu_link_pauze").button(); $("#subhead_menu #menu_link_resume").button(); $("#subhead_menu #menu_link_getextra").button(); $("#subhead_menu #menu_link_removeextra").button(); $("#subhead_menu #menu_link_wanted").button(); $("#subhead_menu #menu_link_check").button(); $("#subhead_menu #menu_link_skipped").button(); $("#subhead_menu #menu_link_retry").button(); $("#subhead_menu #menu_link_new").button(); $("#subhead_menu #menu_link_shutdown").button(); $("#subhead_menu #menu_link_scan").button(); } 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 = $("