Deutsche Welle Out Load Reading

Enhances DW Learn German by improving readability, removing distractions, and adding shortcuts.

目前为 2025-03-09 提交的版本。查看 最新版本

// ==UserScript==
// @name         Deutsche Welle Out Load Reading
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Enhances DW Learn German by improving readability, removing distractions, and adding shortcuts.
// @author       Yange
// @match        https://learngerman.dw.com/de/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create a button
    let button = document.createElement('button');
    button.innerText = 'Clean';
    button.style.position = 'fixed';
    button.style.bottom = '20px';
    button.style.right = '20px';
    button.style.padding = '10px';
    button.style.background = 'red';
    button.style.color = 'white';
    button.style.border = 'none';
    button.style.borderRadius = '5px';
    button.style.cursor = 'pointer';
    button.style.zIndex = '9999';

    // Button click event to remove the <nav>
    button.addEventListener('click', function() {
        let currentUrl = window.location.href;
        if (!currentUrl.endsWith('/lm')){
            window.location.href=currentUrl + '/lm';
        }

        let navHeader = document.querySelector('nav.sk35agp');

        if (navHeader) {
            navHeader.remove();
        }

        let navElement = document.querySelector('nav.s1got9be');

        if (navElement) {
            navElement.remove();
        }
    });

    // Add button to the page
    document.body.appendChild(button);

    // Function to toggle play/pause using the Space key
    function togglePlayPause(event) {
        if (event.code === 'Space') { // Check if Space key is pressed
            event.preventDefault(); // Prevent default scrolling behavior

            let playButton = document.querySelector('button.vjs-play-control'); // Find the play button
            if (playButton) {
                playButton.click(); // Simulate clicking the play/pause button
                console.log('Space key pressed: Toggling play/pause');
            } else {
                console.log('Play button not found.');
            }
        }
    }

    // Add event listener for keydown
    document.addEventListener('keydown', togglePlayPause);




    function removeVideo() {
        let videoContainer = document.querySelector('.video-js'); // Select Video.js player

        if (videoContainer) {
            let videoElement = videoContainer.querySelector('video'); // Find <video> inside it

            if (videoElement) {
                videoElement.remove(); // Remove the video element
                console.log('Video removed, audio kept.');
            }

            // Optional: Hide the entire video container (if needed)
            videoContainer.style.height = '50px'; // Make it smaller
            videoContainer.style.background = 'none'; // Remove background
        } else {
            console.log('No video found.');
        }
    }

    window.addEventListener('load', removeVideo);


})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址