diff --git a/devel/testWrapper.js b/devel/testWrapper.js index 8c6b319..016f6cd 100644 --- a/devel/testWrapper.js +++ b/devel/testWrapper.js @@ -25,6 +25,8 @@ // @author Yout // @match https://elearning.uni-obuda.hu/main/* // @match https://elearning.uni-obuda.hu/kmooc/* +// @match https://qmining.frylabs.net/* +// @match http://qmining.frylabs.net/* // @match file:///* // @grant GM_getResourceText // @grant GM_info diff --git a/stable.user.js b/stable.user.js index 2221e57..a78de20 100755 --- a/stable.user.js +++ b/stable.user.js @@ -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 // --------------------------------------------------------------------------------------