diff --git a/chromium/_locales/en/messages.json b/chromium/_locales/en/messages.json new file mode 100644 index 0000000..19213f8 --- /dev/null +++ b/chromium/_locales/en/messages.json @@ -0,0 +1,41 @@ +{ + "extensionDescription": { + "message": "With Genshin/Star Rail CodeEntter you can quickly enter promo codes for Genshin Impact and Honkai Star Rail, and you can also share a link to this code :) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" + }, + "submit": { + "message": "Enter" + }, + "share": { + "message": "Share" + }, + "labelgi": { + "message": "Genshin Impact Only:" + }, + "labelHsr": { + "message": "Honkai Star Rail Only:" + }, + "options": { + "message": "Settings" + }, + "submitGI": { + "message": "Genshin" + }, + "submitHSR": { + "message": "Star Rail" + }, + "shareGI": { + "message": "Share GI" + }, + "shareHSR": { + "message": "Share HSR" + }, + "reset": { + "message": "Reset" + }, + "buttonColort": { + "message": "Button color:" + }, + "buttonTextColort": { + "message": "Text color:" + } +} \ No newline at end of file diff --git a/chromium/_locales/es/messages.json b/chromium/_locales/es/messages.json new file mode 100644 index 0000000..e5608d1 --- /dev/null +++ b/chromium/_locales/es/messages.json @@ -0,0 +1,41 @@ +{ + "extensionDescription": { + "message": "Con Genshin/Star Rail CodeEntter puedes ingresar rápidamente códigos promocionales para Genshin Impact y Honkai Star Rail, y también puedes compartir un enlace a este código :) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" + }, + "submit": { + "message": "Ingresar" + }, + "share": { + "message": "Compartir" + }, + "labelgi": { + "message": "Solo Genshin Impact:" + }, + "labelHsr": { + "message": "Solo Honkai Star Rail:" + }, + "options": { + "message": "Configuraciones" + }, + "submitGI": { + "message": "Genshin" + }, + "submitHSR": { + "message": "Star Rail" + }, + "shareGI": { + "message": "Compartir GI" + }, + "shareHSR": { + "message": "Compartir HSR" + }, + "reset": { + "message": "Restablecer" + }, + "buttonColort": { + "message": "Color del botón:" + }, + "buttonTextColort": { + "message": "Color del texto:" + } +} \ No newline at end of file diff --git a/chromium/_locales/jp/messages.json b/chromium/_locales/jp/messages.json new file mode 100644 index 0000000..243da38 --- /dev/null +++ b/chromium/_locales/jp/messages.json @@ -0,0 +1,41 @@ +{ + "extensionDescription": { + "message": "Genshin/Star Rail CodeEntterを使用すると、Genshin ImpactとHonkai Star Railのプロモーションコードをすばやく入力でき、このコードへのリンクを共有することもできます:) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" + }, + "submit": { + "message": "入力" + }, + "share": { + "message": "共有" + }, + "labelgi": { + "message": "Genshin Impactのみ:" + }, + "labelHsr": { + "message": "Honkai Star Railのみ:" + }, + "options": { + "message": "設定" + }, + "submitGI": { + "message": "Genshin" + }, + "submitHSR": { + "message": "Star Rail" + }, + "shareGI": { + "message": "GIを共有" + }, + "shareHSR": { + "message": "HSRを共有" + }, + "reset": { + "message": "リセット" + }, + "buttonColort": { + "message": "ボタンの色:" + }, + "buttonTextColort": { + "message": "テキストの色:" + } +} \ No newline at end of file diff --git a/chromium/_locales/ru/messages.json b/chromium/_locales/ru/messages.json new file mode 100644 index 0000000..47428e6 --- /dev/null +++ b/chromium/_locales/ru/messages.json @@ -0,0 +1,41 @@ +{ + "extensionDescription": { + "message": "Благодаря Genshin/Star Rail CodeEntter вы сможете быстро вводить промокоды для Genshin Impact и Honkai Star Rail, a также можете поделиться ссылкой на этот кодик :) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" + }, + "submit": { + "message": "Ввести" + }, + "share": { + "message": "Поделиться" + }, + "labelgi": { + "message": "Только Genshin Impact:" + }, + "labelHsr": { + "message": "Только Honkai Star Rail:" + }, + "options": { + "message": "Настройки" + }, + "submitGI": { + "message": "Genshin" + }, + "submitHSR": { + "message": "Star Rail" + }, + "shareGI": { + "message": "Поделиться GI" + }, + "shareHSR": { + "message": "Поделиться HSR" + }, + "reset": { + "message": "Сбросить" + }, + "buttonColort": { + "message": "Цвет кнопок:" + }, + "buttonTextColort": { + "message": "Цвет текста:" + } +} \ No newline at end of file diff --git a/chromium/genshincheck.js b/chromium/genshincheck.js new file mode 100644 index 0000000..e822894 --- /dev/null +++ b/chromium/genshincheck.js @@ -0,0 +1,69 @@ +if (typeof browser === "undefined") { + browser = chrome; +} + +const GIHOSTS = [ + { + apiHost: "sg-hk4e-api.hoyolab.com", + page: "act.hoyolab.com/ys/event/signin-sea-v3/index.html" + }, + { + apiHost: "hk4e-api-os.mihoyo.com", + page: "webstatic-sea.mihoyo.com/ys/event/signin-sea/index.html" + } +]; + +var currentGIHosts = GIHOSTS; + +function getCurrDay() { + var now = new Date(); + now.setMinutes(now.getMinutes() + now.getTimezoneOffset()); + now.setHours(now.getHours() + 8); + return Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0); +} + +function request(i, currDay) { + var host = currentGIHosts[i]; + if (typeof host === "undefined") { + currentGIHosts = GIHOSTS; + return; + } + fetch("https://" + host.apiHost + "/event/sol/sign?act_id=e202102251931481", { + method : "POST", + headers: { + "Content-Type": "application/json" + }, + credentials: "include" + }) + .then(response => response.json()) + .then(data => { + if(data.retcode == 0 || data.retcode == -5003) { + browser.storage.local.set({gi_lastCheked: currDay}); + currentGIHosts = [host]; + } else { + console.log("badrequest", data); + request(i + 1); + } + }) + .catch(error => { + console.log("error", error); + request(i + 1); + }); +} + +function check() { + browser.storage.local.get({gi_lastCheked: null}).then(storage => { + var currDay = getCurrDay(); + if (storage.gi_lastCheked != currDay) { + request(0, currDay); + } + }); +} + +browser.alarms.onAlarm.addListener(alarm => { + if (alarm.name == "gi_checker") { + check(); + } +}); + +browser.alarms.create("gi_checker", {when: Date.now(), periodInMinutes: 1}); \ No newline at end of file diff --git a/chromium/hsrcheck.js b/chromium/hsrcheck.js new file mode 100644 index 0000000..132ef44 --- /dev/null +++ b/chromium/hsrcheck.js @@ -0,0 +1,67 @@ +if (typeof browser === "undefined") { + browser = chrome; +} + +const HSRHOSTS = [ + { + apiHost: "sg-public-api.hoyolab.com", + page: "act.hoyolab.com/bbs/event/signin/hkrpg/index.html" + } +]; +var currentHSRHosts = HSRHOSTS; + +function getCurrDay() { + var now = new Date(); + now.setMinutes(now.getMinutes() + now.getTimezoneOffset()); + now.setHours(now.getHours() + 8); + return Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0); +} + +function request(i, currDay) { + var host = currentHSRHosts[i]; + if (typeof host === "undefined") { + currentHSRHosts = HSRHOSTS; + return; + } + fetch("https://" + host.apiHost + "/event/luna/os/sign", { + method : "POST", + headers: { + "Content-Type": "application/json" + }, + credentials: "include", + body: JSON.stringify({ + "act_id": "e202303301540311" + }) + }) + .then(response => response.json()) + .then(data => { + if(data.retcode == 0 || data.retcode == -5003) { + browser.storage.local.set({hsr_lastCheked: currDay}); + currentHSRHosts = [host]; + } else { + console.log("badrequest", data); + request(i + 1); + } + }) + .catch(error => { + console.log("error", error); + request(i + 1); + }); +} + +function check() { + browser.storage.local.get({hsr_lastCheked: null}).then(storage => { + var currDay = getCurrDay(); + if (storage.hsr_lastCheked != currDay) { + request(0, currDay); + } + }); +} + +browser.alarms.onAlarm.addListener(alarm => { + if (alarm.name == "hsr_checker") { + check(); + } +}); + +browser.alarms.create("hsr_checker", {when: Date.now(), periodInMinutes: 1}); \ No newline at end of file diff --git a/chromium/manifest.json b/chromium/manifest.json new file mode 100644 index 0000000..21533c1 --- /dev/null +++ b/chromium/manifest.json @@ -0,0 +1,32 @@ +{ + "manifest_version": 3, + "name": "Genshin/Star Rail CodeEntter", + "version": "1.0.2", + "description": "__MSG_extensionDescription__", + "default_locale": "en", + "icons": { + "512": "/pictures/icon.png" + }, + "permissions": [ + "activeTab", + "cookies", + "storage", + "alarms" + ], + "host_permissions": [ + "*://*.hoyoverse.com/", + "*://*.mihoyo.com/*", + "*://*.hoyolab.com/*" + ], + "action": { + "default_icon": "/pictures/icon.png", + "default_title": "CodeEntter" + }, + "options_ui": { + "page": "options.html", + "open_in_tab": false + }, + "background": { + "service_worker": "script_imports.js" + } +} \ No newline at end of file diff --git a/chromium/onlyGi.html b/chromium/onlyGi.html new file mode 100644 index 0000000..754bf6f --- /dev/null +++ b/chromium/onlyGi.html @@ -0,0 +1,88 @@ + + + + + + + +
+ + +
+
+ + +
+ + + + \ No newline at end of file diff --git a/chromium/onlyGi.js b/chromium/onlyGi.js new file mode 100644 index 0000000..460bb5f --- /dev/null +++ b/chromium/onlyGi.js @@ -0,0 +1,77 @@ +if (typeof browser === "undefined") { + browser = chrome; +} + +['submit', 'share', 'options'].forEach(function (buttonId) { + const buttonElement = document.getElementById(buttonId); + if (buttonElement) { + buttonElement.textContent = browser.i18n.getMessage(buttonId); + + buttonElement.addEventListener('click', function () { + const code = document.getElementById('code').value; + let url; + + switch (buttonId) { + case 'submit': + const locales = navigator.language.slice(0, 2); + url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; + document.getElementById('frame').src = url; + break; + + case 'share': + const shareLocales = navigator.language.slice(0, 2); + url = `https://genshin.hoyoverse.com/${shareLocales}/gift?code=${code}`; + navigator.clipboard.writeText(url); + displayOverlay(); + break; + + case 'options': + window.location.href = 'options.html'; + break; + + default: + break; + } + + if (buttonId === 'submit') { + const frame = document.getElementById('frame'); + frame.style.display = 'block'; + document.getElementById('code').style.display = 'none'; + document.getElementById('submit').style.display = 'none'; + document.getElementById('share').style.display = 'none'; + document.getElementById('options').style.display = 'none'; + } + }); + } +}); + +function displayOverlay() { + const overlay = document.createElement('div'); + overlay.style.position = 'fixed'; + overlay.style.top = 0; + overlay.style.left = 0; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; + overlay.style.color = 'white'; + overlay.style.display = 'flex'; + overlay.style.justifyContent = 'center'; + overlay.style.alignItems = 'center'; + overlay.style.fontSize = '1em'; + overlay.textContent = 'The Link Has Been Copied'; + overlay.style.display = 'flex'; + document.body.appendChild(overlay); + + setTimeout(function () { + overlay.style.display = 'none'; + }, 2000); +} + +browser.storage.local.get(['buttonColor', 'buttonTextColor']).then(function (result) { + if (result.buttonColor) { + document.documentElement.style.setProperty('--button-color', result.buttonColor); + } + if (result.buttonTextColor) { + document.documentElement.style.setProperty('--button-text-color', result.buttonTextColor); + } +}); \ No newline at end of file diff --git a/chromium/onlyHsr.html b/chromium/onlyHsr.html new file mode 100644 index 0000000..fbb10af --- /dev/null +++ b/chromium/onlyHsr.html @@ -0,0 +1,88 @@ + + + + + + + +
+ + +
+
+ + +
+ + + + \ No newline at end of file diff --git a/chromium/onlyHsr.js b/chromium/onlyHsr.js new file mode 100644 index 0000000..a2ae666 --- /dev/null +++ b/chromium/onlyHsr.js @@ -0,0 +1,74 @@ +if (typeof browser === "undefined") { + browser = chrome; +} +['submit', 'share', 'options'].forEach(function (buttonId) { + const buttonElement = document.getElementById(buttonId); + if (buttonElement) { + buttonElement.textContent = browser.i18n.getMessage(buttonId); + + buttonElement.addEventListener('click', function () { + const code = document.getElementById('code').value; + let url; + + switch (buttonId) { + case 'submit': + url = `https://hsr.hoyoverse.com/gift?code=${code}`; + document.getElementById('frame').src = url; + break; + + case 'share': + url = `https://hsr.hoyoverse.com/gift?code=${code}`; + navigator.clipboard.writeText(url); + displayOverlay(); + break; + + case 'options': + window.location.href = 'options.html'; + break; + + default: + break; + } + + if (buttonId === 'submit') { + const frame = document.getElementById('frame'); + frame.style.display = 'block'; + document.getElementById('code').style.display = 'none'; + document.getElementById('submit').style.display = 'none'; + document.getElementById('share').style.display = 'none'; + document.getElementById('options').style.display = 'none'; + } + }); + } +}); + +function displayOverlay() { + const overlay = document.createElement('div'); + overlay.style.position = 'fixed'; + overlay.style.top = 0; + overlay.style.left = 0; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; + overlay.style.color = 'white'; + overlay.style.display = 'flex'; + overlay.style.justifyContent = 'center'; + overlay.style.alignItems = 'center'; + overlay.style.fontSize = '1em'; + overlay.textContent = 'The Link Has Been Copied'; + overlay.style.display = 'flex'; + document.body.appendChild(overlay); + + setTimeout(function () { + overlay.style.display = 'none'; + }, 2000); +} + +browser.storage.local.get(['buttonColor', 'buttonTextColor']).then(function (result) { + if (result.buttonColor) { + document.documentElement.style.setProperty('--button-color', result.buttonColor); + } + if (result.buttonTextColor) { + document.documentElement.style.setProperty('--button-text-color', result.buttonTextColor); + } +}); \ No newline at end of file diff --git a/chromium/options.html b/chromium/options.html new file mode 100644 index 0000000..883bed5 --- /dev/null +++ b/chromium/options.html @@ -0,0 +1,99 @@ + + + + + + + + + + + +
+ + +
+
+ + +
+ + + + \ No newline at end of file diff --git a/chromium/options.js b/chromium/options.js new file mode 100644 index 0000000..8a46c6e --- /dev/null +++ b/chromium/options.js @@ -0,0 +1,83 @@ +if (typeof browser === "undefined") { + browser = chrome; +} + +document.getElementById('labelGi').textContent = browser.i18n.getMessage("labelGi"); +document.getElementById('labelHsr').textContent = browser.i18n.getMessage("labelHsr"); +document.getElementById('reset').textContent = browser.i18n.getMessage("reset"); +document.getElementById('buttonColort').textContent = browser.i18n.getMessage("buttonColort"); +document.getElementById('buttonTextColort').textContent = browser.i18n.getMessage("buttonTextColort"); +document.getElementById('buttonColor').addEventListener('input', function() { + var buttonColor = document.getElementById('buttonColor').value; + browser.storage.local.set({ + buttonColor: buttonColor + }, function() { + updateButtonColors(buttonColor, null); + }); +}); + +document.getElementById('buttonTextColor').addEventListener('input', function() { + var buttonTextColor = document.getElementById('buttonTextColor').value; + browser.storage.local.set({ + buttonTextColor: buttonTextColor + }, function() { + updateButtonColors(null, buttonTextColor); + }); +}); + +document.getElementById('onlyHsr').addEventListener('change', function() { + var onlyHsr = document.getElementById('onlyHsr').checked; + browser.storage.local.set({ + onlyHsr: onlyHsr + }); +}); + +document.getElementById('onlyGi').addEventListener('change', function() { + var onlyGi = document.getElementById('onlyGi').checked; + browser.storage.local.set({ + onlyGi: onlyGi + }); +}); + +document.getElementById('reset').addEventListener('click', function() { + var defaultButtonColor = '#9a609a'; + var defaultButtonTextColor = '#ffffff'; + var defaultOnlyHsr = false; + var defaultOnlyGi = false; + document.getElementById('buttonColor').value = defaultButtonColor; + document.getElementById('buttonTextColor').value = defaultButtonTextColor; + document.getElementById('onlyHsr').checked = defaultOnlyHsr; + document.getElementById('onlyGi').checked = defaultOnlyGi; + browser.storage.local.set({ + buttonColor: defaultButtonColor, + buttonTextColor: defaultButtonTextColor, + onlyHsr: defaultOnlyHsr, + onlyGi: defaultOnlyGi + }, function() { + updateButtonColors(defaultButtonColor, defaultButtonTextColor); + }); +}); + +function updateButtonColors(buttonColor, buttonTextColor) { + var buttons = document.getElementsByTagName('button'); + for (var i = 0; i < buttons.length; i++) { + if (buttonColor) { + buttons[i].style.backgroundColor = buttonColor; + } + if (buttonTextColor) { + buttons[i].style.color = buttonTextColor; + } + } +} + +browser.storage.local.get(['buttonColor', 'buttonTextColor', 'onlyHsr', 'onlyGi'], function(result) { + var buttonColor = result.buttonColor ? result.buttonColor : '#9a609a'; + var buttonTextColor = result.buttonTextColor ? result.buttonTextColor : '#ffffff'; + var onlyHsr = result.onlyHsr ? result.onlyHsr : false; + var onlyGi = result.onlyGi ? result.onlyGi : false; + document.getElementById('buttonColor').value = buttonColor; + document.getElementById('buttonTextColor').value = buttonTextColor; + document.getElementById('onlyHsr').checked = onlyHsr; + document.getElementById('onlyGi').checked = onlyGi; + updateButtonColors(buttonColor, buttonTextColor); +}); diff --git a/chromium/options_background.js b/chromium/options_background.js new file mode 100644 index 0000000..3fee6a2 --- /dev/null +++ b/chromium/options_background.js @@ -0,0 +1,51 @@ +chrome.storage.onChanged.addListener(function(changes, areaName) { + if (areaName === 'local' && 'onlyGi' in changes) { + if (changes.onlyGi.newValue) { + chrome.action.setPopup({ + popup: 'onlyGi.html' + }); + } else { + chrome.action.setPopup({ + popup: 'popup.html' + }); + } + } +}); + +chrome.storage.onChanged.addListener(function(changes, areaName) { + if (areaName === 'local' && 'onlyHsr' in changes) { + if (changes.onlyHsr.newValue) { + chrome.action.setPopup({ + popup: 'onlyHsr.html' + }); + } else { + chrome.action.setPopup({ + popup: 'popup.html' + }); + } + } +}); + +chrome.storage.local.get('onlyGi', function(result) { + if (result.onlyGi) { + chrome.action.setPopup({ + popup: 'onlyGi.html' + }); + } else { + chrome.action.setPopup({ + popup: 'popup.html' + }); + } +}); + +chrome.storage.local.get('onlyHsr', function(result) { + if (result.onlyHsr) { + chrome.action.setPopup({ + popup: 'onlyHsr.html' + }); + } else { + chrome.action.setPopup({ + popup: 'popup.html' + }); + } +}); \ No newline at end of file diff --git a/chromium/pictures/background.png b/chromium/pictures/background.png new file mode 100644 index 0000000..70aef99 Binary files /dev/null and b/chromium/pictures/background.png differ diff --git a/chromium/pictures/backgroundGI.png b/chromium/pictures/backgroundGI.png new file mode 100644 index 0000000..8d0611f Binary files /dev/null and b/chromium/pictures/backgroundGI.png differ diff --git a/chromium/pictures/backgroundHSR.png b/chromium/pictures/backgroundHSR.png new file mode 100644 index 0000000..59e8e07 Binary files /dev/null and b/chromium/pictures/backgroundHSR.png differ diff --git a/chromium/pictures/backgroundOptions.png b/chromium/pictures/backgroundOptions.png new file mode 100644 index 0000000..1cc26fd Binary files /dev/null and b/chromium/pictures/backgroundOptions.png differ diff --git a/chromium/pictures/icon.png b/chromium/pictures/icon.png new file mode 100644 index 0000000..f85c0d3 Binary files /dev/null and b/chromium/pictures/icon.png differ diff --git a/chromium/popup.html b/chromium/popup.html new file mode 100644 index 0000000..b4787eb --- /dev/null +++ b/chromium/popup.html @@ -0,0 +1,91 @@ + + + + + + + +
+ + +
+
+ + +
+
+ + +
+ + + + \ No newline at end of file diff --git a/chromium/popup.js b/chromium/popup.js new file mode 100644 index 0000000..ad3ad63 --- /dev/null +++ b/chromium/popup.js @@ -0,0 +1,93 @@ +if (typeof browser === "undefined") { + browser = chrome; +} + +document.body.style.backgroundImage = "url(/pictures/background.png)"; +['submitGI', 'shareGI', 'submitHSR', 'shareHSR', 'options'].forEach(function (buttonId) { + const buttonElement = document.getElementById(buttonId); + if (buttonElement) { + buttonElement.textContent = browser.i18n.getMessage(buttonId); + + buttonElement.addEventListener('click', function () { + const code = document.getElementById('code').value; + let url; + + switch (buttonId) { + case 'submitGI': + const locales = navigator.language.slice(0, 2); + document.body.style.backgroundImage = "url(/pictures/backgroundGI.png)"; + url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; + document.getElementById('frame').src = url; + break; + + case 'shareGI': + const shareLocales = navigator.language.slice(0, 2); + url = `https://genshin.hoyoverse.com/${shareLocales}/gift?code=${code}`; + navigator.clipboard.writeText(url); + displayOverlay(); + break; + + case 'submitHSR': + url = `https://hsr.hoyoverse.com/gift?code=${code}`; + document.body.style.backgroundImage = "url(/pictures/backgroundHSR.png)"; + document.getElementById('frame').src = url; + break; + + case 'shareHSR': + url = `https://hsr.hoyoverse.com/gift?code=${code}`; + navigator.clipboard.writeText(url); + displayOverlay(); + break; + + case 'options': + window.location.href = 'options.html'; + break; + + default: + break; + } + + if (buttonId === 'submitGI' || buttonId === 'submitHSR') { + const frame = document.getElementById('frame'); + frame.style.display = 'block'; + document.getElementById('code').style.display = 'none'; + document.getElementById('submitGI').style.display = 'none'; + document.getElementById('shareGI').style.display = 'none'; + document.getElementById('submitHSR').style.display = 'none'; + document.getElementById('shareHSR').style.display = 'none'; + document.getElementById('options').style.display = 'none'; + } + }); + } +}); + +function displayOverlay() { + const overlay = document.createElement('div'); + overlay.style.position = 'fixed'; + overlay.style.top = 0; + overlay.style.left = 0; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; + overlay.style.color = 'white'; + overlay.style.display = 'flex'; + overlay.style.justifyContent = 'center'; + overlay.style.alignItems = 'center'; + overlay.style.fontSize = '1em'; + overlay.textContent = 'The Link Has Been Copied'; + overlay.style.display = 'flex'; + document.body.appendChild(overlay); + + setTimeout(function () { + overlay.style.display = 'none'; + }, 2000); +} + +browser.storage.local.get(['buttonColor', 'buttonTextColor']).then(function (result) { + if (result.buttonColor) { + document.documentElement.style.setProperty('--button-color', result.buttonColor); + } + if (result.buttonTextColor) { + document.documentElement.style.setProperty('--button-text-color', result.buttonTextColor); + } +}); \ No newline at end of file diff --git a/chromium/script_imports.js b/chromium/script_imports.js new file mode 100644 index 0000000..8d70999 --- /dev/null +++ b/chromium/script_imports.js @@ -0,0 +1,5 @@ +try { + importScripts("options_background.js", "genshincheck.js", "hsrcheck.js"); + } catch (e) { + console.log(e); + } \ No newline at end of file