Skip to content

Instantly share code, notes, and snippets.

@GitHub30
Created May 29, 2022 16:41
Show Gist options
  • Save GitHub30/af41a4fa870020ccfa2ac6f7417295a0 to your computer and use it in GitHub Desktop.
Save GitHub30/af41a4fa870020ccfa2ac6f7417295a0 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name AutoNextUdemy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.udemy.com/course/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=udemy.com
// @grant none
// ==/UserScript==
document.body.addEventListener('click', e => {
if (e.target.type === 'radio') {
requestIdleCallback(() => document.querySelector('[data-purpose="go-to-next-question"]').click())
} else if (e.target.type === 'checkbox') {
const m = document.querySelector('#question-prompt').textContent.match(/(?<=select )\d|\d(?=を選択)|\d(?=つ選択してください)/)
if (m && e.target.closest('form').querySelectorAll('input[type=checkbox]:checked').length === parseInt(m[0], 10)) {
requestIdleCallback(() => document.querySelector('[data-purpose="go-to-next-question"]').click())
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment