├── .gitignore
├── chrome
├── icons
│ ├── .DS_Store
│ └── blackhole.png
├── manifest.json
└── ft_blackhole.js
├── firefox
├── icons
│ └── blackhole.png
├── manifest.json
└── ft_blackhole.js
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | */.DS_Store
3 |
--------------------------------------------------------------------------------
/chrome/icons/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mohamedhaddi/ft_blackhole/HEAD/chrome/icons/.DS_Store
--------------------------------------------------------------------------------
/chrome/icons/blackhole.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mohamedhaddi/ft_blackhole/HEAD/chrome/icons/blackhole.png
--------------------------------------------------------------------------------
/firefox/icons/blackhole.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mohamedhaddi/ft_blackhole/HEAD/firefox/icons/blackhole.png
--------------------------------------------------------------------------------
/chrome/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "name": "ft_blackhole",
4 | "version": "0.6",
5 | "description": "Shows how many days you have left before you get absorbed by the Blackhole.",
6 | "icons": {
7 | "48": "icons/blackhole.png"
8 | },
9 | "content_scripts": [
10 | {
11 | "matches": [
12 | "https://profile.intra.42.fr/",
13 | "https://profile.intra.42.fr/users/*",
14 | "https://profile.intra.42.fr/users/*/"
15 | ],
16 | "js": [
17 | "ft_blackhole.js"
18 | ]
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/firefox/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 2,
3 | "name": "ft_blackhole",
4 | "version": "0.6",
5 | "description": "Shows how many days you have left before you get absorbed by the Blackhole.",
6 | "icons": {
7 | "48": "icons/blackhole.png"
8 | },
9 | "content_scripts": [
10 | {
11 | "matches": [
12 | "https://profile.intra.42.fr/",
13 | "https://profile.intra.42.fr/users/*",
14 | "https://profile.intra.42.fr/users/*/"
15 | ],
16 | "js": [
17 | "ft_blackhole.js"
18 | ]
19 | }
20 | ],
21 | "browser_specific_settings": {
22 | "gecko": {
23 | "id": "ft_blackhole-0.1@intra.42.fr"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## ⚠️ Unmaintained
2 | I am no longer a user of intra.42.fr, therefore I can no longer maintain this extension.
3 |
4 | # ft_blackhole
5 | A simple extension that shows how many days a user has left until the date of the deadline (Blackhole) on [https://intra.42.fr](https://intra.42.fr) and shows it in right under the date in the *Black Hole absorption* section of their profile.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | If you'd like to use it:
14 |
15 | ### For Chrome
16 | It is available in the [Chrome Web Store](https://chrome.google.com/webstore/detail/ftblackhole/pofhnleglcpmmkkaohhadcmombagfeie/).
17 |
18 | ### For Firefox:
19 | Just download [the latest release](https://github.com/mohamedhaddi/ft_blackhole/releases/latest) file from this repo and upload it to **Menu > Add-ons > Settings cog > Install Add-on From File** in your Firefox browser.
20 |
--------------------------------------------------------------------------------
/chrome/ft_blackhole.js:
--------------------------------------------------------------------------------
1 | const username = document
2 | .getElementsByClassName("login")[0]
3 | .getAttribute("data-login");
4 |
5 | const blackholeDataAPI = "https://profile.intra.42.fr/users/" + username + "/goals?cursus=42cursus";
6 |
7 | fetch(blackholeDataAPI)
8 | .then((res) => res.json())
9 | .then((out) => {
10 | if (Object.getOwnPropertyNames(out).length !== 0) {
11 |
12 | const daysLeft = out['singularity'];
13 |
14 | const statuses = {
15 | 'sad': {cat: "😿", color: "#D8636F"},
16 | 'scared': {cat: "🙀", color: "#F0AD4E"},
17 | 'happy': {cat: "😸", color: "#5CB85C"}
18 | }
19 |
20 | const emotion = (() => {
21 | if (daysLeft <= 15) {
22 | return 'sad';
23 | } else if (daysLeft <= 42) {
24 | return 'scared';
25 | } else {
26 | return 'happy';
27 | }
28 | })();
29 |
30 | const daysLeftDiv = document.createElement("div");
31 |
32 | daysLeftDiv.innerText = daysLeft + ' days left ' + statuses[emotion]["cat"];
33 | daysLeftDiv.style.color = statuses[emotion]["color"];
34 | daysLeftDiv.style.fontSize = "0.7em";
35 | daysLeftDiv.style.fontWeight = "400";
36 | daysLeftDiv.style.animation = "0.42s ease 0s 1 normal none running fadeIn";
37 |
38 | document.getElementById("modern-bh-date").appendChild(daysLeftDiv);
39 |
40 | }
41 | })
42 | .catch((err) => {
43 | throw err;
44 | });
45 |
46 |
--------------------------------------------------------------------------------
/firefox/ft_blackhole.js:
--------------------------------------------------------------------------------
1 | const username = document
2 | .getElementsByClassName("login")[0]
3 | .getAttribute("data-login");
4 |
5 | const blackholeDataAPI = "https://profile.intra.42.fr/users/" + username + "/goals?cursus=42cursus";
6 |
7 | fetch(blackholeDataAPI)
8 | .then((res) => res.json())
9 | .then((out) => {
10 | if (Object.getOwnPropertyNames(out).length !== 0) {
11 |
12 | const daysLeft = out['singularity'];
13 |
14 | const statuses = {
15 | 'sad': {cat: "😿", color: "#D8636F"},
16 | 'scared': {cat: "🙀", color: "#F0AD4E"},
17 | 'happy': {cat: "😸", color: "#5CB85C"}
18 | }
19 |
20 | const emotion = (() => {
21 | if (daysLeft <= 15) {
22 | return 'sad';
23 | } else if (daysLeft <= 42) {
24 | return 'scared';
25 | } else {
26 | return 'happy';
27 | }
28 | })();
29 |
30 | const daysLeftDiv = document.createElement("div");
31 |
32 | daysLeftDiv.innerText = daysLeft + ' days left ' + statuses[emotion]["cat"];
33 | daysLeftDiv.style.color = statuses[emotion]["color"];
34 | daysLeftDiv.style.fontSize = "0.7em";
35 | daysLeftDiv.style.fontWeight = "400";
36 | daysLeftDiv.style.animation = "0.42s ease 0s 1 normal none running fadeIn";
37 |
38 | document.getElementById("modern-bh-date").appendChild(daysLeftDiv);
39 |
40 | }
41 | })
42 | .catch((err) => {
43 | throw err;
44 | });
45 |
46 |
--------------------------------------------------------------------------------