Last active
May 28, 2024 07:37
-
-
Save sergkh/94e5a6489680351c5b670a8ec7fa614f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 MKR Schedule summary | |
// @author sergkh | |
// @namespace sergkh | |
// @description Tampermonkey script that shows hours summary for the MKR schedule | |
// @include *81.30.162.30/* | |
// @grant none | |
// @version 0.0.2 | |
// ==/UserScript== | |
(async () => { | |
console.log('script successfully injected') | |
const summaryDiv = (name, query) => { | |
const el = document.createElement("div") | |
el.textContent = `${name}: ${document.querySelectorAll(query).length * 2 } год` | |
return el | |
} | |
const build = () => { | |
var summary = document.getElementById('summary') | |
if (!summary) { | |
summary = document.createElement("div") | |
summary.id = 'summary' | |
summary.setAttribute('style', 'padding: 1em') | |
document.querySelector('#content').appendChild(summary) | |
} | |
summary.textContent = '' | |
summary.appendChild(summaryDiv('Лекції', '.lesson-1')) | |
summary.appendChild(summaryDiv('Практичні', '.lesson-2')) | |
summary.appendChild(summaryDiv('Заочники', '.lesson-9')) | |
summary.appendChild(summaryDiv('Екзамени', '.lesson-5')) | |
summary.appendChild(summaryDiv('Заліки', '.lesson-6')) | |
summary.appendChild(summaryDiv('Навчальна практика', '.lesson-13')) | |
} | |
setInterval(build, 500) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment