From 873354b11c2bd8ee695e979d9403cf61b51a4422 Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Sat, 7 Dec 2024 03:47:15 +0800 Subject: [PATCH] Adapt with MMRL --- module/action.sh | 3 +++ module/service.sh | 4 +--- module/webroot/index.html | 9 +++++++-- module/webroot/index.js | 18 +++++++++++++++++- module/webroot/locales/en-US.json | 2 +- module/webroot/styles.css | 29 +++++++++++++++++++++++------ 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/module/action.sh b/module/action.sh index 67469d3..2e1d248 100644 --- a/module/action.sh +++ b/module/action.sh @@ -11,6 +11,9 @@ SCRIPT_DIR="/data/adb/tricky_store" if pm list packages | grep -q "$PACKAGE_NAME"; then echo "- Launching KSU WebUI..." am start -n "${PACKAGE_NAME}/.WebUIActivity" -e id "$MODID" +elif pm list packages | grep -q "com.dergoogler.mmrl"; then + echo "- Launching KSU WebUI..." + am start -n "com.dergoogler.mmrl/.ui.activity.webui.WebUIActivity" -e MOD_ID "$MODID" else echo "- Installing KSU WebUI..." . "$COMPATH/get_WebUI.sh" diff --git a/module/service.sh b/module/service.sh index b5732c0..982e7d9 100644 --- a/module/service.sh +++ b/module/service.sh @@ -43,9 +43,7 @@ else if [ -d "$TS/webroot" ]; then rm -rf "$TS/webroot" fi - if [ -d "$MODPATH/common/temp" ]; then - ln -s "$MODPATH/webroot" "$TS/webroot" - fi + ln -s "$MODPATH/webroot" "$TS/webroot" fi until [ "$(getprop sys.boot_completed)" = "1" ]; do diff --git a/module/webroot/index.html b/module/webroot/index.html index b39a389..68be35e 100644 --- a/module/webroot/index.html +++ b/module/webroot/index.html @@ -1,15 +1,19 @@ + Document + + +
@@ -114,6 +118,8 @@

KOWX712


+

+


@@ -126,8 +132,6 @@ github.com/KOWX712/Tricky-Addon-Update-Target-List


-

-

j-hc/zygisk-detach: WebUI template

@@ -142,4 +146,5 @@ + \ No newline at end of file diff --git a/module/webroot/index.js b/module/webroot/index.js index 87709a7..73d2a71 100644 --- a/module/webroot/index.js +++ b/module/webroot/index.js @@ -1,4 +1,5 @@ // Header Elements +const headerBlock = document.querySelector('.header-block'); const title = document.querySelector('.header'); const helpButton = document.getElementById('help-button'); const noConnection = document.querySelector('.no-connection'); @@ -706,16 +707,30 @@ document.querySelector(".uninstall-container").addEventListener("click", async ( } }); +// Function to check if running in MMRL +function adjustHeaderForMMRL() { + if (typeof ksu !== 'undefined' && ksu.mmrl) { + console.log("Running in MMRL"); + title.style.top = 'var(--window-inset-top)'; + const insetTop = getComputedStyle(document.documentElement).getPropertyValue('--window-inset-top'); + const insetTopValue = parseInt(insetTop, 10); + searchMenuContainer.style.top = `${insetTopValue + 40}px`; + headerBlock.style.display = 'block'; + } +} + // Scroll event let lastScrollY = window.scrollY; const scrollThreshold = 40; window.addEventListener('scroll', () => { if (isRefreshing) return; if (window.scrollY > lastScrollY && window.scrollY > scrollThreshold) { - title.style.transform = 'translateY(-100%)'; + title.style.transform = 'translateY(-80px)'; + headerBlock.style.transform = 'translateY(-80px)'; searchMenuContainer.style.transform = 'translateY(-40px)'; floatingBtn.style.transform = 'translateY(0)'; } else if (window.scrollY < lastScrollY) { + headerBlock.style.transform = 'translateY(0)'; title.style.transform = 'translateY(0)'; searchMenuContainer.style.transform = 'translateY(0)'; floatingBtn.style.transform = 'translateY(-120px)'; @@ -725,6 +740,7 @@ window.addEventListener('scroll', () => { // Initial load document.addEventListener('DOMContentLoaded', async () => { + adjustHeaderForMMRL(); await initializeAvailableLanguages(); const userLang = detectUserLanguage(); await loadTranslations(userLang); diff --git a/module/webroot/locales/en-US.json b/module/webroot/locales/en-US.json index a1f1b68..231a4b0 100644 --- a/module/webroot/locales/en-US.json +++ b/module/webroot/locales/en-US.json @@ -33,7 +33,7 @@ "by": "by ", "telegram_channel": "Telegram Channel", "github": "GitHub", - "disclaimer": "This WebUI is not a part of Tricky Store, DO NOT report to Tricky Store author if you encounter any issue.", + "disclaimer": "This module is not a part of the Tricky Store module. DO NOT report any issues to Tricky Store if encountered.", "acknowledgment": "Acknowledgment", "no_internet": "Please check your Internet connection", diff --git a/module/webroot/styles.css b/module/webroot/styles.css index a6106c0..0e216a7 100644 --- a/module/webroot/styles.css +++ b/module/webroot/styles.css @@ -1,5 +1,7 @@ body { background-color: #F5F5F5; + padding-top: var(--window-inset-top); + padding-bottom: var(--window-inset-bottom); } .no-scroll { @@ -24,6 +26,18 @@ body { right: 0; } +.header-block { + background-color: #F5F5F5; + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 1100; + transition: transform 0.3s ease; + height: var(--window-inset-top); +} + #title { padding-left: 5px; font-size: 16.5px; @@ -287,6 +301,8 @@ body { position: fixed; top: 50%; left: 50%; + width: 75vw; + max-width: 800px; transform: translate(-50%, -50%); background: #fff; border-radius: 8px; @@ -328,6 +344,10 @@ body { font-size: 14px; } +.about-content p[data-i18n="disclaimer"] { + font-style: italic; +} + .about-content p span[data-i18n="telegram_channel"] { font-weight: bold; } @@ -336,13 +356,9 @@ body { font-weight: bold; } -.about-content p[data-i18n="disclaimer"] { - font-style: italic; -} - .about-content p[data-i18n="acknowledgment"] { + font-weight: bold; font-size: 18px; - text-align: left; } .about-content p:not([data-i18n]) { @@ -698,7 +714,8 @@ body { background-color: #121212; color: #eee; } - + + .header-block, .header { background-color: #121212; }