Skip to content

Commit

Permalink
📰 9/11 update
Browse files Browse the repository at this point in the history
  • Loading branch information
N0chteil committed Sep 9, 2021
1 parent f22dc61 commit dbcdd61
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
package-lock.json
app/
/app/
Binary file added assets/app/usaflag.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/app/usaflag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion covers.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,18 @@
"classical in spatial audio": "cover_classical_in_spatial_audio",
"jazz in spatial audio": "cover_jazz_in_spatial_audio"
},
"song": {}
"song": {
"alan jackson": {
"where were you": "cover_911",
"where were you (when the world stopped turning)": "cover_911"
},
"beyoncé": {
"i was here": "cover_911"
},
"toby keith": {
"courtesy of the red, white and blue (the angry american)": "cover_911",
"courtesy of the red, white and blue": "cover_911",
"american soldier": "cover_911"
}
}
}
37 changes: 31 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@
}}),
appData = new Store({name: "data", defaults: {
userCountUsageAsked: false,
appleEventAsked: false
nineelevenAsked: false,
appleEventAsked: false,
nineelevenCovers: false
}}),
song = {
name: document.querySelector("#songname"),
Expand Down Expand Up @@ -181,6 +183,31 @@
]);
}

if(!appData.get("nineelevenAsked") && (new Date().getMonth() + 1 === 9 && new Date().getDate() === 11)) {
newModal(langString.settings.modal["911"].title, langString.settings.modal["911"].description.replace("%s", marked(`\n* <a class="underline" onclick="openUrl('itmss://music.apple.com/de/album/drive/255369588')">Where Were You - Alan Jackson</a>\n* <a class="underline" onclick="openUrl('itmss://music.apple.com/us/album/4-expanded-edition/626204707')">I Was Here - Beyoncé</a>\n* <a class="underline" onclick="openUrl('itmss://music.apple.com/us/album/35-biggest-hits/1452801021')">Courtesy Of The Red, White And Blue - Toby Keith</a>\n* <a class="underline" onclick="openUrl('itmss://music.apple.com/us/album/35-biggest-hits/1452801021')">American Soldier - Toby Keith</a>`)), [
{
text: langString.settings.modal.buttons.okay,
style: "btn-usaflag",
events: [
{
name: "onclick",
value: "appData.set('nineelevenCovers', false), appData.set('nineelevenAsked', true), closeModal(this.parentElement.id)"
}
]
},
{
text: langString.settings.modal["911"].buttons.okcover,
style: "btn-usaflag",
events: [
{
name: "onclick",
value: "appData.set('nineelevenCovers', true), appData.set('nineelevenAsked', true), closeModal(this.parentElement.id)"
}
]
}
], []);
}

if(!appData.get("appleEventAsked") && (+new Date('9/14/2021 12:00:00 AM UTC') <= Date.now() && Date.now() < +new Date('9/14/2021 6:30:00 PM UTC'))) {
const date = new Date('9/14/2021 5:00:00 PM UTC'),
url = "https://www.apple.com/apple-events/"
Expand Down Expand Up @@ -323,7 +350,7 @@
e.title.classList.add("title");
e.description.classList.add("description");

e.title.textContent = title;
e.title.innerHTML = title;
e.description.innerHTML = description;

e.modal.id = generateEleId();
Expand All @@ -334,7 +361,7 @@
ele = document.createElement("li");

ele.style["text-align"] = "left";
ele.textContent = ext;
ele.innerHTML = ext;

e.modal.appendChild(ele);
}
Expand All @@ -348,7 +375,7 @@
ele.classList.add("btn");
ele.classList.add(btn.style);
if(i === 2) ele.classList.add("btn-last");
ele.textContent = btn.text;
ele.innerHTML = btn.text;

if(btn.events) {
for (let i2 = 0; i2 < buttons[i].events.length; i2++) {
Expand Down Expand Up @@ -403,8 +430,6 @@
result += characters.charAt(Math.floor(Math.random() * characters.length));
}

console.log(result)

return result;
}

Expand Down
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const iTunesEmitter = iTunes.emitter,
language: "en_US",
rpcDetails: "%title% - %album%",
rpcState: "%artist%"
}}),
appData = new Store({name: "data", defaults: {
userCountUsageAsked: false,
nineelevenAsked: false,
appleEventAsked: false,
nineelevenCovers: false
}});

