// ==UserScript== // @name Duolingo PRO // @namespace http://duolingopro.net // @version 3.0BETA.04 // @description The fastest Duolingo XP gainer, working as of March 2025. // @author anonymousHackerIV // @match https://*.duolingo.com/* // @match https://*.duolingo.cn/* // @icon https://www.duolingopro.net/static/favicons/duo/128/light/primary.png // @grant GM_log // @downloadURL https://update.greasyfork.icu/scripts/473310/Duolingo%20PRO.user.js // @updateURL https://update.greasyfork.icu/scripts/473310/Duolingo%20PRO.meta.js // ==/UserScript== let storageLocal; let storageSession; let versionNumber = "04"; let storageLocalVersion = "04"; let storageSessionVersion = "04"; let versionName = "BETA.04"; let versionFull = "3.0BETA.04"; let versionFormal = "3.0 BETA.04"; let serverURL = "https://www.duolingopro.net"; let apiURL = "https://api.duolingopro.net"; let greasyfork = true; let alpha = false; let hidden = false; let lastPage; let currentPage = 1; let windowBlurState = true; let solvingIntervalId; let isAutoMode; let findReactMainElementClass = '_3yE3H'; let reactTraverseUp = 1; const debug = false; let temporaryRandom16 = Array.from({ length: 16 }, () => 'abcdefghijklmnopqrstuvwxyz0123456789'[Math.floor(Math.random() * 36)]).join(''); 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", "random16": temporaryRandom16, "pins": { "home": ["DLP_Get_XP_1_ID", "DLP_Get_GEMS_1_ID"], "legacy": ["DLP_Get_PATH_1_ID", "DLP_Get_PRACTICE_1_ID"] }, "settings": { "autoUpdate": !greasyfork, "showSolveButtons": true, "showAutoServerButton": alpha, "muteLessons": false, "solveSpeed": 0.9 }, "notifications": [ { "id": "0001" } ], "tips": { "seeMore1": false }, "languagePackVersion": "00", "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": { "section": 1, "unit": 1, "level": 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 systemLanguage = document.cookie.split('; ').find(row => row.startsWith('lang=')).split('=')[1]; let systemText = { en: { 1: "Switch to Legacy", 2: "Show", 3: "Connecting", 4: "Donate", 5: "Feedback", 6: "Settings", 7: "What's New", 8: "How much XP would you like to gain?", 9: "GET", 10: "How many Gems would you like to gain?", 12: "Would you like to redeem 3 days of Super Duolingo?", 13: "REDEEM", 14: "Terms & Conditions", 15: "See More", 16: "Back", 17: "How many lessons would you like to solve on the path?", 18: "START", 19: "How many practices would you like to solve?", 21: "How many listening practices would you like to solve? (Requires Super Duolingo)", 23: "Which and how many lessons would you like to repeat?", 25: "Please read and accept the Terms & Conditions to use Duolingo PRO 3.0.", 26: "These are the Terms & Conditions you agreed to use Duolingo PRO 3.0.", 27: "LOADING TERMS & CONDITIONS

YOU CANNOT USE THIS SOFTWARE UNTIL TERMS & CONDITIONS ARE LOADED", 28: "DECLINE", 29: "ACCEPT", 30: "Without accepting the Terms & Conditions, you cannot use Duolingo PRO 3.0.", 31: "BACK", 32: "Settings", 34: "Automatic Updates", 35: "Duolingo PRO 3.0 will automatically update itself when there's a new version available.", 37: "SAVE", 38: "Feedback", 39: "Help us make Duolingo PRO 3.0 better.", 40: "Write here as much as you can with as many details as possible.", 41: "Feedback Type: ", 42: "BUG REPORT", 43: "SUGGESTION", 44: "Add Attachment: (Optional)", 45: "UPLOAD", 47: "SEND", 48: "What's New", 51: "LEARN MORE", 52: "Welcome to", 53: "The next generation of Duolingo PRO is here, with Instant XP, Magnet UI, all powerful than ever. ", 54: "START", 100: "SOLVE", 101: "SOLVE ALL", 102: "PAUSE SOLVE", 103: "Hide", 104: "Show", 105: "Switch to 3.0", 106: "Switch to Legacy", 107: "STOP", 108: "Connected", 109: "Error", 110: "SEND", 111: "SENDING", 112: "SENT", 113: "LOADING", 114: "DONE", 115: "FAILED", 116: "SAVING AND APPLYING", 200: "Under Construction", 201: "The Gems function is currently under construction. We plan to make it accessible to everyone soon.", 202: "Update Available", 203: "You are using an outdated version of Duolingo PRO.

Please update Duolingo PRO or turn on automatic updates.", 204: "Feedback Sent", 205: "Your feedback was successfully sent, and our developers will look over it. Keep in mind, we cannot respond back to your feedback.", 206: "Error Sending Feedback", 207: "Your feedback was not sent. This might be because you are using an outdated or a modified version of Duolingo PRO.", 208: "Unknown Error", 209: "Please try again later. An unknown error occurred. Number: ", 210: "hour", 211: "hours", 212: "minute", 213: "minutes", 214: "and", 215: "{hours} {hourUnit}", 216: "{minutes} {minuteUnit}", 217: "{hourPhrase} {conjunction} {minutePhrase}", 218: "XP Successfully Received", 219: "You received {amount} XP. You can request up to {remainingXP} XP before your limit resets back to {totalLimit} XP in {timeMessage}. To boost your limits, donate.", 220: "Super Duolingo Successfully Redeemed", 221: "You redeemed a 3 day Super Duolingo trial. You can request another 3 day Super Duolingo trial in {timeMessage}.", 222: "Limit Warning", 223: "You can only request up to {limitAmount} XP before your limit resets back to {totalLimitAmount} XP in {timeMessage}. To boost your limits, donate.", 224: "Limit Reached", 225: "You reached your XP limit for the next {timeMessage}. To boost your limits, donate.", 227: "You already redeemed a 3 day Super Duolingo trial. You can request another 3 day Super Duolingo trial in {timeMessage}.", 229: "GEMS testing", 230: "GEMS testing", 231: "Error Connecting", 232: "Duolingo PRO was unable to connect to our servers. This may be because our servers are temporarily unavailable or you are using an outdated version. Check for server status or updates.", }, }; let CSS1; let HTML2; let CSS2; let HTML3; let HTML4; let HTML5; let CSS5; let HTML6; let CSS6; let HTML7; let CSS7; function Two() { CSS1 = ` @font-face { font-family: 'Duolingo Pro Rounded'; src: url(${serverURL}/static/3.0/assets/fonts/Duolingo-Pro-Rounded-Semibold.woff) format('woff'); font-weight: 700; font-style: normal; } @font-face { font-family: 'Duolingo Pro Rounded'; src: url(${serverURL}/static/3.0/assets/fonts/Duolingo-Pro-Rounded-Medium.woff) format('woff'); font-weight: 500; font-style: normal; }`; HTML2 = `

${systemText[systemLanguage][1]}

${systemText[systemLanguage][2]}

${systemText[systemLanguage][3]}

${systemText[systemLanguage][4]}

${systemText[systemLanguage][5]}

${systemText[systemLanguage][6]}

Earn

Duolingo

PRO 3.0

${versionName}

${systemText[systemLanguage][8]}

${systemText[systemLanguage][9]}

${systemText[systemLanguage][10]}

0

${systemText[systemLanguage][9]}

${systemText[systemLanguage][15]}

${systemText[systemLanguage][14]}

${systemText[systemLanguage][7]}

`; 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; } @media (max-width: 699px) { .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; margin-bottom: 80px; } } .DLP_Main_Box { display: flex; width: 312px; padding: 16px; box-sizing: border-box; flex-direction: column; justify-content: center; align-items: center; gap: 8px; overflow: hidden; border-radius: 16px; outline: 2px solid rgb(var(--color-eel), 0.10); outline-offset: -2px; 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: center; justify-content: space-between; align-self: stretch; } .DLP_HStack_Auto_Top { display: flex; align-items: flex-start; justify-content: space-between; align-self: stretch; } .DLP_HStack_0 { display: flex; align-items: center; gap: 0; align-self: stretch; } .DLP_HStack_4 { display: flex; align-items: center; gap: 4px; align-self: stretch; } .DLP_HStack_6 { display: flex; align-items: center; gap: 6px; align-self: stretch; } .DLP_HStack_8 { display: flex; align-items: center; gap: 8px; align-self: stretch; } .DLP_VStack_0 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0; align-self: stretch; } .DLP_VStack_4 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; align-self: stretch; } .DLP_VStack_6 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; align-self: stretch; } .DLP_VStack_8 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; align-self: stretch; } .DLP_VStack_12 { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; 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_Style_1 { border: none; outline: none; background: none; font-family: "Duolingo Pro Rounded"; font-size: 16px; font-style: normal; font-weight: 700; line-height: normal; color: #007AFF; width: 100%; width: 100%; /* Full width */ height: auto; /* Let the height be controlled dynamically */ min-height: 1.2em; /* Set minimum height for one line */ max-height: calc(1.2em * 5); /* Limit to 5 lines */ line-height: 1.2em; /* Adjust the line height */ overflow-y: hidden; /* Hide vertical scrollbar */ resize: none; /* Prevent manual resizing */ padding: 0; /* Remove padding to eliminate extra space */ margin: 0; /* Remove margin to eliminate extra space */ box-sizing: border-box; /* Include padding in height calculation */ } .DLP_Input_Style_1::placeholder { color: rgba(0, 122, 255, 0.50); } .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; overflow-x: hidden; 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: 300px; position: fixed; left: calc(50% - (300px / 2)); z-index: 210; bottom: 16px; border-radius: 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; outline: 2px solid rgb(var(--color-eel), 0.10); outline-offset: -2px; 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; } ._2V6ug._1ursp._7jW2t._3dDzz._1wiIJ { width: 36px !important; height: 38px !important; } ._2V6ug._1ursp._7jW2t._3dDzz._1wiIJ::before { border-radius: 20px !important; } `; HTML3 = `

`; 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; } `; HTML5 = ` `; CSS5 = ` .DLP_AutoServer_Text_Style_1 { font-family: "Duolingo Pro Rounded"; font-size: 16px; font-style: normal; font-weight: 500; line-height: normal; margin: 0; -webkit-font-smoothing: antialiased; } .DLP_AutoServer_Text_Style_2 { font-family: "Duolingo Pro Rounded"; font-size: 24px; font-style: normal; font-weight: 500; line-height: normal; margin: 0; -webkit-font-smoothing: antialiased; } .DLP_AutoServer_Mother_Box { position: fixed; top: 0; bottom: 0; right: 0; left: 0; display: flex; width: 100%; height: 100vh; justify-content: center; align-items: center; flex-shrink: 0; z-index: 210; transition: filter 0.4s cubic-bezier(0.16, 1, 0.32, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.32, 1); background: rgba(var(--color-snow), 0.50); backdrop-filter: blur(16px); } .DLP_AutoServer_Box { display: flex; width: 512px; height: 512px; flex-direction: column; align-items: center; flex-shrink: 0; overflow-y: scroll; overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none; border-radius: 20px; border: 2px solid rgba(var(--color-eel), 0.10); background: rgba(var(--color-snow), 0.90); backdrop-filter: blur(16px); box-sizing: border-box; } .DLP_AutoServer_Box::-webkit-scrollbar { display: none; } .DLP_AutoServer_Menu_Bar { display: flex; width: 100%; height: 60px; padding: 20px; justify-content: space-between; align-items: center; position: sticky; top: 0; right: 0; left: 0; background: rgba(var(--color-snow), 0.80); backdrop-filter: blur(8px); z-index: 2; } .DLP_AutoServer_Scroll_Box { display: flex; padding: 0 20px 20px 20px; flex-direction: column; justify-content: center; align-items: center; gap: 8px; align-self: stretch; } .DLP_AutoServer_Default_Box { display: flex; padding: 16px; justify-content: center; align-items: center; gap: 16px; align-self: stretch; border-radius: 8px; outline: 2px solid rgba(0, 0, 0, 0.10); outline-offset: -2px; } `; HTML6 = `

AutoServer

`; CSS6 = ` .DPAutoServerButtonMainMenu { display: flex; box-sizing: border-box; justify-content: center; align-items: center; gap: 16px; flex-shrink: 0; border-radius: 12px; cursor: pointer; } .DPAutoServerButtonMainMenu:hover { background: rgba(0, 122, 255, 0.10); } .DPAutoServerButtonMainMenu:active { filter: brightness(.9); } .DPAutoServerButtonMainMenu:hover .DPAutoServerElementsMenu { opacity: 1 !important; } .DPAutoServerButtonMainMenuMedium { width: 56px; height: 52px; padding: 8px; } .DPAutoServerButtonMainMenuLarge { width: 222px; height: 52px; padding: 16px 17px; } `; HTML7 = `

Mute

`; CSS7 = ` .vCIrKKxykXwXyUza { outline: 2px solid rgb(var(--color-swan)); outline-offset: -2px; height: 40px; width: auto; padding: 0 16px; gap: 6px; display: inline-flex; justify-content: center; align-items: center; flex-wrap: nowrap; flex-shrink: 0; border-radius: 32px; background: rgb(var(--color-snow), 0.84); backdrop-filter: blur(16px); overflow: hidden; transition: all 0.4s cubic-bezier(0.16, 1, 0.32, 1); cursor: pointer; } .vCIrKKxykXwXyUza p { white-space: nowrap; } .vCIrKKxykXwXyUza svg { flex-shrink: 0; } `; } function One() { Two(); 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 })); document.body.insertAdjacentHTML('beforeend', HTML5); document.head.appendChild(Object.assign(document.createElement('style'), { type: 'text/css', textContent: CSS5 })); let DPAutoServerButtonMainMenuElement = null; let DPAutoServerButtonMainMenuStyle = null; function DPAutoServerButtonMainMenuFunction() { try { if (storageLocal.settings.showAutoServerButton && alpha) { let targetElement = document.querySelector('._2uLXp'); if (!targetElement || document.querySelector('.DPAutoServerButtonMainMenu')) return; DPAutoServerButtonMainMenuStyle = document.createElement('style'); DPAutoServerButtonMainMenuStyle.type = 'text/css'; DPAutoServerButtonMainMenuStyle.innerHTML = CSS6; document.head.appendChild(DPAutoServerButtonMainMenuStyle); let targetDivLast = document.querySelector('[data-test="profile-tab"]'); if (targetElement && targetDivLast) { targetElement.lastChild.insertAdjacentHTML('beforebegin', HTML6); let otherTargetDiv = document.querySelector('.DPAutoServerButtonMainMenu'); otherTargetDiv.addEventListener('click', () => { manageAutoServerWindowVisibility(true); }); let lastWidth = targetElement.offsetWidth; const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if (entry.target.offsetWidth !== lastWidth) { otherTargetDiv.remove(); DPAutoServerButtonMainMenuFunction(); lastWidth = entry.target.offsetWidth; } } }); resizeObserver.observe(targetElement); if (targetElement.offsetWidth < 100) { otherTargetDiv.classList.add('DPAutoServerButtonMainMenuMedium'); document.querySelectorAll('.DPAutoServerElementsMenu').forEach(function(element) { element.remove(); }); } else { otherTargetDiv.classList.add('DPAutoServerButtonMainMenuLarge'); } } } } catch(error) {} } setInterval(DPAutoServerButtonMainMenuFunction, 500); document.querySelector('.DLP_AutoServer_Mother_Box').querySelector('#DLP_AutoServer_Close_Button_1_ID').addEventListener('click', () => { manageAutoServerWindowVisibility(false); }); document.querySelector('.DLP_AutoServer_Mother_Box').addEventListener('click', (event) => { if (event.target === event.currentTarget) { manageAutoServerWindowVisibility(false); } }); function manageAutoServerWindowVisibility(state) { if (state) { document.querySelector('.DLP_AutoServer_Mother_Box').style.display = ""; document.querySelector('.DLP_AutoServer_Mother_Box').offsetHeight; document.querySelector('.DLP_AutoServer_Mother_Box').style.opacity = "1"; document.querySelector('.DLP_AutoServer_Mother_Box').style.filter = "blur(0px)"; } else { document.querySelector('.DLP_AutoServer_Mother_Box').style.opacity = "0"; document.querySelector('.DLP_AutoServer_Mother_Box').style.filter = "blur(8px)"; setTimeout(() => { document.querySelector('.DLP_AutoServer_Mother_Box').style.display = "none"; }, 400); } } let counterPaused = false; function DuolingoProCounterOneFunction() { function handleMuteTab(value) { if (isBusySwitchingPages) return; isBusySwitchingPages = true; muteTab(value); let button = document.querySelector('#DLP_Inset_Button_2_ID'); let icon1 = button.querySelector('#DLP_Inset_Icon_1_ID'); let icon2 = button.querySelector('#DLP_Inset_Icon_2_ID'); let text = button.querySelector('#DLP_Inset_Text_1_ID'); if (value) { setButtonState(button, "Muted", icon1, icon2, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else { setButtonState(button, "Mute", icon2, icon1, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } } if ((window.location.pathname.includes('/lesson') || window.location.pathname.includes('/practice')) && storageSession.legacy.status) { let theBarThing = document.querySelector('#DLP_The_Bar_Thing_Box'); if (!theBarThing) { document.head.appendChild(Object.assign(document.createElement('style'), { type: 'text/css', textContent: CSS7 })); //const targetElement1 = document.querySelector('.I-Avc._1zcW8'); const targetElement1 = document.querySelector('._1zcW8'); const targetElement2 = document.querySelector('.mAxZF'); if (targetElement1) { targetElement1.insertAdjacentHTML('beforeend', HTML7); theBarThing = document.querySelector('#DLP_The_Bar_Thing_Box'); targetElement1.style.display = "flex"; document.querySelector('[role="progressbar"]').style.width = "100%"; } else if (targetElement2) { targetElement2.insertAdjacentHTML('beforeend', HTML7); theBarThing = document.querySelector('#DLP_The_Bar_Thing_Box'); theBarThing.style.marginLeft = '24px'; document.querySelector('._15ch1').style.pointerEvents = 'all'; } else if (debug) console.log('Element with class ._1zcW8 or .mAxZF not found'); let muteButton = theBarThing.querySelector('#DLP_Inset_Button_2_ID'); let expandButton = theBarThing.querySelector('#DLP_Inset_Button_3_ID'); let expandButtonIcon = expandButton.querySelector('#DLP_Inset_Icon_1_ID'); let theBarThingExtended = false; function theBarThingExtend(button, visibility, noAnimation) { if (visibility) { button.style.display = ""; button.style.width = ""; button.style.padding = ""; button.style.transition = ''; let remember0010 = button.offsetWidth; button.style.width = "0px"; requestAnimationFrame(() => { button.style.width = remember0010 + "px"; button.style.padding = ""; button.style.filter = "blur(0px)"; button.style.opacity = "1"; button.style.margin = ""; }); } else { button.style.transition = ''; button.style.width = button.offsetWidth + "px"; requestAnimationFrame(() => { button.style.width = "4px"; button.style.padding = "0"; button.style.filter = "blur(8px)"; button.style.margin = "0 -4px"; button.style.opacity = "0"; }); if (!noAnimation) { setTimeout(function() { button.style.display = "none"; }, 400); } else { button.style.display = "none"; } } } theBarThingExtend(muteButton, false, true); expandButton.addEventListener('click', () => { if (theBarThingExtended) { expandButtonIcon.style.transform = "rotate(0deg)"; theBarThingExtended = false; theBarThingExtend(muteButton, false); } else { expandButtonIcon.style.transform = "rotate(180deg)"; theBarThingExtended = true; theBarThingExtend(muteButton, true); } }); let counterButton = theBarThing.querySelector('#DLP_Inset_Button_1_ID'); let counterButtonText = counterButton.querySelector('#DLP_Inset_Text_1_ID'); let counterButtonIcon = counterButton.querySelector('#DLP_Inset_Icon_1_ID'); counterButton.addEventListener('click', () => { if (isBusySwitchingPages) return; isBusySwitchingPages = true; if (theBarThing.querySelector('#DLP_Inset_Button_1_ID').querySelector('#DLP_Inset_Text_1_ID').innerHTML === 'Click Again to Stop Legacy') { setButtonState(counterButton, "Stopping", undefined, counterButtonIcon.style.display !== 'none' ? counterButtonIcon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { storageSession.legacy.status = false; saveStorageSession(); setTimeout(() => { isBusySwitchingPages = false; window.location.href = "https://duolingo.com"; }, 400); }); } else { counterPaused = true; setButtonState(counterButton, "Click Again to Stop Legacy", undefined, counterButtonIcon.style.display !== 'none' ? counterButtonIcon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; setTimeout(() => { if (storageSession.legacy.status) counterPaused = false; }, 4000); }, 400); }); } }); if (storageLocal.settings.muteLessons) { handleMuteTab(true); } document.querySelector('#DLP_Inset_Button_2_ID').addEventListener('click', () => { storageLocal.settings.muteLessons = !storageLocal.settings.muteLessons; saveStorageLocal(); handleMuteTab(storageLocal.settings.muteLessons); }); } function updateCounter() { let button = theBarThing.querySelector('#DLP_Inset_Button_1_ID'); let text = button.querySelector('#DLP_Inset_Text_1_ID'); let icon = button.querySelector('#DLP_Inset_Icon_1_ID'); if (storageSession.legacy[storageSession.legacy.status].type === 'infinity' && text.textContent !== 'Infinity') { isBusySwitchingPages = true; setButtonState(button, "Infinity", icon, undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else if (storageSession.legacy[storageSession.legacy.status].type === 'xp' && text.textContent !== String(storageSession.legacy[storageSession.legacy.status].amount + ' XP Left')) { isBusySwitchingPages = true; setButtonState(button, String(storageSession.legacy[storageSession.legacy.status].amount + ' XP Left'), undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else if (window.location.pathname === '/practice') { if (storageSession.legacy[storageSession.legacy.status].amount === 1 && text.textContent !== 'Last Practice') { isBusySwitchingPages = true; setButtonState(button, 'Last Practice', undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else if (storageSession.legacy[storageSession.legacy.status].amount === 0 && text.textContent !== 'Finishing Up') { isBusySwitchingPages = true; setButtonState(button, 'Finishing Up', undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else if (storageSession.legacy[storageSession.legacy.status].amount > 1 && text.textContent !== String(storageSession.legacy[storageSession.legacy.status].amount + ' Practices Left')) { isBusySwitchingPages = true; setButtonState(button, String(storageSession.legacy[storageSession.legacy.status].amount + ' Practices Left'), undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } } else if (storageSession.legacy[storageSession.legacy.status].type === 'lesson') { if (storageSession.legacy[storageSession.legacy.status].amount === 1 && text.textContent !== 'Last Lesson') { isBusySwitchingPages = true; setButtonState(button, 'Last Lesson', undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else if (storageSession.legacy[storageSession.legacy.status].amount === 0 && text.textContent !== 'Finishing Up') { isBusySwitchingPages = true; setButtonState(button, 'Finishing Up', undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } else if (storageSession.legacy[storageSession.legacy.status].amount > 1 && text.textContent !== String(storageSession.legacy[storageSession.legacy.status].amount + ' Lessons Left')) { isBusySwitchingPages = true; setButtonState(button, String(storageSession.legacy[storageSession.legacy.status].amount + ' Lessons Left'), undefined, icon.style.display !== 'none' ? icon : undefined, 'rgb(var(--color-snow), 0.84)', '2px solid rgb(var(--color-swan))', 'rgb(var(--color-black-text))', 400, () => { setTimeout(() => { isBusySwitchingPages = false; }, 400); }); } } } if (!counterPaused) updateCounter(); } } setInterval(DuolingoProCounterOneFunction, 500); window.onfocus = () => { windowBlurState = true; }; window.onblur = () => { windowBlurState = false; }; document.querySelector('#DLP_Get_GEMS_1_ID').addEventListener('click', () => { showNotification("warning", systemText[systemLanguage][200], systemText[systemLanguage][201], 6); }); document.querySelector('#DLP_Get_GEMS_2_ID').addEventListener('click', () => { showNotification("warning", systemText[systemLanguage][200], systemText[systemLanguage][201], 6); }); function addButtons() { if (!storageLocal.settings.showSolveButtons) return; if (window.location.pathname === '/learn' && document.querySelector('a[data-test="global-practice"]')) return; if (document.querySelector("#solveAllButton")) return; document.querySelector('[data-test="quit-button"]')?.addEventListener('click', function() { solving("stop"); //storageSession.legacy.status = false; //saveStorageSession(); }); 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; } 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 ? systemText[systemLanguage][102] : systemText[systemLanguage][101], 'auto-solver-btn solve-btn', { 'click': solving }); const pauseCopy = createButton('', systemText[systemLanguage][100], 'auto-solver-btn pause-btn', { 'click': solve }); target.parentElement.appendChild(pauseCopy); target.parentElement.appendChild(solveCopy); if (storageSession.legacy.status) { solving("start"); } } } setInterval(addButtons, 500); try { const container = document.getElementById('DLP_Main_Box_Divider_11_ID'); const textarea = container.querySelector('#DLP_Inset_Input_1_ID'); const activeContainer = container.querySelector('.DLP_Input_Style_1_Active'); // Set initial height to be equal to one line textarea.style.height = '1.2em'; // Set to the height of one line // Add event listener to adjust height dynamically textarea.addEventListener('input', function () { // Reset height to auto to allow shrinking textarea.style.height = 'auto'; // Calculate the maximum height for 5 lines const lineHeight = parseInt(getComputedStyle(textarea).lineHeight); const maxRows = 5; const maxHeight = lineHeight * maxRows; // Set the height to the scrollHeight or maximum height const newHeight = Math.min(textarea.scrollHeight, maxHeight); // Set the new height for the textarea textarea.style.height = newHeight + 'px'; // Adjust the active container height; +32px for padding (16px top and bottom) activeContainer.style.height = (newHeight + 32) + 'px'; // 32px for padding }); } catch (error) { console.log("Construction Zone 1 ERROR: ", error); } let notificationCount = 0; let currentNotification = []; let notificationsHovered = false; const notificationMain = document.querySelector('.DLP_Notification_Main'); notificationMain.addEventListener('mouseenter', () => { notificationsHovered = true; }); notificationMain.addEventListener('mouseleave', () => { notificationsHovered = false; }); function showNotification(icon, head, body, time) { notificationCount++; let notificationID = notificationCount; currentNotification.push(notificationID); let element = new DOMParser() .parseFromString(HTML3, 'text/html') .body.firstChild; element.id = 'DLP_Notification_Box_' + notificationID + '_ID'; notificationMain.appendChild(element); initializeMagneticHover( element.querySelector('#DLP_Notification_Dismiss_Button_1_ID') ); 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; if (body && body !== "") { element.querySelector('#DLP_Inset_Text_2_ID').innerHTML = body; } else { element.querySelector('#DLP_Inset_Text_2_ID').style.display = "none"; } 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; let timerData = null; if (time !== 0) { timerData = { remaining: time * 1000, lastTimestamp: Date.now(), timeoutHandle: null, paused: false, }; timerData.timeoutHandle = setTimeout(internalDisappear, timerData.remaining); } let repeatInterval = setInterval(() => { 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 (timerData) { if (notificationsHovered && !timerData.paused) { clearTimeout(timerData.timeoutHandle); let elapsed = Date.now() - timerData.lastTimestamp; timerData.remaining -= elapsed; timerData.paused = true; } if (!notificationsHovered && timerData.paused) { timerData.paused = false; timerData.lastTimestamp = Date.now(); timerData.timeoutHandle = setTimeout(internalDisappear, timerData.remaining); } } if (notificationsHovered) { let allIDs = currentNotification.slice(); let bottoms = {}; let currentBottom = 16; for (let i = allIDs.length - 1; i >= 0; i--) { let notifEl = document.querySelector( '#DLP_Notification_Box_' + allIDs[i] + '_ID' ); if (!notifEl) continue; notifEl.style.width = ""; notifEl.style.height = ""; notifEl.style.transform = ""; bottoms[allIDs[i]] = currentBottom; currentBottom += notifEl.offsetHeight + 8; } notification.style.bottom = bottoms[notificationID] + "px"; let totalHeight = 0; for (let i = 0; i < allIDs.length; i++) { let notifEl = document.querySelector( '#DLP_Notification_Box_' + allIDs[i] + '_ID' ); if (notifEl) { totalHeight += notifEl.offsetHeight; } } if (allIDs.length > 1) { totalHeight += (allIDs.length - 1) * 8; } notificationMain.style.height = totalHeight + "px"; } else { notificationMain.style.height = ''; notification.style.bottom = "16px"; if (currentNotification[currentNotification.length - 1] !== notificationID) { notification.style.height = notificationHeight + 'px'; requestAnimationFrame(() => { let latestNotif = document.querySelector( '#DLP_Notification_Box_' + String(currentNotification[currentNotification.length - 1]) + '_ID' ); if (latestNotif) { notification.style.height = latestNotif.offsetHeight + 'px'; } notification.style.width = "284px"; notification.style.transform = "translateY(-8px)"; }); } else { requestAnimationFrame(() => { notification.style.height = notificationHeight + "px"; notification.style.width = ""; notification.style.transform = ""; }); } } }, 20); function internalDisappear() { if (timerData && timerData.timeoutHandle) { clearTimeout(timerData.timeoutHandle); } if (isBusyDisappearing) return; isBusyDisappearing = true; 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(); if (currentNotification.length === 0) { notificationMain.style.height = ''; } }, 800); } function disappear() { internalDisappear(); } notification.querySelector('#DLP_Notification_Dismiss_Button_1_ID').addEventListener("click", disappear); return { close: disappear }; } let isBusySwitchingPages = false; let pages = { "DLP_Onboarding_Start_Button_1_ID": [5], "DLP_Switch_Legacy_Button_1_ID": [3], "DLP_Universal_Back_1_Button_1_ID": [1], "DLP_Main_Settings_1_Button_1_ID": [7], "DLP_Main_Feedback_1_Button_1_ID": [8], "DLP_Main_Whats_New_1_Button_1_ID": [9], "DLP_Main_See_More_1_Button_1_ID": [2], "DLP_Main_Terms_1_Button_1_ID": [5], "DLP_Secondary_Settings_1_Button_1_ID": [7], "DLP_Secondary_Feedback_1_Button_1_ID": [8], "DLP_Secondary_Whats_New_1_Button_1_ID": [9], "DLP_Secondary_See_More_1_Button_1_ID": [4], "DLP_Secondary_Terms_1_Button_1_ID": [5], "DLP_Terms_Back_Button_1_ID": [1], "DLP_Terms_Accept_Button_1_ID": [1], "DLP_Terms_Decline_Button_1_ID": [6], "DLP_Terms_Declined_Back_Button_1_ID": [5] }; function goToPage(to, buttonID) { if (isBusySwitchingPages) return; isBusySwitchingPages = true; let mainBox = document.querySelector(`.DLP_Main_Box`); let toNumber = to; let fromPage = document.querySelector(`#DLP_Main_Box_Divider_${currentPage}_ID`); let toPage = document.querySelector(`#DLP_Main_Box_Divider_${toNumber}_ID`); let mainBoxNewToBeWidth = mainBox.offsetWidth; if (buttonID === 'DLP_Main_Terms_1_Button_1_ID' || buttonID === 'DLP_Secondary_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') { toNumber = lastPage; toPage = document.querySelector(`#DLP_Main_Box_Divider_${toNumber}_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_Universal_Back_1_Button_1_ID' || to === -1) { toNumber = lastPage; toPage = document.querySelector(`#DLP_Main_Box_Divider_${toNumber}_ID`); } else if (buttonID === 'DLP_Switch_Legacy_Button_1_ID') { let button = document.querySelector('#DLP_Switch_Legacy_Button_1_ID'); console.log(storageSession.legacy.page); if (storageSession.legacy.page !== 0) { toNumber = 1; toPage = document.querySelector(`#DLP_Main_Box_Divider_${toNumber}_ID`); setButtonState(button, systemText[systemLanguage][106], button.querySelector('#DLP_Inset_Icon_1_ID'), button.querySelector('#DLP_Inset_Icon_2_ID'), 'linear-gradient(0deg, rgba(0, 122, 255, 0.10) 0%, rgba(0, 122, 255, 0.10) 100%), rgba(var(--color-snow), 0.80)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); storageSession.legacy.page = 0; saveStorageSession(); } else { toNumber = 3; toPage = document.querySelector(`#DLP_Main_Box_Divider_${toNumber}_ID`); setButtonState(button, systemText[systemLanguage][105], button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'linear-gradient(0deg, rgba(0, 122, 255, 0.10) 0%, rgba(0, 122, 255, 0.10) 100%), rgba(var(--color-snow), 0.80)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); storageSession.legacy.page = 1; saveStorageSession(); } } else if (buttonID === 'DLP_Terms_Accept_Button_1_ID') { storageLocal.terms = newTermID; saveStorageLocal(); connectToServer(); } else if (buttonID === 'DLP_Onboarding_Start_Button_1_ID') { storageLocal.onboarding = true; saveStorageLocal(); goToPage(1); } if (toNumber === 2) mainBoxNewToBeWidth = "600"; else if (toNumber === 5) mainBoxNewToBeWidth = "400"; else if (toNumber === 7) mainBoxNewToBeWidth = "400"; else if (toNumber === 8) mainBoxNewToBeWidth = "400"; else if (toNumber === 9) mainBoxNewToBeWidth = "400"; else mainBoxNewToBeWidth = "312"; if ([1, 2, 3, 4].includes(toNumber)) legacyButtonVisibility(true); else legacyButtonVisibility(false); if (toNumber === 3) { storageSession.legacy.page = 1; saveStorageSession(); } else if (toNumber === 4) { storageSession.legacy.page = 2; saveStorageSession(); } let mainBoxOldWidth = mainBox.offsetWidth; let mainBoxOldHeight = mainBox.offsetHeight; let fromBoxOldWidth = fromPage.offsetWidth; let fromBoxOldHeight = fromPage.offsetHeight; console.log(fromBoxOldWidth, fromBoxOldHeight); mainBox.style.transition = ""; fromPage.style.display = "none"; toPage.style.display = "block"; mainBox.offsetHeight; mainBox.style.width = `${mainBoxNewToBeWidth}px`; let mainBoxNewWidth = mainBoxNewToBeWidth; let mainBoxNewHeight = mainBox.offsetHeight; let toBoxOldWidth = toPage.offsetWidth; let toBoxOldHeight = toPage.offsetHeight; console.log(toBoxOldWidth, toBoxOldHeight); fromPage.style.display = "block"; toPage.style.display = "none"; mainBox.style.width = `${mainBoxOldWidth}px`; mainBox.style.height = `${mainBoxOldHeight}px`; mainBox.offsetHeight; mainBox.style.transition = "0.8s cubic-bezier(0.16, 1, 0.32, 1)"; mainBox.offsetHeight; mainBox.style.width = `${mainBoxNewToBeWidth}px`; mainBox.style.height = `${mainBoxNewHeight}px`; fromPage.style.transform = `scaleX(1) scaleY(1)`; fromPage.style.width = `${fromBoxOldWidth}px`; fromPage.style.height = `${fromBoxOldHeight}px`; fromPage.style.transition = "opacity 0.4s cubic-bezier(0.16, 1, 0.32, 1), filter 0.4s cubic-bezier(0.16, 1, 0.32, 1), transform 0.8s cubic-bezier(0.16, 1, 0.32, 1)"; fromPage.offsetHeight; fromPage.style.opacity = "0"; fromPage.style.filter = "blur(4px)"; fromPage.style.transform = `scaleX(${toBoxOldWidth / fromBoxOldWidth}) scaleY(${toBoxOldHeight / fromBoxOldHeight})`; toPage.style.width = `${toBoxOldWidth}px`; toPage.style.height = `${toBoxOldHeight}px`; toPage.style.opacity = "0"; toPage.style.filter = "blur(4px)"; toPage.style.transform = `scaleX(${fromBoxOldWidth / toBoxOldWidth}) scaleY(${fromBoxOldHeight / toBoxOldHeight})`; toPage.style.transition = "opacity 0.4s cubic-bezier(0.16, 1, 0.32, 1), filter 0.4s cubic-bezier(0.16, 1, 0.32, 1), transform 0.8s cubic-bezier(0.16, 1, 0.32, 1)"; toPage.offsetHeight; toPage.style.transform = `scaleX(1) scaleY(1)`; setTimeout(() => { fromPage.style.display = "none"; fromPage.style.width = ``; fromPage.style.height = ``; fromPage.style.transform = ``; toPage.style.display = "block"; 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 = ""; toPage.style.width = ``; toPage.style.height = ``; toPage.style.transform = ``; lastPage = currentPage; currentPage = toNumber; isBusySwitchingPages = false; }, 400); }, 400); } Object.keys(pages).forEach(function (key) { document.querySelectorAll(`#${key}`).forEach(element => { element.addEventListener("click", function () { if (isBusySwitchingPages || isGetButtonsBusy) return; goToPage(pages[key][0], 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, systemText[systemLanguage][104], 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, systemText[systemLanguage][103], 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); 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; if (iconToShow) iconToShow.style.display = 'block'; if (iconToHide) iconToHide.style.display = 'none'; let buttonNewWidth = button.offsetWidth; textElement.textContent = previousText; if (iconToShow) iconToShow.style.display = 'none'; if (iconToHide) 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'; if (iconToShow) iconToShow.style.transition = '0.4s'; if (iconToHide) iconToHide.style.transition = '0.4s'; textElement.style.filter = 'blur(4px)'; textElement.style.opacity = '0'; if (iconToHide) iconToHide.style.filter = 'blur(4px)'; if (iconToHide) 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'; if (iconToShow) iconToShow.style.display = 'block'; if (iconToHide) iconToHide.style.display = 'none'; if (iconToShow) iconToShow.style.filter = 'blur(4px)'; if (iconToShow) iconToShow.style.opacity = '0'; textElement.textContent = text; requestAnimationFrame(() => { textElement.style.filter = ''; textElement.style.opacity = ''; if (iconToShow) iconToShow.style.filter = ''; if (iconToShow) iconToShow.style.opacity = '1'; }); setTimeout(() => { button.style.width = ''; }, 400); if (callback) callback(); }, delay); } 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; function 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 (['DLP_Get_LESSON_1_ID', 'DLP_Get_LESSON_2_ID'].includes(id)) { const input3 = element.querySelector('#DLP_Inset_Input_3_ID'); const input4 = element.querySelector('#DLP_Inset_Input_4_ID'); input3.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 > 2) this.value = this.value.slice(0, 2); //if (!storageSession.legacy[category]) storageSession.legacy[category] = []; storageSession.legacy[category].unit = Number(this.value); saveStorageSession(); }); input3.addEventListener("blur", function () { if (this.value.trim() === "") { this.value = "1"; storageSession.legacy[category].unit = 1; saveStorageSession(); } }); input4.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 > 2) this.value = this.value.slice(0, 2); //if (!storageSession.legacy[category]) storageSession.legacy[category] = []; storageSession.legacy[category].level = Number(this.value); saveStorageSession(); }); input4.addEventListener("blur", function () { if (this.value.trim() === "") { this.value = "1"; storageSession.legacy[category].level = 1; saveStorageSession(); } }); } if (storageSession.legacy[category].amount !== 0) input.value = storageSession.legacy[category].amount; updateButtonState(); }); 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; function 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(); }); function updatePinnedItems() { const pinnedIds = storageLocal.pins.legacy || []; for (const id in ids) { if (id.endsWith("1_ID")) { const element = document.getElementById(id); if (element) { if (pinnedIds.includes(id)) { element.style.display = 'flex'; } else { element.style.display = 'none'; } } } } }; updatePinnedItems(); Object.keys(ids).forEach(id => { if (id.endsWith("2_ID")) { const pinActiveIcon = document.querySelector(`#${id} > .DLP_HStack_8 > #DLP_Inset_Icon_1_ID`); const pinInactiveIcon = document.querySelector(`#${id} > .DLP_HStack_8 > #DLP_Inset_Icon_2_ID`); const modifiedId = id.replace("2_ID", "1_ID"); function updatePinViews() { if (storageLocal.pins.legacy.includes(modifiedId)) { pinActiveIcon.style.display = 'block'; pinInactiveIcon.style.display = 'none'; } else { pinActiveIcon.style.display = 'none'; pinInactiveIcon.style.display = 'block'; } }; updatePinViews(); function updatePins(isAdding) { const index = storageLocal.pins.legacy.indexOf(modifiedId); if (isAdding && index === -1) { if (storageLocal.pins.legacy.length > Math.floor(((window.innerHeight) / 200) - 1)) { showNotification("warning", "Pin Limit Reached", "You've pinned too many functions. Please unpin one to continue.", 15); } else { storageLocal.pins.legacy.push(modifiedId); } } else if (!isAdding && index !== -1) { storageLocal.pins.legacy.splice(index, 1); } else { console.log("Something unexpected happened: djr9234."); } updatePinViews(); saveStorageLocal(); updatePinnedItems(); }; pinActiveIcon.addEventListener('click', () => updatePins(false)); pinInactiveIcon.addEventListener('click', () => updatePins(true)); } }); } inputCheck2(); function setupButton1Events(baseId, page, type) { const button1 = document.querySelector(`#${baseId}_ID`).querySelector('#DLP_Inset_Button_1_ID'); const input1 = document.querySelector(`#${baseId}_ID`).querySelector('#DLP_Inset_Input_1_ID'); function clickHandler() { if (isGetButtonsBusy) return; isGetButtonsBusy = true; const buttonElement = document.querySelector(`#${baseId}_ID`).querySelector('#DLP_Inset_Button_1_ID'); const icon1 = buttonElement.querySelector('#DLP_Inset_Icon_1_ID'); const icon2 = buttonElement.querySelector('#DLP_Inset_Icon_2_ID'); if (!storageSession.legacy.status && storageSession.legacy[type].amount > 0) { setButtonState(buttonElement, systemText[systemLanguage][107], icon2, icon1, 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = page; storageSession.legacy.status = type; saveStorageSession(); } else if (storageSession.legacy.status === type) { setButtonState(buttonElement, systemText[systemLanguage][18], icon1, icon2, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); storageSession.legacy.status = false; saveStorageSession(); } setTimeout(() => { isGetButtonsBusy = false; }, 800); }; button1.addEventListener('click', clickHandler); input1.onkeyup = function (event) { if (event.keyCode === 13) { if (isGetButtonsBusy) return; isGetButtonsBusy = true; const buttonElement = document.querySelector(`#${baseId}_ID`).querySelector('#DLP_Inset_Button_1_ID'); const icon1 = buttonElement.querySelector('#DLP_Inset_Icon_1_ID'); const icon2 = buttonElement.querySelector('#DLP_Inset_Icon_2_ID'); if (!storageSession.legacy.status && storageSession.legacy[type].amount > 0) { setButtonState(buttonElement, systemText[systemLanguage][107], icon2, icon1, 'rgba(0, 122, 255, 0.10)', '2px solid rgba(0, 122, 255, 0.20)', '#007AFF', 400); storageSession.legacy.page = page; storageSession.legacy.status = type; saveStorageSession(); } setTimeout(() => { isGetButtonsBusy = false; }, 800); } }; } function setupButton2Events(baseId, type) { const button2 = document.querySelector(`#${baseId}_ID`).querySelector('#DLP_Inset_Button_2_ID'); function clickHandler(toggle, animate) { const icon1 = button2.querySelector('#DLP_Inset_Icon_1_ID'); const icon2 = button2.querySelector('#DLP_Inset_Icon_2_ID'); const icon3 = button2.querySelector('#DLP_Inset_Icon_3_ID'); const input = button2.parentElement.querySelector('#DLP_Inset_Input_1_ID'); function animateElement(element, visibility, duration = 400) { if (visibility) { element.style.display = 'block'; element.style.filter = 'blur(4px)'; element.style.opacity = '0'; element.style.transition = '0.4s'; requestAnimationFrame(() => { element.style.filter = 'blur(0px)'; element.style.opacity = '1'; }); setTimeout(() => { element.style.filter = ''; element.style.opacity = ''; element.style.transition = ''; }, duration); } else { element.style.display = 'block'; element.style.filter = 'blur(0px)'; element.style.opacity = '1'; element.style.transition = '0.4s'; requestAnimationFrame(() => { element.style.filter = 'blur(4px)'; element.style.opacity = '0'; }); setTimeout(() => { element.style.display = 'none'; element.style.filter = ''; element.style.opacity = ''; element.style.transition = ''; }, duration); } } if (storageSession.legacy[type].type === 'lesson') { let iconToHide; let iconToShow = icon1; let inputTo; if (icon2.style.display !== 'none') { iconToHide = icon2; icon3.style.display = 'none'; } else if (icon3.style.display !== 'none') { icon2.style.display = 'none'; iconToHide = icon3; } if (input.style.display === 'none') inputTo = 'show'; iconToShow.style.display = 'none'; animateElement(iconToHide, false); setTimeout(() => animateElement(iconToShow, true), 400); if (inputTo === 'show') setTimeout(() => animateElement(input, true), 400); } else if (storageSession.legacy[type].type === 'xp') { let iconToHide; let iconToShow = icon2; let inputTo; if (icon1.style.display !== 'none') { iconToHide = icon1; icon3.style.display = 'none'; } else if (icon3.style.display !== 'none') { icon1.style.display = 'none'; iconToHide = icon3; } if (input.style.display === 'none') inputTo = 'show'; iconToShow.style.display = 'none'; animateElement(iconToHide, false); setTimeout(() => animateElement(iconToShow, true), 400); if (inputTo === 'show') setTimeout(() => animateElement(input, true), 400); } else if (storageSession.legacy[type].type === 'infinity') { let iconToHide; let iconToShow = icon3; let inputTo; if (icon1.style.display !== 'none') { iconToHide = icon1; icon2.style.display = 'none'; } else if (icon2.style.display !== 'none') { icon1.style.display = 'none'; iconToHide = icon2; } if (input.style.display !== 'none') inputTo = 'hide'; iconToShow.style.display = 'none'; animateElement(iconToHide, false); setTimeout(() => animateElement(iconToShow, true), 400); if (inputTo === 'hide') animateElement(input, false); } }; clickHandler(); button2.addEventListener('click', () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; if (storageSession.legacy[type].type === 'lesson') { storageSession.legacy[type].type = 'xp'; saveStorageSession(); } else if (storageSession.legacy[type].type === 'xp') { storageSession.legacy[type].type = 'infinity'; saveStorageSession(); } else if (storageSession.legacy[type].type === 'infinity') { storageSession.legacy[type].type = 'lesson'; saveStorageSession(); } clickHandler(); setTimeout(() => { isGetButtonsBusy = false; }, 800); }); } for (const type of ['PATH', 'PRACTICE', 'LISTEN', 'LESSON']) { for (let i = 1; i <= 2; i++) { const baseId = `DLP_Get_${type}_${i}`; setupButton1Events(baseId, i, type.toLowerCase()); setupButton2Events(baseId, type.toLowerCase()); } } 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'), systemText[systemLanguage][107], 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'), systemText[systemLanguage][107], 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'), systemText[systemLanguage][107], 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'), systemText[systemLanguage][107], 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.listen.amount > 0) { if (storageSession.legacy.page === 1) { setButtonState(DLP_Get_LISTEN_1_ID.querySelector('#DLP_Inset_Button_1_ID'), systemText[systemLanguage][107], 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'), systemText[systemLanguage][107], 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.lesson.amount > 0) { if (storageSession.legacy.page === 1) { setButtonState(DLP_Get_LESSON_1_ID.querySelector('#DLP_Inset_Button_1_ID'), systemText[systemLanguage][107], 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'), systemText[systemLanguage][107], 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); } } 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') { //storageSession.legacy[storageSession.legacy.status].section window.location.href = `https://duolingo.com/lesson/unit/${storageSession.legacy[storageSession.legacy.status].unit}/level/${storageSession.legacy[storageSession.legacy.status].level}`; } } 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); } }; if (storageSession.legacy.page === 1) { document.querySelector(`#DLP_Main_Box_Divider_${currentPage}_ID`).style.display = 'none'; document.querySelector(`#DLP_Main_Box_Divider_3_ID`).style.display = 'block'; currentPage = 3; let button = document.querySelector('#DLP_Switch_Legacy_Button_1_ID'); setButtonState(button, systemText[systemLanguage][105], button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'linear-gradient(0deg, rgba(0, 122, 255, 0.10) 0%, rgba(0, 122, 255, 0.10) 100%), rgba(var(--color-snow), 0.80)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); } else if (storageSession.legacy.page === 2) { document.querySelector(`#DLP_Main_Box_Divider_${currentPage}_ID`).style.display = 'none'; document.querySelector(`#DLP_Main_Box_Divider_4_ID`).style.display = 'block'; lastPage = 3; currentPage = 4; let button = document.querySelector('#DLP_Switch_Legacy_Button_1_ID'); setButtonState(button, systemText[systemLanguage][105], button.querySelector('#DLP_Inset_Icon_2_ID'), button.querySelector('#DLP_Inset_Icon_1_ID'), 'linear-gradient(0deg, rgba(0, 122, 255, 0.10) 0%, rgba(0, 122, 255, 0.10) 100%), rgba(var(--color-snow), 0.80)', '2px solid rgba(0, 122, 255, 0.20', '#007AFF', 400); } 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_1_ID = document.getElementById("DLP_Get_SUPER_1_ID"); const DLP_Get_SUPER_2_ID = document.getElementById("DLP_Get_SUPER_2_ID"); const DLP_Get_DOUBLE_XP_BOOST_1_ID = document.getElementById("DLP_Get_DOUBLE_XP_BOOST_1_ID"); const DLP_Get_DOUBLE_XP_BOOST_2_ID = document.getElementById("DLP_Get_DOUBLE_XP_BOOST_2_ID"); const DLP_Get_Streak_Freeze_1_ID = document.getElementById("DLP_Get_Streak_Freeze_1_ID"); const DLP_Get_Streak_Freeze_2_ID = document.getElementById("DLP_Get_Streak_Freeze_2_ID"); const DLP_Get_Heart_Refill_1_ID = document.getElementById("DLP_Get_Heart_Refill_1_ID"); const DLP_Get_Heart_Refill_2_ID = document.getElementById("DLP_Get_Heart_Refill_2_ID"); const DLP_Get_Streak_1_ID = document.getElementById("DLP_Get_Streak_1_ID"); const DLP_Get_Streak_2_ID = document.getElementById("DLP_Get_Streak_2_ID"); if (storageLocal.pins.home.includes("DLP_Get_XP_1_ID")) { document.querySelector("#DLP_Get_Heart_Refill_2_ID > .DLP_HStack_8 > #DLP_Inset_Icon_1_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"], "DLP_Get_DOUBLE_XP_BOOST_1_ID": ["double_xp_boost"], "DLP_Get_DOUBLE_XP_BOOST_2_ID": ["double_xp_boost"], "DLP_Get_Streak_Freeze_1_ID": ["streak_freeze"], "DLP_Get_Streak_Freeze_2_ID": ["streak_freeze"], "DLP_Get_Heart_Refill_1_ID": ["heart_refill"], "DLP_Get_Heart_Refill_2_ID": ["heart_refill"], "DLP_Get_Streak_1_ID": ["streak"], "DLP_Get_Streak_2_ID": ["streak"] }; 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; function updateButtonState() { const isEmpty = input.value.length === 0; button.style.opacity = isEmpty ? '0.5' : ''; button.style.pointerEvents = isEmpty ? 'none' : ''; console.log(input.value.length); }; 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 > 9) this.value = this.value.slice(0, 9); updateButtonState(); }); if (!input.value) updateButtonState(); }); function updatePinnedItems() { const pinnedIds = storageLocal.pins.home || []; for (const id in ids) { if (id.endsWith("1_ID")) { const element = document.getElementById(id); if (element) { if (pinnedIds.includes(id)) { element.style.display = 'flex'; } else { element.style.display = 'none'; } } } } }; updatePinnedItems(); Object.keys(ids).forEach(id => { if (id.endsWith("2_ID")) { const pinActiveIcon = document.querySelector(`#${id} > .DLP_HStack_8 > #DLP_Inset_Icon_1_ID`); const pinInactiveIcon = document.querySelector(`#${id} > .DLP_HStack_8 > #DLP_Inset_Icon_2_ID`); const modifiedId = id.replace("2_ID", "1_ID"); function updatePinViews() { if (storageLocal.pins.home.includes(modifiedId)) { pinActiveIcon.style.display = 'block'; pinInactiveIcon.style.display = 'none'; } else { pinActiveIcon.style.display = 'none'; pinInactiveIcon.style.display = 'block'; } }; updatePinViews(); function updatePins(isAdding) { const index = storageLocal.pins.home.indexOf(modifiedId); if (isAdding && index === -1) { if (storageLocal.pins.home.length > Math.floor(((window.innerHeight) / 200) - 1)) { showNotification("warning", "Pin Limit Reached", "You've pinned too many functions. Please unpin one to continue.", 15); } else { storageLocal.pins.home.push(modifiedId); } } else if (!isAdding && index !== -1) { storageLocal.pins.home.splice(index, 1); } else { console.log("Something unexpected happened: djr9234."); } updatePinViews(); saveStorageLocal(); updatePinnedItems(); }; pinActiveIcon.addEventListener('click', () => updatePins(false)); pinInactiveIcon.addEventListener('click', () => updatePins(true)); } }); } inputCheck1(); function initializeMagneticHover(element) { let mouseDown = false; let originalZIndex = null; 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)`; } if (!originalZIndex) { if (element.style.zIndex) originalZIndex = parseInt(element.style.zIndex); else originalZIndex = 0; } element.style.zIndex = originalZIndex + 1; }); element.addEventListener('mouseleave', () => { element.style.transform = 'translate(0, 0) scale(1)'; element.style.zIndex = originalZIndex; 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)`; } }); } document.querySelectorAll('.DLP_Magnetic_Hover_1').forEach(element => { initializeMagneticHover(element); }); 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 serverConnectedBeforeNotification; let newTermID; function connectToServer() { let mainInputsDiv1 = document.getElementById('DLP_Main_Inputs_1_Divider_1_ID'); //fetch(apiURL + '/server', { fetch('https://api.duolingopro.net/server', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ version: versionFormal, key: storageLocal.random16 }) }) .then(response => response.json()) .then(data => { if (data.global || data.versions) { const globalData = data.global; const versionData = data.versions[versionFull]; 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, systemText[systemLanguage][108], 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, systemText[systemLanguage][108], 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, systemText[systemLanguage][108], 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, systemText[systemLanguage][108], DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_2_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_3_ID"), '#34C759'); if (serverConnectedBeforeNotification) { serverConnectedBeforeNotification.close(); serverConnectedBeforeNotification = false; } } serverConnectedBefore = 'yes'; } } else { if (storageLocal.onboarding) { if (currentPage !== 5 && currentPage !== 6) goToPage(5); } else { if (currentPage !== 10) goToPage(10); } } } 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 = systemText[systemLanguage][203]; } //if (storageLocal.languagePackVersion !== versionData.languagePackVersion) { // fetch(serverURL + "/static/3.0/resources/language_pack.json") // .then(response => response.json()) // .then(data => { // if (data[versionFull]) { // storageLocal.languagePack = data[versionFull]; // console.log(data[versionFull]); // storageLocal.languagePackVersion = versionData.languagePackVersion; // saveStorageLocal(); // } // }) // .catch(error => console.error('Error fetching systemText:', error)); //} } 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, systemText[systemLanguage][109], 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, systemText[systemLanguage][109], DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_3_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_2_ID"), '#FF2D55'); if (error !== 'Outdated Client') serverConnectedBeforeNotification = showNotification("error", systemText[systemLanguage][231], systemText[systemLanguage][232], 30); } else if (serverConnectedBefore === 'no') { serverConnectedBefore = 'error'; mainInputsDiv1.style.opacity = '0.5'; mainInputsDiv1.style.pointerEvents = 'none'; updateConnetionButtonStyles(DLP_Server_Connection_Button, systemText[systemLanguage][109], 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, systemText[systemLanguage][109], DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_3_ID"), DLP_Server_Connection_Button_2.querySelector("#DLP_Inset_Icon_1_ID"), '#FF2D55'); } }); } connectToServer(); setTimeout(() => { connectToServer(); }, 1000); setInterval(() => { //if (windowBlurState) connectToServer(); if (document.visibilityState === "visible" || isAutoMode) connectToServer(); }, 4000); function updateReleaseNotes(warnings) { const releaseNotesContainer = document.getElementById('DLP_Release_Notes_List_1_ID'); const controlsContainer = document.getElementById('DLP_Release_Notes_Controls'); const warningCounterDisplay = controlsContainer.querySelector('#DLP_Inset_Text_1_ID'); const prevButton = controlsContainer.querySelector('#DLP_Inset_Icon_1_ID'); const nextButton = controlsContainer.querySelector('#DLP_Inset_Icon_2_ID'); releaseNotesContainer.innerHTML = ''; let currentWarningIndex = 0; const totalWarnings = warnings.length; function updateCounterDisplay(current, total, displayElement) { displayElement.textContent = `${current}/${total}`; } function updateButtonOpacity(current, total, prevButton, nextButton) { if (current === 0) { prevButton.style.opacity = '0.5'; prevButton.style.pointerEvents = 'none'; } else { prevButton.style.opacity = '1'; prevButton.style.pointerEvents = 'auto'; } if (current === total - 1) { nextButton.style.opacity = '0.5'; nextButton.style.pointerEvents = 'none'; } else { nextButton.style.opacity = '1'; nextButton.style.pointerEvents = 'auto'; } } warnings.forEach((warning, index) => { if (warning.head && warning.body && warning.icon) { const warningHTML = `
${warning.icon}

