Replace the usage of prototypejs with jquery in changeCoverArt.jsp

This change was successfully tested on Chromium and Firefox.
master
jvoisin 6 years ago committed by GitHub
parent bf5f8cb713
commit 6d294a770b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 73
      airsonic-main/src/main/webapp/WEB-INF/jsp/changeCoverArt.jsp
  2. 1
      airsonic-main/src/main/webapp/WEB-INF/jsp/externalPlayer.jsp

@ -2,90 +2,77 @@
<html><head> <html><head>
<%@ include file="head.jsp" %> <%@ include file="head.jsp" %>
<%@ include file="jquery.jsp" %>
<script type="text/javascript" src="<c:url value="/dwr/interface/coverArtService.js"/>"></script> <script type="text/javascript" src="<c:url value="/dwr/interface/coverArtService.js"/>"></script>
<script type="text/javascript" src="<c:url value="/dwr/engine.js"/>"></script> <script type="text/javascript" src="<c:url value="/dwr/engine.js"/>"></script>
<script type="text/javascript" src="<c:url value="/dwr/util.js"/>"></script> <script type="text/javascript" src="<c:url value="/dwr/util.js"/>"></script>
<script type="text/javascript" src="<c:url value="/script/prototype.js"/>"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
dwr.engine.setErrorHandler(function() { dwr.engine.setErrorHandler(function() {
$("wait").hide(); $("#wait").hide();
dwr.util.setValue("errorDetails", "Sorry, an error occurred while searching for cover art."); dwr.util.setValue("errorDetails", "Sorry, an error occurred while searching for cover art.");
$("errorDetails").show(); $("#errorDetails").show();
}); });
function setImage(imageUrl) { function setImage(imageUrl) {
$("wait").show(); $("#wait").show();
$("result").hide(); $("#result").hide();
$("success").hide(); $("#success").hide();
$("error").hide(); $("#error").hide();
$("errorDetails").hide(); $("#errorDetails").hide();
$("noImagesFound").hide(); $("#noImagesFound").hide();
coverArtService.setCoverArtImage(${model.id}, imageUrl, setImageComplete); coverArtService.setCoverArtImage(${model.id}, imageUrl, setImageComplete);
} }
function setImageComplete(errorDetails) { function setImageComplete(errorDetails) {
$("wait").hide(); $("#wait").hide();
if (errorDetails != null) { if (errorDetails != null) {
dwr.util.setValue("errorDetails", errorDetails, { escapeHtml:false }); dwr.util.setValue("errorDetails", errorDetails, { escapeHtml:false });
$("error").show(); $("#error").show();
$("errorDetails").show(); $("#errorDetails").show();
} else { } else {
$("success").show(); $("#success").show();
} }
} }
function searchComplete(searchResults) { function searchComplete(searchResults) {
$("wait").hide(); $("#wait").hide();
if (searchResults.length > 0) { if (searchResults.length > 0) {
var images = $("#images");
var images = $("images"); images.empty();
images.innerHTML = "";
for (var i = 0; i < searchResults.length; i++) { for (var i = 0; i < searchResults.length; i++) {
var result = searchResults[i]; var result = searchResults[i];
var node = $("template").cloneNode(true); var node = $("#template").clone();
var link = node.getElementsByClassName("search-result-link")[0];
link.href = "javascript:setImage('" + result.imageUrl + "');";
var thumbnail = node.getElementsByClassName("search-result-image")[0];
thumbnail.src = result.imageUrl;
var title = node.getElementsByClassName("search-result-artist")[0];
title.innerHTML = result.artist;
var dimension = node.getElementsByClassName("search-result-album")[0]; node.find(".search-result-link").attr("href", "javascript:setImage('" + result.imageUrl + "');");
dimension.innerHTML = result.album; node.find(".search-result-image").attr("src", result.imageUrl);
node.find(".search-result-artist").text(result.artist);
node.find(".search-result-album").text(result.album);
node.show(); node.show();
images.appendChild(node); node.appendTo(images);
} }
$("result").show(); $("#result").show();
} else { } else {
$("noImagesFound").show(); $("#noImagesFound").show();
} }
} }
function search() { function search() {
$("#wait").show();
$("wait").show(); $("#result").hide();
$("result").hide(); $("#success").hide();
$("success").hide(); $("#error").hide();
$("error").hide(); $("#errorDetails").hide();
$("errorDetails").hide(); $("#noImagesFound").hide();
$("noImagesFound").hide();
var artist = dwr.util.getValue("artist"); var artist = dwr.util.getValue("artist");
var album = dwr.util.getValue("album"); var album = dwr.util.getValue("album");
coverArtService.searchCoverArt(artist, album, searchComplete); coverArtService.searchCoverArt(artist, album, searchComplete);
} }
</script> </script>
</head> </head>
<body class="mainframe bgcolor1" onload="search()"> <body class="mainframe bgcolor1" onload="search()">

@ -5,7 +5,6 @@
<head> <head>
<%@ include file="head.jsp" %> <%@ include file="head.jsp" %>
<meta name="og:type" content="album"/> <meta name="og:type" content="album"/>
<script type="text/javascript" src="<c:url value="/script/prototype.js"/>"></script>
<script type="text/javascript" src="<c:url value="/script/mediaelement/mediaelement-and-player.min.js"/>"></script> <script type="text/javascript" src="<c:url value="/script/mediaelement/mediaelement-and-player.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/script/mediaelement/playlist.min.js"/>"></script> <script type="text/javascript" src="<c:url value="/script/mediaelement/playlist.min.js"/>"></script>
<link type="text/css" rel="stylesheet" href="<c:url value="/script/mediaelement/playlist.min.css"/>"> <link type="text/css" rel="stylesheet" href="<c:url value="/script/mediaelement/playlist.min.css"/>">

Loading…
Cancel
Save