Fix double percent-sign escaping in template
This commit is contained in:
+17
-6
@@ -57,7 +57,7 @@
|
|||||||
}
|
}
|
||||||
button:hover { background: #555; }
|
button:hover { background: #555; }
|
||||||
.progress-container {
|
.progress-container {
|
||||||
width: 100%%;
|
width: 100%;
|
||||||
background: #ddd;
|
background: #ddd;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
height: 100%%;
|
height: 100%;
|
||||||
background: #333;
|
background: #333;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
width: 0;
|
width: 0;
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
progressContainer.style.display = 'block';
|
progressContainer.style.display = 'block';
|
||||||
progressBar.style.width = '0%%';
|
progressBar.style.width = '0%';
|
||||||
results.innerHTML = '';
|
results.innerHTML = '';
|
||||||
|
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
xhr.upload.addEventListener('progress', (e) => {
|
xhr.upload.addEventListener('progress', (e) => {
|
||||||
if (e.lengthComputable) {
|
if (e.lengthComputable) {
|
||||||
const percent = (e.loaded / e.total) * 100;
|
const percent = (e.loaded / e.total) * 100;
|
||||||
progressBar.style.width = percent + '%%';
|
progressBar.style.width = percent + '%';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -169,9 +169,20 @@
|
|||||||
const response = JSON.parse(xhr.responseText);
|
const response = JSON.parse(xhr.responseText);
|
||||||
displayResults(response.urls);
|
displayResults(response.urls);
|
||||||
} else {
|
} else {
|
||||||
results.innerHTML = '<div class="result-item">Upload failed: ' + xhr.statusText + '</div>';
|
let message = xhr.statusText;
|
||||||
|
try {
|
||||||
|
const response = JSON.parse(xhr.responseText);
|
||||||
|
if (response.error) {
|
||||||
|
message = response.error;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (xhr.responseText) {
|
||||||
|
message = xhr.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results.innerHTML = '<div class="result-item">Upload failed: ' + message + '</div>';
|
||||||
}
|
}
|
||||||
progressBar.style.width = '100%%';
|
progressBar.style.width = '100%';
|
||||||
});
|
});
|
||||||
|
|
||||||
xhr.addEventListener('error', () => {
|
xhr.addEventListener('error', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user