diff --git a/chromium/_locales/en/messages.json b/chromium/_locales/en/messages.json index 52b5f54..b69aa70 100644 --- a/chromium/_locales/en/messages.json +++ b/chromium/_locales/en/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Quick entry of Genshin Impact/Honkai: Star Rail promo codes | 2.2.2.1" + "message": "Quick entry of Genshin Impact/Honkai: Star Rail promo codes | 2.2.3" }, "submit": { "message": "Submit" @@ -32,10 +32,10 @@ "reset": { "message": "Reset" }, - "buttonColort": { + "labelButtonColor": { "message": "Button Color" }, - "buttonTextColort": { + "labelTextColor": { "message": "Text Color" }, "labelBackground": { @@ -46,5 +46,23 @@ }, "displayOverlay" :{ "message": "Link copied" + }, + "labelGlobal": { + "message": "Global settings" + }, + "labelMainPopup": { + "message": "Main popup settings" + }, + "labelOnlyGi": { + "message": "Popup settings, only Genshin Impact" + }, + "labelOnlyHsr": { + "message": "Popup settings, Honkai Star Rail only" + }, + "labelRounding": { + "message": "Disable roundings" + }, + "labelSnow": { + "message": "Turn off the snowfall" } } \ No newline at end of file diff --git a/chromium/_locales/es/messages.json b/chromium/_locales/es/messages.json index c59b209..ec6691a 100644 --- a/chromium/_locales/es/messages.json +++ b/chromium/_locales/es/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Entrada rápida de los códigos promocionales de Genshin Impact/Honkai: Star Rail | 2.2.2.1" + "message": "Entrada rápida de los códigos promocionales de Genshin Impact/Honkai: Star Rail | 2.2.3" }, "submit": { "message": "Enviar" @@ -32,10 +32,10 @@ "reset": { "message": "Reiniciar" }, - "buttonColort": { + "labelButtonColor": { "message": "Color de botones" }, - "buttonTextColort": { + "labelTextColor": { "message": "Color de texto" }, "labelBackground": { @@ -46,5 +46,23 @@ }, "displayOverlay" :{ "message": "Enlace copiado" + }, + "labelGlobal": { + "message": "Configuración global" + }, + "labelMainPopup": { + "message": "Configuración de la ventana principal" + }, + "labelOnlyGi": { + "message": "Ajustes de ventana, sólo Genshin Impact" + }, + "labelOnlyHsr": { + "message": "Ajustes de ventana, sólo Honkai Star Rail" + }, + "labelRounding": { + "message": "Desactivar el redondeo" + }, + "labelSnow": { + "message": "Apagar la nevada" } } \ No newline at end of file diff --git a/chromium/_locales/jp/messages.json b/chromium/_locales/jp/messages.json index c8cf934..47e0604 100644 --- a/chromium/_locales/jp/messages.json +++ b/chromium/_locales/jp/messages.json @@ -29,10 +29,10 @@ "reset": { "message": "リセット" }, - "buttonColort": { + "labelButtonColor": { "message": "ボタンの色" }, - "buttonTextColort": { + "labelTextColor": { "message": "テキストの色" }, "labelBackground": { @@ -43,5 +43,23 @@ }, "displayOverlay" :{ "message": "コピーされたリンク" + }, + "labelGlobal": { + "message": "グローバル設定" + }, + "labelMainPopup": { + "message": "メインウィンドウの設定" + }, + "labelOnlyGi": { + "message": "ウィンドウの設定のみ Genshin Impact" + }, + "labelOnlyHsr": { + "message": "ウィンドウの設定のみ Honkai Star Rail" + }, + "labelRounding": { + "message": "丸めを無効にする" + }, + "labelSnow": { + "message": "降雪のスイッチを切る" } } \ No newline at end of file diff --git a/chromium/_locales/ru/messages.json b/chromium/_locales/ru/messages.json index 7fa1baf..370566d 100644 --- a/chromium/_locales/ru/messages.json +++ b/chromium/_locales/ru/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Быстрый ввод промокодов Genshin Impact/Honkai: Star Rail | 2.2.2.1" + "message": "Быстрый ввод промокодов Genshin Impact/Honkai: Star Rail | 2.2.3" }, "submit": { "message": "Ввести" @@ -8,7 +8,7 @@ "share": { "message": "Поделиться" }, - "labelgi": { + "labelGi": { "message": "Только Genshin Impact" }, "labelHsr": { @@ -32,10 +32,10 @@ "reset": { "message": "Сбросить" }, - "buttonColort": { + "labelButtonColor": { "message": "Цвет кнопок" }, - "buttonTextColort": { + "labelTextColor": { "message": "Цвет текста" }, "labelBackground": { @@ -44,7 +44,25 @@ "labelBackgroundColor": { "message": "Цвет фона (если включено)" }, - "displayOverlay" :{ + "displayOverlay": { "message": "Ссылка скопирована" + }, + "labelGlobal": { + "message": "Глобальные настройки" + }, + "labelMainPopup": { + "message": "Настройки основного окна" + }, + "labelOnlyGi": { + "message": "Настройки окна, только Genshin Impact" + }, + "labelOnlyHsr": { + "message": "Настройки окна, только Honkai Star Rail" + }, + "labelRounding": { + "message": "Отключить закругления" + }, + "labelSnow": { + "message": "Отключить снегопад" } } \ No newline at end of file diff --git a/chromium/manifest.json b/chromium/manifest.json index 72457c5..b036293 100644 --- a/chromium/manifest.json +++ b/chromium/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Genshin/Star Rail CodeEntter", - "version": "2.2.2", + "version": "2.2.3", "description": "__MSG_extensionDescription__", "default_locale": "en", "icons": { diff --git a/chromium/onlyGi.html b/chromium/onlyGi.html index 7bc1e64..054cb82 100644 --- a/chromium/onlyGi.html +++ b/chromium/onlyGi.html @@ -20,6 +20,7 @@ background-repeat: no-repeat; background-position: center; overflow: hidden; + width: 170vh; } #input-container { display: flex; @@ -32,11 +33,13 @@ box-sizing: border-box; background-color: var(--input-color); color: var(--input-text-color); + border-radius: var(--border-radius); border: none; - border-radius: 10px; padding: 10px; width: 100%; font-family: 'SDK_SC_Web'; + z-index: 2; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.6); } #buttons-container { display: flex; @@ -51,22 +54,24 @@ display: flex; align-items: center; justify-content: center; - border-radius: 10px; border: none; + border-radius: var(--border-radius); background: var(--button-color); color: var(--button-text-color); padding: 10px; transition: transform 0.3s ease; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.5); } #submit:hover, #share:hover, #options:hover { - transform: scale(1.2); + transform: scale(1.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; - border-radius: 10px; + border-radius: var(--border-radius); + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.5); } #frame { border: none; @@ -86,6 +91,16 @@ z-index: 2; font-family: 'SDK_SC_Web'; } + @keyframes snowfall { + from { + transform: translateY(-100vh); + } to { + transform: translateY(100vh); + } + } + .snowflake { + z-index: 1; + } @@ -99,5 +114,6 @@
+ \ No newline at end of file diff --git a/chromium/onlyGi.js b/chromium/onlyGi.js index ff88255..6ab0891 100644 --- a/chromium/onlyGi.js +++ b/chromium/onlyGi.js @@ -5,21 +5,19 @@ if (typeof browser === "undefined") { const buttonElement = document.getElementById(buttonId); if (buttonElement) { buttonElement.textContent = browser.i18n.getMessage(buttonId); - + buttonElement.addEventListener('click', function () { const code = document.getElementById('code').value; + const locales = navigator.language.slice(0, 2); 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}`; + url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; navigator.clipboard.writeText(url); displayOverlay(); break; @@ -27,7 +25,6 @@ if (typeof browser === "undefined") { default: break; } - if (buttonId === 'submit') { const frame = document.getElementById('frame'); frame.style.display = 'block'; @@ -48,8 +45,32 @@ function displayOverlay() { overlay.style.display = 'none'; }, 2000); } - -browser.storage.local.get(['buttonColorGi', 'buttonTextColorGi', 'BackgroundGi', 'BackgroundColorGi']).then(function (result) { +function createSnowflake() { + const snowflake = document.createElement('div'); + snowflake.className = 'snowflake'; + snowflake.innerHTML = '❄'; + const size = Math.random() * 3 + 2; + const fontSize = size > 5 ? 5 : size; + snowflake.style.fontSize = fontSize + 'rem'; + snowflake.style.position = 'absolute'; + snowflake.style.color = 'white'; + snowflake.style.pointerEvents = 'none'; + const startPositionLeft = Math.random() * window.innerWidth; + const duration = Math.random() * 4 + 3 + 's'; + const delay = Math.random() * 10 + 's'; + snowflake.style.left = startPositionLeft + 'px'; + snowflake.style.animation = `snowfall ${duration} linear ${delay} infinite`; + document.body.appendChild(snowflake); + snowflake.addEventListener('animationiteration', () => { + snowflake.style.left = Math.random() * window.innerWidth + 'px'; + }); +} +function generateSnowfall() { + for (let i = 0; i < 20; i++) { + createSnowflake(); + } +} +browser.storage.local.get(['snowDisable', 'buttonColorGi', 'buttonTextColorGi', 'BackgroundGi', 'BackgroundColorGi']).then(function (result) { if (result.buttonColorGi) { document.documentElement.style.setProperty('--button-color', result.buttonColorGi); } @@ -67,4 +88,19 @@ browser.storage.local.get(['buttonColorGi', 'buttonTextColorGi', 'BackgroundGi', document.body.style.backgroundPosition = 'center'; document.body.style.overflow = 'hidden'; } + if (result.snowDisable){ + console.log("Snow Disable"); + } + else { + console.log("Snow Enable"); + generateSnowfall(); + } +}); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } }); \ No newline at end of file diff --git a/chromium/onlyHsr.html b/chromium/onlyHsr.html index 90be258..79624ef 100644 --- a/chromium/onlyHsr.html +++ b/chromium/onlyHsr.html @@ -20,6 +20,7 @@ background-repeat: no-repeat; background-position: center; overflow: hidden; + width: 170vh; } #input-container { display: flex; @@ -32,11 +33,13 @@ box-sizing: border-box; background-color: var(--input-color); color: var(--input-text-color); + border-radius: var(--border-radius); border: none; - border-radius: 10px; padding: 10px; width: 100%; font-family: 'SDK_SC_Web'; + z-index: 2; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.6); } #buttons-container { display: flex; @@ -52,22 +55,24 @@ display: flex; align-items: center; justify-content: center; - border-radius: 10px; border: none; + border-radius: var(--border-radius); background: var(--button-color); color: var(--button-text-color); padding: 10px; transition: transform 0.3s ease; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.5); } #submit:hover, #share:hover{ - transform: scale(1.2); + transform: scale(1.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; - border-radius: 10px; + border-radius: var(--border-radius); + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.5); } #frame { border: none; @@ -87,6 +92,16 @@ z-index: 2; font-family: 'SDK_SC_Web'; } + @keyframes snowfall { + from { + transform: translateY(-100vh); + } to { + transform: translateY(100vh); + } + } + .snowflake { + z-index: 1; + } @@ -100,5 +115,6 @@
+ \ No newline at end of file diff --git a/chromium/onlyHsr.js b/chromium/onlyHsr.js index 01fd509..5122e57 100644 --- a/chromium/onlyHsr.js +++ b/chromium/onlyHsr.js @@ -9,7 +9,6 @@ if (typeof browser === "undefined") { buttonElement.addEventListener('click', function () { const code = document.getElementById('code').value; let url; - switch (buttonId) { case 'submit': url = `https://hsr.hoyoverse.com/gift?code=${code}`; @@ -46,7 +45,6 @@ function displayOverlay() { overlay.style.display = 'none'; }, 2000); } - browser.storage.local.get(['buttonColorHsr', 'buttonTextColorHsr', 'BackgroundHsr', 'BackgroundColorHsr']).then(function (result) { if (result.buttonColorHsr) { document.documentElement.style.setProperty('--button-color', result.buttonColorHsr); @@ -65,4 +63,12 @@ browser.storage.local.get(['buttonColorHsr', 'buttonTextColorHsr', 'BackgroundHs document.body.style.backgroundPosition = 'center'; document.body.style.overflow = 'hidden'; } +}); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } }); \ No newline at end of file diff --git a/chromium/options.html b/chromium/options.html index 2109472..0abea32 100644 --- a/chromium/options.html +++ b/chromium/options.html @@ -12,7 +12,8 @@ background-color: rgb(35, 34, 43); font-family: 'SDK_SC_Web'; padding: 10px; - min-height: 100vh; + min-height: 50vh; + font-size: 13px; } label { @@ -38,13 +39,13 @@ cursor: pointer; text-align: center; transition: transform 0.3s ease; - border-radius: 10px; + border-radius: var(--border-radius); font-family: 'SDK_SC_Web'; } button:hover { - transform: scale(1.1); - border-radius: 10px; + transform: scale(1.05); + border-radius: var(--border-radius); } .checkbox-label { @@ -62,42 +63,6 @@ margin-bottom: 0; } - .tooltip { - display: inline-block; - position: relative; - border-bottom: 1px dotted black; - margin-left: 4px; - } - - .tooltip .tooltiptext { - visibility: hidden; - width: 120px; - background-color: #555; - color: #fff; - text-align: center; - border-radius: 6px; - padding: 5px 0; - position: absolute; - z-index: 1; - bottom: 125%; - left: 50%; - margin-left: -60px; - opacity: 0; - transition: opacity 0.3s; - } - - .tooltip:hover .tooltiptext { - visibility: visible; - opacity: 1; - } - #dcWorkIcon{ - width: 30px; - height: 30px; - border-radius: 50%; - position: fixed; - bottom: 10px; - right: 10px; - } @media (prefers-color-scheme: dark) { body { background-color: rgb(28, 27, 34); @@ -112,15 +77,17 @@ } #settingsSectionSelector { margin-bottom: 20px; + font-family: 'SDK_SC_Web'; + font-size: 13px; }
@@ -131,25 +98,33 @@
+
+ + +
+
+ + +
- +
- +
- +
- +
@@ -164,11 +139,11 @@
- +
- +
@@ -181,9 +156,6 @@
-
- -
\ No newline at end of file diff --git a/chromium/options.js b/chromium/options.js index 7eb61f2..3042eea 100644 --- a/chromium/options.js +++ b/chromium/options.js @@ -3,6 +3,8 @@ if (typeof browser === "undefined") { } document.getElementById('labelGi').textContent = browser.i18n.getMessage("labelGi"); document.getElementById('labelHsr').textContent = browser.i18n.getMessage("labelHsr"); +document.getElementById('labelSnow').textContent = browser.i18n.getMessage("labelSnow"); +document.getElementById('labelRounding').textContent = browser.i18n.getMessage("labelRounding"); document.getElementById('labelBackgroundGi').textContent = browser.i18n.getMessage("labelBackground"); document.getElementById('labelBackgroundColorGi').textContent = browser.i18n.getMessage("labelBackgroundColor"); document.getElementById('labelBackgroundHsr').textContent = browser.i18n.getMessage("labelBackground"); @@ -10,41 +12,16 @@ document.getElementById('labelBackgroundColorHsr').textContent = browser.i18n.ge document.getElementById('resetpopup').textContent = browser.i18n.getMessage("reset"); document.getElementById('resetGi').textContent = browser.i18n.getMessage("reset"); document.getElementById('resetHsr').textContent = browser.i18n.getMessage("reset"); -document.getElementById('buttonColort').textContent = browser.i18n.getMessage("buttonColort"); -document.getElementById('buttonColorGit').textContent = browser.i18n.getMessage("buttonColort"); -document.getElementById('buttonColorHsrt').textContent = browser.i18n.getMessage("buttonColort"); -document.getElementById('buttonTextColort').textContent = browser.i18n.getMessage("buttonTextColort"); -document.getElementById('buttonTextColorGit').textContent = browser.i18n.getMessage("buttonTextColort"); -document.getElementById('buttonTextColorHsrt').textContent = browser.i18n.getMessage("buttonTextColort"); -// function toggleBackgroundColorHsr(BackgroundHsr) { -// if (BackgroundHsr) { -// labelBackgroundColorHsr.style.display = 'block'; -// BackgroundColorHsr.style.display = 'block'; -// } else { -// labelBackgroundColorHsr.style.display = 'none'; -// BackgroundColorHsr.style.display = 'none'; -// } -// } -// function toggleBackgroundColorGi(BackgroundGi) { -// if (BackgroundGi) { -// labelBackgroundColorGi.style.display = 'block'; -// BackgroundColorGi.style.display = 'block'; -// } else { -// labelBackgroundColorGi.style.display = 'none'; -// BackgroundColorGi.style.display = 'none'; -// } -// } -// 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; -// } -// } -// } +document.getElementById('labelButtonColor').textContent = browser.i18n.getMessage("labelButtonColor"); +document.getElementById('labelButtonColorGi').textContent = browser.i18n.getMessage("labelButtonColor"); +document.getElementById('labelButtonColorHsr').textContent = browser.i18n.getMessage("labelButtonColor"); +document.getElementById('labelTextColor').textContent = browser.i18n.getMessage("labelTextColor"); +document.getElementById('labelTextColorGi').textContent = browser.i18n.getMessage("labelTextColor"); +document.getElementById('labelTextColorHsr').textContent = browser.i18n.getMessage("labelTextColor"); +document.getElementById('labelGlobal-settings').textContent = browser.i18n.getMessage("labelGlobal"); +document.getElementById('labelMainPopup-settings').textContent = browser.i18n.getMessage("labelMainPopup"); +document.getElementById('labelOnlyGi-settings').textContent = browser.i18n.getMessage("labelOnlyGi"); +document.getElementById('labelOnlyHsr-settings').textContent = browser.i18n.getMessage("labelOnlyHsr"); function showSettingsSection(section) { var sections = ['global-settings','main-popup-settings', 'onlyGi-settings', 'onlyHsr-settings']; sections.forEach(function (s) { @@ -54,20 +31,6 @@ function showSettingsSection(section) { } }); } -function updateDcWorkIconColor() { - if (dcwork = true) { - dcWorkIcon.style.backgroundColor = 'green'; - } - else { - dcWorkIcon.style.backgroundColor = 'red'; - } -} -function updateIconColorOnChange() { - browser.storage.local.get('dcwork', function(result) { - dcwork = result.dcwork; - updateDcWorkIconColor(); - }); -} document.getElementById('settingsSectionSelector').addEventListener('change', function () { var selectedSection = this.value; showSettingsSection(selectedSection); @@ -132,16 +95,26 @@ document.getElementById('onlyGi').addEventListener('change', function() { onlyGi: onlyGi }); }); +document.getElementById('snowDisable').addEventListener('change', function() { + var snowDisable = document.getElementById('snowDisable').checked; + browser.storage.local.set({ + snowDisable: snowDisable + }); +}); +document.getElementById('roundingDisable').addEventListener('change', function() { + var roundingDisable = document.getElementById('roundingDisable').checked; + browser.storage.local.set({ + roundingDisable: roundingDisable + }); +}); document.getElementById('BackgroundGi').addEventListener('change', function() { var BackgroundGi = document.getElementById('BackgroundGi').checked; - // toggleBackgroundColorGi(BackgroundGi); browser.storage.local.set({ BackgroundGi: BackgroundGi }); }); document.getElementById('BackgroundHsr').addEventListener('change', function() { var BackgroundHsr = document.getElementById('BackgroundHsr').checked; - // toggleBackgroundColorHsr(BackgroundHsr); browser.storage.local.set({ BackgroundHsr: BackgroundHsr }); @@ -172,10 +145,7 @@ document.getElementById('resetHsr').addEventListener('click', function() { buttonTextColorHsr: '#ffffff', BackgroundColorHsr: '#1e274e' })}); -dcWorkIcon.style.border = '2px solid #000'; -document.body.appendChild(dcWorkIcon); - -browser.storage.local.get(['BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi', 'BackgroundColorGi', 'buttonColorMain', 'buttonColorGi', 'buttonColorHsr', 'buttonTextColorMain', 'buttonTextColorGi', 'buttonTextColorHsr', 'onlyHsr', 'onlyGi'], function(result) { +browser.storage.local.get(['roundingDisable', 'snowDisable', 'BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi', 'BackgroundColorGi', 'buttonColorMain', 'buttonColorGi', 'buttonColorHsr', 'buttonTextColorMain', 'buttonTextColorGi', 'buttonTextColorHsr', 'onlyHsr', 'onlyGi'], function(result) { var buttonColorMain = result.buttonColorMain ? result.buttonColorMain : '#9a609a'; var buttonColorGi = result.buttonColorGi ? result.buttonColorGi : '#a89f96'; var buttonColorHsr = result.buttonColorHsr ? result.buttonColorHsr : '#004080'; @@ -186,6 +156,8 @@ browser.storage.local.get(['BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi' var BackgroundColorHsr = result.BackgroundColorHsr ? result.BackgroundColorHsr: '#1e274e'; var onlyHsr = result.onlyHsr ? result.onlyHsr : false; var onlyGi = result.onlyGi ? result.onlyGi : false; + var snowDisable = result.snowDisable ? result.snowDisable: false; + var roundingDisable = result.roundingDisable ? result.roundingDisable: false; var BackgroundGi = result.BackgroundGi ? result.BackgroundGi: false; var BackgroundHsr = result.BackgroundHsr ? result.BackgroundHsr: false; document.getElementById('buttonColorMain').value = buttonColorMain; @@ -198,15 +170,16 @@ browser.storage.local.get(['BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi' document.getElementById('BackgroundColorHsr').value = BackgroundColorHsr; document.getElementById('onlyHsr').checked = onlyHsr; document.getElementById('onlyGi').checked = onlyGi; - document.getElementById('BackgroundGi').checked = BackgroundGi; + document.getElementById('snowDisable').checked = snowDisable; + document.getElementById('roundingDisable').checked = roundingDisable; document.getElementById('BackgroundHsr').checked = BackgroundHsr; + document.getElementById('BackgroundGi').checked = BackgroundGi; }); -browser.storage.onChanged.addListener(function(changes, areaName) { - if (areaName === 'local' && 'dcwork' in changes) { - dcwork = changes.dcwork.newValue; - updateDcWorkIconColor(); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') } -}); -updateIconColorOnChange(); -// toggleBackgroundColorHsr(); -// toggleBackgroundColorGi(); \ No newline at end of file + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } +}); \ No newline at end of file diff --git a/chromium/popup.html b/chromium/popup.html index 96fa8ed..38c5e1c 100644 --- a/chromium/popup.html +++ b/chromium/popup.html @@ -20,6 +20,8 @@ background-repeat: no-repeat; background-position: center; overflow: hidden; + background-image: url(./pictures/background.png); + width: 170vh; } #input-container { display: flex; @@ -32,12 +34,13 @@ box-sizing: border-box; background-color: var(--input-color); color: var(--input-text-color); + border-radius: var(--border-radius); border: none; - border-radius: 10px; padding: 10px; width: 100%; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.6); } #buttons-container { display: flex; @@ -52,26 +55,28 @@ display: flex; align-items: center; justify-content: center; - border-radius: 10px; border: none; + border-radius: var(--border-radius); background: var(--button-color); color: var(--button-text-color); padding: 10px; transition: transform 0.3s ease; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.5); } #submitGI:hover, #submitHSR:hover, #shareGI:hover, #shareHSR:hover, #options:hover { - transform: scale(1.2); + transform: scale(1.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; - border-radius: 10px; + border-radius: var(--border-radius); + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.5); } #frame { border: none; - z-index: 2; + z-index: 3; } #displayOverlay { position: fixed; @@ -87,6 +92,16 @@ z-index: 2; font-family: 'SDK_SC_Web'; } + @keyframes snowfall { + from { + transform: translateY(-100vh); + } to { + transform: translateY(100vh); + } + } + .snowflake { + z-index: 1; + } @@ -104,5 +119,6 @@
+ \ No newline at end of file diff --git a/chromium/popup.js b/chromium/popup.js index d5514f5..d7ef180 100644 --- a/chromium/popup.js +++ b/chromium/popup.js @@ -1,37 +1,32 @@ if (typeof browser === "undefined") { browser = chrome; } -document.body.style.backgroundImage = "url(/pictures/background.png)"; ['submitGI', 'shareGI', 'submitHSR', 'shareHSR'].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; - + const locales = navigator.language.slice(0, 2); 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 'shareGI': + url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; + navigator.clipboard.writeText(url); + displayOverlay(); + break; + case 'shareHSR': url = `https://hsr.hoyoverse.com/gift?code=${code}`; navigator.clipboard.writeText(url); @@ -41,7 +36,6 @@ document.body.style.backgroundImage = "url(/pictures/background.png)"; default: break; } - if (buttonId === 'submitGI' || buttonId === 'submitHSR') { const frame = document.getElementById('frame'); frame.style.display = 'block'; @@ -54,7 +48,6 @@ document.body.style.backgroundImage = "url(/pictures/background.png)"; }); } }); - function displayOverlay() { const overlay = document.getElementById('displayOverlay'); overlay.textContent = browser.i18n.getMessage("displayOverlay") @@ -64,7 +57,6 @@ function displayOverlay() { overlay.style.display = 'none'; }, 2000); } - browser.storage.local.get(['buttonColorMain', 'buttonTextColorMain']).then(function (result) { if (result.buttonColorMain) { document.documentElement.style.setProperty('--button-color', result.buttonColorMain); @@ -72,4 +64,12 @@ browser.storage.local.get(['buttonColorMain', 'buttonTextColorMain']).then(funct if (result.buttonTextColorMain) { document.documentElement.style.setProperty('--button-text-color', result.buttonTextColorMain); } +}); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } }); \ No newline at end of file diff --git a/chromium/snow.js b/chromium/snow.js new file mode 100644 index 0000000..0776d94 --- /dev/null +++ b/chromium/snow.js @@ -0,0 +1,33 @@ +function createSnowflake() { + const snowflake = document.createElement('div'); + snowflake.className = 'snowflake'; + snowflake.innerHTML = '❄'; + const size = Math.random() * 3 + 2; + const fontSize = size > 5 ? 5 : size; + snowflake.style.fontSize = fontSize + 'rem'; + snowflake.style.position = 'absolute'; + snowflake.style.color = 'white'; + snowflake.style.pointerEvents = 'none'; + const startPositionLeft = Math.random() * window.innerWidth; + const duration = Math.random() * 4 + 3 + 's'; + const delay = Math.random() * 10 + 's'; + snowflake.style.left = startPositionLeft + 'px'; + snowflake.style.animation = `snowfall ${duration} linear ${delay} infinite`; + document.body.appendChild(snowflake); + snowflake.addEventListener('animationiteration', () => { + snowflake.style.left = Math.random() * window.innerWidth + 'px'; + }); + } + function generateSnowfall() { + for (let i = 0; i < 20; i++) { + createSnowflake(); + } + } + chrome.storage.local.get(['snowDisable']).then(function (result) { + if (result.snowDisable){ + console.log("Snow Disable"); + } else { + console.log("Snow Enable"); + generateSnowfall(); + } + }) \ No newline at end of file diff --git a/firefox/_locales/en/messages.json b/firefox/_locales/en/messages.json index 9366653..b69aa70 100644 --- a/firefox/_locales/en/messages.json +++ b/firefox/_locales/en/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "With Genshin/Star Rail CodeEnter, you can quickly input promo codes for Genshin Impact and Honkai Star Rail, and also share a link to this tool :) FirefoxVersion 2.2.2" + "message": "Quick entry of Genshin Impact/Honkai: Star Rail promo codes | 2.2.3" }, "submit": { "message": "Submit" @@ -32,10 +32,10 @@ "reset": { "message": "Reset" }, - "buttonColort": { + "labelButtonColor": { "message": "Button Color" }, - "buttonTextColort": { + "labelTextColor": { "message": "Text Color" }, "labelBackground": { @@ -43,5 +43,26 @@ }, "labelBackgroundColor": { "message": "Background Color (if enabled)" + }, + "displayOverlay" :{ + "message": "Link copied" + }, + "labelGlobal": { + "message": "Global settings" + }, + "labelMainPopup": { + "message": "Main popup settings" + }, + "labelOnlyGi": { + "message": "Popup settings, only Genshin Impact" + }, + "labelOnlyHsr": { + "message": "Popup settings, Honkai Star Rail only" + }, + "labelRounding": { + "message": "Disable roundings" + }, + "labelSnow": { + "message": "Turn off the snowfall" } -} +} \ No newline at end of file diff --git a/firefox/_locales/es/messages.json b/firefox/_locales/es/messages.json index 867e10c..ec6691a 100644 --- a/firefox/_locales/es/messages.json +++ b/firefox/_locales/es/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Con Genshin/Star Rail CodeEnter, puedes ingresar rápidamente códigos promocionales para Genshin Impact y Honkai Star Rail, ¡y también compartir un enlace a esta herramienta :) FirefoxVersion 2.2.2" + "message": "Entrada rápida de los códigos promocionales de Genshin Impact/Honkai: Star Rail | 2.2.3" }, "submit": { "message": "Enviar" @@ -32,10 +32,10 @@ "reset": { "message": "Reiniciar" }, - "buttonColort": { + "labelButtonColor": { "message": "Color de botones" }, - "buttonTextColort": { + "labelTextColor": { "message": "Color de texto" }, "labelBackground": { @@ -43,5 +43,26 @@ }, "labelBackgroundColor": { "message": "Color de fondo (si está habilitado)" + }, + "displayOverlay" :{ + "message": "Enlace copiado" + }, + "labelGlobal": { + "message": "Configuración global" + }, + "labelMainPopup": { + "message": "Configuración de la ventana principal" + }, + "labelOnlyGi": { + "message": "Ajustes de ventana, sólo Genshin Impact" + }, + "labelOnlyHsr": { + "message": "Ajustes de ventana, sólo Honkai Star Rail" + }, + "labelRounding": { + "message": "Desactivar el redondeo" + }, + "labelSnow": { + "message": "Apagar la nevada" } -} +} \ No newline at end of file diff --git a/firefox/_locales/jp/messages.json b/firefox/_locales/jp/messages.json index 1d09623..47e0604 100644 --- a/firefox/_locales/jp/messages.json +++ b/firefox/_locales/jp/messages.json @@ -1,7 +1,4 @@ { - "extensionDescription": { - "message": "Genshin/Star Rail CodeEnterを使用すると、Genshin ImpactおよびHonkai Star Railのプロモコードを素早く入力でき、またこのツールのリンクを共有することもできます :) FirefoxVersion 2.2.2" - }, "submit": { "message": "送信" }, @@ -32,10 +29,10 @@ "reset": { "message": "リセット" }, - "buttonColort": { + "labelButtonColor": { "message": "ボタンの色" }, - "buttonTextColort": { + "labelTextColor": { "message": "テキストの色" }, "labelBackground": { @@ -43,5 +40,26 @@ }, "labelBackgroundColor": { "message": "背景の色(有効になっている場合)" + }, + "displayOverlay" :{ + "message": "コピーされたリンク" + }, + "labelGlobal": { + "message": "グローバル設定" + }, + "labelMainPopup": { + "message": "メインウィンドウの設定" + }, + "labelOnlyGi": { + "message": "ウィンドウの設定のみ Genshin Impact" + }, + "labelOnlyHsr": { + "message": "ウィンドウの設定のみ Honkai Star Rail" + }, + "labelRounding": { + "message": "丸めを無効にする" + }, + "labelSnow": { + "message": "降雪のスイッチを切る" } -} +} \ No newline at end of file diff --git a/firefox/_locales/ru/messages.json b/firefox/_locales/ru/messages.json index 8df8e28..370566d 100644 --- a/firefox/_locales/ru/messages.json +++ b/firefox/_locales/ru/messages.json @@ -1,6 +1,6 @@ { "extensionDescription": { - "message": "Благодаря Genshin/Star Rail CodeEntter вы сможете быстро вводить промокоды для Genshin Impact и Honkai Star Rail, a также можете поделиться ссылкой на этот кодик :) FirefoxVersion 2.2.2" + "message": "Быстрый ввод промокодов Genshin Impact/Honkai: Star Rail | 2.2.3" }, "submit": { "message": "Ввести" @@ -8,7 +8,7 @@ "share": { "message": "Поделиться" }, - "labelgi": { + "labelGi": { "message": "Только Genshin Impact" }, "labelHsr": { @@ -32,10 +32,10 @@ "reset": { "message": "Сбросить" }, - "buttonColort": { + "labelButtonColor": { "message": "Цвет кнопок" }, - "buttonTextColort": { + "labelTextColor": { "message": "Цвет текста" }, "labelBackground": { @@ -43,5 +43,26 @@ }, "labelBackgroundColor": { "message": "Цвет фона (если включено)" + }, + "displayOverlay": { + "message": "Ссылка скопирована" + }, + "labelGlobal": { + "message": "Глобальные настройки" + }, + "labelMainPopup": { + "message": "Настройки основного окна" + }, + "labelOnlyGi": { + "message": "Настройки окна, только Genshin Impact" + }, + "labelOnlyHsr": { + "message": "Настройки окна, только Honkai Star Rail" + }, + "labelRounding": { + "message": "Отключить закругления" + }, + "labelSnow": { + "message": "Отключить снегопад" } -} +} \ No newline at end of file diff --git a/firefox/dailychecker.js b/firefox/dailychecker.js index 88d0693..7bc0b15 100644 --- a/firefox/dailychecker.js +++ b/firefox/dailychecker.js @@ -60,4 +60,4 @@ browser.alarms.onAlarm.addListener(alarm => { check(); } }); -browser.alarms.create("daily_checker", {when: Date.now(), periodInMinutes: 1}); +browser.alarms.create("daily_checker", {when: Date.now(), periodInMinutes: 1}); \ No newline at end of file diff --git a/firefox/manifest.json b/firefox/manifest.json index 1624210..338d0a2 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Genshin/Star Rail CodeEntter", - "version": "2.2.2", + "version": "2.2.3", "description": "__MSG_extensionDescription__", "default_locale": "en", "icons": { diff --git a/firefox/onlyGi.html b/firefox/onlyGi.html index c6fb16a..32dc951 100644 --- a/firefox/onlyGi.html +++ b/firefox/onlyGi.html @@ -32,11 +32,13 @@ box-sizing: border-box; background-color: var(--input-color); color: var(--input-text-color); + border-radius: var(--border-radius); border: none; - border-radius: 10px; padding: 10px; width: 100%; font-family: 'SDK_SC_Web'; + z-index: 2; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.6); } #buttons-container { display: flex; @@ -51,22 +53,24 @@ display: flex; align-items: center; justify-content: center; - border-radius: 10px; border: none; + border-radius: var(--border-radius); background: var(--button-color); color: var(--button-text-color); padding: 10px; transition: transform 0.3s ease; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.5); } #submit:hover, #share:hover, #options:hover { - transform: scale(1.2); + transform: scale(1.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; - border-radius: 10px; + border-radius: var(--border-radius); + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.5); } #frame { border: none; @@ -86,6 +90,16 @@ z-index: 2; font-family: 'SDK_SC_Web'; } + @keyframes snowfall { + from { + transform: translateY(-100vh); + } to { + transform: translateY(100vh); + } + } + .snowflake { + z-index: 1; + } @@ -99,5 +113,6 @@
+ - + \ No newline at end of file diff --git a/firefox/onlyGi.js b/firefox/onlyGi.js index 198b5f4..a9420a1 100644 --- a/firefox/onlyGi.js +++ b/firefox/onlyGi.js @@ -2,21 +2,19 @@ const buttonElement = document.getElementById(buttonId); if (buttonElement) { buttonElement.textContent = browser.i18n.getMessage(buttonId); - + buttonElement.addEventListener('click', function () { const code = document.getElementById('code').value; + const locales = navigator.language.slice(0, 2); 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}`; + url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; navigator.clipboard.writeText(url); displayOverlay(); break; @@ -24,7 +22,6 @@ default: break; } - if (buttonId === 'submit') { const frame = document.getElementById('frame'); frame.style.display = 'block'; @@ -45,8 +42,32 @@ function displayOverlay() { overlay.style.display = 'none'; }, 2000); } - -browser.storage.local.get(['buttonColorGi', 'buttonTextColorGi', 'BackgroundGi', 'BackgroundColorGi']).then(function (result) { +function createSnowflake() { + const snowflake = document.createElement('div'); + snowflake.className = 'snowflake'; + snowflake.innerHTML = '❄'; + const size = Math.random() * 3 + 2; + const fontSize = size > 5 ? 5 : size; + snowflake.style.fontSize = fontSize + 'rem'; + snowflake.style.position = 'absolute'; + snowflake.style.color = 'white'; + snowflake.style.pointerEvents = 'none'; + const startPositionLeft = Math.random() * window.innerWidth; + const duration = Math.random() * 4 + 3 + 's'; + const delay = Math.random() * 10 + 's'; + snowflake.style.left = startPositionLeft + 'px'; + snowflake.style.animation = `snowfall ${duration} linear ${delay} infinite`; + document.body.appendChild(snowflake); + snowflake.addEventListener('animationiteration', () => { + snowflake.style.left = Math.random() * window.innerWidth + 'px'; + }); +} +function generateSnowfall() { + for (let i = 0; i < 20; i++) { + createSnowflake(); + } +} +browser.storage.local.get(['snowDisable', 'buttonColorGi', 'buttonTextColorGi', 'BackgroundGi', 'BackgroundColorGi']).then(function (result) { if (result.buttonColorGi) { document.documentElement.style.setProperty('--button-color', result.buttonColorGi); } @@ -64,4 +85,19 @@ browser.storage.local.get(['buttonColorGi', 'buttonTextColorGi', 'BackgroundGi', document.body.style.backgroundPosition = 'center'; document.body.style.overflow = 'hidden'; } + if (result.snowDisable){ + console.log("Snow Disable"); + } + else { + console.log("Snow Enable"); + generateSnowfall(); + } }); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } +}); \ No newline at end of file diff --git a/firefox/onlyHsr.html b/firefox/onlyHsr.html index 1604c7e..6f319fc 100644 --- a/firefox/onlyHsr.html +++ b/firefox/onlyHsr.html @@ -32,11 +32,13 @@ box-sizing: border-box; background-color: var(--input-color); color: var(--input-text-color); + border-radius: var(--border-radius); border: none; - border-radius: 10px; padding: 10px; width: 100%; font-family: 'SDK_SC_Web'; + z-index: 2; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.6); } #buttons-container { display: flex; @@ -52,22 +54,24 @@ display: flex; align-items: center; justify-content: center; - border-radius: 10px; border: none; + border-radius: var(--border-radius); background: var(--button-color); color: var(--button-text-color); padding: 10px; transition: transform 0.3s ease; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.5); } #submit:hover, #share:hover{ - transform: scale(1.2); + transform: scale(1.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; - border-radius: 10px; + border-radius: var(--border-radius); + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.5); } #frame { border: none; @@ -87,6 +91,16 @@ z-index: 2; font-family: 'SDK_SC_Web'; } + @keyframes snowfall { + from { + transform: translateY(-100vh); + } to { + transform: translateY(100vh); + } + } + .snowflake { + z-index: 1; + } @@ -100,5 +114,6 @@
+ - + \ No newline at end of file diff --git a/firefox/onlyHsr.js b/firefox/onlyHsr.js index fb78a12..ad25809 100644 --- a/firefox/onlyHsr.js +++ b/firefox/onlyHsr.js @@ -6,7 +6,6 @@ buttonElement.addEventListener('click', function () { const code = document.getElementById('code').value; let url; - switch (buttonId) { case 'submit': url = `https://hsr.hoyoverse.com/gift?code=${code}`; @@ -43,7 +42,6 @@ function displayOverlay() { overlay.style.display = 'none'; }, 2000); } - browser.storage.local.get(['buttonColorHsr', 'buttonTextColorHsr', 'BackgroundHsr', 'BackgroundColorHsr']).then(function (result) { if (result.buttonColorHsr) { document.documentElement.style.setProperty('--button-color', result.buttonColorHsr); @@ -63,3 +61,11 @@ browser.storage.local.get(['buttonColorHsr', 'buttonTextColorHsr', 'BackgroundHs document.body.style.overflow = 'hidden'; } }); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } +}); \ No newline at end of file diff --git a/firefox/options.html b/firefox/options.html index 1699d1b..a0a6cbf 100644 --- a/firefox/options.html +++ b/firefox/options.html @@ -5,14 +5,15 @@
@@ -131,25 +98,33 @@
+
+ + +
+
+ + +
- +
- +
- +
- +
@@ -164,11 +139,11 @@
- +
- +
@@ -183,4 +158,4 @@
- + \ No newline at end of file diff --git a/firefox/options.js b/firefox/options.js index 020a403..d179fa2 100644 --- a/firefox/options.js +++ b/firefox/options.js @@ -1,5 +1,7 @@ document.getElementById('labelGi').textContent = browser.i18n.getMessage("labelGi"); document.getElementById('labelHsr').textContent = browser.i18n.getMessage("labelHsr"); +document.getElementById('labelSnow').textContent = browser.i18n.getMessage("labelSnow"); +document.getElementById('labelRounding').textContent = browser.i18n.getMessage("labelRounding"); document.getElementById('labelBackgroundGi').textContent = browser.i18n.getMessage("labelBackground"); document.getElementById('labelBackgroundColorGi').textContent = browser.i18n.getMessage("labelBackgroundColor"); document.getElementById('labelBackgroundHsr').textContent = browser.i18n.getMessage("labelBackground"); @@ -7,12 +9,16 @@ document.getElementById('labelBackgroundColorHsr').textContent = browser.i18n.ge document.getElementById('resetpopup').textContent = browser.i18n.getMessage("reset"); document.getElementById('resetGi').textContent = browser.i18n.getMessage("reset"); document.getElementById('resetHsr').textContent = browser.i18n.getMessage("reset"); -document.getElementById('buttonColort').textContent = browser.i18n.getMessage("buttonColort"); -document.getElementById('buttonColorGit').textContent = browser.i18n.getMessage("buttonColort"); -document.getElementById('buttonColorHsrt').textContent = browser.i18n.getMessage("buttonColort"); -document.getElementById('buttonTextColort').textContent = browser.i18n.getMessage("buttonTextColort"); -document.getElementById('buttonTextColorGit').textContent = browser.i18n.getMessage("buttonTextColort"); -document.getElementById('buttonTextColorHsrt').textContent = browser.i18n.getMessage("buttonTextColort"); +document.getElementById('labelButtonColor').textContent = browser.i18n.getMessage("labelButtonColor"); +document.getElementById('labelButtonColorGi').textContent = browser.i18n.getMessage("labelButtonColor"); +document.getElementById('labelButtonColorHsr').textContent = browser.i18n.getMessage("labelButtonColor"); +document.getElementById('labelTextColor').textContent = browser.i18n.getMessage("labelTextColor"); +document.getElementById('labelTextColorGi').textContent = browser.i18n.getMessage("labelTextColor"); +document.getElementById('labelTextColorHsr').textContent = browser.i18n.getMessage("labelTextColor"); +document.getElementById('labelGlobal-settings').textContent = browser.i18n.getMessage("labelGlobal"); +document.getElementById('labelMainPopup-settings').textContent = browser.i18n.getMessage("labelMainPopup"); +document.getElementById('labelOnlyGi-settings').textContent = browser.i18n.getMessage("labelOnlyGi"); +document.getElementById('labelOnlyHsr-settings').textContent = browser.i18n.getMessage("labelOnlyHsr"); function showSettingsSection(section) { var sections = ['global-settings','main-popup-settings', 'onlyGi-settings', 'onlyHsr-settings']; sections.forEach(function (s) { @@ -86,16 +92,26 @@ document.getElementById('onlyGi').addEventListener('change', function() { onlyGi: onlyGi }); }); +document.getElementById('snowDisable').addEventListener('change', function() { + var snowDisable = document.getElementById('snowDisable').checked; + browser.storage.local.set({ + snowDisable: snowDisable + }); +}); +document.getElementById('roundingDisable').addEventListener('change', function() { + var roundingDisable = document.getElementById('roundingDisable').checked; + browser.storage.local.set({ + roundingDisable: roundingDisable + }); +}); document.getElementById('BackgroundGi').addEventListener('change', function() { var BackgroundGi = document.getElementById('BackgroundGi').checked; - // toggleBackgroundColorGi(BackgroundGi); browser.storage.local.set({ BackgroundGi: BackgroundGi }); }); document.getElementById('BackgroundHsr').addEventListener('change', function() { var BackgroundHsr = document.getElementById('BackgroundHsr').checked; - // toggleBackgroundColorHsr(BackgroundHsr); browser.storage.local.set({ BackgroundHsr: BackgroundHsr }); @@ -126,10 +142,7 @@ document.getElementById('resetHsr').addEventListener('click', function() { buttonTextColorHsr: '#ffffff', BackgroundColorHsr: '#1e274e' })}); -dcWorkIcon.style.border = '2px solid #000'; -document.body.appendChild(dcWorkIcon); - -browser.storage.local.get(['BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi', 'BackgroundColorGi', 'buttonColorMain', 'buttonColorGi', 'buttonColorHsr', 'buttonTextColorMain', 'buttonTextColorGi', 'buttonTextColorHsr', 'onlyHsr', 'onlyGi'], function(result) { +browser.storage.local.get(['roundingDisable', 'snowDisable', 'BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi', 'BackgroundColorGi', 'buttonColorMain', 'buttonColorGi', 'buttonColorHsr', 'buttonTextColorMain', 'buttonTextColorGi', 'buttonTextColorHsr', 'onlyHsr', 'onlyGi'], function(result) { var buttonColorMain = result.buttonColorMain ? result.buttonColorMain : '#9a609a'; var buttonColorGi = result.buttonColorGi ? result.buttonColorGi : '#a89f96'; var buttonColorHsr = result.buttonColorHsr ? result.buttonColorHsr : '#004080'; @@ -140,6 +153,8 @@ browser.storage.local.get(['BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi' var BackgroundColorHsr = result.BackgroundColorHsr ? result.BackgroundColorHsr: '#1e274e'; var onlyHsr = result.onlyHsr ? result.onlyHsr : false; var onlyGi = result.onlyGi ? result.onlyGi : false; + var snowDisable = result.snowDisable ? result.snowDisable: false; + var roundingDisable = result.roundingDisable ? result.roundingDisable: false; var BackgroundGi = result.BackgroundGi ? result.BackgroundGi: false; var BackgroundHsr = result.BackgroundHsr ? result.BackgroundHsr: false; document.getElementById('buttonColorMain').value = buttonColorMain; @@ -152,6 +167,16 @@ browser.storage.local.get(['BackgroundHsr', 'BackgroundColorHsr', 'BackgroundGi' document.getElementById('BackgroundColorHsr').value = BackgroundColorHsr; document.getElementById('onlyHsr').checked = onlyHsr; document.getElementById('onlyGi').checked = onlyGi; - document.getElementById('BackgroundGi').checked = BackgroundGi; + document.getElementById('snowDisable').checked = snowDisable; + document.getElementById('roundingDisable').checked = roundingDisable; document.getElementById('BackgroundHsr').checked = BackgroundHsr; + document.getElementById('BackgroundGi').checked = BackgroundGi; }); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } +}); \ No newline at end of file diff --git a/firefox/options_background.js b/firefox/options_background.js index 1735b40..9cebe07 100644 --- a/firefox/options_background.js +++ b/firefox/options_background.js @@ -1,7 +1,6 @@ async function updatePopup() { const resultGi = await browser.storage.local.get('onlyGi'); const resultHsr = await browser.storage.local.get('onlyHsr'); - if (resultGi.onlyGi) { browser.browserAction.setPopup({ popup: 'onlyGi.html' @@ -16,11 +15,9 @@ async function updatePopup() { }); } } - browser.storage.onChanged.addListener(async function(changes, areaName) { if (areaName === 'local' && ('onlyGi' in changes || 'onlyHsr' in changes)) { await updatePopup(); } }); - updatePopup(); \ No newline at end of file diff --git a/firefox/popup.html b/firefox/popup.html index ff982bb..bfbc208 100644 --- a/firefox/popup.html +++ b/firefox/popup.html @@ -20,6 +20,7 @@ background-repeat: no-repeat; background-position: center; overflow: hidden; + background-image: url(./pictures/background.png); } #input-container { display: flex; @@ -32,12 +33,13 @@ box-sizing: border-box; background-color: var(--input-color); color: var(--input-text-color); + border-radius: var(--border-radius); border: none; - border-radius: 10px; padding: 10px; width: 100%; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.6); } #buttons-container { display: flex; @@ -52,26 +54,28 @@ display: flex; align-items: center; justify-content: center; - border-radius: 10px; border: none; + border-radius: var(--border-radius); background: var(--button-color); color: var(--button-text-color); padding: 10px; transition: transform 0.3s ease; z-index: 2; font-family: 'SDK_SC_Web'; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.5); } #submitGI:hover, #submitHSR:hover, #shareGI:hover, #shareHSR:hover, #options:hover { - transform: scale(1.2); + transform: scale(1.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; - border-radius: 10px; + border-radius: var(--border-radius); + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.5); } #frame { border: none; - z-index: 2; + z-index: 3; } #displayOverlay { position: fixed; @@ -87,6 +91,16 @@ z-index: 2; font-family: 'SDK_SC_Web'; } + @keyframes snowfall { + from { + transform: translateY(-100vh); + } to { + transform: translateY(100vh); + } + } + .snowflake { + z-index: 1; + } @@ -104,5 +118,6 @@
+ - + \ No newline at end of file diff --git a/firefox/popup.js b/firefox/popup.js index fdf0b87..cefa58c 100644 --- a/firefox/popup.js +++ b/firefox/popup.js @@ -1,34 +1,29 @@ -document.body.style.backgroundImage = "url(/pictures/background.png)"; ['submitGI', 'shareGI', 'submitHSR', 'shareHSR'].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; - + const locales = navigator.language.slice(0, 2); 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 'shareGI': + url = `https://genshin.hoyoverse.com/${locales}/gift?code=${code}`; + navigator.clipboard.writeText(url); + displayOverlay(); + break; + case 'shareHSR': url = `https://hsr.hoyoverse.com/gift?code=${code}`; navigator.clipboard.writeText(url); @@ -38,7 +33,6 @@ document.body.style.backgroundImage = "url(/pictures/background.png)"; default: break; } - if (buttonId === 'submitGI' || buttonId === 'submitHSR') { const frame = document.getElementById('frame'); frame.style.display = 'block'; @@ -51,7 +45,6 @@ document.body.style.backgroundImage = "url(/pictures/background.png)"; }); } }); - function displayOverlay() { const overlay = document.getElementById('displayOverlay'); overlay.textContent = browser.i18n.getMessage("displayOverlay") @@ -61,7 +54,6 @@ function displayOverlay() { overlay.style.display = 'none'; }, 2000); } - browser.storage.local.get(['buttonColorMain', 'buttonTextColorMain']).then(function (result) { if (result.buttonColorMain) { document.documentElement.style.setProperty('--button-color', result.buttonColorMain); @@ -70,3 +62,11 @@ browser.storage.local.get(['buttonColorMain', 'buttonTextColorMain']).then(funct document.documentElement.style.setProperty('--button-text-color', result.buttonTextColorMain); } }); +browser.storage.local.get(['roundingDisable']).then(function (result) { + if (result.roundingDisable) { + document.documentElement.style.setProperty('--border-radius', '10px') + } + else { + document.documentElement.style.setProperty('--border-radius', '20px') + } +}); \ No newline at end of file diff --git a/firefox/snow.js b/firefox/snow.js new file mode 100644 index 0000000..c5f74a1 --- /dev/null +++ b/firefox/snow.js @@ -0,0 +1,33 @@ +function createSnowflake() { + const snowflake = document.createElement('div'); + snowflake.className = 'snowflake'; + snowflake.innerHTML = '❄'; + const size = Math.random() * 3 + 2; + const fontSize = size > 5 ? 5 : size; + snowflake.style.fontSize = fontSize + 'rem'; + snowflake.style.position = 'absolute'; + snowflake.style.color = 'white'; + snowflake.style.pointerEvents = 'none'; + const startPositionLeft = Math.random() * window.innerWidth; + const duration = Math.random() * 4 + 3 + 's'; + const delay = Math.random() * 10 + 's'; + snowflake.style.left = startPositionLeft + 'px'; + snowflake.style.animation = `snowfall ${duration} linear ${delay} infinite`; + document.body.appendChild(snowflake); + snowflake.addEventListener('animationiteration', () => { + snowflake.style.left = Math.random() * window.innerWidth + 'px'; + }); + } + function generateSnowfall() { + for (let i = 0; i < 20; i++) { + createSnowflake(); + } + } + browser.storage.local.get(['snowDisable']).then(function (result) { + if (result.snowDisable){ + console.log("Snow Disable"); + } else { + console.log("Snow Enable"); + generateSnowfall(); + } + }) \ No newline at end of file