您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Suite d'outils pour faciliter l'administration de Moodle
// ==UserScript== // @name Moodle-Ultimate-Toolbox // @description Suite d'outils pour faciliter l'administration de Moodle // @author obooklage - Education Nationale / Académie de Créteil - FRANCE // @version 7 // @licence MIT License (MIT) // @namespace Violentmonkey Scripts // @icon https://tracker.moodle.org/secure/attachment/56206/Moodle-Icon-1024-corners.png // @match *://moodle*/* // ==/UserScript== function ConsolePrint(message) { var startTime = new Date(); console.log('[Moodle-Ultimate-Toolbox] '+ startTime.toLocaleTimeString() + ' ' + message) ; } function insertTextAtCursor(text) { var sel, range, html; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); range.insertNode( document.createTextNode(text) ); } } else if (document.selection && document.selection.createRange) { document.selection.createRange().text = text; } } /* Intercept CTRL+E for "\( MATHS \)" and CTRL+K for Python, insertion in caret/cursor position of contenteditable div */ function keyDownHandler(zEvent) { if (zEvent.ctrlKey && zEvent.code === "KeyE") { ConsolePrint('CONTROL-E KEY DETECTED'); /* question editor present ? */ if( document.getElementsByClassName('editor_atto_content') ) { ConsolePrint("EDITOR(S) DETECTED"); insertTextAtCursor("\\( MATHS \\) "); } } else if (zEvent.ctrlKey && zEvent.code === "KeyK") { ConsolePrint('CONTROL-K KEY DETECTED'); /* question editor present ? */ if( document.getElementsByClassName('editor_atto_content') ) { ConsolePrint("EDITOR(S) DETECTED"); insertTextAtCursor("<span syntax=\"python\">code</span>"); } } } /* Course set next page */ /* Remplir le selecteur 'Aller' et remplir le champ de description */ function FunctionChanged() { ConsolePrint("Changed"); var selector = document.getElementById("id_jumpto_0"); var text = selector.options[selector.selectedIndex].text; if( text == "Fin de la leçon") text = "Valider et terminer la leçon" document.getElementById('id_answer_editor_0').value = text; } var selector = document.getElementById("id_jumpto_0"); if(selector) { ConsolePrint("Select item id_jumpto_0 found"); selector.addEventListener("change", FunctionChanged); textfield = document.getElementById('id_answer_editor_0'); if(textfield) { text = document.getElementById("id_answer_editor_0").value; ConsolePrint("Texte existant = ["+text+"]"); if(text=="") { FunctionChanged(); } } } /* Application */ if (self == top) { /* run only in the top frame. we do our own frame parsing */ ConsolePrint('STARTED'); /* Keyboard */ document.addEventListener("keydown", keyDownHandler, false); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址