Печенька с предсказанием
Автоматизацияasync function shop() { const cookies = document.querySelectorAll('.menu-shop-item img') const numbers = [] for (let i = 0; i < 79; i++) { const cookie = cookies[i] const imageUrl = cookie.src const regex = /\/(\d+)\./ const match = imageUrl.match(regex) const number = match ? match[1] : null if (number) { numbers.push(number) } } console.log(numbers) numbers.forEach((number, index) => { const element = document.querySelector(`img[src*="/${number}."]`) if (number === '1') { setTimeout(() => { element.click() setTimeout(() => { element.click() }, 1000) }, index * 1000) } else { setTimeout(() => { element.click() }, index * 1000) } }) // Рекурсивный вызов функции для повторного запуска setTimeout(shop, numbers.length * 1000) } shop(); async function swipeBiscuits() { const biscuits = document.querySelectorAll('.biscuit-item') biscuits.forEach((biscuit) => { const biscuitNumber = extractBiscuitNumber(biscuit) if (biscuitNumber) { const targetBiscuitNumber = biscuitNumber const targetBiscuit = document.querySelector(`.biscuit-icon-type-${targetBiscuitNumber}`) if (targetBiscuit) { const biscuitRect = biscuit.getBoundingClientRect() const biscuitCenterX = biscuitRect.left + biscuitRect.width / 2 const biscuitCenterY = biscuitRect.top + biscuitRect.height / 2 const targetRect = targetBiscuit.getBoundingClientRect() const targetCenterX = targetRect.left + targetRect.width / 2 const targetCenterY = targetRect.top + targetRect.height / 2 biscuit.dispatchEvent( new MouseEvent('mousedown', { bubbles: true, cancelable: true, clientX: biscuitCenterX, clientY: biscuitCenterY, }) ) biscuit.dispatchEvent( new MouseEvent('mousemove', { bubbles: true, cancelable: true, clientX: targetCenterX, clientY: targetCenterY, }) ) targetBiscuit.dispatchEvent( new MouseEvent('mouseup', { bubbles: true, cancelable: true, clientX: targetCenterX, clientY: targetCenterY, }) ) } } }) } function extractBiscuitNumber(biscuit) { const className = biscuit.className const numberRegex = /biscuit-icon-type-(\d+)/ const match = className.match(numberRegex) if (match) { return parseInt(match[1]) } return null } setInterval(swipeBiscuits, 500)
Leave a Comment