${warning.head}

${warning.tag}

${warning.body}

`; releaseNotesContainer.insertAdjacentHTML('beforeend', warningHTML); } }); updateCounterDisplay(currentWarningIndex + 1, totalWarnings, warningCounterDisplay); updateButtonOpacity(currentWarningIndex, totalWarnings, prevButton, nextButton); prevButton.addEventListener('click', () => { if (isBusySwitchingPages) return; isBusySwitchingPages = true; if (currentWarningIndex > 0) { const oldWarning = document.getElementById(`warning-${currentWarningIndex}`); const newWarning = document.getElementById(`warning-${currentWarningIndex - 1}`); oldWarning.style.filter = 'blur(16px)'; oldWarning.style.opacity = '0'; newWarning.style.filter = 'blur(16px)'; newWarning.style.opacity = '0'; setTimeout(() => { oldWarning.style.display = 'none'; newWarning.style.display = 'flex'; newWarning.offsetHeight; newWarning.style.filter = 'blur(0px)'; newWarning.style.opacity = '1'; currentWarningIndex--; updateCounterDisplay(currentWarningIndex + 1, totalWarnings, warningCounterDisplay); updateButtonOpacity(currentWarningIndex, totalWarnings, prevButton, nextButton); setTimeout(() => { isBusySwitchingPages = false; }, 400); }, 400); } }); nextButton.addEventListener('click', () => { if (isBusySwitchingPages) return; isBusySwitchingPages = true; if (currentWarningIndex < totalWarnings - 1) { const oldWarning = document.getElementById(`warning-${currentWarningIndex}`); const newWarning = document.getElementById(`warning-${currentWarningIndex + 1}`); oldWarning.style.filter = 'blur(16px)'; oldWarning.style.opacity = '0'; newWarning.style.filter = 'blur(16px)'; newWarning.style.opacity = '0'; setTimeout(() => { oldWarning.style.display = 'none'; newWarning.style.display = 'flex'; newWarning.offsetHeight; newWarning.style.filter = 'blur(0px)'; newWarning.style.opacity = '1'; currentWarningIndex++; updateCounterDisplay(currentWarningIndex + 1, totalWarnings, warningCounterDisplay); updateButtonOpacity(currentWarningIndex, totalWarnings, prevButton, nextButton); setTimeout(() => { isBusySwitchingPages = false; }, 400); }, 400); } }); } 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(feedbackType, FeedbackText); 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, systemText[systemLanguage][111], 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, systemText[systemLanguage][112], doneIcon, loadingIcon, 'rgba(52, 199, 89, 0.10)', '2px solid rgba(52, 199, 89, 0.20)', '#34C759', 400, () => { confetti(); }); } else if (sendFeedbackStatus === 'error') { setButtonState(DLP_Feedback_Send_Button_1_ID, systemText[systemLanguage][115], failedIcon, loadingIcon, 'rgba(255, 45, 85, 0.10)', '2px solid rgba(255, 45, 85, 0.20)', '#FF2D55', 400, () => { }); } 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(); }); DLP_Feedback_Send_Button_1_ID.style.pointerEvents = 'none'; DLP_Feedback_Send_Button_1_ID.style.opacity = '0.5'; DLP_Feedback_Text_Input_1_ID.addEventListener("input", function () { if (DLP_Feedback_Text_Input_1_ID.value.replace(/\s/g, "").length <= 16) { DLP_Feedback_Send_Button_1_ID.style.pointerEvents = 'none'; DLP_Feedback_Send_Button_1_ID.style.opacity = '0.5'; } else { DLP_Feedback_Send_Button_1_ID.style.pointerEvents = ''; DLP_Feedback_Send_Button_1_ID.style.opacity = ''; } }); async function sendFeedbackServer(head, body) { try { sendFeedbackStatus = 'sending'; let payload = { head: head, body: body, version: versionFormal }; if (DLP_Feedback_Attachment_Input_Hidden_1_ID.files.length > 0) { const file = DLP_Feedback_Attachment_Input_Hidden_1_ID.files[0]; const base64File = await new Promise((resolve) => { const reader = new FileReader(); reader.onloadend = () => { resolve(reader.result); }; reader.readAsDataURL(file); }); payload.file = base64File; } const response = await fetch(apiURL + "/feedback", { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1]}` }, body: JSON.stringify(payload) }); const responseData = await response.json(); if (responseData.status) sendFeedbackStatus = 'sent'; else sendFeedbackStatus = 'error'; showNotification(responseData.notification.icon, responseData.notification.head, responseData.notification.body, responseData.notification.duration); } catch (error) { console.error('Error:', error); sendFeedbackStatus = 'error'; showNotification("error", systemText[systemLanguage][206], systemText[systemLanguage][207], 30); } } function generateTimeMessage1(hours, minutes) { let hourPhrase = ''; let minutePhrase = ''; let timeMessage = ''; if (hours > 0) { hourPhrase = systemText[systemLanguage][215] .replace("{hours}", hours) .replace("{hourUnit}", hours > 1 ? systemText[systemLanguage][211] : systemText[systemLanguage][210]); } if (minutes > 0) { minutePhrase = systemText[systemLanguage][216] .replace("{minutes}", minutes) .replace("{minuteUnit}", minutes > 1 ? systemText[systemLanguage][213] : systemText[systemLanguage][212]); } if (hours > 0 && minutes > 0) { timeMessage = systemText[systemLanguage][217] .replace("{hourPhrase}", hourPhrase) .replace("{conjunction}", systemText[systemLanguage][214]) .replace("{minutePhrase}", minutePhrase); } else if (hours > 0) timeMessage = hourPhrase; else if (minutes > 0) timeMessage = minutePhrase; return timeMessage; } 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, systemText[systemLanguage][113], 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'; if (id === "streak") { (async () => { try { const response = await fetch(apiURL + '/streak', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1]}` }, body: JSON.stringify({ amount: amount }) }); if (!response.ok) { throw new Error('Request failed with status ' + response.status); } const reader = response.body.getReader(); const decoder = new TextDecoder(); let done = false; let buffer = ''; while (!done) { const { value, done: doneReading } = await reader.read(); done = doneReading; buffer += decoder.decode(value, { stream: true }); let openBraces = 0; let start = 0; for (let i = 0; i < buffer.length; i++) { if (buffer[i] === '{') { openBraces++; } else if (buffer[i] === '}') { openBraces--; if (openBraces === 0) { const jsonStr = buffer.substring(start, i + 1).trim(); try { const data = JSON.parse(jsonStr); if (data.status === 'completed') { status = "done"; done = true; showNotification(data.notification.icon, data.notification.head, data.notification.body, data.notification.duration); const input = button.parentElement.querySelector('#DLP_Inset_Input_1_ID'); if (input) { input.value = ""; //setTimeout(() => input.dispatchEvent(new Event("input")), 2400); } } else if (data.status == 'failed') { status = "error"; done = true; showNotification(data.notification.icon, data.notification.head, data.notification.body, data.notification.duration); console.log(data); } else { console.log(`Percentage: ${data.percentage}%`); button.querySelector('#DLP_Inset_Text_1_ID').innerHTML = data.percentage + '%'; } buffer = buffer.substring(i + 1); i = -1; start = 0; openBraces = 0; } catch (e) { } } } else if (openBraces === 0 && buffer[i].trim() !== "") { start = i; } } } } catch (error) { console.error('Error during request:', error); status = 'error'; } })(); } else { fetch(apiURL + '/request', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1]}` }, body: JSON.stringify({ gain_type: id, amount: amount }) }) .then(response => response.json()) .then(data => { if (data.status === true) { status = 'done'; showNotification(data.notification.icon, data.notification.head, data.notification.body, data.notification.duration); const input = button.parentElement.querySelector('#DLP_Inset_Input_1_ID'); if (input) { input.value = ""; //setTimeout(() => input.dispatchEvent(new Event("input")), 2400); } } else { status = 'rejected'; showNotification(data.notification.icon, data.notification.head, data.notification.body, data.notification.duration); const input = button.parentElement.querySelector('#DLP_Inset_Input_1_ID'); if (data.max_amount && input) input.value = data.max_amount; else if (input) { input.value = ""; //setTimeout(() => input.dispatchEvent(new Event("input")), 2400); } } }) .catch(error => { status = 'error'; console.error('Error fetching data:', error); showNotification("error", systemText[systemLanguage][208], systemText[systemLanguage][209] + "0001", 15); }); } setTimeout(() => { f(); }, 800); function f() { if (status === 'done') { setButtonState(button, systemText[systemLanguage][114], doneIcon, loadingIcon, 'rgba(52, 199, 89, 0.10)', '2px solid rgba(52, 199, 89, 0.20)', '#34C759', 400, () => { confetti(); setTimeout(() => { setButtonState(button, systemText[systemLanguage][9], ogIcon, doneIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); setTimeout(() => { isGetButtonsBusy = false; }, 800); }, 800); }); } else if (status === 'error') { setButtonState(button, systemText[systemLanguage][115], failedIcon, loadingIcon, 'rgba(255, 45, 85, 0.10)', '2px solid rgba(255, 45, 85, 0.20)', '#FF2D55', 400, () => { setTimeout(() => { setButtonState(button, systemText[systemLanguage][9], ogIcon, failedIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); setTimeout(() => { isGetButtonsBusy = false; }, 800); }, 800); }); } else if (status === 'rejected') { setButtonState(button, systemText[systemLanguage][9], ogIcon, loadingIcon, '#007AFF', '2px solid rgba(0, 0, 0, 0.20)', '#FFF', 400); setTimeout(() => { isGetButtonsBusy = false; }, 800); } else { setTimeout(() => { f(); }, 400); } } }); } const getButtonsList1 = [ { base: 'DLP_Get_XP', type: 'xp', input: true }, { base: 'DLP_Get_GEMS', type: 'gems', input: true }, { base: 'DLP_Get_SUPER', type: 'super' }, { base: 'DLP_Get_DOUBLE_XP_BOOST', type: 'double_xp_boost' }, { base: 'DLP_Get_Streak_Freeze', type: 'streak_freeze', input: true }, { base: 'DLP_Get_Heart_Refill', type: 'heart_refill' }, { base: 'DLP_Get_Streak', type: 'streak', input: true }, ]; function setupGetButtons(base, type, hasInput) { [1, 2].forEach(n => { const parent = document.getElementById(`${base}_${n}_ID`); if (!parent) return; const button = parent.querySelector('#DLP_Inset_Button_1_ID'); const handler = () => { if (isGetButtonsBusy) return; isGetButtonsBusy = true; handleClick(button, type, hasInput ? Number(parent.querySelector('#DLP_Inset_Input_1_ID').value) : 1); }; button.addEventListener('click', handler); if (hasInput) { const input = parent.querySelector('#DLP_Inset_Input_1_ID'); input.onkeyup = e => e.keyCode === 13 && handler(); } }); }; getButtonsList1.forEach(({ base, type, input }) => setupGetButtons(base, type, input)); let DLP_Settings_Save_Button_1_ID = document.getElementById("DLP_Settings_Save_Button_1_ID"); DLP_Settings_Save_Button_1_ID.addEventListener('click', () => { if (isBusySwitchingPages) return; isBusySwitchingPages = true; storageLocal.settings.autoUpdate = DLP_Settings_Auto_Update; storageLocal.settings.showAutoServerButton = DLP_Settings_Show_AutoServer_Button; storageLocal.settings.showSolveButtons = DLP_Settings_Show_Solve_Buttons; storageLocal.settings.solveSpeed = Number(settingsLegacySolveSpeedInputSanitizeValue(DLP_Settings_Legacy_Solve_Speed_1_ID.querySelector('#DLP_Inset_Input_1_ID').value, true)); saveStorageLocal(); setButtonState(DLP_Settings_Save_Button_1_ID, systemText[systemLanguage][116], null, 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(-1); location.reload(); }, 1600); //setTimeout(() => { // setButtonState(DLP_Settings_Save_Button_1_ID, systemText[systemLanguage][37], 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); // isBusySwitchingPages = false; //}, 2400); }); }); let DLP_Settings_Auto_Update = storageLocal.settings.autoUpdate; let DLP_Settings_Show_AutoServer_Button = storageLocal.settings.showAutoServerButton; let DLP_Settings_Show_Solve_Buttons = storageLocal.settings.showSolveButtons; let DLP_Settings_Legacy_Solve_Speed = storageLocal.settings.solveSpeed; let DLP_Settings_Toggle_Busy = false; let DLP_Settings_Show_Solve_Buttons_1_ID = document.getElementById("DLP_Settings_Show_Solve_Buttons_1_ID"); let DLP_Settings_Show_AutoServer_Button_1_ID = document.getElementById("DLP_Settings_Show_AutoServer_Button_1_ID"); let DLP_Settings_Legacy_Solve_Speed_1_ID = document.getElementById("DLP_Settings_Legacy_Solve_Speed_1_ID"); let DLP_Settings_Auto_Update_Toggle_1_ID = document.getElementById("DLP_Settings_Auto_Update_Toggle_1_ID"); handleToggleClick(DLP_Settings_Show_Solve_Buttons_1_ID.querySelector('#DLP_Inset_Toggle_1_ID'), DLP_Settings_Show_Solve_Buttons); if (alpha) handleToggleClick(DLP_Settings_Show_AutoServer_Button_1_ID.querySelector('#DLP_Inset_Toggle_1_ID'), DLP_Settings_Show_AutoServer_Button); else DLP_Settings_Show_AutoServer_Button_1_ID.remove(); handleToggleClick(DLP_Settings_Auto_Update_Toggle_1_ID.querySelector('#DLP_Inset_Toggle_1_ID'), DLP_Settings_Auto_Update); DLP_Settings_Legacy_Solve_Speed_1_ID.querySelector('#DLP_Inset_Input_1_ID').value = DLP_Settings_Legacy_Solve_Speed; DLP_Settings_Legacy_Solve_Speed_1_ID.querySelector('#DLP_Inset_Input_1_ID').addEventListener("input", function () { this.value = settingsLegacySolveSpeedInputSanitizeValue(this.value, false); }); DLP_Settings_Legacy_Solve_Speed_1_ID.querySelector('#DLP_Inset_Input_1_ID').addEventListener("blur", function () { this.value = settingsLegacySolveSpeedInputSanitizeValue(this.value, true); DLP_Settings_Legacy_Solve_Speed = Number(this.value); }); function settingsLegacySolveSpeedInputSanitizeValue(value, completeSanitization) { value = value.replace(/[^0-9.,]/g, ''); let match = value.match(/[.,]/g); if (match && match.length > 1) { value = value.slice(0, value.lastIndexOf(match[match.length - 1])); } let decimalIndex = value.indexOf('.'); if (decimalIndex !== -1) { value = value.slice(0, decimalIndex + 3); } let digitCount = value.replace(/[^0-9]/g, '').length; if (digitCount > 3) { value = value.replace(/(\d{3})\d+/, '$1'); } if (/^0\d/.test(value) && !value.startsWith("0.")) { value = value.replace(/^0+/, '0'); } if (!completeSanitization) return value; value = value.replace(',', '.'); value = parseFloat(value); if (!isNaN(value)) { if (value < 0.6) value = 0.6; } else { value = 0.8; } return value; } 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; 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.querySelector('#DLP_Inset_Toggle_1_ID').addEventListener('click', () => { if (DLP_Settings_Toggle_Busy) return; if (!greasyfork) { DLP_Settings_Auto_Update = !DLP_Settings_Auto_Update; DLP_Settings_Toggle_Busy = true; handleToggleClick(DLP_Settings_Auto_Update_Toggle_1_ID.querySelector('#DLP_Inset_Toggle_1_ID'), DLP_Settings_Auto_Update); setTimeout(() => { DLP_Settings_Toggle_Busy = false; }, 800); } }); DLP_Settings_Show_Solve_Buttons_1_ID.querySelector('#DLP_Inset_Toggle_1_ID').addEventListener('click', () => { if (DLP_Settings_Toggle_Busy) return; DLP_Settings_Show_Solve_Buttons = !DLP_Settings_Show_Solve_Buttons; DLP_Settings_Toggle_Busy = true; handleToggleClick(DLP_Settings_Show_Solve_Buttons_1_ID.querySelector('#DLP_Inset_Toggle_1_ID'), DLP_Settings_Show_Solve_Buttons); setTimeout(() => { DLP_Settings_Toggle_Busy = false; }, 800); }); DLP_Settings_Show_AutoServer_Button_1_ID.querySelector('#DLP_Inset_Toggle_1_ID').addEventListener('click', () => { if (DLP_Settings_Toggle_Busy) return; DLP_Settings_Show_AutoServer_Button = !DLP_Settings_Show_AutoServer_Button; DLP_Settings_Toggle_Busy = true; handleToggleClick(DLP_Settings_Show_AutoServer_Button_1_ID.querySelector('#DLP_Inset_Toggle_1_ID'), DLP_Settings_Show_AutoServer_Button); setTimeout(() => { DLP_Settings_Toggle_Busy = false; }, 800); }); function confetti() { let canvas = document.getElementById("DLP_Confetti_Canvas"); if (!canvas.confettiInitialized) { 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; canvas.ctx = ctx; canvas.cx = cx; canvas.cy = cy; canvas.confetti = []; canvas.animationId = null; canvas.confettiInitialized = true; let resizeCanvas = () => { canvas.width = window.innerWidth; canvas.height = window.innerHeight; canvas.cx = canvas.ctx.canvas.width / 2; canvas.cy = canvas.ctx.canvas.height / 2; }; const resizeObserver = new ResizeObserver(() => { resizeCanvas(); }); resizeObserver.observe(canvas); let render = () => { canvas.ctx.clearRect(0, 0, canvas.width, canvas.height); canvas.confetti.forEach((confetto, index) => { let width = confetto.dimensions.x * confetto.scale.x; let height = confetto.dimensions.y * confetto.scale.y; canvas.ctx.translate(confetto.position.x, confetto.position.y); canvas.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) canvas.confetti.splice(index, 1); if (confetto.position.x > canvas.width) confetto.position.x = 0; if (confetto.position.x < 0) confetto.position.x = canvas.width; canvas.ctx.fillStyle = confetto.color.front; canvas.ctx.fillRect(-width / 2, -height / 2, width, height); canvas.ctx.setTransform(1, 0, 0, 1, 0, 0); }); canvas.animationId = window.requestAnimationFrame(render); }; render(); } 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" }, ]; const confettiSizeRange = { min: 5, max: 15 }; let randomRange = (min, max) => Math.random() * (max - min) + min; const confettiCount = 500; for (let i = 0; i < confettiCount; i++) { canvas.confetti.push({ color: colors[Math.floor(randomRange(0, colors.length))], dimensions: { x: randomRange(confettiSizeRange.min, confettiSizeRange.max), y: randomRange(confettiSizeRange.min, confettiSizeRange.max), }, 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), }, }); } } async function generateEarnKey() { const endpoint = `https://api.duolingopro.net/earn/connect/generate`; try { const response = await fetch(endpoint, { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${document.cookie.split(';').find(cookie => cookie.includes('jwt_token')).split('=')[1]}` }, }); if (response.ok) { const data = await response.json(); if (data.earn_key) { console.log('Earn Key:', data.earn_key); return data.earn_key; } else { throw new Error('Earn key not found in the response.'); } } else if (response.status === 401) { throw new Error('Unauthorized: Invalid or missing authentication token.'); } else if (response.status === 429) { throw new Error('Rate limit exceeded: Please try again later.'); } else if (response.status === 500) { const errorData = await response.json(); throw new Error(`Server Error: ${errorData.detail || 'An unexpected error occurred.'}`); } else { const errorData = await response.json(); throw new Error(`Error ${response.status}: ${errorData.detail || 'An unexpected error occurred.'}`); } } catch (error) { console.error('Error generating earn key:', error.message); throw error; } } let earnButtonAssignedLink = false; document.querySelectorAll("#DLP_Main_Earn_Button_1_ID, #DLP_Secondary_Earn_Button_1_ID").forEach(button => { button.addEventListener('click', () => { button.style.opacity = '0.5'; button.style.pointerEvents = 'none'; generateEarnKey() .then(earnKey => { console.log('Successfully retrieved earn key:', earnKey); button.setAttribute("onclick", `window.open('${serverURL}/earn/connect/link/${earnKey}', '_blank');`); if (!earnButtonAssignedLink) { earnButtonAssignedLink = true; window.open(serverURL + "/earn/connect/link/" + earnKey, "_blank"); } }) .catch(error => { console.error('Failed to retrieve earn key:', error.message); }) .finally(() => { button.style.opacity = ''; button.style.pointerEvents = ''; }); }); }); 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); }; } document.addEventListener('keydown', function(event) { if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') { if (event.shiftKey) { solving(); } else { solve(); } } }); function updateSolveButtonText(text) { document.getElementById("solveAllButton").innerText = text; } function solving(value) { if (value === "start") isAutoMode = true; else if (value === "stop") isAutoMode = false; else isAutoMode = !isAutoMode; updateSolveButtonText(isAutoMode ? systemText[systemLanguage][102] : systemText[systemLanguage][101]); 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', '._2V6ug._1ursp._7jW2t._28UWu._3h0lA._1S2uf._1E9sc' // No Thanks Legendary Button ]; 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; storageSession.legacy.status = false; 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; storageSession.legacy.status = false; 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') { const nl = document.querySelectorAll('[data-test*="challenge-tap-token"]:not(span)'); const textElements = document.querySelectorAll('[data-test="challenge-tap-token-text"]'); const textToElementMap = new Map(); for (let i = 0; i < nl.length; i++) { const text = textElements[i].innerText.toLowerCase().trim(); textToElementMap.set(text, nl[i]); } for (const key in window.sol.dictionary) { if (window.sol.dictionary.hasOwnProperty(key)) { const value = window.sol.dictionary[key]; const keyPart = key.split(":")[1].toLowerCase().trim(); const normalizedValue = value.toLowerCase().trim(); const element1 = textToElementMap.get(keyPart); const element2 = textToElementMap.get(normalizedValue); if (element1 && !element1.disabled) element1.click(); if (element2 && !element2.disabled) element2.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; } try { if (false) { if (storageLocal.languagePackVersion !== "00") { if (!storageLocal.languagePack.hasOwnProperty(systemLanguage)) systemLanguage = "en"; systemText = storageLocal.languagePack; One(); } else { systemLanguage = "en"; One(); } } else { systemLanguage = "en"; One(); } } catch (error) { console.log(error); One(); }