Admin Panel v6
This commit is contained in:
@@ -281,15 +281,25 @@
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
const cdnBase = '@Model.CdnBaseUrl';
|
||||
const cdnBase = '@Html.Raw(Model.CdnBaseUrl)';
|
||||
|
||||
function updatePreview() {
|
||||
const path = document.getElementById('spritePath').value;
|
||||
const img = document.getElementById('spritePreview');
|
||||
const placeholder = document.getElementById('spritePlaceholder');
|
||||
if (path) {
|
||||
img.src = cdnBase + '/' + path;
|
||||
placeholder.classList.add('hidden');
|
||||
if (path && path.trim()) {
|
||||
const fullUrl = cdnBase + '/' + path.trim();
|
||||
console.log('Loading preview:', fullUrl);
|
||||
img.onload = function() {
|
||||
img.classList.remove('hidden');
|
||||
placeholder.classList.add('hidden');
|
||||
};
|
||||
img.onerror = function() {
|
||||
console.log('Failed to load:', fullUrl);
|
||||
img.classList.add('hidden');
|
||||
placeholder.classList.remove('hidden');
|
||||
};
|
||||
img.src = fullUrl;
|
||||
} else {
|
||||
img.classList.add('hidden');
|
||||
placeholder.classList.remove('hidden');
|
||||
@@ -304,7 +314,9 @@
|
||||
}
|
||||
|
||||
// Init
|
||||
updatePreview();
|
||||
toggleMaxStack();
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
updatePreview();
|
||||
toggleMaxStack();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user