Last active
February 10, 2022 02:53
-
-
Save tan9/df262289574f8c1db32e5705b8cddabc to your computer and use it in GitHub Desktop.
This file contains 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 臺中市校園閱讀認證小幫手 | |
// @description 在「臺中市國民小學推動校園閱讀線上認證系統」將認證題目改用注音字型顯示、增加快捷鍵等,方便認證。 | |
// @version 0.2.1 | |
// @author Pei-Tang Huang | |
// @downloadURL https://gist.githubusercontent.com/tan9/df262289574f8c1db32e5705b8cddabc/raw/ | |
// @updateURL https://gist.githubusercontent.com/tan9/df262289574f8c1db32e5705b8cddabc/raw/ | |
// @match *://read.tc.edu.tw/* | |
// @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.3/mousetrap.min.js | |
// @require https://code.jquery.com/jquery-3.4.1.min.js | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
const $ = jQuery; | |
// 改用注音字體 | |
$("span") | |
.filter((i, e) => $(e).css("font-family") === "標楷體") | |
.css( | |
"font-family", | |
"華康標楷W5注音,文鼎標楷注音,王漢宗中楷體注音,標楷體" | |
); | |
// 為選項加上快捷鍵 | |
$('input[type="radio"][name="my_answer"]') | |
.before(i => `<kbd>${i + 1}</kbd>`) | |
.each((i, e) => | |
Mousetrap.bind(e.value, () => { | |
e.checked = true; | |
$('input[type="submit"]').click(); | |
}) | |
); | |
// 自動跳過跳到下一題 | |
if ($('input[value="下一題"')) { | |
setTimeout(() => $('input[value="下一題"').click(), 1500); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
謝謝您!:)