mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Adding cid on qmining site to better find user errors by cid
This commit is contained in:
parent
ac127afb99
commit
2f9446157b
2 changed files with 43 additions and 2 deletions
|
@ -27,6 +27,8 @@
|
|||
// @match https://elearning.uni-obuda.hu/main/*
|
||||
// @match https://elearning.uni-obuda.hu/kmooc/*
|
||||
// @match https://mooc.unideb.hu/*
|
||||
// @match https://qmining.frylabs.net/*
|
||||
// @match http://qmining.frylabs.net/*
|
||||
// @grant GM_getResourceText
|
||||
// @grant GM_info
|
||||
// @grant GM_getValue
|
||||
|
@ -610,7 +612,7 @@
|
|||
}
|
||||
|
||||
function AfterLoad () {
|
||||
var url = location.href // eslint-disable-line
|
||||
const url = location.href // eslint-disable-line
|
||||
|
||||
try {
|
||||
if ((url.includes('/quiz/') && url.includes('attempt.php')) || forceTestPage) { // if the current page is a test
|
||||
|
@ -651,8 +653,46 @@
|
|||
// : Main logic stuff {{{
|
||||
|
||||
// : Loading {{{
|
||||
function HandleQminingSite (url) {
|
||||
try {
|
||||
Array.from(document.getElementById('sideBarLinks').childNodes).forEach((link) => {
|
||||
link.addEventListener('mousedown', () => {
|
||||
FillFeedbackCID(url, link)
|
||||
})
|
||||
})
|
||||
|
||||
FillFeedbackCID(url,
|
||||
document.getElementById('sideBarLinks').getElementsByClassName('active')[0]
|
||||
)
|
||||
} catch (e) {
|
||||
console.info('Error filling client ID input', e)
|
||||
}
|
||||
}
|
||||
|
||||
function FillFeedbackCID (url, link) {
|
||||
try {
|
||||
if (link.id === 'feedback') {
|
||||
const cidSetInterval = setInterval(() => {
|
||||
const cid = document.getElementById('cid')
|
||||
if (cid) {
|
||||
cid.value = GetId()
|
||||
window.clearInterval(cidSetInterval)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
} catch (e) {
|
||||
console.info('Error filling client ID input', e)
|
||||
}
|
||||
}
|
||||
|
||||
function Init () {
|
||||
const url = location.href // eslint-disable-line
|
||||
|
||||
if (url.includes(serverAdress.split('/')[2])) {
|
||||
HandleQminingSite(url)
|
||||
return
|
||||
}
|
||||
|
||||
if (false) { // eslint-disable-line
|
||||
setVal('version16', undefined)
|
||||
setVal('version15', undefined)
|
||||
|
@ -660,7 +700,6 @@
|
|||
setVal('showQuestions', undefined)
|
||||
setVal('showSplash', undefined)
|
||||
}
|
||||
var url = location.href // eslint-disable-line
|
||||
// --------------------------------------------------------------------------------------
|
||||
// event listener fuckery
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue