From cc20635c09cceb705b68dfa2ac2c41664fd01e11 Mon Sep 17 00:00:00 2001
From: Chinazaekpere-Ike <108843939+Chinazaekpere-Ike@users.noreply.github.com>
Date: Tue, 25 Oct 2022 21:16:48 +0100
Subject: [PATCH] Get title of Image on URL and display on sidebar
---
examples/archive.html | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/examples/archive.html b/examples/archive.html
index 6edb788de..67a849c22 100644
--- a/examples/archive.html
+++ b/examples/archive.html
@@ -109,6 +109,13 @@
Images
let image = new Image(150, 150);
let placeButton = document.createElement('a');
fetchedFrom = document.createElement('p');
+
+ let characterNum = 28;
+ let imageName = input;
+ imageName = ImageName.value.slice (characterNum);
+ imageName = imageName.replaceAll ('-', ' ')
+ let newStr = imageName.charAt(0).toupperCase() + imageName.slice(1)
+
fetchedFromUrl = document.createElement('a');
fetchedFromUrl.setAttribute('href', input.value);
fetchedFromUrl.setAttribute('target', '_blank');
@@ -117,6 +124,10 @@ Images
placeButton.classList.add('btn', 'btn-sm', 'btn-outline-secondary', 'place-button');
placeButton.innerHTML = 'Place on map ';
+
+ let imageTitle = document.createElement ('div');
+ imageTitle.classList.add ('mb-4');
+ imageTitle.innerHTML = newStr
placeButton.addEventListener('click', (event) => {
if(!placeButton.getElementsByClassName('fa-spinner')[0]){
@@ -142,6 +153,7 @@ Images
imageRow.append(image, placeButton);
imageContainer.appendChild(imageRow);
+ imageContainer.appendChild(imageTitle);
imageCount++;
}
});