Skip to content

Commit 46ddbec

Browse files
committed
update widgets
1 parent fe2a75c commit 46ddbec

4 files changed

Lines changed: 25 additions & 5 deletions

File tree

neocities/widgets/lastfm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="UTF-8" />
77
<meta name="viewport" content="width=device-width,initial-scale=1" />
88
<meta name="robots" content="noindex, nofollow" />
9-
<script src="widgets.js?nocache=2"></script>
9+
<script src="widgets.js?nocache=3"></script>
1010
<style>
1111
body {
1212
background: 0 0;

neocities/widgets/pollcode.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="UTF-8" />
77
<meta name="viewport" content="width=device-width,initial-scale=1" />
88
<meta name="robots" content="noindex, nofollow" />
9-
<script src="widgets.js?nocache=2"></script>
9+
<script src="widgets.js?nocache=3"></script>
1010
<style>
1111
body {
1212
background: 0 0;

neocities/widgets/statuscafe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="UTF-8" />
77
<meta name="viewport" content="width=device-width,initial-scale=1" />
88
<meta name="robots" content="noindex, nofollow" />
9-
<script src="widgets.js?nocache=2"></script>
9+
<script src="widgets.js?nocache=3"></script>
1010
<style>
1111
body {
1212
background: 0 0;

neocities/widgets/widgets.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const knownParams = [
1717
"viewButtonAsLink",
1818
"spacing",
1919
"showAlbumCover",
20+
"albumCoverLeft",
2021
];
2122

2223
/*
@@ -55,6 +56,13 @@ function doCSS(params) {
5556
document.body.querySelector("main").style.margin = "0";
5657
}
5758
}
59+
if (params.get("width")) {
60+
document.body.style.textAlign = params.get("center") == "1" ? "center" : "left";
61+
62+
if (params.get("center") == "0") {
63+
document.body.querySelector("main").style.margin = "0";
64+
}
65+
}
5866

5967
// Backwards Compability (now unknown):
6068
if (params.get("font")) document.body.style.fontFamily = '"' + params.get("font").replaceAll("%20", " ") + '"';
@@ -225,18 +233,30 @@ function initLastFm(params) {
225233
albumCoverUrl = "https://lastfm.freetls.fastly.net/i/u/300x300/acdd1489ea27beb10b07c58ffdb99a83.jpg";
226234
}
227235

236+
let albumCoverHTMLLeft = "";
237+
let albumCoverHTMLRight = "";
238+
228239
let albumCoverHTML = "";
229240
if (params.get("showAlbumCover") && albumCoverUrl) {
230241
if (params.get("showAlbumCover") != "0") {
231242
const size = params.get("showAlbumCover") < 10 ? 10 : params.get("showAlbumCover");
232243
albumCoverHTML = `<img src="${albumCoverUrl}" height="${size}" width="${size}" />`;
244+
245+
albumCoverHTMLRight = albumCoverHTML;
246+
247+
if (params.get("albumCoverLeft")) {
248+
if (params.get("albumCoverLeft") == "1") {
249+
albumCoverHTMLLeft = albumCoverHTML;
250+
albumCoverHTMLRight = "";
251+
}
252+
}
233253
}
234254
}
235255

236256
if (swapPositions) {
237-
song.innerHTML = `<span class="artist">${artist}</span>${delimiter}<span class="name">${songTitle}</span>` + albumCoverHTML;
257+
song.innerHTML = albumCoverHTMLLeft + `<span class="artist">${artist}</span>${delimiter}<span class="name">${songTitle}</span>` + albumCoverHTMLRight;
238258
} else {
239-
song.innerHTML = `<span class="name" > ${songTitle}</span>${delimiter}<span class="artist">${artist}</span>` + albumCoverHTML;
259+
song.innerHTML = albumCoverHTMLLeft + `<span class="name" > ${songTitle}</span>${delimiter}<span class="artist">${artist}</span>` + albumCoverHTMLRight;
240260
}
241261

242262
if (params.get("marquee")) {

0 commit comments

Comments
 (0)