console.log = log.log;
Expand Down Expand Up @@ -338,12 +344,14 @@ function isEqual(obj1, obj2) {
}

function checkCover(ct) {
if(!ct) return;
if(!config.get("showAlbumCover")) return presenceData.largeImageKey = "applemusic-logo";
if(appData.get("nineelevenCovers") && (new Date().getMonth() + 1 === 9 && new Date().getDate() === 11)) return presenceData.largeImageKey = "cover_911";

if(covers.album[ct.album.toLowerCase()]) presenceData.largeImageKey = covers.album[ct.album.toLowerCase()];
else if(covers.song[ct.name.toLowerCase()]) presenceData.largeImageKey = covers.song[ct.name.toLowerCase()];
else if(covers.song[ct.album.toLowerCase()]) presenceData.largeImageKey = covers.song[ct.album.toLowerCase()];
else if(presenceData.largeImageKey !== "applemusic-logo") presenceData.largeImageKey = "applemusic-logo";
else if(covers.song[ct.artist.toLowerCase()]) {
if(covers.song[ct.artist.toLowerCase()][ct.name.toLowerCase()]) presenceData.largeImageKey = covers.song[ct.artist.toLowerCase()][ct.name.toLowerCase()];
} else if(presenceData.largeImageKey !== "applemusic-logo") presenceData.largeImageKey = "applemusic-logo";
}

function replaceRPCVars(ct, cfg) {
Expand Down
7 changes: 7 additions & 0 deletions language/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
"title": "User-Zählung",
"description": "Dürfen wir unseren User-Counter durch Deine Installierung der App für unsere Statistiken aktualisieren? Wir senden beziehungsweise speichern keine persönlichen Informationen über Dich."
},
"911": {
"title": "Zum Gedenken an die Opfer des 11. September",
"description": "Zu Ehren der Opfer des 11. Septembers haben wir für diese Songs individuelle Albumcover erstellt: %s\nUnd wenn du möchtest, kannst du alle deine Covers ändern (nur für heute).",
"buttons": {
"okcover": "Okay, ändere die Covers!"
}
},
"appleEvent": {
"title": "Nicht vergessen!",
"description": "Heute um %d Uhr (10.00 Uhr PDT) ist das Apple Event! Schaue es hier live: %s",
Expand Down
10 changes: 9 additions & 1 deletion language/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@
"modal": {
"usercount": {
"title": "User-Counting",
"description": "May we update our user counter by your installation of the app for our statistics? We do not send respectively store any personal information about you.",
"description": "May we update our user counter by your installation of the app for our statistics? We do not send respectively store any personal information about you."
},
"911": {
"title": "In memory of the victims of September 11",
"description": "To honor those who died on September 11 we added some custom album covers for these songs: %s\nAnd when you want, you can change all of the covers (only for today).",
"buttons": {
"okcover": "Okay, change the covers!"
}
},
"appleEvent": {
"title": "Do not forget!",
"description": "Today at %d o'clock (10a.m. PDT) is the Apple Event! Watch it live here: %s",
Expand Down
19 changes: 16 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ body[data-theme="dark"] {
color: #ffffff8c;
}

a.underline {
text-decoration: underline;
}

input:focus, select:focus {
outline: none;
}
Expand Down Expand Up @@ -194,6 +198,10 @@ div.modal {
max-height: 60%;
}

div.modal::-webkit-scrollbar {
width: 0;
}

body.modalIsOpen div.content {
filter: blur(5px) grayscale(90%);
user-select: none;
Expand Down Expand Up @@ -273,9 +281,14 @@ div.modal .btn.btn-rainbow {
background-image: linear-gradient(90deg, #00C0FF 0%, #FFCF00 49%, #FC4F4F 80%, #00C0FF 100%);
}

div.modal .btn.btn-rainbow:hover {
background-image: linear-gradient(90deg, #00C0FF 0%, #FFCF00 49%, #FC4F4F 80%, #00C0FF 100%);
animation: slidebg 5s linear infinite;
div.modal .btn.btn-usaflag {
background-image: url("assets/app/usaflag.png");
background-size: cover;
transition: .4s background-image;
}

div.modal .btn.btn-usaflag:hover {
background-image: url("assets/app/usaflag.gif");
}

div.setting input[type="text"], div.setting select {
Expand Down

0 comments on commit dbcdd61

Please sign in to comment.