// ==UserScript== // @name Duolingo PRO // @namespace http://tampermonkey.net/ // @version 3.0BETA.02 // @description The fastest Duolingo XP farmer, working as of July 2024. // @author anonymousHackerIV // @match https://*.duolingo.com/* // @icon https://github.com/anonymoushackerIV/Duolingo-Pro-BETA/blob/main/assets/duolingo-pro-logo-square-round.png.png?raw=true // @grant GM_log // @downloadURL none // ==/UserScript== let storageLocal; let storageSession; let limits; let versionNumber = "02"; let storageLocalVersion = "02"; let storageSessionVersion = "02"; let versionName = "BETA.02"; let versionFullname = "3.0BETA.02"; let serverURL = "https://www.duolingopro.net"; let greasyfork = true; let hidden = false; let lastPage; let currentPage = 1; let legacyMode = false; let solvingIntervalId; let isAutoMode; let findReactMainElementClass = '_3yE3H'; let reactTraverseUp = 1; const debug = false; if (localStorage.getItem("DLP_Local_Storage") == null || JSON.parse(localStorage.getItem("DLP_Local_Storage")).storageVersion !== storageLocalVersion) { localStorage.setItem("DLP_Local_Storage", JSON.stringify({ "version": versionNumber, "terms": "00", "pins": { "home": [1, 2], "legacy": [1, 2] }, "legacy": { "solveSpeed": 0.9 }, "settings": { "autoUpdate": greasyfork, "solveSpeed": 0.9 }, "notifications": [ { "id": "0001" } ], "tips": { "seeMore1": false }, "onboarding": false, "storageVersion": storageLocalVersion })); storageLocal = JSON.parse(localStorage.getItem("DLP_Local_Storage")); } else { storageLocal = JSON.parse(localStorage.getItem("DLP_Local_Storage")); } function saveStorageLocal() { localStorage.setItem("DLP_Local_Storage", JSON.stringify(storageLocal)); } if (sessionStorage.getItem("DLP_Session_Storage") == null || JSON.parse(sessionStorage.getItem("DLP_Session_Storage")).storageVersion !== storageSessionVersion) { sessionStorage.setItem("DLP_Session_Storage", JSON.stringify({ "legacy": { "page": 0, "status": false, "path": { "type": "lesson", "amount": 0 }, "practice": { "type": "lesson", "amount": 0 }, "listen": { "type": "lesson", "amount": 0 }, "lesson": { "unit": 1, "lesson": 1, "type": "lesson", "amount": 0 } }, "notifications": [ { "id": "0001" } ], "storageVersion": storageSessionVersion })); storageSession = JSON.parse(sessionStorage.getItem("DLP_Session_Storage")); } else { storageSession = JSON.parse(sessionStorage.getItem("DLP_Session_Storage")); } function saveStorageSession() { sessionStorage.setItem("DLP_Session_Storage", JSON.stringify(storageSession)); } let CSS1 = ` @font-face { font-family: 'Duolingo Pro Rounded'; src: url(${serverURL}/static/3.0/assets/fonts/Duolingo-Pro-Rounded-Semibold.woff) format('woff'); } `; let HTML2 = `

Switch to Legacy

Show

Connecting

Donate

Feedback

Settings

Release Notes

Duolingo

PRO 3.0

${versionName}

How much XP would you like to get?

GET

How many Gems would you like to get?

GET

Terms & Conditions

See more

