diff --git a/stable.user.js b/stable.user.js index 074a3ce..482d0b9 100755 --- a/stable.user.js +++ b/stable.user.js @@ -21,7 +21,7 @@ // ==UserScript== // @name Moodle/Elearning/KMOOC test help -// @version 2.0.1.17 +// @version 2.0.1.18 // @description Online Moodle/Elearning/KMOOC test help // @author MrFry // @match https://elearning.uni-obuda.hu/main/* @@ -155,6 +155,16 @@ } class StringUtils { + removeMultipleEnters(text) { + let res = text.replace(/\t/g, '') + + while (res.includes('\n\n')) { + res = res.replace('\n\n', '\n') + } + + return res + } + RemoveStuff(value, removableStrings, toReplace) { removableStrings.forEach(x => { var regex = new RegExp(x, 'g') @@ -1816,7 +1826,6 @@ left: (window.innerWidth - width) / 2 + 'px', opacity: '1', cursor: 'move', - userSelect: 'none', }) mainDiv.setAttribute('id', 'scriptMessage') // ------------------------------------------------------------------ @@ -1833,7 +1842,6 @@ isMouseDown = false }) mainDiv.addEventListener('mousemove', e => { - e.preventDefault() if (isMouseDown) { mousePosition = { x: e.clientX, @@ -1852,7 +1860,9 @@ var mesageNode = document.createElement('p') // new paragraph mesageNode.innerHTML = simpleMessageText.replace(/\n/g, '
') simpleMessageParagrapg.appendChild(mesageNode) - mesageNode.style.margin = defMargin // fancy margin + SetStyle(mesageNode, { + margin: defMargin, + }) Array.from(mesageNode.getElementsByTagName('a')).forEach(anchorElem => { anchorElem.style.color = 'lightblue' @@ -1901,6 +1911,15 @@ questionCell, 'ur question goes here, mister OwO' ) + + questionTextElement.addEventListener('mousedown', e => { + e.stopPropagation() + }) + + SetStyle(questionTextElement, { + cursor: 'auto', + }) + questionTextElement.setAttribute('id', 'questionTextElement') // BUTTON SETUP ----------------------------------------------------------------------------------------------------------- @@ -1935,7 +1954,9 @@ const SetQuestionText = () => { var relevantQuestion = GetRelevantQuestion() - questionTextElement.innerText = relevantQuestion.m + questionTextElement.innerText = SUtils.removeMultipleEnters( + relevantQuestion.m + ) if (currItem === 0 && currRelevantQuestion === 0) { numberTextBox.innerText = currRelevantQuestion + 1 + '.' } else {