skip online class for 'gseek.kr'

skip video

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         skip online class for 'gseek.kr'
// @namespace    http://tampermonkey.net/
// @version      2025-04-16
// @description  skip video
// @author       dh.jo
// @match        https://www.gseek.kr/user/course/online/player
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gseek.kr
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function sleep(ms) {
        const wakeUpTime = Date.now() + ms;
        while (Date.now() < wakeUpTime) {}
    }

    const $video = document.querySelector('#player');
    const $nextBtn = document.querySelector('#nextLessonBtn');

    function skip() {
        if (!$video) return;
        if ($video.paused) {
            $video.play();
            sleep(200);
        }
        $video.currentTime = 99999;
        sleep(200);

        const nextId = $nextBtn.getAttribute("data-next_esson_sn");
        if (nextId == '0') {
            // 끝
            window.location.href = '/user/mypage/learning/online/list';
        } else {
            // 다음 go
            window.fnLessonPlay(nextId, true);
        }
    }

    function generateSkipButton() {
        const $closeBtn = document.querySelector('.course-close');
        const skipButtonHTML = `
    <button type="button" style="padding: 0 24px; background: #a80909;" class="skip-button">
      <span class="mob-hidden">스킵</span>
    </button>
  `;
        $closeBtn.insertAdjacentHTML('afterend', skipButtonHTML);

        const $skipBtn = document.querySelector('.skip-button');
        $skipBtn.onclick = function () {
            skip();
            return false;
        };
    }

    $video.addEventListener("loadeddata", () => {
        if ($video.readyState >= 2) {
            if ($video) {
                skip();
            }
        }
    });

    generateSkipButton();

})();