You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
add mmrl check and guide
This commit is contained in:
@@ -262,6 +262,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Permission Check Popup -->
|
||||||
|
<div id="permission-popup" class="permission-popup hidden">
|
||||||
|
<div class="permission-content">
|
||||||
|
<h2 id="permission-title">Please allow JavaScript API in MMRL settings</h2>
|
||||||
|
<div class="permission-steps">
|
||||||
|
<p>1. Settings</p>
|
||||||
|
<p>2. Security</p>
|
||||||
|
<p>3. Allow JavaScript API</p>
|
||||||
|
<p>4. Tricky Store</p>
|
||||||
|
<p>5. Enable both options</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="uninstall-container hidden-uninstall">
|
<div class="uninstall-container hidden-uninstall">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const title = document.querySelector('.header');
|
|||||||
export const noConnection = document.querySelector('.no-connection');
|
export const noConnection = document.querySelector('.no-connection');
|
||||||
|
|
||||||
// Loading, Save and Prompt Elements
|
// Loading, Save and Prompt Elements
|
||||||
|
const permissionPopup = document.getElementById('permission-popup');
|
||||||
const loadingIndicator = document.querySelector('.loading');
|
const loadingIndicator = document.querySelector('.loading');
|
||||||
const prompt = document.getElementById('prompt');
|
const prompt = document.getElementById('prompt');
|
||||||
const floatingCard = document.querySelector('.floating-card');
|
const floatingCard = document.querySelector('.floating-card');
|
||||||
@@ -24,6 +25,7 @@ const rippleClasses = ['.language-option', '.menu-button', '.menu-options li', '
|
|||||||
// Variables
|
// Variables
|
||||||
let e = 0;
|
let e = 0;
|
||||||
let isRefreshing = false;
|
let isRefreshing = false;
|
||||||
|
let MMRL_API = true;
|
||||||
|
|
||||||
// Function to load the version from module.prop
|
// Function to load the version from module.prop
|
||||||
async function getModuleVersion() {
|
async function getModuleVersion() {
|
||||||
@@ -162,7 +164,7 @@ document.querySelector(".uninstall-container").addEventListener("click", async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Function to check if running in MMRL
|
// Function to check if running in MMRL
|
||||||
function checkMMRL() {
|
async function checkMMRL() {
|
||||||
if (typeof ksu !== 'undefined' && ksu.mmrl) {
|
if (typeof ksu !== 'undefined' && ksu.mmrl) {
|
||||||
// Adjust elements position for MMRL
|
// Adjust elements position for MMRL
|
||||||
title.style.top = 'var(--window-inset-top)';
|
title.style.top = 'var(--window-inset-top)';
|
||||||
@@ -179,6 +181,16 @@ function checkMMRL() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error requesting API:", error);
|
console.log("Error requesting API:", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check permissions
|
||||||
|
try {
|
||||||
|
await execCommand('ls /data/adb/modules');
|
||||||
|
MMRL_API = true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Permission check failed:', error);
|
||||||
|
permissionPopup.classList.remove('hidden');
|
||||||
|
MMRL_API = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +293,8 @@ window.addEventListener('scroll', () => {
|
|||||||
|
|
||||||
// Initial load
|
// Initial load
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
checkMMRL();
|
await checkMMRL();
|
||||||
|
if (!MMRL_API) return;
|
||||||
hideFloatingBtn();
|
hideFloatingBtn();
|
||||||
getModuleVersion();
|
getModuleVersion();
|
||||||
await initializeAvailableLanguages();
|
await initializeAvailableLanguages();
|
||||||
|
|||||||
@@ -202,6 +202,49 @@ body {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.permission-popup {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.85);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-popup.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-content {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 12px;
|
||||||
|
width: 80%;
|
||||||
|
max-width: 400px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-content h2 {
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-steps {
|
||||||
|
text-align: left;
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-steps p {
|
||||||
|
color: #333;
|
||||||
|
margin: 10px 0;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.ripple {
|
.ripple {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
@@ -252,4 +295,13 @@ body {
|
|||||||
.file-item svg {
|
.file-item svg {
|
||||||
fill: #C2C2C2;
|
fill: #C2C2C2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.permission-content {
|
||||||
|
background-color: #343434;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-content h2,
|
||||||
|
.permission-steps p {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user