Last active
May 7, 2023 08:06
-
-
Save su8ru/a37876a56cc7a2eb4384449034f081bb to your computer and use it in GitHub Desktop.
Moodle を便利にする userscript / "Raw" ボタンからインストールできます / いらない機能があったらコメントアウトしてね
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name moodle-utils | |
// @namespace https://su8ru.dev/ | |
// @version 0.3.1 | |
// @description Make Moodle more useful | |
// @author subaru <[email protected]> | |
// @supportURL https://su8ru.dev/ | |
// @license MIT | |
// @match https://moodle.elms.hokudai.ac.jp/* | |
// @updateURL https://gist.github.com/su8ru/a37876a56cc7a2eb4384449034f081bb/raw/moodle-utils.user.js | |
// @downloadURL https://gist.github.com/su8ru/a37876a56cc7a2eb4384449034f081bb/raw/moodle-utils.user.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// 「このリソースはポップアップウィンドウに表示されます。」をその場で開く | |
if (/\/mod\/(mediasite|resource)\/view.php\?id/.test(location.href)) { | |
const elm = document.querySelector('#page-content a'); | |
location.replace(elm.href); | |
} | |
// パンくずリストの「グループ」リンクを「ダッシュボード」にする | |
const groupElm = document.querySelector('a[href="https://moodle.elms.hokudai.ac.jp/course/index.php"]'); | |
if (groupElm) { | |
groupElm.setAttribute('href', 'https://moodle.elms.hokudai.ac.jp/my/'); | |
groupElm.innerText = 'ダッシュボード'; | |
} | |
// ヘッダーロゴのリンク先をダッシュボードにする | |
const logoElm = document.querySelector('a[href="https://moodle.elms.hokudai.ac.jp"]'); | |
if (logoElm) { | |
logoElm.setAttribute('href', 'https://moodle.elms.hokudai.ac.jp/my/'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment