mirror of
https://github.com/mue/mue.git
synced 2026-07-23 08:47:19 +02:00
Progress, crediting Pexels etc
This commit is contained in:
@@ -11,9 +11,94 @@ export default class Background extends React.Component {
|
||||
document.getElementById('photographer').innerText = `Photo by ${data.photographer}`;
|
||||
document.getElementById('location').innerText = `${data.location}`;
|
||||
} catch (e) { // ..and if that fails we load one locally
|
||||
let photographer;
|
||||
const photo = Math.floor(Math.random() * (20 - 1 + 1)) + 1; // There are 20 images in the offline-images folder
|
||||
document.getElementById('backgroundCredits').style.display = 'none';
|
||||
document.getElementById('photographer').innerText = 'Photo from Pexels';
|
||||
document.getElementById('root').style.backgroundImage = `url(../offline-images/${Math.floor(Math.random() * (20 - 1 + 1)) + 1})`; // There are 20 images in the offline-images folder
|
||||
// eslint-disable-next-line default-case
|
||||
switch (photo) { // Select photographer based on image file number
|
||||
case 1: {
|
||||
photographer = 'Tirachard Kumtanom (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
photographer = 'Sohail Na (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
photographer = 'Miriam Espacio (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
photographer = 'NO NAME (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 11: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 12: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 13: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 14: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 15: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 17: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 19: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 20: {
|
||||
photographer = 'Fabian Wiktor (Pexels)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.getElementById('photographer').innerText = `Photo by ${photographer}`;
|
||||
document.getElementById('root').style.backgroundImage = `url(../offline-images/${photo}.jpeg)`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user