Adapt with MMRL

This commit is contained in:
KOWX712
2024-12-07 03:47:15 +08:00
parent 3d8ca67a6a
commit 873354b11c
6 changed files with 52 additions and 13 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -1,15 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title data-i18n="title">Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/styles.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/mmrl/insets.css" />
<script type="module" crossorigin src="/index.js"></script>
</head>
<body>
<!-- Header -->
<div class="header-block"></div>
<div class="header">
<div id="title" data-i18n="title"></div>
<button id="help-button" class="help-button"><i class="fa fa-question-circle"></i></button>
@@ -114,6 +118,8 @@
<p data-i18n="module_name_line2"></p>
<p><span data-i18n="by"></span>KOWX712</p>
<br>
<p data-i18n="disclaimer"></p>
<br>
<p>
<span data-i18n="telegram_channel"></span>
<br>
@@ -126,8 +132,6 @@
<span>github.com/KOWX712/Tricky-Addon-Update-Target-List</span>
</p>
<br>
<p data-i18n="disclaimer"></p>
<br>
<p data-i18n="acknowledgment"></p>
<p>j-hc/zygisk-detach: WebUI template</p>
</div>
@@ -142,4 +146,5 @@
</div>
</div>
</body>
</html>

View File

@@ -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);

View File

@@ -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",

View File

@@ -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;
}