Skip to content

Commit

Permalink
♻️ Refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: SeMiD <[email protected]>
  • Loading branch information
PreMiD-Automations committed Feb 25, 2021
1 parent fe2ca1b commit 235e79e
Show file tree
Hide file tree
Showing 33 changed files with 1,094 additions and 916 deletions.
2 changes: 1 addition & 1 deletion websites/0-9/4anime/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ga_IE": "Féach ar anime ar líne i gcaighdeán ard 1080p le fotheidil Bhéarla. Suí siar agus scíth a ligean!"
},
"url": "4anime.to",
"version": "1.6.0",
"version": "1.6.1",
"logo": "https://premid.is-inside.me/0Ki4Cf2i.png",
"thumbnail": "https://i.imgur.com/Tcf3IMX.png",
"color": "#ff0808",
Expand Down
26 changes: 12 additions & 14 deletions websites/0-9/4anime/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ const presence = new Presence({
});

let lastPlaybackState = null,
playback,
browsingStamp = Math.floor(Date.now() / 1000);
playback,
browsingStamp = Math.floor(Date.now() / 1000);

if (lastPlaybackState != playback) {
lastPlaybackState = playback;
browsingStamp = Math.floor(Date.now() / 1000);
}
presence.on("UpdateData", async () => {
playback =
document.querySelector(".vjs-current-time-display") !== null
? true
: false;
document.querySelector(".vjs-current-time-display") !== null ? true : false;
const presenceData: PresenceData = {
largeImageKey: "logo"
};
Expand All @@ -32,18 +30,18 @@ presence.on("UpdateData", async () => {
presence.setActivity(presenceData, true);
}

const video: HTMLVideoElement =
document.querySelector("#example_video_1_html5_api");
const video: HTMLVideoElement = document.querySelector(
"#example_video_1_html5_api"
);

if (video !== null && !isNaN(video.duration)) {
const series = document.querySelector("a#titleleft"),
seriesTitle = series.textContent,
episode = document.querySelector("span#titleleft").textContent,

timestamps = presence.getTimestamps(
Math.floor(video.currentTime),
Math.floor(video.duration)
);
seriesTitle = series.textContent,
episode = document.querySelector("span#titleleft").textContent,
timestamps = presence.getTimestamps(
Math.floor(video.currentTime),
Math.floor(video.duration)
);
presenceData.smallImageKey = video.paused ? "pause" : "play";
presenceData.smallImageText = video.paused
? (await strings).pause
Expand Down
2 changes: 1 addition & 1 deletion websites/A/Altearn/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"fr": "Altearn est une association à but non-lucratif qui vise à déveloper et mettre en place des solutions et événements dans un but pédagogique, scientifique ou de sensibilisation."
},
"service": "Altearn",
"version": "1.1.0",
"version": "1.1.1",
"logo": "https://i.imgur.com/FXRVkUd.png",
"thumbnail": "https://i.imgur.com/dWA3LHB.png",
"color": "#888888",
Expand Down
30 changes: 17 additions & 13 deletions websites/A/Altearn/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ presence.on("UpdateData", async () => {
presenceData.state = document.title
.replace(" | Altearn", "")
.replace("Assemblée Générale - ", "");
if(button) presenceData.buttons = [
if (button)
presenceData.buttons = [
{
label: "View General Assembly",
url: document.URL
Expand All @@ -44,28 +45,31 @@ presence.on("UpdateData", async () => {
) {
presenceData.details = "Reading an article:";
presenceData.state = document.title.replace(" | Altearn", "");
if(button) presenceData.buttons = [
{
label: "View article",
url: document.URL
}
];
if (window.location.pathname.includes("/author/")) {
presenceData.details = "Looking for an user:";
presenceData.state = document.title.replace(" | Altearn", "");
if(button) presenceData.buttons = [
if (button)
presenceData.buttons = [
{
label: "View user",
label: "View article",
url: document.URL
}
];
if (window.location.pathname.includes("/author/")) {
presenceData.details = "Looking for an user:";
presenceData.state = document.title.replace(" | Altearn", "");
if (button)
presenceData.buttons = [
{
label: "View user",
url: document.URL
}
];
}
if (document.title.includes("Fiche de poste:")) {
presenceData.details = "Viewing a place as";
presenceData.state = document.title
.replace(" | Altearn", "")
.replace("Fiche de poste:", "");
if(button) presenceData.buttons = [
if (button)
presenceData.buttons = [
{
label: "View place",
url: document.URL
Expand Down
2 changes: 1 addition & 1 deletion websites/B/BuildTheEarth/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"en": "We are recreating the entire planet in Minecraft."
},
"service": "BuildTheEarth",
"version": "1.1.0",
"version": "1.1.1",
"logo": "https://i.imgur.com/XvapvDX.png",
"thumbnail": "https://i.imgur.com/YzqC7ju.png",
"color": "#104D92",
Expand Down
13 changes: 7 additions & 6 deletions websites/B/BuildTheEarth/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ presence.on("UpdateData", async () => {
presenceData.state = document.title.replace(" - BuildTheEarth", "");
if (window.location.pathname.length != 1) {
presenceData.details = "Viewing a BuildTeam:";
if(button) presenceData.buttons = [
{
label: "View the team",
url: document.URL
}
];
if (button)
presenceData.buttons = [
{
label: "View the team",
url: document.URL
}
];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion websites/C/Cuevana 3/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"en": "Cuevana 3 is a streaming website where you can watch and download movies and series in spanish, english and subtitled.",
"es": "Cuevana 3 es una pagina web donde puedes ver y descargar películas y series en latino, español, ingles y subtitulado."
},
"version": "1.1.1",
"version": "1.1.2",
"logo": "https://i.imgur.com/uu5XX85.png",
"thumbnail": "https://i.imgur.com/TckG8Jd.png",
"color": "#007AFF",
Expand Down
8 changes: 2 additions & 6 deletions websites/C/Cuevana 3/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ presence.on("UpdateData", async () => {
}

presenceData.buttons = [
{ label: "Ver Película",
url: window.location.href
}
{ label: "Ver Película", url: window.location.href }
];

presence.setActivity(presenceData, !video.paused);
Expand All @@ -71,9 +69,7 @@ presence.on("UpdateData", async () => {
presenceData.smallImageKey = "browsing";
presenceData.smallImageText = (await strings).browsing;
presenceData.buttons = [
{ label: "Ver Episodio",
url: window.location.href
}
{ label: "Ver Episodio", url: window.location.href }
];
presence.setActivity(presenceData);
} else {
Expand Down
2 changes: 1 addition & 1 deletion websites/F/FR-Minecraft/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"fr": "L'actualité Minecraft, des astuces, des outils et toute l'aide necessaire pour jouer à Minecraft !"
},
"service": "FR-Minecraft",
"version": "1.1.0",
"version": "1.1.1",
"logo": "https://i.imgur.com/W33UNTD.png",
"thumbnail": "https://i.imgur.com/XIed4IC.png",
"color": "#4AD818",
Expand Down
Loading

0 comments on commit 235e79e

Please sign in to comment.