Duolingo Pro Beta (Support)

Fixi the Listening only mode from the original extension.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Duolingo Pro Beta (Support)
// @namespace    http://tampermonkey.net/
// @license      MIT
// @version      2024-04-09
// @description  Fixi the Listening only mode from the original extension.
// @author       Zensud
// @match        https://www.duolingo.com/*
// @icon         https://imgs.search.brave.com/V03bRmemSGDlrBy5Iq1IdnhmfODnqNAC0L6F7si5F6w/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvY2NjMzk1YmM5/Y2ZhZTFkYTg3ZTlm/NjNhZjZiYjY3M2Yy/NTZmMmUyNDQwYzkx/MTY2MjJjMWRmYWRi/Mjc4NzQxMy93d3cu/ZHVvbGluZ28uY29t/Lw
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const listeningPage = "https://www.duolingo.com/practice-hub/listening-practice"; //Listening url
    let buttonClicked = false;

    function navigateTolisteningPage() {
        window.location.href = listeningPage;
    }

    //click Solve all button automaticlly
    function clickButtonOnce() {
        if (!buttonClicked) {
            const button = document.getElementById("solveAllButton");
            if (button) {
                button.click();
                buttonClicked = true;
            }
        }
    }

    // Check if the current page is the practice-hub
    if (window.location.href === "https://www.duolingo.com/practice-hub") { 
        // If on the practice-hub, navigate to the listening page
        navigateTolisteningPage();
    } else if (window.location.href === listeningPage) {
        // If on the listening, click the button
        clickButtonOnce();
    }

    // Continuously check if the current page is the practice-hub or the listening page, and navigate/click button accordingly
    setInterval(function() {
        if (window.location.href === "https://www.duolingo.com/practice-hub") { 
            navigateTolisteningPage();
        } else if (window.location.href === listeningPage) {
            clickButtonOnce();
        }
    }, 5000); // Adjust the interval 
})();