`; let CSS2 = ` .DLP_NoSelect { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .DLP_Text_Style_1 { font-family: "Duolingo Pro Rounded"; font-size: 16px; font-style: normal; font-weight: 700; line-height: normal; margin: 0; -webkit-font-smoothing: antialiased; } .DLP_Text_Style_2 { font-family: "Duolingo Pro Rounded"; font-size: 24px; font-style: normal; font-weight: 700; line-height: normal; margin: 0; -webkit-font-smoothing: antialiased; } .DLP_Magnetic_Hover_1 { transition: filter 0.4s cubic-bezier(0.16, 1, 0.32, 1), transform 0.4s cubic-bezier(0.16, 1, 0.32, 1); cursor: pointer; } .DLP_Magnetic_Hover_1:hover { filter: brightness(0.9); transform: scale(1.05); } .DLP_Magnetic_Hover_1:active { filter: brightness(0.9); transform: scale(0.9); } .DLP_Main { display: inline-flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; gap: 8px; position: fixed; right: 16px; bottom: 16px; z-index: 2; } .DLP_Main_Box { display: flex; width: 300px; padding: 16px; box-sizing: border-box; flex-direction: column; justify-content: center; align-items: center; gap: 8px; overflow: hidden; border-radius: 16px; border: 2px solid rgb(var(--color-eel), 0.10); background: rgb(var(--color-snow), 0.90); backdrop-filter: blur(16px); } .DLP_Main_Box_Divider { display: flex; box-sizing: border-box; flex-direction: column; justify-content: center; align-items: center; gap: 8px; width: 100%; } svg { flex-shrink: 0; } .DLP_HStack_Auto { display: flex; align-items: flex-start; justify-content: space-between; align-self: stretch; } .DLP_HStack_8 { display: flex; align-items: flex-start; gap: 8px; align-self: stretch; } .DLP_HStack_4 { display: flex; align-items: flex-start; gap: 4px; align-self: stretch; } .DLP_HStack_0 { display: flex; align-items: flex-start; gap: 0; align-self: stretch; } .DLP_VStack_0 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0; align-self: stretch; } .DLP_VStack_8 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; align-self: stretch; } .DLP_Button_Style_1 { display: flex; height: 40px; padding: 10px 12px 10px 10px; box-sizing: border-box; align-items: center; gap: 6px; flex: 1 0 0; border-radius: 8px; } .DLP_Input_Input_Style_1 { border: none; outline: none; background: none; text-align: right; font-family: "Duolingo Pro Rounded"; font-size: 16px; font-style: normal; font-weight: 700; line-height: normal; color: #007AFF; width: 100%; } .DLP_Input_Input_Style_1::placeholder { color: rgba(0, 122, 255, 0.50); } .DLP_Input_Style_1_Active { display: flex; height: 48px; padding: 16px; box-sizing: border-box; align-items: center; flex: 1 0 0; gap: 6px; border-radius: 8px; outline: 2px solid rgba(0, 122, 255, 0.20); outline-offset: -2px; background: rgba(0, 122, 255, 0.10); } .DLP_Input_Button_Style_1_Active { display: flex; height: 48px; padding: 12px 12px 12px 14px; box-sizing: border-box; justify-content: center; align-items: center; gap: 6px; border-radius: 8px; outline: 2px solid rgba(0, 0, 0, 0.20); outline-offset: -2px; background: #007AFF; } @keyframes DLP_Rotate_360_Animation_1 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @keyframes DLP_Pulse_Opacity_Animation_1 { 0% { opacity: 1; } 16.66666666% { opacity: 0.75; } 33.33333333% { opacity: 1; } 100% { opacity: 1; } } .DLP_Scroll_Box_Style_1 { display: flex; height: 200px; padding: 14px 16px; box-sizing: border-box; justify-content: center; align-items: flex-start; gap: 8px; align-self: stretch; border-radius: 8px; outline: 2px solid rgb(var(--color-eel), 0.10); outline-offset: -2px; background: rgb(var(--color-snow), 0.90); position: relative; } .DLP_Scroll_Box_Text_Style_1 { font-family: "Duolingo Pro Rounded"; font-size: 16px; font-style: normal; font-weight: 700; line-height: normal; opacity: 0.5; margin: 0; overflow-y: scroll; position: absolute; top: 0; bottom: 0; right: 16px; left: 16px; padding-top: 16px; padding-bottom: 16px; } .DLP_Scroll_Box_Text_Style_1::-webkit-scrollbar { transform: translateX(16px); } .DLP_Button_Style_2 { display: flex; height: 48px; box-sizing: border-box; justify-content: center; align-items: center; gap: 6px; flex: 1 0 0; border-radius: 8px; } .DLP_Toggle_Style_1 { display: flex; width: 48px; height: 48px; padding: 16px; box-sizing: border-box; justify-content: center; align-items: center; gap: 6px; border-radius: 8px; transition: background 0.8s cubic-bezier(0.16, 1, 0.32, 1), filter 0.4s cubic-bezier(0.16, 1, 0.32, 1), transform 0.4s cubic-bezier(0.16, 1, 0.32, 1); } .DLP_Toggle_Style_1_ON { outline: 2px solid rgba(0, 0, 0, 0.20); outline-offset: -2px; background: #34C759; } .DLP_Toggle_Style_1_OFF { outline: 2px solid rgba(0, 0, 0, 0.20); outline-offset: -2px; background: #FF2D55; } .DLP_Large_Input_Box_Style_1 { display: flex; padding: 16px; box-sizing: border-box; justify-content: center; align-items: flex-start; align-self: stretch; border-radius: 8px; border: none; outline: 2px solid rgb(var(--color-eel), 0.10); outline-offset: -2px; background: rgb(var(--color-snow), 0.90); color: rgb(var(--color-eel), 0.50); font-size: 16px; font-weight: 700; font-family: Duolingo Pro Rounded, 'din-round' !important; resize: vertical; transition: .2s; } .DLP_Large_Input_Box_Style_1::placeholder { font-weight: 700; color: rgb(var(--color-eel), 0.25); } .DLP_Large_Input_Box_Style_1:focus { outline: 2px solid #007AFF; } .DLP_Feedback_Type_Button_Style_1_ON { outline: 2px solid rgba(0, 0, 0, 0.20); outline-offset: -2px; background: #FF2D55; } .DLP_Feedback_Type_Button_Style_1_ON .DLP_Text_Style_1 { color: #FFF; } .DLP_Feedback_Type_Button_Style_1_OFF { outline: 2px solid rgba(255, 45, 85, 0.20); outline-offset: -2px; background: rgba(255, 45, 85, 0.10); } .DLP_Feedback_Type_Button_Style_1_OFF .DLP_Text_Style_1 { color: #FF2D55; } .DLP_Feedback_Type_Button_Style_2_ON { outline: 2px solid rgba(0, 0, 0, 0.20); outline-offset: -2px; background: #34C759; } .DLP_Feedback_Type_Button_Style_2_ON .DLP_Text_Style_1 { color: #FFF; } .DLP_Feedback_Type_Button_Style_2_OFF { outline: 2px solid rgba(52, 199, 89, 0.20); outline-offset: -2px; background: rgba(52, 199, 89, 0.10); } .DLP_Feedback_Type_Button_Style_2_OFF .DLP_Text_Style_1 { color: #34C759; } .DLP_Notification_Main { display: flex; justify-content: center; align-items: center; transition: 0.8s cubic-bezier(0.16, 1, 0.32, 1); width: 100%; position: fixed; left: 16px; } .DLP_Notification_Box { display: flex; width: 300px; padding: 16px; box-sizing: border-box; flex-direction: column; justify-content: flex-start; align-items: center; gap: 4px; border-radius: 16px; border: 2px solid rgb(var(--color-eel), 0.10); background: rgb(var(--color-snow), 0.90); backdrop-filter: blur(16px); transition: 0.8s cubic-bezier(0.16, 1, 0.32, 1); filter: blur(16px); opacity: 0; } `; let HTML3 = `

`; let HTML4 = ` .solve-btn { position: relative; min-width: 150px; font-size: 17px; border: none; border-bottom: 4px solid #2b70c9; border-radius: 16px; padding: 13px 16px; transition: filter .0s; font-weight: 700; letter-spacing: .8px; background: #1cb0f6; color: rgb(var(--color-snow)); cursor: pointer; } .pause-btn { position: relative; min-width: 100px; font-size: 17px; border: none; border-bottom: 4px solid #ff9600; border-radius: 16px; padding: 13px 16px; transition: filter .0s; font-weight: 700; letter-spacing: .8px; background: #ffc800; color: rgb(var(--color-snow)); cursor: pointer; } .auto-solver-btn:hover { filter: brightness(1.1); } .auto-solver-btn:active { border-bottom: 0px; margin-bottom: 4px; top: 4px; } `; function One() { document.head.appendChild(Object.assign(document.createElement('style'), { type: 'text/css', textContent: CSS1 })); document.body.insertAdjacentHTML('beforeend', HTML2); document.head.appendChild(Object.assign(document.createElement('style'), { type: 'text/css', textContent: CSS2 })); setTimeout(() => { if (!storageLocal.onboarding) { if (currentPage !== 10) goToPage(currentPage, 10); } else if (storageSession.legacy.page === 1) { let button = document.querySelector('#DLP_Switch_Legacy_Button_1_ID'); goToPage(currentPage, 3); setTimeout(() => { setButtonState(button, 'Switch to 3.0', button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); }, 1000); } else if (storageSession.legacy.page === 2) { let button = document.querySelector('#DLP_Switch_Legacy_Button_1_ID'); goToPage(currentPage, 4); setTimeout(() => { setButtonState(button, 'Switch to 3.0', button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); }, 1000); } document.getElementById("DLP_Main_Discord_Button_1_ID").addEventListener("click", function() { window.open("https://duolingopro.net/discord", "_blank"); }); document.getElementById("DLP_Main_GitHub_Button_1_ID").addEventListener("click", function() { window.open("https://duolingopro.net/github", "_blank"); }); document.getElementById("DLP_Secondary_Discord_Button_1_ID").addEventListener("click", function() { window.open("https://duolingopro.net/discord", "_blank"); }); document.getElementById("DLP_Secondary_GitHub_Button_1_ID").addEventListener("click", function() { window.open("https://duolingopro.net/github", "_blank"); }); document.getElementById("DLP_Main_Donate_Button_1_ID").addEventListener("click", function() { window.open("https://duolingopro.net/patreon", "_blank"); }); document.getElementById("DLP_Secondary_Donate_Button_1_ID").addEventListener("click", function() { window.open("https://duolingopro.net/patreon", "_blank"); }); document.querySelectorAll('.GEMS_UNAVAILABLE').forEach(item => { item.addEventListener('click', () => { showNotification("warning", "Gems Function is Unavailable", "The Gems function is currently unavailable. We plan to make it accessible to everyone soon.", 6); }); }); }, 400); function addButtons() { function createButton(id, text, styleClass, eventHandlers) { const button = document.createElement('button'); button.id = id; button.innerText = text; button.className = styleClass; Object.keys(eventHandlers).forEach(event => { button.addEventListener(event, eventHandlers[event]); }); return button; } if (window.location.pathname === '/learn' && document.querySelector('a[data-test="global-practice"]')) { return; } if (document.querySelector("#solveAllButton")) { return; } const nextButton = document.querySelector('[data-test="player-next"]'); const storiesContinueButton = document.querySelector('[data-test="stories-player-continue"]'); const storiesDoneButton = document.querySelector('[data-test="stories-player-done"]'); const target = nextButton || storiesContinueButton || storiesDoneButton; if (document.querySelector('[data-test="story-start"]') && storageSession.legacy.status) { document.querySelector('[data-test="story-start"]').click(); } if (!target) { const startButton = document.querySelector('[data-test="start-button"]'); if (!startButton) { return; } const solveAllButton = createButton("solveAllButton", "COMPLETE SKILL", "solve-all-btn", { 'click': () => { solving(true); setInterval(() => { const startButton = document.querySelector('[data-test="start-button"]'); if (startButton && startButton.innerText.startsWith("START")) { startButton.click(); } }, 1000); startButton.click(); } }); startButton.parentNode.appendChild(solveAllButton); } else { if (document.querySelector('.MYehf') !== null) { document.querySelector('.MYehf').style.display = "flex"; document.querySelector('.MYehf').style.gap = "20px"; } else if (document.querySelector(".FmlUF") !== null) { // Story findReactMainElementClass = '_3TJzR'; reactTraverseUp = 0; document.querySelector('._3TJzR').style.display = "flex"; document.querySelector('._3TJzR').style.gap = "20px"; } const buttonsCSS = document.createElement('style'); buttonsCSS.innerHTML = HTML4; document.head.appendChild(buttonsCSS); const solveCopy = createButton('solveAllButton', solvingIntervalId ? 'PAUSE SOLVE' : 'SOLVE ALL', 'auto-solver-btn solve-btn', { 'click': solving }); const pauseCopy = createButton('', 'SOLVE', 'auto-solver-btn pause-btn', { 'click': solve }); target.parentElement.appendChild(pauseCopy); target.parentElement.appendChild(solveCopy); if (storageSession.legacy.status) { solving("start"); } } } setInterval(addButtons, 500); let notificationCount = 0; let currentNotification = []; function showNotification(icon, head, body, time) { notificationCount++; let notificationID = notificationCount; currentNotification.push(notificationID); let notificationMain = document.querySelector('.DLP_Notification_Main'); let element = new DOMParser().parseFromString(HTML3, 'text/html').body.firstChild; element.id = 'DLP_Notification_Box_' + notificationID + '_ID'; notificationMain.appendChild(element); if (icon === "") element.querySelector('#DLP_Inset_Icon_1_ID').remove(); else if (icon === "checkmark") element.querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; else if (icon === "warning") element.querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; else if (icon === "error") element.querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; element.querySelector('#DLP_Inset_Text_1_ID').innerHTML = head; element.querySelector('#DLP_Inset_Text_2_ID').innerHTML = body; //document.head.appendChild(Object.assign(document.createElement('style'), { type: 'text/css', textContent: CSS4 })); let notification = document.querySelector('#DLP_Notification_Box_' + notificationID + '_ID'); let notificationHeight = notification.offsetHeight; notification.style.bottom = '-' + notificationHeight + 'px'; setTimeout(() => { requestAnimationFrame(() => { notification.style.bottom = "16px"; notification.style.filter = "blur(0px)"; notification.style.opacity = "1"; }); }, "50"); let isBusyDisappearing = false; function repeat() { if (document.body.offsetWidth <= 963) { requestAnimationFrame(() => { notificationMain.style.width = "300px"; notificationMain.style.position = "fixed"; notificationMain.style.left = "16px"; }); } else { requestAnimationFrame(() => { notificationMain.style.width = ""; notificationMain.style.position = ""; notificationMain.style.left = ""; }); } if (isBusyDisappearing) return; if (currentNotification[currentNotification.length - 1] !== notificationID) { notification.style.height = notificationHeight + 'px'; requestAnimationFrame(() => { //console.log('#DLP_Notification_Box_' + String(currentNotification.pop()) + '_ID'); //console.log(notificationID, currentNotification[currentNotification.length - 1], currentNotification); notification.style.height = document.querySelector('#DLP_Notification_Box_' + String(currentNotification[currentNotification.length - 1]) + '_ID').offsetHeight + 'px'; notification.style.width = "284px"; notification.style.transform = "translateY(-8px)"; }); } else { requestAnimationFrame(() => { notification.style.height = notificationHeight + "px"; notification.style.width = ""; notification.style.transform = ""; }); } } let repeatInterval = setInterval(repeat, 100); function disappear() { if (isBusyDisappearing) return; isBusyDisappearing = true; if (currentNotification[currentNotification.length - 1] === notificationID) { currentNotification.splice(currentNotification.indexOf(notificationID), 1); requestAnimationFrame(() => { notification.style.bottom = "-" + notificationHeight + "px"; notification.style.filter = "blur(16px)"; notification.style.opacity = "0"; }); clearInterval(repeatInterval); setTimeout(() => { notification.remove(); }, "800"); } else if (currentNotification[currentNotification.length - 2] === notificationID) { currentNotification.splice(currentNotification.indexOf(notificationID), 1); requestAnimationFrame(() => { notification.style.transform = ""; notification.style.filter = "blur(16px)"; notification.style.opacity = "0"; }); clearInterval(repeatInterval); setTimeout(() => { notification.remove(); }, "800"); } else { currentNotification.splice(currentNotification.indexOf(notificationID), 1); notification.remove(); clearInterval(repeatInterval); } } notification.querySelector('#DLP_Notification_Dismiss_Button_1_ID').addEventListener("click", disappear); if (time !== 0) setTimeout(disappear, time * 1000); } let isBusySwitchingPages = false; let pages = { "DLP_Onboarding_Start_Button_1_ID": [10, 1], "DLP_Switch_Legacy_Button_1_ID": [1, 3], "DLP_Main_See_More_1_Button_1_ID": [1, 2], "DLP_Main_2_Back_1_Button_1_ID": [2, 1], "DLP_Main_2_Terms_1_Button_1_ID": [2, 5], "DLP_Main_Terms_1_Button_1_ID": [1, 5], "DLP_Secondary_Feedback_1_Button_1_ID": [3, 8], "DLP_Secondary_Settings_1_Button_1_ID": [1, 7], "DLP_Secondary_Release_Notes_1_Button_1_ID": [1, 9], "DLP_Secondary_Terms_1_Button_1_ID": [3, 5], "DLP_Secondary_See_More_1_Button_1_ID": [3, 4], "DLP_Secondary_2_Back_1_Button_1_ID": [4, 3], "DLP_Secondary_2_Terms_1_Button_1_ID": [4, 5], "DLP_Terms_Back_Button_1_ID": [5, 1], "DLP_Terms_Accept_Button_1_ID": [5, 1], "DLP_Terms_Decline_Button_1_ID": [5, 6], "DLP_Terms_Declined_Back_Button_1_ID": [6, 5], "DLP_Main_Feedback_1_Button_1_ID": [1, 8], "DLP_Feedback_Cancel_1_Button_1_ID": [8, 1], "DLP_Main_Settings_1_Button_1_ID": [1, 7], "DLP_Settings_Back_1_Button_1_ID": [7, 1], "DLP_Main_Release_Notes_1_Button_1_ID": [1, 9], "DLP_Release_Notes_Back_1_Button_1_ID": [9, 1] }; function goToPage(from, to, buttonID) { isBusySwitchingPages = true; let mainBox = document.querySelector(`.DLP_Main_Box`); let fromNumber = from; let toNumber = to; let fromPage = document.querySelector(`#DLP_Main_Box_Divider_${fromNumber}_ID`); let toPage = document.querySelector(`#DLP_Main_Box_Divider_${toNumber}_ID`); if (buttonID === 'DLP_Main_Terms_1_Button_1_ID' || buttonID === 'DLP_Main_2_Terms_1_Button_1_ID' || buttonID === 'DLP_Secondary_Terms_1_Button_1_ID' || buttonID === 'DLP_Secondary_2_Terms_1_Button_1_ID') { document.querySelector(`#DLP_Terms_1_Text_1_ID`).style.display = 'none'; document.querySelector(`#DLP_Terms_1_Button_1_ID`).style.display = 'none'; document.querySelector(`#DLP_Terms_1_Text_2_ID`).style.display = 'block'; document.querySelector(`#DLP_Terms_1_Button_2_ID`).style.display = 'block'; } else if (buttonID === 'DLP_Terms_Back_Button_1_ID') { toPage = document.querySelector(`#DLP_Main_Box_Divider_${lastPage}_ID`); setTimeout(() => { document.querySelector(`#DLP_Terms_1_Text_1_ID`).style.display = 'block'; document.querySelector(`#DLP_Terms_1_Button_1_ID`).style.display = 'block'; document.querySelector(`#DLP_Terms_1_Text_2_ID`).style.display = 'none'; document.querySelector(`#DLP_Terms_1_Button_2_ID`).style.display = 'none'; }, "400"); } else if (buttonID === 'DLP_Switch_Legacy_Button_1_ID') { let button = document.querySelector('#DLP_Switch_Legacy_Button_1_ID'); if (legacyMode) { fromPage = document.querySelector(`#DLP_Main_Box_Divider_${currentPage}_ID`); toPage = document.querySelector(`#DLP_Main_Box_Divider_${fromNumber}_ID`); toNumber = fromNumber; setButtonState(button, 'Switch to Legacy', button.querySelector('#DLP_Inset_Icon_1_ID'), button.querySelector('#DLP_Inset_Icon_2_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); storageSession.legacy.page = 0; saveStorageSession(); } else { fromPage = document.querySelector(`#DLP_Main_Box_Divider_${currentPage}_ID`); setButtonState(button, 'Switch to 3.0', button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); } legacyMode = !legacyMode; } else if (buttonID === 'DLP_Terms_Accept_Button_1_ID') { storageLocal.terms = newTermID; saveStorageLocal(); } else if (buttonID === 'DLP_Onboarding_Start_Button_1_ID') { storageLocal.onboarding = true; saveStorageLocal(); goToPage(10, 1); } //if (to === 1 || to === 3) { // if (buttonID === 'DLP_Terms_Back_Button_1_ID') { // if (lastPage === 1 || lastPage === 3) legacyButtonVisibility(true); // } else legacyButtonVisibility(true); //} else if (from === 1 || from === 3) legacyButtonVisibility(false); if (to === 1 || to === 2 || to === 3 || to === 4) { legacyButtonVisibility(true); } else legacyButtonVisibility(false); let mainBoxOldHeight = mainBox.offsetHeight; fromPage.style.display = "none"; toPage.style.display = "block"; let mainBoxNewHeight = mainBox.offsetHeight; fromPage.style.display = "block"; toPage.style.display = "none"; mainBox.style.height = `${mainBoxOldHeight}px`; mainBox.offsetHeight; mainBox.style.transition = "0.8s cubic-bezier(0.16, 1, 0.32, 1)"; mainBox.offsetHeight; mainBox.style.height = `${mainBoxNewHeight}px`; fromPage.style.transition = "0.4s cubic-bezier(0.16, 1, 0.32, 1)"; fromPage.style.opacity = "0"; fromPage.style.filter = "blur(4px)"; toPage.style.opacity = "0"; toPage.style.filter = "blur(4px)"; setTimeout(() => { fromPage.style.display = "none"; toPage.style.display = "block"; toPage.style.transition = "0.4s cubic-bezier(0.16, 1, 0.32, 1)"; toPage.offsetHeight; toPage.style.opacity = "1"; toPage.style.filter = "blur(0px)"; setTimeout(() => { toPage.style.opacity = ""; toPage.style.filter = ""; toPage.style.transition = ""; fromPage.style.transition = ""; toPage.style.opacity = ""; toPage.style.filter = ""; mainBox.style.height = ""; lastPage = currentPage; currentPage = toNumber; isBusySwitchingPages = false; }, "400"); }, "400"); } Object.keys(pages).forEach(function (key) { document.getElementById(key).addEventListener("click", function () { if (isBusySwitchingPages || isGetButtonsBusy) return; goToPage(pages[this.id][0], pages[this.id][1], key); }); }); document.getElementById('DLP_Hide_Button_1_ID').addEventListener("click", function () { if (isBusySwitchingPages) return; hidden = !hidden; hide(hidden); }); function hide(value) { if (isBusySwitchingPages) return; isBusySwitchingPages = true; let button = document.querySelector(`#DLP_Hide_Button_1_ID`); let main = document.querySelector(`.DLP_Main`); let mainBox = document.querySelector(`.DLP_Main_Box`); let mainBoxHeight = mainBox.offsetHeight; main.style.transition = "0.8s cubic-bezier(0.16, 1, 0.32, 1)"; mainBox.style.transition = "0.8s cubic-bezier(0.16, 1, 0.32, 1)"; if (value) { setButtonState(button, 'Show', button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); main.style.bottom = `-${mainBoxHeight - 8}px`; legacyButtonVisibility(false); mainBox.style.filter = "blur(8px)"; mainBox.style.opacity = "0"; } else { setButtonState(button, 'Hide', button.querySelector('#DLP_Inset_Icon_1_ID'), button.querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); main.style.bottom = "16px"; if (currentPage === 1 || currentPage === 3) legacyButtonVisibility(true); mainBox.style.filter = ""; mainBox.style.opacity = ""; } setTimeout(() => { main.style.transition = ""; mainBox.style.transition = ""; isBusySwitchingPages = false; }, "800"); } document.querySelector(`.DLP_Main`).style.bottom = `-${document.querySelector(`.DLP_Main_Box`).offsetHeight - 8}px`; document.querySelector(`.DLP_Main_Box`).style.opacity = "0"; document.querySelector(`.DLP_Main_Box`).style.filter = "blur(8px)"; document.querySelector(`#DLP_Switch_Legacy_Button_1_ID`).style.filter = "blur(8px)"; document.querySelector(`#DLP_Switch_Legacy_Button_1_ID`).style.opacity = "0"; document.querySelector(`#DLP_Switch_Legacy_Button_1_ID`).style.display = "none"; hide(false, false); function legacyButtonVisibility(value) { let legacyButton = document.querySelector(`#DLP_Switch_Legacy_Button_1_ID`); legacyButton.style.transition = 'width 0.8s cubic-bezier(0.77,0,0.18,1), opacity 0.8s cubic-bezier(0.16, 1, 0.32, 1), filter 0.8s cubic-bezier(0.16, 1, 0.32, 1), transform 0.4s cubic-bezier(0.16, 1, 0.32, 1)'; if (value) { legacyButton.style.display = ""; legacyButton.offsetWidth; legacyButton.style.filter = ""; legacyButton.style.opacity = ""; } else { legacyButton.style.filter = "blur(8px)"; legacyButton.style.opacity = "0"; setTimeout(() => { legacyButton.style.display = "none"; }, "800"); } } function handleVisibility() { if (document.querySelector('.MYehf') !== null || window.location.pathname.includes('/lesson') || window.location.pathname === '/practice') { document.querySelector('.DLP_Main').style.display = 'none'; } else { document.querySelector('.DLP_Main').style.display = ''; } } setInterval(handleVisibility, 200); const DLP_Get_PATH_1_ID = document.getElementById("DLP_Get_PATH_1_ID"); const DLP_Get_PATH_2_ID = document.getElementById("DLP_Get_PATH_2_ID"); const DLP_Get_PRACTICE_1_ID = document.getElementById("DLP_Get_PRACTICE_1_ID"); const DLP_Get_PRACTICE_2_ID = document.getElementById("DLP_Get_PRACTICE_2_ID"); const DLP_Get_LISTEN_1_ID = document.getElementById("DLP_Get_LISTEN_1_ID"); const DLP_Get_LISTEN_2_ID = document.getElementById("DLP_Get_LISTEN_2_ID"); const DLP_Get_LESSON_1_ID = document.getElementById("DLP_Get_LESSON_1_ID"); const DLP_Get_LESSON_2_ID = document.getElementById("DLP_Get_LESSON_2_ID"); function inputCheck2() { const ids = { "DLP_Get_PATH_1_ID": ["path"], "DLP_Get_PATH_2_ID": ["path"], "DLP_Get_PRACTICE_1_ID": ["practice"], "DLP_Get_PRACTICE_2_ID": ["practice"], "DLP_Get_LISTEN_1_ID": ["listen"], "DLP_Get_LISTEN_2_ID": ["listen"], "DLP_Get_LESSON_1_ID": ["lesson"], "DLP_Get_LESSON_2_ID": ["lesson"] }; Object.keys(ids).forEach(id => { const element = document.getElementById(id); if (!element) return; const input = element.querySelector('#DLP_Inset_Input_1_ID'); const button = element.querySelector('#DLP_Inset_Button_1_ID'); if (!input || !button) return; const updateButtonState = () => { const isEmpty = input.value.length === 0; button.style.opacity = isEmpty ? '0.5' : ''; button.style.pointerEvents = isEmpty ? 'none' : ''; }; const category = ids[id][0]; input.addEventListener("input", function () { this.value = this.value.replace(/[^0-9]/g, ""); if (this.value.length = 1 && this.value[0] === '0') this.value = this.value.slice(1); if (this.value.length > 6) this.value = this.value.slice(0, 6); updateButtonState(); if (!storageSession.legacy[category]) storageSession.legacy[category] = []; storageSession.legacy[category].amount = Number(this.value); saveStorageSession(); }); if (storageSession.legacy[category].amount !== 0) input.value = storageSession.legacy[category].amount; updateButtonState(); }); } inputCheck2(); DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.path.amount > 0) { setButtonState(DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 1; storageSession.legacy.status = 'path'; saveStorageSession(); } else if (storageSession.legacy.status === 'path') { setButtonState(DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.path.type === 'lesson') { DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.path.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.path.type === 'xp') { DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.path.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.path.type === 'infinity') { DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.path.type = 'lesson'; saveStorageSession(); } }); DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.path.amount > 0) { setButtonState(DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 2; storageSession.legacy.status = 'path'; saveStorageSession(); } else if (storageSession.legacy.status === 'path') { setButtonState(DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.path.type === 'lesson') { DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.path.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.path.type === 'xp') { DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.path.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.path.type === 'infinity') { DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.path.type = 'lesson'; saveStorageSession(); } }); DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.practice.amount > 0) { setButtonState(DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 1; storageSession.legacy.status = 'practice'; saveStorageSession(); } else if (storageSession.legacy.status === 'practice') { setButtonState(DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.practice.type === 'lesson') { DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.practice.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.practice.type === 'xp') { DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.practice.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.practice.type === 'infinity') { DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.practice.type = 'lesson'; saveStorageSession(); } }); DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.practice.amount > 0) { setButtonState(DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 2; storageSession.legacy.status = 'practice'; saveStorageSession(); } else if (storageSession.legacy.status === 'practice') { setButtonState(DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.practice.type === 'lesson') { DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.practice.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.practice.type === 'xp') { DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.practice.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.practice.type === 'infinity') { DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.practice.type = 'lesson'; saveStorageSession(); } }); DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.listen.amount > 0) { setButtonState(DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 1; storageSession.legacy.status = 'listen'; saveStorageSession(); } else if (storageSession.legacy.status === 'listen') { setButtonState(DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.listen.type === 'lesson') { DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.listen.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.listen.type === 'xp') { DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.listen.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.listen.type === 'infinity') { DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.listen.type = 'lesson'; saveStorageSession(); } }); DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.listen.amount > 0) { setButtonState(DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 2; storageSession.legacy.status = 'listen'; saveStorageSession(); } else if (storageSession.legacy.status === 'listen') { setButtonState(DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.listen.type === 'lesson') { DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.listen.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.listen.type === 'xp') { DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.listen.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.listen.type === 'infinity') { DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.listen.type = 'lesson'; saveStorageSession(); } }); DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.lesson.amount > 0) { setButtonState(DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 1; storageSession.legacy.status = 'listen'; saveStorageSession(); } else if (storageSession.legacy.status === 'listen') { setButtonState(DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.lesson.type === 'lesson') { DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.lesson.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.lesson.type === 'xp') { DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.lesson.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.lesson.type === 'infinity') { DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.lesson.type = 'lesson'; saveStorageSession(); } }); DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (!storageSession.legacy.status && storageSession.legacy.lesson.amount > 0) { setButtonState(DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = 2; storageSession.legacy.status = 'listen'; saveStorageSession(); } else if (storageSession.legacy.status === 'listen') { setButtonState(DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'START', DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.page = 0; storageSession.legacy.status = false; saveStorageSession(); } }); DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { if (storageSession.legacy.lesson.type === 'lesson') { DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'block'; storageSession.legacy.lesson.type = 'xp'; saveStorageSession(); } else if (storageSession.legacy.lesson.type === 'xp') { DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_2_ID').style.display = 'none'; DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'block'; storageSession.legacy.lesson.type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy.lesson.type === 'infinity') { DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_3_ID').style.display = 'none'; DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_2_ID').querySelector('#DLP_Inset_Icon_1_ID').style.display = 'block'; storageSession.legacy.lesson.type = 'lesson'; saveStorageSession(); } }); function restoreClick2() { if (storageSession.legacy.status === 'path' && storageSession.legacy.path.amount > 0) { if (storageSession.legacy.page === 1) { setButtonState(DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PATH_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } else if (storageSession.legacy.page === 2) { setButtonState(DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PATH_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } } else if (storageSession.legacy.status === 'practice' && storageSession.legacy.practice.amount > 0) { if (storageSession.legacy.page === 1) { setButtonState(DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PRACTICE_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } else if (storageSession.legacy.page === 2) { setButtonState(DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_PRACTICE_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } } else if (storageSession.legacy.status === 'listen' && storageSession.legacy.practice.listen > 0) { if (storageSession.legacy.page === 1) { setButtonState(DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } else if (storageSession.legacy.page === 2) { setButtonState(DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LISTEN_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } } else if (storageSession.legacy.status === 'lesson' && storageSession.legacy.practice.lesson > 0) { if (storageSession.legacy.page === 1) { setButtonState(DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } else if (storageSession.legacy.page === 2) { setButtonState(DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'STOP', DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_2_ID'), DLP_Get_LESSON_2_ID.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); } } } setTimeout(restoreClick2, 400); let pageSwitching = false; function process1() { if (window.location.href.includes('/lesson') || window.location.href.includes('/practice') || window.location.href.includes('/practice-hub/listening-practice')) return; if (storageSession.legacy.status && storageSession.legacy[storageSession.legacy.status].amount > 0) { if (pageSwitching) return; pageSwitching = true; setTimeout(() => { checkChest(); }, 2000); } else { pageSwitching = false; } } setInterval(process1, 500); function process2() { if (storageSession.legacy.status && storageSession.legacy[storageSession.legacy.status].amount > 0) { if (storageSession.legacy.status === 'path') { window.location.href = "https://duolingo.com/lesson"; } else if (storageSession.legacy.status === 'practice') { window.location.href = "https://duolingo.com/practice"; } else if (storageSession.legacy.status === 'listen') { window.location.href = "https://duolingo.com/practice-hub/listening-practice"; } else if (storageSession.legacy.status === 'lesson') { window.location.href = "https://duolingo.com/lesson/unit/1/level/1"; } } else { pageSwitching = false; } } let checkChestCount = 0; function checkChest() { try { if (document.readyState === 'complete') { const imageUrl = 'https://d35aaqx5ub95lt.cloudfront.net/images/path/09f977a3e299d1418fde0fd053de0beb.svg'; const images = document.querySelectorAll('.TI9Is'); if (!images.length) { setTimeout(function() { process2(); }, 2000); } else { let imagesProcessed = 0; let chestFound = false; images.forEach(image => { if (image.src === imageUrl) { image.click(); chestFound = true; setTimeout(function() { process2(); }, 2000); } imagesProcessed++; if (imagesProcessed >= images.length && !chestFound) { process2(); } }); } } else { setTimeout(function() { checkChestCount++; checkChest(); }, 100); } } catch (error) { setTimeout(function() { process2(); }, 2000); } }; const DLP_Get_XP_1_ID = document.getElementById("DLP_Get_XP_1_ID"); const DLP_Get_XP_2_ID = document.getElementById("DLP_Get_XP_2_ID"); const DLP_Get_GEMS_1_ID = document.getElementById("DLP_Get_GEMS_1_ID"); const DLP_Get_GEMS_2_ID = document.getElementById("DLP_Get_GEMS_2_ID"); const DLP_Get_SUPER_2_ID = document.getElementById("DLP_Get_SUPER_2_ID"); function inputCheck1() { const ids = { "DLP_Get_XP_1_ID": ["xp"], "DLP_Get_XP_2_ID": ["xp"], "DLP_Get_GEMS_1_ID": ["gems"], "DLP_Get_GEMS_2_ID": ["gems"], //"DLP_Get_SUPER_1_ID": ["super"], "DLP_Get_SUPER_2_ID": ["super"] }; Object.keys(ids).forEach(id => { const element = document.getElementById(id); if (!element) return; const input = element.querySelector('#DLP_Inset_Input_1_ID'); const button = element.querySelector('#DLP_Inset_Button_1_ID'); if (!input || !button) return; const updateButtonState = () => { const isEmpty = input.value.length === 0; button.style.opacity = isEmpty ? '0.5' : ''; button.style.pointerEvents = isEmpty ? 'none' : ''; }; const category = ids[id][0]; input.addEventListener("input", function () { this.value = this.value.replace(/[^0-9]/g, ""); if (this.value.length = 1 && this.value[0] === '0') this.value = this.value.slice(1); if (this.value.length > 8) this.value = this.value.slice(0, 8); updateButtonState(); }); if (!input.value) updateButtonState(); }); } inputCheck1(); let DLP_Magnetic_Hover_1 = document.querySelectorAll('.DLP_Magnetic_Hover_1'); DLP_Magnetic_Hover_1.forEach(element => { let mouseDown = false; element.addEventListener('mousemove', (e) => { const rect = element.getBoundingClientRect(); const x = e.clientX - rect.left - rect.width / 2; const y = e.clientY - rect.top - rect.height / 2; if (mouseDown) { element.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px) scale(0.9)`; } else { element.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px) scale(1.1)`; } }); element.addEventListener('mouseleave', () => { element.style.transform = 'translate(0, 0) scale(1)'; mouseDown = false; }); element.addEventListener('mousedown', (e) => { mouseDown = true; const rect = element.getBoundingClientRect(); const x = e.clientX - rect.left - rect.width / 2; const y = e.clientY - rect.top - rect.height / 2; if (mouseDown) { element.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px) scale(0.9)`; } else { element.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px) scale(1.1)`; } }); element.addEventListener('mouseup', (e) => { mouseDown = false; const rect = element.getBoundingClientRect(); const x = e.clientX - rect.left - rect.width / 2; const y = e.clientY - rect.top - rect.height / 2; if (mouseDown) { element.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px) scale(0.9)`; } else { element.style.transform = `translate(${x * 0.1}px, ${y * 0.1}px) scale(1.1)`; } }); }); let DLP_Server_Connection_Button = document.getElementById("DLP_Main_1_Server_Connection_Button_1_ID"); let DLP_Server_Connection_Button_2 = document.getElementById("DLP_Secondary_1_Server_Connection_Button_1_ID"); DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_1_ID").style.animation = 'DLP_Rotate_360_Animation_1 4s ease-in-out infinite'; DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_1_ID").style.animation = 'DLP_Rotate_360_Animation_1 4s ease-in-out infinite'; function updateConnetionButtonStyles(button, text, iconToShow, iconToHide, buttonColor) { let textToChange = button.querySelector("#DLP_Inset_Text_1_ID"); textToChange.style.animation = ''; iconToHide.style.animation = ''; iconToShow.style.animation = ''; textToChange.offsetWidth; iconToHide.offsetWidth; iconToShow.offsetWidth; requestAnimationFrame(() => { textToChange.style.filter = 'blur(4px)'; textToChange.style.opacity = '0'; iconToHide.style.filter = 'blur(4px)'; iconToHide.style.opacity = '0'; iconToShow.style.filter = 'blur(4px)'; iconToShow.style.opacity = '0'; button.style.background = buttonColor; button.style.outline = '2px solid rgba(0, 0, 0, 0.20)'; }); setTimeout(() => { iconToHide.style.display = 'none'; iconToShow.style.display = 'block'; requestAnimationFrame(() => { textToChange.style.transition = '0s'; textToChange.textContent = text; textToChange.style.color = '#FFF'; textToChange.offsetWidth; textToChange.style.transition = '0.4s'; textToChange.offsetWidth; textToChange.style.filter = ''; textToChange.style.opacity = ''; iconToShow.offsetWidth; iconToShow.style.filter = ''; iconToShow.style.opacity = ''; setTimeout(() => { textToChange.style.animation = 'DLP_Pulse_Opacity_Animation_1 6s ease-in-out infinite'; iconToShow.style.animation = 'DLP_Pulse_Opacity_Animation_1 6s ease-in-out infinite'; }, 400); }); }, 400); } let serverConnectedBefore = 'no'; let newTermID; function connectToServer() { let mainInputsDiv1 = document.getElementById('DLP_Main_Inputs_1_Divider_1_ID'); fetch(serverURL + '/static/3.0/server.json') .then(response => response.json()) .then(data => { if (data.global || data.versions) { const globalData = data.global; const versionData = data.versions[versionName]; const warnings = versionData.warnings || []; const termsText = Object.entries(globalData.terms)[0][1]; newTermID = Object.entries(globalData.terms)[0][0]; console.log('Global Warning:', globalData.warning); console.log('Notifications:', globalData.notifications); document.querySelector(`#DLP_Terms_Main_Text_1_ID`).innerHTML = termsText; if (versionData.status === 'latest') { if (storageLocal.terms === newTermID) { if (serverConnectedBefore === 'no' || serverConnectedBefore === 'error') { updateReleaseNotes(warnings); mainInputsDiv1.style.opacity = '1'; mainInputsDiv1.style.pointerEvents = 'auto'; if (serverConnectedBefore === 'no') { updateConnetionButtonStyles(DLP_Server_Connection_Button, 'Connected', DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_2_ID"), DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_1_ID"), '#34C759'); updateConnetionButtonStyles(DLP_Server_Connection_Button_2, 'Connected', DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_2_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_1_ID"), '#34C759'); } else if (serverConnectedBefore === 'error') { updateConnetionButtonStyles(DLP_Server_Connection_Button, 'Connected', DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_2_ID"), DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_3_ID"), '#34C759'); updateConnetionButtonStyles(DLP_Server_Connection_Button_2, 'Connected', DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_2_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_3_ID"), '#34C759'); } serverConnectedBefore = 'yes'; } } else { if (storageLocal.onboarding) if (currentPage !== 5 && currentPage !== 6) goToPage(currentPage, 5); } } else if (document.getElementById('DLP_Main_Warning_1_ID').style.display === 'none') { document.getElementById('DLP_Main_Inputs_1_Divider_1_ID').style.display = 'none'; document.getElementById('DLP_Main_Warning_1_ID').style.display = 'block'; document.getElementById('DLP_Main_Warning_1_ID').innerHTML = `You are using an outdated version of Duolingo PRO.

Please update Duolingo PRO or turn on automatic updates.`; throw new Error('Outdated Client'); } } else { console.error(`Version ${versionNumber} not found in the data`); } }) .catch(error => { console.error('Error fetching data:', error); if (serverConnectedBefore === 'yes') { serverConnectedBefore = 'error'; mainInputsDiv1.style.opacity = '0.5'; mainInputsDiv1.style.pointerEvents = 'none'; updateConnetionButtonStyles(DLP_Server_Connection_Button, 'Error', DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_3_ID"), DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_2_ID"), '#FF2D55'); updateConnetionButtonStyles(DLP_Server_Connection_Button_2, 'Error', DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_3_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_2_ID"), '#FF2D55'); } else if (serverConnectedBefore === 'no') { serverConnectedBefore = 'error'; mainInputsDiv1.style.opacity = '0.5'; mainInputsDiv1.style.pointerEvents = 'none'; updateConnetionButtonStyles(DLP_Server_Connection_Button, 'Error', DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_3_ID"), DLP_Server_Connection_Button.querySelector("#DLP_Inset_Icon_1_ID"), '#FF2D55'); updateConnetionButtonStyles(DLP_Server_Connection_Button_2, 'Error', DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_3_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_1_ID"), '#FF2D55'); } }); } connectToServer(); setInterval(() => { connectToServer(); }, 6000); function updateReleaseNotes(warnings) { const releaseNotesContainer = document.getElementById('DLP_Release_Notes_List_1_ID'); releaseNotesContainer.innerHTML = ''; warnings.forEach(warning => { if (warning.head && warning.body && warning.icon) { console.log(warning); let warningHTML = ''; if (warning.icon === 'error') { warningHTML = `

${warning.head}

${warning.body}

`; } else if (warning.icon === 'warning') { warningHTML = `

${warning.head}

${warning.body}

`; } else if (warning.icon === 'checkmark') { warningHTML = `

${warning.head}

${warning.body}

`; } releaseNotesContainer.insertAdjacentHTML('beforeend', warningHTML); } }); } let DLP_Feedback_Text_Input_1_ID = document.getElementById("DLP_Feedback_Text_Input_1_ID"); let DLP_Feedback_Type_Bug_Report_Button_1_ID = document.getElementById("DLP_Feedback_Type_Bug_Report_Button_1_ID"); let DLP_Feedback_Type_Suggestion_Button_1_ID = document.getElementById("DLP_Feedback_Type_Suggestion_Button_1_ID"); let DLP_Feedback_Attachment_Upload_Button_1_ID = document.getElementById("DLP_Feedback_Attachment_Upload_Button_1_ID"); let DLP_Feedback_Attachment_Input_Hidden_1_ID = document.getElementById("DLP_Feedback_Attachment_Input_Hidden_1_ID"); let DLP_Feedback_Send_Button_1_ID = document.getElementById("DLP_Feedback_Send_Button_1_ID"); let sendFeedbackStatus = ''; DLP_Feedback_Send_Button_1_ID.addEventListener('click', () => { if (sendFeedbackStatus !== '') return; let FeedbackText = DLP_Feedback_Text_Input_1_ID.value; sendFeedbackServer('', FeedbackText, feedbackType, ''); const ogIcon = DLP_Feedback_Send_Button_1_ID.querySelector('#DLP_Inset_Icon_1_ID'); const loadingIcon = DLP_Feedback_Send_Button_1_ID.querySelector('#DLP_Inset_Icon_2_ID'); const doneIcon = DLP_Feedback_Send_Button_1_ID.querySelector('#DLP_Inset_Icon_3_ID'); const failedIcon = DLP_Feedback_Send_Button_1_ID.querySelector('#DLP_Inset_Icon_4_ID'); setButtonState(DLP_Feedback_Send_Button_1_ID, 'SENDING', loadingIcon, ogIcon, 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400, () => { loadingIcon.style.animation = 'DLP_Rotate_360_Animation_1 4s ease-in-out infinite'; function f() { if (sendFeedbackStatus === 'sent') { setButtonState(DLP_Feedback_Send_Button_1_ID, 'SENT', doneIcon, loadingIcon, 'rgba(52, 199, 89, 0.10)', '2px solid rgba(52, 199, 89, 0.20)', '#34C759', 400, () => { confetti(); setTimeout(() => { setButtonState(DLP_Feedback_Send_Button_1_ID, 'SEND', ogIcon, doneIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); sendFeedbackStatus = ''; }, 4000); }); } else if (sendFeedbackStatus === 'error') { setButtonState(DLP_Feedback_Send_Button_1_ID, 'FAILED', failedIcon, loadingIcon, 'rgba(255, 45, 85, 0.10)', '2px solid rgba(255, 45, 85, 0.20)', '#FF2D55', 400, () => { setTimeout(() => { setButtonState(DLP_Feedback_Send_Button_1_ID, 'SEND', ogIcon, failedIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); sendFeedbackStatus = ''; }, 4000); }); } else if (sendFeedbackStatus === 'sending') { setTimeout(() => { f(); }, 800); } } f(); }); }); let feedbackType = 'Suggestion'; DLP_Feedback_Type_Bug_Report_Button_1_ID.addEventListener('click', () => { feedbackType = 'Bug Report'; DLP_Feedback_Type_Bug_Report_Button_1_ID.classList.add('DLP_Feedback_Type_Button_Style_1_ON'); DLP_Feedback_Type_Bug_Report_Button_1_ID.classList.remove('DLP_Feedback_Type_Button_Style_1_OFF'); DLP_Feedback_Type_Suggestion_Button_1_ID.classList.add('DLP_Feedback_Type_Button_Style_2_OFF'); DLP_Feedback_Type_Suggestion_Button_1_ID.classList.remove('DLP_Feedback_Type_Button_Style_2_ON'); }); DLP_Feedback_Type_Suggestion_Button_1_ID.addEventListener('click', () => { feedbackType = 'Suggestion'; DLP_Feedback_Type_Bug_Report_Button_1_ID.classList.add('DLP_Feedback_Type_Button_Style_1_OFF'); DLP_Feedback_Type_Bug_Report_Button_1_ID.classList.remove('DLP_Feedback_Type_Button_Style_1_ON'); DLP_Feedback_Type_Suggestion_Button_1_ID.classList.add('DLP_Feedback_Type_Button_Style_2_ON'); DLP_Feedback_Type_Suggestion_Button_1_ID.classList.remove('DLP_Feedback_Type_Button_Style_2_OFF'); }); let currentFileName = ''; setInterval(() => { if (DLP_Feedback_Attachment_Input_Hidden_1_ID.files.length > 0) { let fileName = DLP_Feedback_Attachment_Input_Hidden_1_ID.files[0].name; if (currentFileName === fileName) return; currentFileName = fileName; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Text_1_ID').style.filter = 'blur(4px)'; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Text_1_ID').style.opacity = '0'; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Icon_1_ID').style.filter = 'blur(4px)'; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Icon_1_ID').style.opacity = '0'; DLP_Feedback_Attachment_Upload_Button_1_ID.style.background = '#007AFF'; DLP_Feedback_Attachment_Upload_Button_1_ID.style.outline = '2px solid rgba(0, 0, 0, 0.20)'; setTimeout(() => { DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Icon_1_ID').style.display = 'none'; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Text_1_ID').textContent = fileName; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Text_1_ID').style.color = '#FFF'; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Text_1_ID').style.filter = ''; DLP_Feedback_Attachment_Upload_Button_1_ID.querySelector('#DLP_Inset_Text_1_ID').style.opacity = ''; }, 400); } }, 1000); DLP_Feedback_Attachment_Upload_Button_1_ID.addEventListener('click', () => { DLP_Feedback_Attachment_Input_Hidden_1_ID.click(); }); async function sendFeedbackServer(head, body, type, email) { try { sendFeedbackStatus = 'sending'; const formData = new FormData(); if (DLP_Feedback_Attachment_Input_Hidden_1_ID.files.length > 0) { formData.append('file', DLP_Feedback_Attachment_Input_Hidden_1_ID.files[0]); } formData.append('head', head); formData.append('body', body); formData.append('type', type); formData.append('email', email); formData.append('version', versionFullname); const userResponse = await fetch('https://www.duolingo.com/2017-06-30/users/' + JSON.parse(atob(document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1].split('.')[1])).sub + '?fields=username'); if (!userResponse.ok) throw new Error('Failed to fetch user data'); const userData = await userResponse.json(); formData.append('pro_id', userData.username); const response = await fetch(serverURL + "/feedback", { method: 'POST', body: formData }); if (!response.ok) { console.error("HTTP error! Status:", response.status); return; } const responseData = await response.text(); if (responseData === 'success') { sendFeedbackStatus = 'sent'; showNotification("checkmark", "Feedback Sent", "Your feedback was successfully sent, and our developers will look over it. Keep in mind, we cannot respond back to your feedback. ", 30); } else { sendFeedbackStatus = 'error'; console.log('0001 Response:', responseData); } } catch (error) { sendFeedbackStatus = 'error'; } } let isGetButtonsBusy = false; function setButtonState(button, text, iconToShow, iconToHide, bgColor, outlineColor, textColor, delay, callback) { const textElement = button.querySelector('#DLP_Inset_Text_1_ID'); const icons = [1, 2, 3, 4].map(num => button.querySelector(`#DLP_Inset_Icon_${num}_ID`)); let previousText = textElement.textContent; textElement.textContent = text; iconToShow.style.display = 'block'; iconToHide.style.display = 'none'; let buttonNewWidth = button.offsetWidth; textElement.textContent = previousText; iconToShow.style.display = 'none'; iconToHide.style.display = 'block'; button.style.transition = 'width 0.8s cubic-bezier(0.77,0,0.18,1), background 0.8s cubic-bezier(0.16, 1, 0.32, 1), outline 0.8s cubic-bezier(0.16, 1, 0.32, 1), filter 0.4s cubic-bezier(0.16, 1, 0.32, 1), transform 0.4s cubic-bezier(0.16, 1, 0.32, 1)'; button.style.width = `${button.offsetWidth}px`; requestAnimationFrame(() => { textElement.style.transition = '0.4s'; iconToShow.style.transition = '0.4s'; iconToHide.style.transition = '0.4s'; textElement.style.filter = 'blur(4px)'; textElement.style.opacity = '0'; iconToHide.style.filter = 'blur(4px)'; iconToHide.style.opacity = '0'; button.style.width = `${buttonNewWidth}px`; button.style.background = bgColor; button.style.outline = outlineColor; }); setTimeout(() => { textElement.style.transition = '0s'; textElement.style.color = textColor; textElement.offsetWidth; textElement.style.transition = '0.4s'; iconToShow.style.display = 'block'; iconToHide.style.display = 'none'; iconToShow.style.filter = 'blur(4px)'; iconToShow.style.opacity = '0'; textElement.textContent = text; requestAnimationFrame(() => { textElement.style.filter = ''; textElement.style.opacity = ''; iconToShow.style.filter = ''; iconToShow.style.opacity = '1'; }); setTimeout(() => { button.style.width = ''; }, 400); if (callback) callback(); }, delay); } function handleClick(button, id, amount) { const ogIcon = button.querySelector('#DLP_Inset_Icon_1_ID'); const loadingIcon = button.querySelector('#DLP_Inset_Icon_2_ID'); const doneIcon = button.querySelector('#DLP_Inset_Icon_3_ID'); const failedIcon = button.querySelector('#DLP_Inset_Icon_4_ID'); setButtonState(button, 'LOADING', loadingIcon, ogIcon, 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400, () => { loadingIcon.style.animation = 'DLP_Rotate_360_Animation_1 4s ease-in-out infinite'; let status = 'loading'; fetch(serverURL + '/limits/user', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ token: document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1] }) }) .then(response => response.json()) .then(data => { limits = data; console.log(limits); if (amount <= limits[id].limit_amount) { fetch(serverURL + '/request', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ token: document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1], gain_type: id, amount: amount }) }) .then(response => response.json()) .then(data => { if (data.status === true) { status = 'done'; console.log('Status true:', data.status); if (id === 'xp') { let timeMessage = `${Math.floor(limits[id].limit_time / 3600) > 0 ? Math.floor(limits[id].limit_time / 3600) + " hour" + (Math.floor(limits[id].limit_time / 3600) > 1 ? "s" : "") : ""}${Math.floor(limits[id].limit_time / 3600) > 0 && Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? " and " : ""}${Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? Math.floor((limits[id].limit_time % 3600) / 60) + " minute" + (Math.floor((limits[id].limit_time % 3600) / 60) > 1 ? "s" : "") : ""}`; showNotification("checkmark", "XP Successfully Recieved", "You received " + amount + " XP. You can request up to " + (limits[id].limit_amount - amount) + " XP before your limit resets back to " + limits[id].total_limit_amount + " XP in " + timeMessage + ". To boost your limits, donate.", 15); button.parentElement.querySelector('#DLP_Inset_Input_1_ID').value = ''; } else if (id === 'super') { let timeMessage = `${Math.floor(limits[id].limit_time / 86400) > 0 ? Math.floor(limits[id].limit_time / 86400) + " day" + (Math.floor(limits[id].limit_time / 86400) > 1 ? "s" : "") : ""}${Math.floor(limits[id].limit_time / 86400) > 0 && (Math.floor((limits[id].limit_time % 86400) / 3600) > 0 || Math.floor((limits[id].limit_time % 3600) / 60) > 0) ? " and " : ""}${Math.floor((limits[id].limit_time % 86400) / 3600) > 0 ? Math.floor((limits[id].limit_time % 86400) / 3600) + " hour" + (Math.floor((limits[id].limit_time % 86400) / 3600) > 1 ? "s" : "") : ""}${(Math.floor((limits[id].limit_time % 86400) / 3600) > 0 || Math.floor(limits[id].limit_time / 86400) > 0) && Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? " and " : ""}${Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? Math.floor((limits[id].limit_time % 3600) / 60) + " minute" + (Math.floor((limits[id].limit_time % 3600) / 60) > 1 ? "s" : "") : ""}`; showNotification("checkmark", "Super Duolingo Successfully Redeemed", "You redeemed a 3 day Super Duolingo trial. You can request another 3 day Super Duolingo trial in " + timeMessage + ".", 15); } } else { status = 'error'; console.error('Status false:', data); showNotification(data.notification.icon, data.notification.head, data.notification.body, data.notification.duration); } }) .catch(error => { status = 'error'; console.error('Error fetching data:', error); showNotification("error", "Unknown Error", "An unknown error occurred. Please try again later.", 15); }); } else if (limits[id].limit_amount > 0) { status = 'rejected'; if (id === 'xp') { let timeMessage = `${Math.floor(limits[id].limit_time / 3600) > 0 ? Math.floor(limits[id].limit_time / 3600) + " hour" + (Math.floor(limits[id].limit_time / 3600) > 1 ? "s" : "") : ""}${Math.floor(limits[id].limit_time / 3600) > 0 && Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? " and " : ""}${Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? Math.floor((limits[id].limit_time % 3600) / 60) + " minute" + (Math.floor((limits[id].limit_time % 3600) / 60) > 1 ? "s" : "") : ""}`; showNotification("warning", "Limit Warning", "You can only request up to " + limits[id].limit_amount + " XP before your limit resets back to " + limits[id].total_limit_amount + " XP in " + timeMessage + ". To boost your limits, donate.", 30); button.parentElement.querySelector('#DLP_Inset_Input_1_ID').value = limits[id].limit_amount; } } else if (limits[id].limit_amount === 0) { status = 'rejected'; if (id === 'xp') { showNotification("warning", "Limit Reached", "You can request up to " + limits[id].limit_amount + " XP. To get higher limits, donate.", 15); button.parentElement.querySelector('#DLP_Inset_Input_1_ID').value = limits[id].limit_amount; } else if (id === 'super') { let timeMessage = `${Math.floor(limits[id].limit_time / 86400) > 0 ? Math.floor(limits[id].limit_time / 86400) + " day" + (Math.floor(limits[id].limit_time / 86400) > 1 ? "s" : "") + (Math.floor((limits[id].limit_time % 86400) / 3600) > 0 || Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? ", " : "") : ""}${Math.floor((limits[id].limit_time % 86400) / 3600) > 0 ? Math.floor((limits[id].limit_time % 86400) / 3600) + " hour" + (Math.floor((limits[id].limit_time % 86400) / 3600) > 1 ? "s" : "") + (Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? " and " : "") : ""}${Math.floor((limits[id].limit_time % 3600) / 60) > 0 ? Math.floor((limits[id].limit_time % 3600) / 60) + " minute" + (Math.floor((limits[id].limit_time % 3600) / 60) > 1 ? "s" : "") : ""}`; showNotification("warning", "Limit Reached", "You already redeemed a 3 day Super Duolingo trial. You can request another 3 day Super Duolingo trial in " + timeMessage + ".", 15); } } }) .catch(error => { status = 'error'; showNotification("error", "Unknown Error", "An unknown error occurred. Please try again later.", 15); console.error('Error fetching data:', error); }); setTimeout(() => { f(); }, 800); function f() { if (status === 'done') { setButtonState(button, 'DONE', doneIcon, loadingIcon, 'rgba(52, 199, 89, 0.10)', '2px solid rgba(52, 199, 89, 0.20)', '#34C759', 400, () => { confetti(); isGetButtonsBusy = false; setTimeout(() => { setButtonState(button, 'GET', ogIcon, doneIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); }, 3000); }); } else if (status === 'error') { setButtonState(button, 'FAILED', failedIcon, loadingIcon, 'rgba(255, 45, 85, 0.10)', '2px solid rgba(255, 45, 85, 0.20)', '#FF2D55', 400, () => { isGetButtonsBusy = false; setTimeout(() => { setButtonState(button, 'GET', ogIcon, failedIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); }, 3000); }); } else if (status === 'rejected') { isGetButtonsBusy = false; setButtonState(button, 'GET', ogIcon, loadingIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); } else { setTimeout(() => { f(); }, 400); } } }); } DLP_Get_XP_1_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; handleClick(DLP_Get_XP_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'xp', Number(DLP_Get_XP_1_ID.querySelector('#DLP_Inset_Input_1_ID').value)); }); DLP_Get_XP_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; handleClick(DLP_Get_XP_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'xp', Number(DLP_Get_XP_2_ID.querySelector('#DLP_Inset_Input_1_ID').value)); }); DLP_Get_GEMS_1_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; handleClick(DLP_Get_GEMS_1_ID.querySelector('#DLP_Inset_Button_1_ID'), 'gems', Number(DLP_Get_GEMS_1_ID.querySelector('#DLP_Inset_Input_1_ID').value)); }); DLP_Get_GEMS_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; handleClick(DLP_Get_GEMS_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'gems', Number(DLP_Get_GEMS_2_ID.querySelector('#DLP_Inset_Input_1_ID').value)); }); DLP_Get_SUPER_2_ID.querySelector('#DLP_Inset_Button_1_ID').addEventListener('click', () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; handleClick(DLP_Get_SUPER_2_ID.querySelector('#DLP_Inset_Button_1_ID'), 'super', 1); }); let DLP_Settings_Save_Button_1_ID = document.getElementById("DLP_Settings_Save_Button_1_ID"); let DLP_Settings_Save_Button_1_ID_Busy = false; DLP_Settings_Save_Button_1_ID.addEventListener('click', () => { if (DLP_Settings_Save_Button_1_ID_Busy) return; DLP_Settings_Save_Button_1_ID_Busy = true; storageLocal.settings.autoUpdate = DLP_Settings_Auto_Update; saveStorageLocal(); setButtonState(DLP_Settings_Save_Button_1_ID, 'SAVED', DLP_Settings_Save_Button_1_ID.querySelector('#DLP_Inset_Icon_3_ID'), DLP_Settings_Save_Button_1_ID.querySelector('#DLP_Inset_Icon_1_ID'), 'rgba(52, 199, 89, 0.10)', '2px solid rgba(52, 199, 89, 0.20)', '#34C759', 400, () => { //confetti(); setTimeout(() => { goToPage(7, 1); }, 1600); setTimeout(() => { setButtonState(DLP_Settings_Save_Button_1_ID, 'SAVE', DLP_Settings_Save_Button_1_ID.querySelector('#DLP_Inset_Icon_1_ID'), DLP_Settings_Save_Button_1_ID.querySelector('#DLP_Inset_Icon_3_ID'), '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); DLP_Settings_Save_Button_1_ID_Busy = false; }, 2400); }); }); let DLP_Settings_Auto_Update = storageLocal.settings.autoUpdate; let DLP_Settings_Auto_Update_Toggle_1_ID_Busy = false; let DLP_Settings_Auto_Update_Toggle_1_ID = document.getElementById("DLP_Settings_Auto_Update_Toggle_1_ID"); handleToggleClick(DLP_Settings_Auto_Update_Toggle_1_ID, DLP_Settings_Auto_Update); function handleToggleClick(button, state) { let iconToHide; let iconToShow; if (state) { iconToHide = button.querySelector("#DLP_Inset_Icon_2_ID"); iconToShow = button.querySelector("#DLP_Inset_Icon_1_ID"); } else { iconToHide = button.querySelector("#DLP_Inset_Icon_1_ID"); iconToShow = button.querySelector("#DLP_Inset_Icon_2_ID"); } if (state) { button.classList.add('DLP_Toggle_Style_1_ON'); button.classList.remove('DLP_Toggle_Style_1_OFF'); } else { button.classList.add('DLP_Toggle_Style_1_OFF'); button.classList.remove('DLP_Toggle_Style_1_ON'); } iconToHide.style.transition = '0.4s'; iconToShow.style.transition = '0.4s'; if (iconToHide.style.display === 'block') { iconToHide.style.display = 'block'; iconToShow.style.display = 'none'; requestAnimationFrame(() => { iconToHide.style.filter = 'blur(4px)'; iconToHide.style.opacity = '0'; }); } setTimeout(() => { iconToHide.style.display = 'none'; iconToShow.style.display = 'block'; iconToShow.offsetWidth; // idk iconToShow.style.filter = 'blur(4px)'; iconToShow.style.opacity = '0'; setTimeout(() => { // idk requestAnimationFrame(() => { iconToShow.offsetWidth; iconToShow.style.filter = ''; iconToShow.style.opacity = '1'; }); }, 20); // idk }, (iconToHide.style.display === 'block') ? 400 : 0); } DLP_Settings_Auto_Update_Toggle_1_ID.addEventListener('click', () => { if (DLP_Settings_Auto_Update_Toggle_1_ID_Busy) return; if (greasyfork) { } else { DLP_Settings_Auto_Update = !DLP_Settings_Auto_Update; DLP_Settings_Auto_Update_Toggle_1_ID_Busy = true; handleToggleClick(DLP_Settings_Auto_Update_Toggle_1_ID, DLP_Settings_Auto_Update); setTimeout(() => { DLP_Settings_Auto_Update_Toggle_1_ID_Busy = false; }, 800); } }); function confetti() { let canvas = document.getElementById("DLP_Confetti_Canvas"); let ctx = canvas.getContext("2d"); canvas.width = window.innerWidth; canvas.height = window.innerHeight; let cx = ctx.canvas.width / 2; let cy = ctx.canvas.height / 2; let confetti = []; const confettiCount = 500; const gravity = 0.5; const terminalVelocity = 10; const drag = 0.01; const colors = [ { front: "#FF2D55", back: "#FF2D55" }, { front: "#FF9500", back: "#FF9500" }, { front: "#FFCC00", back: "#FFCC00" }, { front: "#34C759", back: "#34C759" }, { front: "#5AC8FA", back: "#5AC8FA" }, { front: "#007AFF", back: "#007AFF" }, { front: "#5856D6", back: "#5856D6" }, { front: "#AF52DE", back: "#AF52DE" }, ]; let resizeCanvas = () => { canvas.width = window.innerWidth; canvas.height = window.innerHeight; cx = ctx.canvas.width / 2; cy = ctx.canvas.height / 2; }; let randomRange = (min, max) => Math.random() * (max - min) + min; let initConfetti = () => { for (let i = 0; i < confettiCount; i++) { confetti.push({ color: colors[Math.floor(randomRange(0, colors.length))], dimensions: { x: randomRange(5, 10), y: randomRange(5, 10), }, position: { x: randomRange(0, canvas.width), y: canvas.height - 1, }, rotation: randomRange(0, 2 * Math.PI), scale: { x: 1, y: 1, }, velocity: { x: randomRange(-25, 25), y: randomRange(0, -50), }, }); } }; let render = () => { ctx.clearRect(0, 0, canvas.width, canvas.height); confetti.forEach((confetto, index) => { let width = confetto.dimensions.x * confetto.scale.x; let height = confetto.dimensions.y * confetto.scale.y; ctx.translate(confetto.position.x, confetto.position.y); ctx.rotate(confetto.rotation); confetto.velocity.x -= confetto.velocity.x * drag; confetto.velocity.y = Math.min( confetto.velocity.y + gravity, terminalVelocity, ); confetto.velocity.x += Math.random() > 0.5 ? Math.random() : -Math.random(); confetto.position.x += confetto.velocity.x; confetto.position.y += confetto.velocity.y; if (confetto.position.y >= canvas.height) confetti.splice(index, 1); if (confetto.position.x > canvas.width) confetto.position.x = 0; if (confetto.position.x < 0) confetto.position.x = canvas.width; ctx.fillStyle = confetto.color.front; ctx.fillRect(-width / 2, -height / 2, width, height); ctx.setTransform(1, 0, 0, 1, 0, 0); }); window.requestAnimationFrame(render); }; render(); window.addEventListener("resize", function () { resizeCanvas(); }); initConfetti(); } function carryOn() { if (document.querySelector('.DLP_Main')) { fetch('https://www.duolingo.com/2017-06-30/users/' + JSON.parse(atob(document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1].split('.')[1])).sub + '?fields=username') .then(response => response.json()) .then(data => { console.log(data.username); fetch(serverURL + '/analytics/3.0/userscript', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ type: 'foreign', token: document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1] }) }) .then(response => response.json()) .then(data => { }) .catch(error => { console.error('Error fetching data:', error); }); }) .catch(error => { console.error('Error fetching data:', error); }); } } carryOn(); const originalPlay = HTMLAudioElement.prototype.play; function muteTab(value) { HTMLAudioElement.prototype.play = function () { if (value) { this.muted = true; } else { this.muted = false; } return originalPlay.apply(this, arguments); }; } function updateSolveButtonText(text) { document.getElementById("solveAllButton").innerText = text; } function solving(value) { if (value === "start") { isAutoMode = true; updateSolveButtonText(isAutoMode ? "PAUSE SOLVE" : "SOLVE ALL"); solvingIntervalId = isAutoMode ? setInterval(solve, storageLocal.settings.solveSpeed * 1000) : clearInterval(solvingIntervalId); } else if (value === "stop") { isAutoMode = false; updateSolveButtonText(isAutoMode ? "PAUSE SOLVE" : "SOLVE ALL"); solvingIntervalId = isAutoMode ? setInterval(solve, storageLocal.settings.solveSpeed * 1000) : clearInterval(solvingIntervalId); } else { isAutoMode = !isAutoMode; updateSolveButtonText(isAutoMode ? "PAUSE SOLVE" : "SOLVE ALL"); solvingIntervalId = isAutoMode ? setInterval(solve, storageLocal.settings.solveSpeed * 1000) : clearInterval(solvingIntervalId); } } let hcwNIIOdaQqCZRDL = false; function solve() { const practiceAgain = document.querySelector('[data-test="player-practice-again"]'); const sessionCompleteSlide = document.querySelector('[data-test="session-complete-slide"]'); const selectorsForSkip = [ '[data-test="practice-hub-ad-no-thanks-button"]', '.vpDIE', '[data-test="plus-no-thanks"]', '._1N-oo._36Vd3._16r-S._1ZBYz._23KDq._1S2uf.HakPM', '._8AMBh._2vfJy._3Qy5R._28UWu._3h0lA._1S2uf._1E9sc', '._1Qh5D._36g4N._2YF0P._28UWu._3h0lA._1S2uf._1E9sc', '[data-test="story-start"]', '._3bBpU._1x5JY._1M9iF._36g4N._2YF0P.T7I0c._2EnxW.MYehf' ]; selectorsForSkip.forEach(selector => { const element = document.querySelector(selector); if (element) element.click(); }); const status = storageSession.legacy.status; const type = status ? storageSession.legacy[status]?.type : null; let amount; if (sessionCompleteSlide !== null && isAutoMode && storageSession.legacy.status) { if (!hcwNIIOdaQqCZRDL) { hcwNIIOdaQqCZRDL = true; if (type === 'lesson') { storageSession.legacy[status].amount -= 1; saveStorageSession(); amount = status ? storageSession.legacy[status]?.amount : null; if (amount > 0) { if (practiceAgain !== null) { practiceAgain.click(); return; } else { location.reload(); } } else { storageSession.legacy[status].amount = 0; saveStorageSession(); window.location.href = "https://duolingo.com"; return; } } else if (type === 'xp') { storageSession.legacy[status].amount -= findSubReact(document.getElementsByClassName("_1XNQX")[0]).xpGoalSessionProgress.totalXpThisSession; saveStorageSession(); amount = status ? storageSession.legacy[status]?.amount : null; if (amount > 0) { if (practiceAgain !== null) { practiceAgain.click(); return; } else { location.reload(); } } else { storageSession.legacy[status].amount = 0; saveStorageSession(); window.location.href = "https://duolingo.com"; return; } } else if (type === 'infinity') { if (practiceAgain !== null) { practiceAgain.click(); return; } else { location.reload(); } } } } try { window.sol = findReact(document.getElementsByClassName(findReactMainElementClass)[0]).props.currentChallenge; } catch (error) { console.log(error); //let next = document.querySelector('[data-test="player-next"]'); //if (next) { // next.click(); //} //return; } //if (!window.sol) { // return; //} let challengeType; if (window.sol) { challengeType = determineChallengeType(); } else { challengeType = 'error'; nextClickFunc(); } if (challengeType === 'error') { nextClickFunc(); } else if (challengeType) { if (debug) document.getElementById("solveAllButton").innerText = challengeType; handleChallenge(challengeType); nextClickFunc(); } else { nextClickFunc(); } } let zXIArDomWMPkmTVf = 0; let GtPzsoCcLnDAVvjb; let SciiOTPybxFAimRW = false; function nextClickFunc() { setTimeout(function () { try { let nextButtonNormal = document.querySelector('[data-test="player-next"]'); let storiesContinueButton = document.querySelector('[data-test="stories-player-continue"]'); let storiesDoneButton = document.querySelector('[data-test="stories-player-done"]'); let nextButtonAriaValueNormal = nextButtonNormal ? nextButtonNormal.getAttribute('aria-disabled') : null; let nextButtonAriaValueStoriesContinue = storiesContinueButton ? storiesContinueButton.disabled : null; let nextButton = nextButtonNormal || storiesContinueButton || storiesDoneButton; let nextButtonAriaValue = nextButtonAriaValueNormal || nextButtonAriaValueStoriesContinue || storiesDoneButton; if (nextButton) { if (nextButtonAriaValue === 'true' || nextButtonAriaValue === true) { if (document.querySelectorAll('._35QY2._3jIlr.f2zGP._18W4a.xtPuL').length > 0) { } else { if (nextButtonAriaValue === 'true') { console.log('The next button is disabled.'); } } if (zXIArDomWMPkmTVf >= 3 && !SciiOTPybxFAimRW && nextButtonAriaValue === 'true') { SciiOTPybxFAimRW = true; LhEqEHHc(); //notificationCall("Can't Recognize Question Type", "Duolingo Pro ran into an error while solving this question, an automatic question error report is being made."); } } else if (nextButtonAriaValue === 'false' || nextButtonAriaValue === false) { nextButton.click(); //mainSolveStatistics('question', 1); zXIArDomWMPkmTVf = 0; if (document.querySelector('[data-test="player-next"]').classList.contains('_2oGJR')) { if (isAutoMode) { setTimeout(function () { nextButton.click(); }, 100); } } else if (document.querySelector('[data-test="player-next"]').classList.contains('_3S8jJ')) { //if (solveSpeed < 0.6) { // solveSpeed = 0.6; // localStorage.setItem('duopro.autoSolveDelay', solveSpeed); //} } else { console.log('The element does not have the class ._9C_ii or .NAidc or the element is not found.'); } } else { console.log('The aria-disabled attribute is not set or has an unexpected value.'); //notificationCall("what", "Idk"); nextButton.click(); } } else { console.log('Element with data-test="player-next" or data-test="stories-player-continue" not found.'); } } catch (error) { } }, 100); } let fPuxeFVNBsHJUBgP = false; function LhEqEHHc() { if (!fPuxeFVNBsHJUBgP) { fPuxeFVNBsHJUBgP = true; const randomImageValue = Math.random().toString(36).substring(2, 15); //questionErrorLogs(findReact(document.getElementsByClassName(findReactMainElementClass)[0]).props.currentChallenge, document.body.innerHTML, randomImageValue); //const challengeAssistElement = document.querySelector('[data-test="challenge challenge-assist"]'); const challengeAssistElement = document.querySelector('._3x0ok'); if (challengeAssistElement) { } else { console.log('Element not found'); } } } function determineChallengeType() { try { console.log(window.sol); if (document.getElementsByClassName("FmlUF").length > 0) { // Story if (window.sol.type === "arrange") { return "Story Arrange" } else if (window.sol.type === "multiple-choice" || window.sol.type === "select-phrases") { return "Story Multiple Choice" } else if (window.sol.type === "point-to-phrase") { return "Story Point to Phrase" } else if (window.sol.type === "match") { return "Story Pairs" } } else { // Lesson if (document.querySelectorAll('[data-test*="challenge-speak"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Challenge Speak'; } else if (document.querySelectorAll('[data-test*="challenge-name"]').length > 0 && document.querySelectorAll('[data-test="challenge-choice"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Challenge Name'; } else if (window.sol.type === 'listenMatch') { hcwNIIOdaQqCZRDL = false; return 'Listen Match'; } else if (document.querySelectorAll('[data-test="challenge challenge-listenSpeak"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Listen Speak'; } else if (document.querySelectorAll('[data-test="challenge-choice"]').length > 0) { hcwNIIOdaQqCZRDL = false; if (document.querySelectorAll('[data-test="challenge-text-input"]').length > 0) { return 'Challenge Choice with Text Input'; } else { return 'Challenge Choice' } } else if (document.querySelectorAll('[data-test$="challenge-tap-token"]').length > 0) { hcwNIIOdaQqCZRDL = false; if (window.sol.pairs !== undefined) { return 'Pairs'; } else if (window.sol.correctTokens !== undefined) { return 'Tokens Run'; } else if (window.sol.correctIndices !== undefined) { return 'Indices Run'; } } else if (document.querySelectorAll('[data-test="challenge-tap-token-text"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Fill in the Gap'; } else if (document.querySelectorAll('[data-test="challenge-text-input"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Challenge Text Input'; } else if (document.querySelectorAll('[data-test*="challenge-partialReverseTranslate"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Partial Reverse'; } else if (document.querySelectorAll('textarea[data-test="challenge-translate-input"]').length > 0) { hcwNIIOdaQqCZRDL = false; return 'Challenge Translate Input'; } else if (document.querySelectorAll('[data-test="session-complete-slide"]').length > 0) { return 'Session Complete'; } else if (document.querySelectorAll('[data-test="daily-quest-progress-slide"]').length > 0) { return 'Daily Quest Progress'; } else if (document.querySelectorAll('[data-test="streak-slide"]').length > 0) { return 'Streak'; } else if (document.querySelectorAll('[data-test="leaderboard-slide"]').length > 0) { // needs maintainance return 'Leaderboard'; } else { return false; } } } catch (error) { console.log(error); return 'error'; } } function handleChallenge(challengeType) { // Implement logic to handle different challenge types // This function should encapsulate the logic for each challenge type if (challengeType === 'Challenge Speak' || challengeType === 'Listen Match' || challengeType === 'Listen Speak') { const buttonSkip = document.querySelector('button[data-test="player-skip"]'); buttonSkip?.click(); } else if (challengeType === 'Challenge Choice' || challengeType === 'Challenge Choice with Text Input') { // Text input if (challengeType === 'Challenge Choice with Text Input') { let elm = document.querySelectorAll('[data-test="challenge-text-input"]')[0]; let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set; nativeInputValueSetter.call(elm, window.sol.correctSolutions ? window.sol.correctSolutions[0].split(/(?<=^\S+)\s/)[1] : (window.sol.displayTokens ? window.sol.displayTokens.find(t => t.isBlank).text : window.sol.prompt)); let inputEvent = new Event('input', { bubbles: true }); elm.dispatchEvent(inputEvent); } else if (challengeType === 'Challenge Choice') { document.querySelectorAll("[data-test='challenge-choice']")[window.sol.correctIndex].click(); } } else if (challengeType === 'Pairs') { let nl = document.querySelectorAll('[data-test*="challenge-tap-token"]:not(span)'); if (document.querySelectorAll('[data-test="challenge-tap-token-text"]').length === nl.length) { window.sol.pairs?.forEach((pair) => { for (let i = 0; i < nl.length; i++) { const nlInnerText = nl[i].querySelector('[data-test="challenge-tap-token-text"]').innerText.toLowerCase().trim(); try { if ( ( nlInnerText === pair.transliteration.toLowerCase().trim() || nlInnerText === pair.character.toLowerCase().trim() ) && !nl[i].disabled ) { nl[i].click() } } catch (TypeError) { if ( ( nlInnerText === pair.learningToken.toLowerCase().trim() || nlInnerText === pair.fromToken.toLowerCase().trim() ) && !nl[i].disabled ) { nl[i].click() } } } }) } } else if (challengeType === 'Story Pairs') { let nl = document.querySelectorAll('[data-test*="challenge-tap-token"]:not(span)'); const pairs = []; if (document.querySelectorAll('[data-test="challenge-tap-token-text"]').length === nl.length) { Object.keys(window.sol.dictionary).forEach((key) => { if (!pairs.includes(key.split(":")[1])) { pairs.push(key.split(":")[1]); pairs.push(window.sol.dictionary[key]); } for (let p = 0; p < pairs.length; p++) { for (let i = 0; i < nl.length; i++) { const nlInnerText = nl[i].querySelector('[data-test="challenge-tap-token-text"]').innerText.toLowerCase().trim(); if (nlInnerText === pairs[p] && !nl[i].disabled) { nl[i].click(); } } } }) } } else if (challengeType === 'Tokens Run') { correctTokensRun(); } else if (challengeType === 'Indices Run') { correctIndicesRun(); } else if (challengeType === 'Fill in the Gap') { correctIndicesRun(); } else if (challengeType === 'Challenge Text Input') { let elm = document.querySelectorAll('[data-test="challenge-text-input"]')[0]; let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set; nativeInputValueSetter.call(elm, window.sol.correctSolutions ? window.sol.correctSolutions[0] : (window.sol.displayTokens ? window.sol.displayTokens.find(t => t.isBlank).text : window.sol.prompt)); let inputEvent = new Event('input', { bubbles: true }); elm.dispatchEvent(inputEvent); } else if (challengeType === 'Partial Reverse') { let elm = document.querySelector('[data-test*="challenge-partialReverseTranslate"]')?.querySelector("span[contenteditable]"); let nativeInputNodeTextSetter = Object.getOwnPropertyDescriptor(Node.prototype, "textContent").set nativeInputNodeTextSetter.call(elm, window.sol?.displayTokens?.filter(t => t.isBlank)?.map(t => t.text)?.join()?.replaceAll(',', '')); let inputEvent = new Event('input', { bubbles: true }); elm.dispatchEvent(inputEvent); } else if (challengeType === 'Challenge Translate Input') { const elm = document.querySelector('textarea[data-test="challenge-translate-input"]'); const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value").set; nativeInputValueSetter.call(elm, window.sol.correctSolutions ? window.sol.correctSolutions[0] : window.sol.prompt); let inputEvent = new Event('input', { bubbles: true }); elm.dispatchEvent(inputEvent); } else if (challengeType === 'Challenge Name') { let articles = findReact(document.getElementsByClassName(findReactMainElementClass)[0]).props.currentChallenge.articles; let correctSolutions = findReact(document.getElementsByClassName(findReactMainElementClass)[0]).props.currentChallenge.correctSolutions[0]; let matchingArticle = articles.find(article => correctSolutions.startsWith(article)); let matchingIndex = matchingArticle !== undefined ? articles.indexOf(matchingArticle) : null; let remainingValue = correctSolutions.substring(matchingArticle.length); let selectedElement = document.querySelector(`[data-test="challenge-choice"]:nth-child(${matchingIndex + 1})`); if (selectedElement) { selectedElement.click(); } let elm = document.querySelector('[data-test="challenge-text-input"]'); let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set; nativeInputValueSetter.call(elm, remainingValue); let inputEvent = new Event('input', { bubbles: true }); elm.dispatchEvent(inputEvent); } else if (challengeType === 'Session Complete') { } else if (challengeType === 'Story Arrange') { let choices = document.querySelectorAll('[data-test*="challenge-tap-token"]:not(span)'); for (let i = 0; i < window.sol.phraseOrder.length; i++) { choices[window.sol.phraseOrder[i]].click(); } } else if (challengeType === 'Story Multiple Choice') { let choices = document.querySelectorAll('[data-test="stories-choice"]'); choices[window.sol.correctAnswerIndex].click(); } else if (challengeType === 'Story Point to Phrase') { let choices = document.querySelectorAll('[data-test="challenge-tap-token-text"]'); var correctIndex = -1; for (let i = 0; i < window.sol.parts.length; i++) { if (window.sol.parts[i].selectable === true) { correctIndex += 1; if (window.sol.correctAnswerIndex === i) { choices[correctIndex].parentElement.click(); } } } } } function correctTokensRun() { const all_tokens = document.querySelectorAll('[data-test$="challenge-tap-token"]'); const correct_tokens = window.sol.correctTokens; const clicked_tokens = []; correct_tokens.forEach(correct_token => { const matching_elements = Array.from(all_tokens).filter(element => element.textContent.trim() === correct_token.trim()); if (matching_elements.length > 0) { const match_index = clicked_tokens.filter(token => token.textContent.trim() === correct_token.trim()).length; if (match_index < matching_elements.length) { matching_elements[match_index].click(); clicked_tokens.push(matching_elements[match_index]); } else { clicked_tokens.push(matching_elements[0]); } } }); } function correctIndicesRun() { if (window.sol.correctIndices) { window.sol.correctIndices?.forEach(index => { document.querySelectorAll('div[data-test="word-bank"] [data-test*="challenge-tap-token"]:not(span)')[index].click(); }); } } function findSubReact(dom, traverseUp = reactTraverseUp) { const key = Object.keys(dom).find(key => key.startsWith("__reactProps")); return dom?.[key]?.children?.props?.slide; } function findReact(dom, traverseUp = reactTraverseUp) { const key = Object.keys(dom).find(key => { return key.startsWith("__reactFiber$") // react 17+ || key.startsWith("__reactInternalInstance$"); // react <17 }); const domFiber = dom[key]; if (domFiber == null) return null; // react <16 if (domFiber._currentElement) { let compFiber = domFiber._currentElement._owner; for (let i = 0; i < traverseUp; i++) { compFiber = compFiber._currentElement._owner; } return compFiber._instance; } // react 16+ const GetCompFiber = fiber => { //return fiber._debugOwner; // this also works, but is __DEV__ only let parentFiber = fiber.return; while (typeof parentFiber.type == "string") { parentFiber = parentFiber.return; } return parentFiber; }; let compFiber = GetCompFiber(domFiber); for (let i = 0; i < traverseUp; i++) { compFiber = GetCompFiber(compFiber); } return compFiber.stateNode; } window.findReact = findReact; window.findSubReact = findSubReact; window.ss = solving; } One();