Skip to content

Commit

Permalink
2.2.7.1 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kajitsy committed Aug 24, 2024
1 parent 4d11ed4 commit c6771c9
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 120 deletions.
2 changes: 1 addition & 1 deletion chromium/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chromium/_locales/es/messages.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chromium/_locales/ru/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extensionDescription": {
"message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7"
"message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7.1"
},
"stgi": {
"message": "Ввести"
Expand Down
2 changes: 1 addition & 1 deletion chromium/manifest.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
96 changes: 40 additions & 56 deletions chromium/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -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 => {
Expand All @@ -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);
});
}
});
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 => {
Expand All @@ -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);
});
}
});
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 => {
Expand All @@ -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"));
});
}
});
Expand Down Expand Up @@ -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';
Expand All @@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -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 => {
Expand All @@ -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);
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion firefox/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion firefox/_locales/es/messages.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion firefox/_locales/ru/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extensionDescription": {
"message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7"
"message": "Быстрый ввод промокодов игр HoYoverse | 2.2.7.1"
},
"stgi": {
"message": "Ввести"
Expand Down
2 changes: 1 addition & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Loading

0 comments on commit c6771c9

Please sign in to comment.