mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
alphabetically ordering subjects on menu list
This commit is contained in:
parent
73d465213c
commit
1e1a179e80
1 changed files with 13 additions and 7 deletions
|
@ -256,7 +256,7 @@
|
||||||
this.A = SUtils.SimplifyAnswer(a)
|
this.A = SUtils.SimplifyAnswer(a)
|
||||||
try {
|
try {
|
||||||
this.I = JSON.parse(i).sort((a, b) => {
|
this.I = JSON.parse(i).sort((a, b) => {
|
||||||
return a > b
|
return a.localeCompare(b)
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.I = i
|
this.I = i
|
||||||
|
@ -352,9 +352,9 @@
|
||||||
getSubjNameWithoutYear () {
|
getSubjNameWithoutYear () {
|
||||||
let t = this.Name.split(' - ')
|
let t = this.Name.split(' - ')
|
||||||
if (t[0].match(/^[0-9]{4}\/[0-9]{2}\/[0-9]{1}$/i)) {
|
if (t[0].match(/^[0-9]{4}\/[0-9]{2}\/[0-9]{1}$/i)) {
|
||||||
return t[1] || ''
|
return t[1] || this.Name
|
||||||
} else {
|
} else {
|
||||||
return ''
|
return this.Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@
|
||||||
if (logElementGetting) { Log('testing if question is grab-box') }
|
if (logElementGetting) { Log('testing if question is grab-box') }
|
||||||
let results = this.GetFormResult() // getting results element
|
let results = this.GetFormResult() // getting results element
|
||||||
let t = results[i].getElementsByClassName('dragitems')[0].childNodes
|
let t = results[i].getElementsByClassName('dragitems')[0].childNodes
|
||||||
if (t.length !== 1) { Log('grab box drag items group length is not 1!') }
|
if (t.length !== 1) { Log('grab box drag items group length is not 1!'); console.log(results[i].getElementsByClassName('dragitems')[0]) }
|
||||||
let placedItems = t[0].getElementsByClassName('placed')
|
let placedItems = t[0].getElementsByClassName('placed')
|
||||||
let res = []
|
let res = []
|
||||||
for (let i = 0; i < placedItems.length; i++) {
|
for (let i = 0; i < placedItems.length; i++) {
|
||||||
|
@ -777,7 +777,7 @@
|
||||||
// "húzza oda ..." skip
|
// "húzza oda ..." skip
|
||||||
fun.push((i) => {
|
fun.push((i) => {
|
||||||
let temp = RPM.GetAnswersFromGrabBox(i)
|
let temp = RPM.GetAnswersFromGrabBox(i)
|
||||||
console.log('GRABBOX TEST')
|
console.log('GRABBOX TEST') // TODO: remove
|
||||||
console.log(temp)
|
console.log(temp)
|
||||||
return temp.map((x) => {
|
return temp.map((x) => {
|
||||||
return x.text
|
return x.text
|
||||||
|
@ -1125,6 +1125,7 @@
|
||||||
}
|
}
|
||||||
r.AddSubject(s)
|
r.AddSubject(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
data = r
|
data = r
|
||||||
count = allCount + 1 // couse starting with -1 to show errors
|
count = allCount + 1 // couse starting with -1 to show errors
|
||||||
|
|
||||||
|
@ -1333,8 +1334,6 @@
|
||||||
function SearchSameQuestion (questionData, quiz, i) {
|
function SearchSameQuestion (questionData, quiz, i) {
|
||||||
var r = questionData.Search(quiz[i])
|
var r = questionData.Search(quiz[i])
|
||||||
|
|
||||||
console.log(quiz[i], r) // TODO: remove
|
|
||||||
|
|
||||||
let count = 0
|
let count = 0
|
||||||
r.forEach((item) => {
|
r.forEach((item) => {
|
||||||
if (item.match > minResultMatchPercent) {
|
if (item.match > minResultMatchPercent) {
|
||||||
|
@ -1941,6 +1940,13 @@
|
||||||
others: []
|
others: []
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const ordered = {}
|
||||||
|
Object.keys(grouped).sort().forEach((key) => {
|
||||||
|
ordered[key] = grouped[key]
|
||||||
|
})
|
||||||
|
|
||||||
|
grouped = ordered
|
||||||
|
|
||||||
let collapsibles = []
|
let collapsibles = []
|
||||||
|
|
||||||
Object.entries(grouped).forEach(([subjName, subjGroup]) => {
|
Object.entries(grouped).forEach(([subjName, subjGroup]) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue