Skip to content

Instantly share code, notes, and snippets.

@su8ru
Last active May 7, 2023 08:06
Show Gist options
  • Save su8ru/a37876a56cc7a2eb4384449034f081bb to your computer and use it in GitHub Desktop.
Save su8ru/a37876a56cc7a2eb4384449034f081bb to your computer and use it in GitHub Desktop.
Moodle を便利にする userscript / "Raw" ボタンからインストールできます / いらない機能があったらコメントアウトしてね
// ==UserScript==
// @name moodle-utils
// @namespace https://su8ru.dev/
// @version 0.3.1
// @description Make Moodle more useful
// @author subaru <contact@su8ru.dev>
// @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