mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Removed number before kgk questions, code formatting
This commit is contained in:
parent
b8b4af45a5
commit
4386dc72b5
1 changed files with 29 additions and 25 deletions
|
@ -46,7 +46,7 @@
|
||||||
// : Script header {{{
|
// : Script header {{{
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 2.1.3.2
|
// @version 2.1.3.3
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author MrFry
|
// @author MrFry
|
||||||
// @match https://elearning.uni-obuda.hu/*
|
// @match https://elearning.uni-obuda.hu/*
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
const overlayElemUpdateInterval = 2 // seconds
|
const overlayElemUpdateInterval = 2 // seconds
|
||||||
|
|
||||||
if (isDevel) {
|
if (isDevel) {
|
||||||
log('Moodle script running in developement mode!')
|
warn('Moodle script running in developement mode!')
|
||||||
infoExpireTime = 1
|
infoExpireTime = 1
|
||||||
serverAdress = 'http://localhost:8080/'
|
serverAdress = 'http://localhost:8080/'
|
||||||
apiAdress = 'http://localhost:8080/'
|
apiAdress = 'http://localhost:8080/'
|
||||||
|
@ -1047,8 +1047,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleKGKResults(url) {
|
function HandleKGKResults(url) {
|
||||||
const tableChilds = document.getElementsByTagName('table')[0].childNodes[0]
|
const tableChilds =
|
||||||
.childNodes
|
document.getElementsByTagName('table')[0].childNodes[0].childNodes
|
||||||
const question = removeUnnecesarySpaces(
|
const question = removeUnnecesarySpaces(
|
||||||
tableChilds[0].innerText.split(':')[1]
|
tableChilds[0].innerText.split(':')[1]
|
||||||
)
|
)
|
||||||
|
@ -1066,7 +1066,9 @@
|
||||||
location: url,
|
location: url,
|
||||||
quiz: [
|
quiz: [
|
||||||
{
|
{
|
||||||
Q: question,
|
Q: question.includes('.')
|
||||||
|
? question.split('.').splice(1).join('.').trim()
|
||||||
|
: question,
|
||||||
A: answer,
|
A: answer,
|
||||||
data: {
|
data: {
|
||||||
type: 'simple',
|
type: 'simple',
|
||||||
|
@ -1077,6 +1079,7 @@
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log(sentData)
|
||||||
post('isAdding', sentData).then((res) => {
|
post('isAdding', sentData).then((res) => {
|
||||||
ShowSaveQuizDialog(res.success, sentData, res.totalNewQuestions)
|
ShowSaveQuizDialog(res.success, sentData, res.totalNewQuestions)
|
||||||
})
|
})
|
||||||
|
@ -2055,7 +2058,7 @@
|
||||||
|
|
||||||
Array.from(messageNode.childNodes).forEach((node) => {
|
Array.from(messageNode.childNodes).forEach((node) => {
|
||||||
if (node.tagName === 'A') {
|
if (node.tagName === 'A') {
|
||||||
let linkNode = document.createElement('span')
|
const linkNode = document.createElement('span')
|
||||||
SetStyle(linkNode, {
|
SetStyle(linkNode, {
|
||||||
color: 'lightblue',
|
color: 'lightblue',
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
|
@ -2084,7 +2087,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let currOpacity = getVal(`${elem.id}_opacity`) || 1
|
let currOpacity = getVal(`${elem.id}_opacity`) || 1
|
||||||
elem.addEventListener('wheel', (e) => {
|
elem.addEventListener(
|
||||||
|
'wheel',
|
||||||
|
(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const isUp = e.deltaY < 0
|
const isUp = e.deltaY < 0
|
||||||
if (isUp) {
|
if (isUp) {
|
||||||
|
@ -2098,7 +2103,9 @@
|
||||||
}
|
}
|
||||||
elem.style.opacity = currOpacity
|
elem.style.opacity = currOpacity
|
||||||
setVal(`${elem.id}_opacity`, currOpacity)
|
setVal(`${elem.id}_opacity`, currOpacity)
|
||||||
})
|
},
|
||||||
|
{ capture: true }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMoveEventListener(elem) {
|
function addMoveEventListener(elem) {
|
||||||
|
@ -2364,11 +2371,8 @@
|
||||||
'.'
|
'.'
|
||||||
}
|
}
|
||||||
|
|
||||||
result.msgContainer.child.leftSideDiv.child.matchPercent.elem.innerText = isNaN(
|
result.msgContainer.child.leftSideDiv.child.matchPercent.elem.innerText =
|
||||||
getCurrMsg().p
|
isNaN(getCurrMsg().p) ? '' : getCurrMsg().p + '%'
|
||||||
)
|
|
||||||
? ''
|
|
||||||
: getCurrMsg().p + '%'
|
|
||||||
|
|
||||||
result.msgContainer.child.msgDiv.elem.innerText = getCurrMsg().m
|
result.msgContainer.child.msgDiv.elem.innerText = getCurrMsg().m
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue