Elearning Download

高雄科技大學 Elearning 檔案下載(114學年度修復版)

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Elearning Download
// @namespace    https://facaikotei.github.io/
// @version      6.0.2
// @description  高雄科技大學 Elearning 檔案下載(114學年度修復版)
// @author       (c)2025 facaikotei (c)2022 Juirmin
// @match        https://elearning.nkust.edu.tw/moocs/*
// @require      https://update.greasyfork.org/scripts/12228/setMutationHandler.js
// @icon         https://elearning.nkust.edu.tw/moocs/assets/icons/PWA_icon_128.png
// @license      MIT
// @website      https://greasyfork.org/users/1305953
// ==/UserScript==

(function () {
    'use strict';

    setMutationHandler(document.querySelector('.cgust-main'), '.course-node__info', async (els) => {
        const courseNodeData = await (await fetch(`/api/v1/courses/${JSON.parse(sessionStorage.assignment).courseId}/node`)).json();
        const urlExtractor = item => [item.blank_url, ...item.items.flatMap(urlExtractor)];
        const urls = courseNodeData.data.items.flatMap(urlExtractor);
        els = [...new Set(els)];
        els.forEach((el, index) => {
            const url = urls[index % urls.length];
            if (url && !el.querySelector(`[href="${url}"]`)) {
                el.insertAdjacentHTML('beforeend', `<a target="_blank" href="${url}">下載</a>`);
            }
        });
    });
})();