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
+3
View File
@@ -11,6 +11,9 @@ SCRIPT_DIR="/data/adb/tricky_store"
if pm list packages | grep -q "$PACKAGE_NAME"; then if pm list packages | grep -q "$PACKAGE_NAME"; then
echo "- Launching KSU WebUI..." echo "- Launching KSU WebUI..."
am start -n "${PACKAGE_NAME}/.WebUIActivity" -e id "$MODID" 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 else
echo "- Installing KSU WebUI..." echo "- Installing KSU WebUI..."
. "$COMPATH/get_WebUI.sh" . "$COMPATH/get_WebUI.sh"
+1 -3
View File
@@ -43,9 +43,7 @@ else
if [ -d "$TS/webroot" ]; then if [ -d "$TS/webroot" ]; then
rm -rf "$TS/webroot" rm -rf "$TS/webroot"
fi fi
if [ -d "$MODPATH/common/temp" ]; then ln -s "$MODPATH/webroot" "$TS/webroot"
ln -s "$MODPATH/webroot" "$TS/webroot"
fi
fi fi
until [ "$(getprop sys.boot_completed)" = "1" ]; do until [ "$(getprop sys.boot_completed)" = "1" ]; do
+7 -2
View File
@@ -1,15 +1,19 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title data-i18n="title">Document</title> <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="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" href="/styles.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/mmrl/insets.css" />
<script type="module" crossorigin src="/index.js"></script> <script type="module" crossorigin src="/index.js"></script>
</head> </head>
<body> <body>
<!-- Header --> <!-- Header -->
<div class="header-block"></div>
<div class="header"> <div class="header">
<div id="title" data-i18n="title"></div> <div id="title" data-i18n="title"></div>
<button id="help-button" class="help-button"><i class="fa fa-question-circle"></i></button> <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 data-i18n="module_name_line2"></p>
<p><span data-i18n="by"></span>KOWX712</p> <p><span data-i18n="by"></span>KOWX712</p>
<br> <br>
<p data-i18n="disclaimer"></p>
<br>
<p> <p>
<span data-i18n="telegram_channel"></span> <span data-i18n="telegram_channel"></span>
<br> <br>
@@ -126,8 +132,6 @@
<span>github.com/KOWX712/Tricky-Addon-Update-Target-List</span> <span>github.com/KOWX712/Tricky-Addon-Update-Target-List</span>
</p> </p>
<br> <br>
<p data-i18n="disclaimer"></p>
<br>
<p data-i18n="acknowledgment"></p> <p data-i18n="acknowledgment"></p>
<p>j-hc/zygisk-detach: WebUI template</p> <p>j-hc/zygisk-detach: WebUI template</p>
</div> </div>
@@ -142,4 +146,5 @@
</div> </div>
</div> </div>
</body> </body>
</html> </html>
+17 -1
View File
@@ -1,4 +1,5 @@
// Header Elements // Header Elements
const headerBlock = document.querySelector('.header-block');
const title = document.querySelector('.header'); const title = document.querySelector('.header');
const helpButton = document.getElementById('help-button'); const helpButton = document.getElementById('help-button');
const noConnection = document.querySelector('.no-connection'); 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 // Scroll event
let lastScrollY = window.scrollY; let lastScrollY = window.scrollY;
const scrollThreshold = 40; const scrollThreshold = 40;
window.addEventListener('scroll', () => { window.addEventListener('scroll', () => {
if (isRefreshing) return; if (isRefreshing) return;
if (window.scrollY > lastScrollY && window.scrollY > scrollThreshold) { 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)'; searchMenuContainer.style.transform = 'translateY(-40px)';
floatingBtn.style.transform = 'translateY(0)'; floatingBtn.style.transform = 'translateY(0)';
} else if (window.scrollY < lastScrollY) { } else if (window.scrollY < lastScrollY) {
headerBlock.style.transform = 'translateY(0)';
title.style.transform = 'translateY(0)'; title.style.transform = 'translateY(0)';
searchMenuContainer.style.transform = 'translateY(0)'; searchMenuContainer.style.transform = 'translateY(0)';
floatingBtn.style.transform = 'translateY(-120px)'; floatingBtn.style.transform = 'translateY(-120px)';
@@ -725,6 +740,7 @@ window.addEventListener('scroll', () => {
// Initial load // Initial load
document.addEventListener('DOMContentLoaded', async () => { document.addEventListener('DOMContentLoaded', async () => {
adjustHeaderForMMRL();
await initializeAvailableLanguages(); await initializeAvailableLanguages();
const userLang = detectUserLanguage(); const userLang = detectUserLanguage();
await loadTranslations(userLang); await loadTranslations(userLang);
+1 -1
View File
@@ -33,7 +33,7 @@
"by": "by ", "by": "by ",
"telegram_channel": "Telegram Channel", "telegram_channel": "Telegram Channel",
"github": "GitHub", "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", "acknowledgment": "Acknowledgment",
"no_internet": "Please check your Internet connection", "no_internet": "Please check your Internet connection",
+22 -5
View File
@@ -1,5 +1,7 @@
body { body {
background-color: #F5F5F5; background-color: #F5F5F5;
padding-top: var(--window-inset-top);
padding-bottom: var(--window-inset-bottom);
} }
.no-scroll { .no-scroll {
@@ -24,6 +26,18 @@ body {
right: 0; 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 { #title {
padding-left: 5px; padding-left: 5px;
font-size: 16.5px; font-size: 16.5px;
@@ -287,6 +301,8 @@ body {
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
width: 75vw;
max-width: 800px;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
@@ -328,6 +344,10 @@ body {
font-size: 14px; font-size: 14px;
} }
.about-content p[data-i18n="disclaimer"] {
font-style: italic;
}
.about-content p span[data-i18n="telegram_channel"] { .about-content p span[data-i18n="telegram_channel"] {
font-weight: bold; font-weight: bold;
} }
@@ -336,13 +356,9 @@ body {
font-weight: bold; font-weight: bold;
} }
.about-content p[data-i18n="disclaimer"] {
font-style: italic;
}
.about-content p[data-i18n="acknowledgment"] { .about-content p[data-i18n="acknowledgment"] {
font-weight: bold;
font-size: 18px; font-size: 18px;
text-align: left;
} }
.about-content p:not([data-i18n]) { .about-content p:not([data-i18n]) {
@@ -699,6 +715,7 @@ body {
color: #eee; color: #eee;
} }
.header-block,
.header { .header {
background-color: #121212; background-color: #121212;
} }