Duolingo Pro Beta (Support)

Fixi the Listening only mode from the original extension.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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 
})();