Sometimes i do this when i finish the course, un-check all of the lessons i watch. So i created the script and i said to myself "do it with some options". So here it is...
// Instant checking for the un-collapsed sections
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
if (!checkbox.checked) {
checkbox.click()
}
}
// Instant unchecking for the un-collapsed sections
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
if (checkbox.checked) {
checkbox.click()
}
}
Before running the script, make sure that you collapse all of the course sections to run script properly.
// This is for instant checking
const sections = document.getElementsByClassName("udlite-btn udlite-btn-large udlite-btn-link udlite-heading-md js-panel-toggler panel--panel-toggler--30J_B")
for (const section of sections) {
section.click()
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
if (!checkbox.checked) {
checkbox.click()
}
}
section.click()
}
// This is for instant un-checking.
const sections = document.getElementsByClassName("udlite-btn udlite-btn-large udlite-btn-link udlite-heading-md js-panel-toggler panel--panel-toggler--30J_B")
for (const section of sections) {
section.click()
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
if (checkbox.checked) {
checkbox.click()
}
}
section.click()
}
// This is for checking with delay
const delay = 2000
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const sections = document.getElementsByClassName("udlite-btn udlite-btn-large udlite-btn-link udlite-heading-md js-panel-toggler panel--panel-toggler--30J_B")
async function demo() {
for (const section of sections) {
section.click()
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
if (!checkbox.checked) {
checkbox.click()
await sleep(delay);
}
}
section.click()
}
}
demo();
// This is for un-checking with delay
const delay = 2000
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const sections = document.getElementsByClassName("udlite-btn udlite-btn-large udlite-btn-link udlite-heading-md js-panel-toggler panel--panel-toggler--30J_B")
async function demo() {
for (const section of sections) {
section.click()
var checkboxes = document.getElementsByClassName("udlite-sr-only udlite-real-toggle-input")
for (const checkbox of checkboxes) {
if (checkbox.checked) {
checkbox.click()
await sleep(delay);
}
}
section.click()
}
}
demo();