السلام عليكم احتاج مساعده. احتاج احد يشرح لي هذة الاكواد
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function clickOnButtons() {
var installButtonText = "تثبيت"; // النص المطلوب للزر الذي يجب الضغط عليه
var yesButtonText = "نعم"; // النص المطلوب للزر الذي يجب الانتظار حتى يظهر
var installButton = null;
var yesButton = null;
var buttons = document.querySelectorAll('button');
// البحث عن الزر الذي يحمل النص "تثبيت"
for (var i = 0; i < buttons.length; i++) {
var buttonText = buttons[i].innerText.trim();
if (buttonText.includes(installButtonText)) {
installButton = buttons[i];
break;
}
}
if (installButton) {
installButton.click();
console.log("تم النقر على الزر الذي يحتوي على كلمة 'تثبيت' بنجاح.");
// انتظار حتى يتواجد زر "نعم" - استخدام الـ ID إذا كان متوفرًا
yesButton = document.getElementById("yesButtonId");
if (!yesButton) {
while (!yesButton) {
yesButton = [...document.querySelectorAll('button')].find(button => button.innerText.trim() === yesButtonText);
if (!yesButton) {
await delay(100); // انتظار قبل المحاولة مرة أخرى
}
}
}
if (yesButton) {
yesButton.click();
console.log("CLASS'.");
} else {
console.log("CLASS'.");
}
} else {
console.log("CLASS'.");
}
}
// تنفيذ الدالة كل ثلاث ثوانٍ للزر "تثبيت" وباستمرار للبحث عن زر "نعم" كل 100 ميلي ثانية
setInterval(clickOnButtons, 500);
let optionbtn1 = document.querySelector("app-active-requests div:nth-child(1) > table > tbody > tr:nth-child(1) button")
let FAWZIoptionbtn2 = document.querySelector("app-active-requests div:nth-child(1) > table > tbody > tr:nth-child(2) button")
let interval1
let interval2
let interval3
let a = window.prompt("ادخل السرعة ب الملي ثانية ");
a=Number(a)
if(a <= 500){
a =100
}
function beep(x) {
const context = new AudioContext();
const oscillator = context.createOscillator();
oscillator.type = "sine";
oscillator.connect(context.destination);
oscillator.start();
oscillator.stop(context.currentTime + x);
}
function triger(optionbtn1,FAWZIoptionbtn2) {
let status1=0
let status2=0
if (optionbtn1) {
status1=1
}
if (FAWZIoptionbtn2) {
status2=1
}
return status1+status2
}
let counter =triger(optionbtn1,FAWZIoptionbtn2)
if (counter ===1) {
interval1 =setInterval(() => {
const targetContainer = document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div");
if (!targetContainer) {
let optionbtn1 = document.querySelector("app-active-requests div:nth-child(1) > table > tbody > tr:nth-child(1) button")
let FAWZIoptionbtn2 = document.querySelector("app-active-requests div:nth-child(1) > table > tbody > tr:nth-child(2) button")
optionbtn1.click()
console.log("1")
setTimeout(() => {
let FAWZIexecutebtn = document.querySelector("div.cdk-overlay-container div > button:nth-child(1)")
if (FAWZIexecutebtn) {
FAWZIexecutebtn.click()
}
}, 100);
}}, a);
}
if (counter ===2) {
let flag =1
interval2= setInterval(() => {
const targetContainer = document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div");
if (!targetContainer) {
let optionbtn1 = document.querySelector("app-active-requests div:nth-child(1) > table > tbody > tr:nth-child(1) button")
let FAWZIoptionbtn2 = document.querySelector("app-active-requests div:nth-child(1) > table > tbody > tr:nth-child(2) button")
if (flag ===1) {
optionbtn1.click()
flag=2
}else if (flag ===2) {
FAWZIoptionbtn2.click()
flag=1
}
setTimeout(() => {
let FAWZIexecutebtn = document.querySelector("div.cdk-overlay-container div > button:nth-child(1)")
if (FAWZIexecutebtn) {
FAWZIexecutebtn.click()
}
}, 150);
}}, a);
}
function observeAndRun(selector) {
const observer = new MutationObserver(() => {
if (elementExists(selector)) {
observer.disconnect();
addMathEvaluator();
observeAndRun(selector); // Re-run the observer
}
});
observer.observe(document.body, { childList: true, subtree: true });
}
// / Start observing for the target element
observeAndRun("div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show");
// Function to check if the target element exists
function elementExists(selector) {
return document.querySelector(selector) !== null;
}
function addMathEvaluator() {
const mathEvaluatorHTML = `
<div style="text-align: center;">
<form id="mathForm" onsubmit="evaluateExpression(); return false;">
<button type="submit">Evaluate</button>
<input type="text" id="mathInput" placeholder="Enter a math expression" autocomplete="off">
</form>
<p id="result"></p>
</div>
`;
const mathEvaluatorWrapper = document.createElement('div');
mathEvaluatorWrapper.innerHTML = mathEvaluatorHTML;
const targetContainer = document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div");
// Check if the evaluator is already present before appending
if (!targetContainer.querySelector("#mathForm")) {
targetContainer.appendChild(mathEvaluatorWrapper);
if (document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > img")) {
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > img").style.marginTop=0
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > img").style.marginBottom=0
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > img").style.width = "350px";
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > img").style.height = "250px"
document.querySelector("#swal2-title").remove()
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > input.swal2-input").style.margin = 0
// document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > div.swal2-actions > button.swal2-confirm.swal2-styled.swal2-default-outline")
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > div.swal2-actions").style.margin = 0
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div").style.padding = 0
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > div.swal2-actions").style.display = "flex"
document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > div.swal2-actions").style.flexWrap = "nowrap"
}
// Set focus on the input after a small delay
setTimeout(() => {
const mathInput = document.getElementById('mathInput');
mathInput.focus();
}, 100 );
beep(1)
// clearInterval(interval1)
// clearInterval(interval2)
// clearInterval(interval3)
}
}
function simulateButtonClick(selector) {
const button = document.querySelector(selector);
if (button) {
button.click();
}
}
function observeNewButton(selector) {
const observer = new MutationObserver(() => {
const button = document.querySelector(selector);
if (button) {
button.click();
observer.disconnect();
}
});
observer.observe(document.body, { childList: true, subtree: true });
}
function evaluateExpression() {
const inputElement = document.getElementById('mathInput');
const resultElement = document.getElementById('result');
const targetInput = document.querySelector("body > div.swal2-container.swal2-rtl.swal2-center.swal2-backdrop-show > div > input.swal2-input");
const expression = inputElement.value;
try {
const result = eval(expression);
resultElement.textContent = result;
targetInput.value = result; // Insert the result into the target input
simulateButtonClick(" div > div.swal2-actions > button.swal2-confirm.swal2-styled.swal2-default-outline"); // Simulate a click on the specified button
observeNewButton("div.mat-dialog-actions > button:nth-child(1)");
} catch (error) {
resultElement.textContent = 'Invalid expression';
}
}
function focusOnMathInput() {
const mathInput = document.querySelector("#mathInput");
if (mathInput) {
mathInput.focus();
}
}
// Add a click event listener to the document
document.addEventListener('click', focusOnMathInput);
setInterval(()=>{
if (document.querySelector("#toast-container > div > div.ng-star-inserted")) {
let toast = document.querySelector("#toast-container > div > div.ng-star-inserted").innerText;
console.log(toast)
let isPresent = toast.includes("نشاط");
if (isPresent) {
beep(1);
console.log("نشاط")
}
isPresent = toast.includes("صلاحية الجلسة");
if (isPresent) {
console.log("خروج")
beep(5);
}
isPresent = toast.includes("لقد تجاوزت");
if (isPresent) {
console.log("لقد تجاوزت")
beep(1);
}
isPresent = toast.includes("قفل حسابك");
if (isPresent) {
console.log("قفل حسابك")
beep(5);
}
}
},100)
console.log("CLASS")
console.log("class")
التعليقات