2024-07-07 08:27:18 -05:00
|
|
|
const setTheme = (theme) => {
|
|
|
|
document.documentElement.className = theme;
|
|
|
|
localStorage.setItem('theme', theme);
|
|
|
|
}
|
|
|
|
|
|
|
|
const hasCodeRun = localStorage.getItem('hasCodeRun');
|
|
|
|
|
|
|
|
if (!hasCodeRun) {
|
|
|
|
const defaultTheme = "{{ config.extra.default_theme }}";
|
|
|
|
setTheme(defaultTheme);
|
|
|
|
localStorage.setItem('hasCodeRun', 'true');
|
|
|
|
}
|
|
|
|
|
|
|
|
const getTheme = () => {
|
|
|
|
const theme = localStorage.getItem('theme');
|
|
|
|
if (theme) {
|
|
|
|
setTheme(theme);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-13 23:41:43 -05:00
|
|
|
getTheme();
|
|
|
|
|
|
|
|
let user = 'ameiro';
|
|
|
|
let url = 'https://lastfm-last-played.biancarosa.com.br/' + user + '/latest-song';
|
|
|
|
let song = document.querySelector('#song');
|
|
|
|
fetch(url)
|
|
|
|
.then(function (response) {
|
|
|
|
return response.json()
|
|
|
|
}).then(function (json) {
|
|
|
|
song.innerHTML = json['track']['name'] + ' - ' + json['track']['artist']['#text'];
|
2024-09-15 00:15:34 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
function myFunction() {
|
|
|
|
var x = document.getElementById("myTopnav");
|
|
|
|
if (x.className === "left-sidebar") {
|
|
|
|
x.className += " responsive";
|
|
|
|
} else {
|
|
|
|
x.className = "left-sidebar";
|
|
|
|
}
|
|
|
|
if (x.style.display === "block") {
|
|
|
|
x.style.display = "none";
|
|
|
|
} else {
|
|
|
|
x.style.display = "block";
|
|
|
|
}
|
|
|
|
}
|