Skip to content

Commit

Permalink
Use hoverNotification instead of alert
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelookingnerd committed Apr 21, 2023
1 parent 7b17539 commit 60635fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ SOFTWARE.
<script src="${rootURL}/plugin/custom-folder-icon/js/custom-icon-global.js" type="text/javascript" />
<f:section title="${%CustomFolderIcons}">
<f:entry title="${%CleanupIcons}" help="${descriptor.getHelpFile('global-cleanup')}">
<input type="button" value="${%Cleanup}" onclick="doCustomIconCleanup('${%CleanupSuccess}', '${%CleanupFailed}')" />
<input id="custom-icon-cleanup" type="button" value="${%Cleanup}"
onclick="doCustomIconCleanup('${%CleanupSuccess}', '${%CleanupFailed}')" />
</f:entry>
</f:section>
</j:jelly>
5 changes: 3 additions & 2 deletions src/main/webapp/js/custom-icon-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ function doUploadCustomIcon(successMessage, errorMessage) {
body: formData
}).then(rsp => {
rsp.text().then(text => {
let cropper = document.getElementById("custom-icon-cropper")
if (rsp.ok) {
let iconName = document.getElementById("custom-icon-name")
iconName.setAttribute("value", text);
iconName.dispatchEvent(new Event("input"));
alert(successMessage + " " + text);
hoverNotification(successMessage + " " + text, cropper);
} else {
let error = text.substring(text.lastIndexOf("<title>") + 7, text.lastIndexOf("</title>"))
alert(errorMessage + " " + error);
hoverNotification(errorMessage + " " + error, cropper);
}
});
});
Expand Down
5 changes: 3 additions & 2 deletions src/main/webapp/js/custom-icon-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ function doCustomIconCleanup(successMessage, errorMessage) {
method: "post",
headers: crumb.wrap({}),
}).then(rsp => {
let button = document.getElementById("custom-icon-cleanup")
if (rsp.ok) {
alert(successMessage);
hoverNotification(successMessage, button.parentNode);
} else {
alert(errorMessage + " " + rsp.status + " - " + rsp.statusText);
hoverNotification(errorMessage + " " + rsp.status + " - " + rsp.statusText, button.parentNode);
}
}).catch(error => {
console.error(error);
Expand Down

0 comments on commit 60635fd

Please sign in to comment.