Removed number before kgk questions, code formatting

This commit is contained in:
mrfry 2022-02-16 19:24:46 +01:00
parent b8b4af45a5
commit 4386dc72b5

View file

@ -46,7 +46,7 @@
// : Script header {{{
// ==UserScript==
// @name Moodle/Elearning/KMOOC test help
// @version 2.1.3.2
// @version 2.1.3.3
// @description Online Moodle/Elearning/KMOOC test help
// @author MrFry
// @match https://elearning.uni-obuda.hu/*
@ -147,7 +147,7 @@
const overlayElemUpdateInterval = 2 // seconds
if (isDevel) {
log('Moodle script running in developement mode!')
warn('Moodle script running in developement mode!')
infoExpireTime = 1
serverAdress = 'http://localhost:8080/'
apiAdress = 'http://localhost:8080/'
@ -1047,8 +1047,8 @@
}
function HandleKGKResults(url) {
const tableChilds = document.getElementsByTagName('table')[0].childNodes[0]
.childNodes
const tableChilds =
document.getElementsByTagName('table')[0].childNodes[0].childNodes
const question = removeUnnecesarySpaces(
tableChilds[0].innerText.split(':')[1]
)
@ -1066,7 +1066,9 @@
location: url,
quiz: [
{
Q: question,
Q: question.includes('.')
? question.split('.').splice(1).join('.').trim()
: question,
A: answer,
data: {
type: 'simple',
@ -1077,6 +1079,7 @@
],
}
log(sentData)
post('isAdding', sentData).then((res) => {
ShowSaveQuizDialog(res.success, sentData, res.totalNewQuestions)
})
@ -2055,7 +2058,7 @@
Array.from(messageNode.childNodes).forEach((node) => {
if (node.tagName === 'A') {
let linkNode = document.createElement('span')
const linkNode = document.createElement('span')
SetStyle(linkNode, {
color: 'lightblue',
textDecoration: 'underline',
@ -2084,21 +2087,25 @@
}
let currOpacity = getVal(`${elem.id}_opacity`) || 1
elem.addEventListener('wheel', (e) => {
e.preventDefault()
const isUp = e.deltaY < 0
if (isUp) {
if (currOpacity + messageOpacityDelta <= 1) {
currOpacity = currOpacity + messageOpacityDelta
elem.addEventListener(
'wheel',
(e) => {
e.preventDefault()
const isUp = e.deltaY < 0
if (isUp) {
if (currOpacity + messageOpacityDelta <= 1) {
currOpacity = currOpacity + messageOpacityDelta
}
} else {
if (currOpacity - messageOpacityDelta > minMessageOpacity) {
currOpacity = currOpacity - messageOpacityDelta
}
}
} else {
if (currOpacity - messageOpacityDelta > minMessageOpacity) {
currOpacity = currOpacity - messageOpacityDelta
}
}
elem.style.opacity = currOpacity
setVal(`${elem.id}_opacity`, currOpacity)
})
elem.style.opacity = currOpacity
setVal(`${elem.id}_opacity`, currOpacity)
},
{ capture: true }
)
}
function addMoveEventListener(elem) {
@ -2364,11 +2371,8 @@
'.'
}
result.msgContainer.child.leftSideDiv.child.matchPercent.elem.innerText = isNaN(
getCurrMsg().p
)
? ''
: getCurrMsg().p + '%'
result.msgContainer.child.leftSideDiv.child.matchPercent.elem.innerText =
isNaN(getCurrMsg().p) ? '' : getCurrMsg().p + '%'
result.msgContainer.child.msgDiv.elem.innerText = getCurrMsg().m
} catch (e) {