| Custom CSS |
@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@700;800&display=swap");
#app { background-position: right; }
#app #sortable, #app main { padding: 20px; }
.black { color: rgb(186, 194, 222) !important; }
.tooltip { display: none; }
.searchform { box-shadow: rgba(0, 0, 0, 0.05) -1px -1px 5px 0, rgba(0, 0, 0, 0.15) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px !important; border-radius: 12px; background-image: none; border: none; outline: none; background-color: rgba(69, 71, 90, 0.7) !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.searchform button { background: rgb(137, 180, 250) !important; color: rgb(224, 228, 243) !important; }
.searchform input { background: rgb(108, 112, 134) !important; color: rgb(205, 214, 244) !important; }
.searchform select { background: rgb(108, 112, 134) !important; border-right: 1px solid rgb(108, 112, 134) !important; color: rgb(224, 228, 243) !important; }
.item { box-shadow: rgba(0, 0, 0, 0.05) -1px -1px 5px 0, rgba(0, 0, 0, 0.5) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px !important; border-radius: 12px; background-image: none; border: none; outline: none; height: 100px; width: 300px; margin: 1.25rem; padding: 1rem 55px 1rem 1rem; transition: all 0.25s ease-in-out; transition-property: transform, box-shadow, background-color; background-color: rgba(69, 71, 90, 0.3) !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.item:after { height: 100px; opacity: 0.1; }
.item:hover { transform: scale(1.1); background-color: rgba(69, 71, 90, 0.6) !important; box-shadow: rgba(0, 0, 0, 0.1) 0px 60px 40px -7px !important; }
.item .svg-inline--fa { height: 100px; vertical-align: middle; opacity: 0.2; }
@media only screen and (max-width: 750px) { .item { padding-top: 2rem; padding-bottom: 2rem; }
}
.details * { color: rgb(137, 180, 250) !important; } .details { padding: 0 0.5rem; }
.app-icon { filter: drop-shadow(1px 1px 2px rgba(10, 0, 20, 0.1)); }
.livestats-container {
margin-top: 0.5rem;
}
.livestats-container .livestats .title {
margin-bottom: 3px;
}
.livestats-container .livestats li {
padding-right: 1rem;
}
.livestats-container strong {
font-weight: 500 !important;
padding: 0 2px;
}
.details > .title {
font-weight: 800;
font-size: 0.9rem !important;
letter-spacing: 1px;
font-family: var(--font-family);
text-shadow: var(--shadow-color) 1px 0 5px;
text-shadow: -1px -1px 1px rgba(255, 255, 255, 0.1), 1px 1px 2px var(--shadow-color);
transition: all 0.25s ease-in-out;
}
.item:hover .details > .title {
text-shadow: -1px -1px 1px rgba(255, 255, 255, 0.1), 1px 1px 5px var(--shadow-color);
}
#app main,
#app #sortable {
padding: 3px;
}
#config-buttons {
width: 300px;
height: 45px;
margin-left: -150px;
bottom: 0px;
left: 50%;
overflow: hidden;
border-top-left-radius: 8px;
border-top-right-radius: 10px;
background-color: rgba(0, 0, 0, 0.2);
backdrop-filter: var(--backdrop-filter);
-webkit-backdrop-filter: var(--backdrop-filter);
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
#config-buttons a {
background: none;
}
#config-buttons a svg {
transition: all 0.15s ease-in-out;
color: rgba(255, 255, 255, 0.1);
}
#config-buttons a:hover svg {
transform: scale(1.1);
color: rgba(255, 255, 255, 0.2);
transition: all 0.15s ease-in-out;
}.headerInfos {
display: flex;
justify-content: space-between; /* Pour espacer les éléments */
margin: 20px;
}
.divDate {
order: 1;
display: flex; /* Utilisation de flexbox pour aligner les éléments verticalement */
align-items: center; /* Alignement vertical au centre */
}
.divDate, .meteo {
background-color: rgba(23, 42, 75, 0.1);
border-radius: 10px; /* Coins arrondis */
box-shadow: inset 0 1px 2px 0 rgba(0,0,0,.2);
padding: 10px 20px; /* Padding de 10px à gauche et à droite */
}
.horloge,
.ladate {
display: inline-block; /* Affichage en ligne pour positionner les éléments côte à côte */
margin-right: 10px; /* Marge entre les éléments */
}
.ladate span {
display: block; /* Affichage en bloc pour le span contenant le nom du jour */
/* Supprimer la marge entre le span et le reste du texte */
margin-bottom: 0; /* Ajustement pour supprimer l'espacement */
}
.horloge {
font-size: 2.5em;
}
.temperature {
font-size: 2em;
}
.horloge, .ladate,.temperature {
font-weight: bold;
}
.meteo {
order: 2;
display: flex;
flex-direction: column;
}
.ville-temp-container {
display: flex;
justify-content: space-between;
}
.temperature {
padding-right: 50px;
}
.icon {
margin-top: 5px;
}
.horloge,
.ladate, .temperature, .ville, .description {
color: white;
}
span.ville {
padding-right: 50px;
}
|
|
| Custom JavaScript |
const sortableElement = document.querySelector('.appheader');
function insertAfter(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
function createAndInsertDiv(className, referenceNode) {
var newDiv = document.createElement("div");
newDiv.classList.add(className);
referenceNode.appendChild(newDiv);
return newDiv;
}
if (sortableElement) {
// Création de la div parente 'headerInfos'
var headerInfos = document.createElement('div');
headerInfos.classList.add('headerInfos');
insertAfter(sortableElement, headerInfos);
// Création de la div 'divDate' à l'intérieur de 'headerInfos'
var divDate = createAndInsertDiv('divDate', headerInfos);
// Création des éléments <div> pour la date et l'heure à l'intérieur de 'divDate'
var timeDiv = createAndInsertDiv('horloge', divDate);
var dateDiv = createAndInsertDiv('ladate', divDate);
// Création de la div 'meteo' à l'intérieur de 'headerInfos'
var meteoDiv = createAndInsertDiv('meteo', headerInfos);
function afficherDateHeure() {
const maintenant = new Date();
const optionsJour = {
weekday: 'long'
};
const optionsHeure = {
hour: 'numeric',
minute: 'numeric'
};
const optionsDate = {
year: 'numeric',
month: 'long',
day: 'numeric'
};
const jourFormatted = maintenant.toLocaleDateString(undefined, optionsJour);
const dateFormatted = maintenant.toLocaleDateString(undefined, optionsDate);
const heureFormatted = maintenant.toLocaleTimeString(undefined, optionsHeure);
// Effacer le contenu des éléments pour éviter l'accumulation des éléments
dateDiv.innerHTML = '';
// Insérer le jour de la semaine dans la balise <span> de la classe '.ladate'
var spanJourSemaine = document.createElement('span');
spanJourSemaine.textContent = jourFormatted;
dateDiv.appendChild(spanJourSemaine);
// Insérer l'heure sans les secondes dans '.horloge'
timeDiv.textContent = heureFormatted;
// Insérer le reste de la date en dehors de la balise <span>
dateDiv.appendChild(document.createTextNode(dateFormatted));
}
function afficherMeteo(latitude, longitude) {
const apiKey = 'd299d1e06d800a971827cf9e159097b1' ; // Remplacez ceci par votre clé API OpenWeatherMap
fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${latitude}&lon=${longitude}&appid=${apiKey}&units=metric&lang=en`)
.then(response => response.json())
.then(data => {
const temperature = Math.round(data.main.temp); // Arrondir la température à l'entier le plus proche
const ville = data.name;
const icon = data.weather[0].icon;
const description = data.weather[0].description;
// Affichage de la météo dans la div 'meteo'
meteoDiv.innerHTML = `<div class="ville-temp-container"><div class="temperature">${temperature}°C</div><div class="icon"><img src="http://openweathermap.org/img/wn/${icon}.png"></div></div><div class="ville-temp-container"><span class="ville">${ville}</span><span class="description">${description}</span</div>`;
})
.catch(error => {
console.error('Erreur lors de la récupération des données météo', error);
meteoDiv.textContent = 'Impossible de récupérer les données météo';
});
}
// Obtenir la géolocalisation de l'utilisateur (exemple ici avec une valeur statique)
const latitude = 53.2606635; // Latitude de la ville (exemple pour Paris)
const longitude = -2.1255158; // Longitude de la ville (exemple pour Paris)
// Appel initial pour afficher la date, l'heure et la météo
afficherDateHeure();
afficherMeteo(latitude, longitude);
// Mettre à jour l'heure toutes les secondes
setInterval(afficherDateHeure, 1000);
}
|
|