From c6771c9d954031bfe6dcf28549919f63b4f10182 Mon Sep 17 00:00:00 2001 From: Kajitsy Date: Sun, 25 Aug 2024 00:01:50 +0300 Subject: [PATCH] 2.2.7.1 Update --- chromium/_locales/en/messages.json | 2 +- chromium/_locales/es/messages.json | 2 +- chromium/_locales/ru/messages.json | 2 +- chromium/manifest.json | 2 +- chromium/popup.js | 96 +++++++++++++----------------- firefox/_locales/en/messages.json | 2 +- firefox/_locales/es/messages.json | 2 +- firefox/_locales/ru/messages.json | 2 +- firefox/manifest.json | 2 +- firefox/popup.js | 96 +++++++++++++----------------- 10 files changed, 88 insertions(+), 120 deletions(-) diff --git a/chromium/_locales/en/messages.json b/chromium/_locales/en/messages.json index 04ea366..6ad3ab8 100644 --- a/chromium/_locales/en/messages.json +++ b/chromium/_locales/en/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Quick input of promo codes for HoYoverse games | 2.2.7" + "message": "Quick input of promo codes for HoYoverse games | 2.2.7.1" }, "stgi": { "message": "Submit" diff --git a/chromium/_locales/es/messages.json b/chromium/_locales/es/messages.json index cde1739..fd667b4 100644 --- a/chromium/_locales/es/messages.json +++ b/chromium/_locales/es/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Entrada rápida de códigos promocionales para juegos de HoYoverse | 2.2.7" + "message": "Entrada rápida de códigos promocionales para juegos de HoYoverse | 2.2.7.1" }, "stgi": { "message": "Enviar" diff --git a/chromium/_locales/ru/messages.json b/chromium/_locales/ru/messages.json index 9e52011..e81b596 100644 --- a/chromium/_locales/ru/messages.json +++ b/chromium/_locales/ru/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7" + "message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7.1" }, "stgi": { "message": "Ввести" diff --git a/chromium/manifest.json b/chromium/manifest.json index d2ad6da..2b6fff5 100644 --- a/chromium/manifest.json +++ b/chromium/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "HoYoverse CodeEnter", - "version": "2.2.7", + "version": "2.2.7.1", "description": "__MSG_extensionDescription__", "default_locale": "en", "icons": { diff --git a/chromium/popup.js b/chromium/popup.js index 1fb30cc..36ea073 100644 --- a/chromium/popup.js +++ b/chromium/popup.js @@ -3,8 +3,8 @@ const frame = document.getElementById('frame'); const codeElement = document.getElementById('code'); const overlay = document.getElementById('displayOverlay'); effectVision = true; -function displayOverlay() { - overlay.textContent = chrome.i18n.getMessage("displayOverlay") +function displayOverlay(text) { + overlay.textContent = text overlay.style.display = 'flex'; setTimeout(() => { overlay.style.display = 'none'; @@ -30,7 +30,7 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result case 'sehsr': url = `https://hsr.hoyoverse.com/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -77,13 +77,12 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -96,24 +95,21 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(chrome.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(chrome.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } }); @@ -149,7 +145,7 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result case 'sezzz': url = `https://zenless.hoyoverse.com/redemption?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -196,13 +192,12 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -215,24 +210,21 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(chrome.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(chrome.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } }); @@ -267,7 +259,7 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result case 'segi': url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -314,13 +306,12 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -333,24 +324,21 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(chrome.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(chrome.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error")); }); } }); @@ -458,7 +446,7 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result case 'shareGI': url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; case 'submitHSR': gameBiz = 'hkrpg_global'; @@ -467,7 +455,7 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result case 'shareHSR': url = `https://hsr.hoyoverse.com/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; case 'submitZZZ': gameBiz = 'nap_global'; @@ -476,7 +464,7 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result case 'shareZZZ': url = `https://zenless.hoyoverse.com/redemption?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -523,13 +511,12 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -542,24 +529,21 @@ chrome.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (result if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(chrome.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(chrome.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(chrome.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(chrome.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(chrome.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } }); diff --git a/firefox/_locales/en/messages.json b/firefox/_locales/en/messages.json index 04ea366..6ad3ab8 100644 --- a/firefox/_locales/en/messages.json +++ b/firefox/_locales/en/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Quick input of promo codes for HoYoverse games | 2.2.7" + "message": "Quick input of promo codes for HoYoverse games | 2.2.7.1" }, "stgi": { "message": "Submit" diff --git a/firefox/_locales/es/messages.json b/firefox/_locales/es/messages.json index cde1739..fd667b4 100644 --- a/firefox/_locales/es/messages.json +++ b/firefox/_locales/es/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Entrada rápida de códigos promocionales para juegos de HoYoverse | 2.2.7" + "message": "Entrada rápida de códigos promocionales para juegos de HoYoverse | 2.2.7.1" }, "stgi": { "message": "Enviar" diff --git a/firefox/_locales/ru/messages.json b/firefox/_locales/ru/messages.json index 9e52011..e81b596 100644 --- a/firefox/_locales/ru/messages.json +++ b/firefox/_locales/ru/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7" + "message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7.1" }, "stgi": { "message": "Ввести" diff --git a/firefox/manifest.json b/firefox/manifest.json index 0e509bf..1aa7bb7 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "HoYoverse CodeEnter", - "version": "2.2.7", + "version": "2.2.7.1", "description": "__MSG_extensionDescription__", "default_locale": "en", "icons": { diff --git a/firefox/popup.js b/firefox/popup.js index 9a77e07..85be79d 100644 --- a/firefox/popup.js +++ b/firefox/popup.js @@ -3,8 +3,8 @@ const frame = document.getElementById('frame'); const codeElement = document.getElementById('code'); const overlay = document.getElementById('displayOverlay'); effectVision = true; -function displayOverlay() { - overlay.textContent = browser.i18n.getMessage("displayOverlay") +function displayOverlay(text) { + overlay.textContent = text overlay.style.display = 'flex'; setTimeout(() => { overlay.style.display = 'none'; @@ -30,7 +30,7 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul case 'sehsr': url = `https://hsr.hoyoverse.com/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -77,13 +77,12 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -96,24 +95,21 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(browser.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(browser.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } }); @@ -149,7 +145,7 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul case 'sezzz': url = `https://zenless.hoyoverse.com/redemption?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -196,13 +192,12 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -215,24 +210,21 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(browser.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(browser.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } }); @@ -267,7 +259,7 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul case 'segi': url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -314,13 +306,12 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -333,24 +324,21 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(browser.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(browser.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } }); @@ -458,7 +446,7 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul case 'shareGI': url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; case 'submitHSR': gameBiz = 'hkrpg_global'; @@ -467,7 +455,7 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul case 'shareHSR': url = `https://hsr.hoyoverse.com/gift?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; case 'submitZZZ': gameBiz = 'nap_global'; @@ -476,7 +464,7 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul case 'shareZZZ': url = `https://zenless.hoyoverse.com/redemption?code=${code}`; navigator.clipboard.writeText(url); - displayOverlay(); + displayOverlay(chrome.i18n.getMessage("displayOverlay")); break; default: break; @@ -523,13 +511,12 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }) .catch(error => { @@ -542,24 +529,21 @@ browser.storage.local.get(['onlyHsr', 'onlyGi', 'onlyZzz']).then(function (resul if (index === data.data.list.length - 1) { if (successful > 0 && failed === 0) { - alert(browser.i18n.getMessage("success_all")); + displayOverlay(chrome.i18n.getMessage("success_all")); } else if (successful === 0 && failed > 0) { - alert(browser.i18n.getMessage("fail_all")); + displayOverlay(chrome.i18n.getMessage("fail_all")); } else { - alert(browser.i18n.getMessage("partial_success", [successful, failed])); + displayOverlay(chrome.i18n.getMessage("partial_success", [successful, failed])); } - window.close(); } }); }); } else { - alert(browser.i18n.getMessage("account_data_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("account_data_error")); } }) .catch(error => { - alert(browser.i18n.getMessage("api_request_error")); - window.close(); + displayOverlay(chrome.i18n.getMessage("api_request_error"), error); }); } });