diff --git a/browser-addons/manifest-firefox.json b/browser-addons/manifest-firefox.json
new file mode 100644
index 0000000..712be9a
--- /dev/null
+++ b/browser-addons/manifest-firefox.json
@@ -0,0 +1,25 @@
+{
+ "manifest_version": 3,
+ "name": "Funix Extension",
+ "description": "FunixGaming Addon pour ne rien louper ! Lives, vidéos et autres !",
+ "version": "2.0.0",
+ "author": "contact@funixgaming.fr",
+ "homepage_url": "https://funixgaming.fr",
+
+ "permissions": ["notifications"],
+
+ "action": {
+ "default_title": "Funix Addon",
+ "default_popup": "src/html/base.html",
+ "default_icon": "src/icons/app_icon.png"
+ },
+
+ "icons": {
+ "64": "src/icons/app_icon.png"
+ },
+
+ "background": {
+ "scripts": ["src/js/background.js"]
+ }
+ }
+
\ No newline at end of file
diff --git a/browser-addons/manifest.json b/browser-addons/manifest.json
index b742c0c..059ccd9 100644
--- a/browser-addons/manifest.json
+++ b/browser-addons/manifest.json
@@ -1,24 +1,28 @@
{
- "manifest_version": 3,
- "name": "Funix Extension",
- "description": "FunixGaming Addon pour ne rien louper ! Lives, vidéos et autres !",
- "version": "2.0.0",
- "author": "contact@funixgaming.fr",
- "homepage_url": "https://funixgaming.fr",
-
- "permissions": ["notifications"],
-
- "action": {
- "default_title": "Funix Addon",
- "default_popup": "src/html/base.html",
- "default_icon": "src/icons/app_icon.png"
- },
-
- "icons": {
- "64": "src/icons/app_icon.png"
- },
-
- "background": {
- "service_worker": "src/js/background-chrome.js"
+ "manifest_version": 3,
+ "name": "Funix Extension",
+ "description": "FunixGaming Addon pour ne rien louper ! Lives, vidéos et autres !",
+ "version": "2.0.0",
+ "author": "contact@funixgaming.fr",
+ "homepage_url": "https://funixgaming.fr",
+
+ "permissions": ["notifications"],
+
+ "action": {
+ "default_title": "Funix Addon",
+ "default_popup": "src/html/base.html",
+
+ "default_icon": {
+ "64":"src/icons/app_icon.png"
+ }
+ },
+
+ "icons": {
+ "64": "src/icons/app_icon.png"
+ },
+
+ "background": {
+ "service_worker": "src/js/background.js"
+ }
}
-}
+
\ No newline at end of file
diff --git a/browser-addons/src/html/base.html b/browser-addons/src/html/base.html
index 1882fd1..b104a68 100644
--- a/browser-addons/src/html/base.html
+++ b/browser-addons/src/html/base.html
@@ -69,14 +69,14 @@
0
- Hors Lig
+ Hors Ligne
-
+
Rejoindre le live
diff --git a/browser-addons/src/js/background-chrome.js b/browser-addons/src/js/background-chrome.js
deleted file mode 100644
index 5e32c66..0000000
--- a/browser-addons/src/js/background-chrome.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const url = 'https://api.funixgaming.fr/twitch/streams/funix';
-
-let body = {};
-
-function checkStream() {
- fetch(url).then(async response => {
- if (response.ok) {
- body = await response.json();
-
- if (body.data.length === 0) {
- chrome.action.setIcon({
- path: '../icons/app_icon.png'
- });
- } else {
- chrome.action.setIcon({
- path: '../icons/app_icon_live.png'
- });
- }
- }
- });
-}
-
-checkStream();
-setInterval(checkStream, 10000);
diff --git a/browser-addons/src/js/background.js b/browser-addons/src/js/background.js
new file mode 100644
index 0000000..55d816c
--- /dev/null
+++ b/browser-addons/src/js/background.js
@@ -0,0 +1,32 @@
+const url = 'https://api.funixgaming.fr/twitch/streams/funix';
+
+let body = {};
+
+function setIcon(iconPath) {
+ if (navigator.userAgent.indexOf("Firefox") !== -1) {
+ browser.action.setIcon({
+ path: iconPath
+ });
+ } else if (navigator.userAgent.indexOf("Chrome") !== -1) {
+ chrome.action.setIcon({
+ path: iconPath
+ });
+ }
+}
+
+function checkStream() {
+ fetch(url).then(async response => {
+ if (response.ok) {
+ body = await response.json();
+
+ if (body.data.length === 0) {
+ setIcon("/src/icons/app_icon.png");
+ } else {
+ setIcon("/src/icons/app_icon_live.png");
+ }
+ }
+ });
+}
+
+checkStream();
+setInterval(checkStream, 10000);
diff --git a/browser-addons/src/js/twitch-handle-front.js b/browser-addons/src/js/twitch-handle-front.js
index 2cf2c45..e40c95c 100644
--- a/browser-addons/src/js/twitch-handle-front.js
+++ b/browser-addons/src/js/twitch-handle-front.js
@@ -2,6 +2,7 @@ const spanStreamTitle = document.getElementById('twitch-stream-title');
const spanTwitchViewers = document.getElementById('twitch-stream-viewers');
const spanGameName = document.getElementById('twitch-game-name');
const imgMiniaLive = document.getElementById('twitch-stream-minia');
+const joinLiveBtn = document.getElementById('join-live');
const defaultMiniaLive = '../img/offline.png';
const url = 'https://api.funixgaming.fr/twitch/streams/funix';
@@ -26,6 +27,7 @@ function updateLiveHtml(live) {
setText(spanTwitchViewers, live.viewer_count.toString());
setText(spanGameName, live.game_name);
imgMiniaLive.src = live.thumbnail_url.replace("{width}", "990").replace("{height}", "540");
+ joinLiveBtn.hidden = false;
}
function turnOffLive() {