-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Correction de l'ouverture de la page des paramètres
- Loading branch information
1 parent
249ce4f
commit fe68c7c
Showing
1 changed file
with
3 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import * as browser from 'webextension-polyfill'; | ||
|
||
|
||
console.log("Better IUT RCC background task started!"); | ||
console.log("[Better IUT RCC] Background script lancé"); | ||
|
||
|
||
// Ajout d'un listener pour ouvrir la popup/paramètres | ||
browser.runtime.onMessage.addListener(function(request, sender, sendResponse) { | ||
if (request.openOptions) { | ||
const url = browser.runtime.getURL("popup.html"); | ||
if (url.includes("chrome-extension://")) { | ||
try { | ||
console.log("[Better IUT RCC] Opening options page..."); | ||
chrome.action.openPopup(); // Google Chrome 127+ | ||
} catch (e) { | ||
console.log("[Better IUT RCC] Opening options page... (fallback)"); | ||
chrome.browserAction.openPopup(); // Google Chrome 126- | ||
} | ||
} else { | ||
alert("L'ouverture de la page des paramètres n'est pas supportée sur Firefox pour le moment. Veuillez ouvrir la page des paramètres manuellement."); | ||
} | ||
console.info("[Better IUT RCC] Ouverture des paramètres"); | ||
browser.runtime.openOptionsPage() | ||
} | ||
}) |