Skip to content

Instantly share code, notes, and snippets.

@Askill
Created October 7, 2022 07:31
Show Gist options
  • Save Askill/9b16c46f7d9599c8bb2c04df98b06b9c to your computer and use it in GitHub Desktop.
Save Askill/9b16c46f7d9599c8bb2c04df98b06b9c to your computer and use it in GitHub Desktop.
function OpenSections() {
console.log('Opening Sections...');
var index = 0;
var sectionPush = document.querySelectorAll('.js-panel-toggler')
var sectionHidden = document.querySelectorAll('.panel--content-wrapper--1g5eE')
sectionHidden.forEach((item) => {
const hidden = item.getAttribute('aria-hidden');
if (hidden == "true") {
sectionPush[index].click();
}
index++
})
console.log('Opening Sections DONE');
}
function GetToalMins() {
let total = 0;
const items = document.querySelectorAll('.item-link.udlite-custom-focus-visible')
items.forEach((item) => {
const isChecked = item.querySelector('.udlite-real-toggle-input').checked;
if (!isChecked) {
let timer = item.querySelector('.udlite-text-xs span');
if (timer) {
time = timer.innerText.replace('min', '');
total+= parseInt(time);
}
}
})
return total
}
function ConvertMins(total) {
console.log('Calculation Total DONE')
console.log("Total: " + total + "mins")
var minsToHours = 60
var minsToDays = (minsToHours * 24)
var days = parseInt(total/minsToDays)
total -= (days*minsToDays)
var hours = parseInt(total/minsToHours)
total -= (hours*minsToHours)
var mints = total
console.log(days + " day, " + hours + " hours, " + mints + " mins");
}
function getLeftTime() {
OpenSections();
var total = GetToalMins();
ConvertMins(total);
}
getLeftTime();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment