// ==UserScript== // @name Duolingo Switch Windows // @namespace http://tampermonkey.net/ // @match https://*.duolingo.com/* // @grant none // @license MIT // @require https://cdn.jsdelivr.net/npm/tailwindcss-cdn@3.4.10/tailwindcss.js // @version 1.0 // @author DuoSolverGrinder // @description It switches automatically between learn and league windows with the goal to be online for other users, and they think // you're watching for them to try to avoid those users who like to make points while you're offline. // For other options you can visit the links https://github.com/DuoSolverGrinder/DuoSolverGrinder, https://duosolver.is-great.net/ // @downloadURL none // ==/UserScript== let state = 0; let activate = false; let switchWindowInterval = null; let switchBetweenTimesInSeconds = 60; let bttnSwitch = 'switchWindow-switch-bttn'; let html = `

To grind xp, use next links:

` function toggleMenu() { let bttn = document.getElementById(bttnSwitch); if(activate) { activate = false; bttn.textContent = 'Activate'; clearInterval(switchWindowInterval); switchWindowInterval = null; return; } activate = true; bttn.textContent = 'Deactivate'; switchWindowInterval = setInterval(()=>{ state = state == 0 ? 2: 0; document.getElementsByClassName("_2dvyl")[state].click() }, switchBetweenTimesInSeconds * 1000) } function insertButtons() { let container = document.getElementById('switchWindow-container'); if(!container) { document.body.insertAdjacentHTML('beforeend',html); let bttn = document.getElementById(bttnSwitch); bttn.addEventListener('click', toggleMenu ); activate ? bttn.textContent = "Deactivate" : "Activate"; } } window.onload = (event) => { setInterval(insertButtons, 1000); }