mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
ESLint error disable hack
This commit is contained in:
parent
6ad2da1ac8
commit
bd031525d0
1 changed files with 70 additions and 72 deletions
142
main.js
142
main.js
|
@ -21,19 +21,18 @@
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// REMOVE THIS, only to disable ESLINT errors
|
|
||||||
// ------------------------------------------------------------------------------
|
// GM functions, only to disable ESLINT errors
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// const GM_getValue = 0
|
const location = location
|
||||||
// const GM_info = 0
|
const a = Main
|
||||||
// const GM_setValue = 0
|
function getVal (name) { return GM_getValue(name) }
|
||||||
// const GM_xmlhttpRequest = 0
|
function setVal (name, val) { return GM_setValue(name, val) }
|
||||||
// const GM_openInTab = 0
|
function openInTab (address, options) { GM_openInTab(address, options) }
|
||||||
// const GM_getResourceText = 0
|
function getResourceText (name) { return GM_getResourceText(name) }
|
||||||
// Main()
|
function xmlhttpRequest (opts) { GM_xmlhttpRequest(opts) }
|
||||||
// const location = 0
|
function info () { return GM_info }
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
var data // all data, which is in the resource txt
|
var data // all data, which is in the resource txt
|
||||||
var addEventListener // add event listener function
|
var addEventListener // add event listener function
|
||||||
|
@ -269,7 +268,7 @@ class QuestionDB {
|
||||||
get activeIndexes () {
|
get activeIndexes () {
|
||||||
var r = []
|
var r = []
|
||||||
for (var i = 0; i < this.length; i++) {
|
for (var i = 0; i < this.length; i++) {
|
||||||
if (GM_getValue('Is' + i + 'Active')) {
|
if (getVal('Is' + i + 'Active')) {
|
||||||
r.push(i)
|
r.push(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,11 +276,11 @@ class QuestionDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
GetIfActive (ind) {
|
GetIfActive (ind) {
|
||||||
return GM_getValue('Is' + ind + 'Active')
|
return getVal('Is' + ind + 'Active')
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeActive (i, value) {
|
ChangeActive (i, value) {
|
||||||
GM_setValue('Is' + i + 'Active', !!value)
|
setVal('Is' + i + 'Active', !!value)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddQuestion (subj, q) {
|
AddQuestion (subj, q) {
|
||||||
|
@ -735,7 +734,7 @@ function Main () {
|
||||||
Init(function (count, subjCount) {
|
Init(function (count, subjCount) {
|
||||||
var url = location.href
|
var url = location.href
|
||||||
|
|
||||||
let skipLoad = GM_getValue('skipLoad')
|
let skipLoad = getVal('skipLoad')
|
||||||
if (count === -2 && subjCount === -2 && skipLoad) {
|
if (count === -2 && subjCount === -2 && skipLoad) {
|
||||||
if (url.includes('/quiz/') && url.includes('attempt.php')) {
|
if (url.includes('/quiz/') && url.includes('attempt.php')) {
|
||||||
ShowMessage({
|
ShowMessage({
|
||||||
|
@ -758,7 +757,7 @@ function Main () {
|
||||||
m: 'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!',
|
m: 'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!',
|
||||||
isSimple: true
|
isSimple: true
|
||||||
}, undefined, function () {
|
}, undefined, function () {
|
||||||
GM_openInTab(serverAdress + 'lred', {
|
openInTab(serverAdress + 'lred', {
|
||||||
active: true
|
active: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -771,7 +770,6 @@ function Main () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
console.log('Moodle Test Script run time:')
|
console.log('Moodle Test Script run time:')
|
||||||
console.timeEnd('main')
|
console.timeEnd('main')
|
||||||
|
|
||||||
|
@ -787,11 +785,11 @@ function Main () {
|
||||||
|
|
||||||
function Init (cwith) {
|
function Init (cwith) {
|
||||||
if (false) { // eslint-disable-line
|
if (false) { // eslint-disable-line
|
||||||
GM_setValue('version16', undefined)
|
setVal('version16', undefined)
|
||||||
GM_setValue('version15', undefined)
|
setVal('version15', undefined)
|
||||||
GM_setValue('firstRun', undefined)
|
setVal('firstRun', undefined)
|
||||||
GM_setValue('showQuestions', undefined)
|
setVal('showQuestions', undefined)
|
||||||
GM_setValue('showSplash', undefined)
|
setVal('showSplash', undefined)
|
||||||
}
|
}
|
||||||
var url = location.href // window location
|
var url = location.href // window location
|
||||||
var count = -1 // loaded question count. stays -1 if the load failed.
|
var count = -1 // loaded question count. stays -1 if the load failed.
|
||||||
|
@ -822,9 +820,9 @@ function Init (cwith) {
|
||||||
|
|
||||||
function VersionActions () {
|
function VersionActions () {
|
||||||
// FOR TESTING ONLY
|
// FOR TESTING ONLY
|
||||||
// GM_setValue("version15", true);
|
// setVal("version15", true);
|
||||||
// GM_setValue("firstRun", true);
|
// setVal("firstRun", true);
|
||||||
// GM_setValue("version16", true);
|
// setVal("version16", true);
|
||||||
// throw "asd";
|
// throw "asd";
|
||||||
|
|
||||||
FreshStart()
|
FreshStart()
|
||||||
|
@ -836,19 +834,19 @@ function VersionActions () {
|
||||||
// : Version action functions {{{
|
// : Version action functions {{{
|
||||||
|
|
||||||
function FreshStart () {
|
function FreshStart () {
|
||||||
var firstRun = GM_getValue('firstRun') // if the current run is the frst
|
var firstRun = getVal('firstRun') // if the current run is the frst
|
||||||
if (firstRun === undefined || firstRun === true) {
|
if (firstRun === undefined || firstRun === true) {
|
||||||
GM_setValue('firstRun', false)
|
setVal('firstRun', false)
|
||||||
ShowHelp() // showing help
|
ShowHelp() // showing help
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Version15 () {
|
function Version15 () {
|
||||||
var version15 = GM_getValue('version15') // if the current run is the frst
|
var version15 = getVal('version15') // if the current run is the frst
|
||||||
if (version15 === undefined || version15 === true) {
|
if (version15 === undefined || version15 === true) {
|
||||||
GM_setValue('useNetDB', '1')
|
setVal('useNetDB', '1')
|
||||||
GM_setValue('version15', false)
|
setVal('version15', false)
|
||||||
document.write(
|
document.write(
|
||||||
'<h1>Moodle teszt userscript:<h1><h3>1.5.0 verzió: a script mostantól XMLHTTP kéréseket küld szerver fele! Erre a userscript futtató kiegészitőd is figyelmeztetni fog! Ha ez történik, a script rendes működése érdekében engedélyezd (Always allow domain)! Ha nem akarod, hogy ez történjen, akkor ne engedélyezd, vagy a menüben válaszd ki a "helyi fájl használata" opciót!</h3> <h3>Elküldött adatok: minden teszt után a kérdés-válasz páros. Fogadott adatok: Az összes eddig ismert kérdés. Érdemes help-et elolvasni!!!</h3><h5>Ez az ablak frissités után eltűnik. Ha nem, akkor a visza gombbal próbálkozz.</h5>'
|
'<h1>Moodle teszt userscript:<h1><h3>1.5.0 verzió: a script mostantól XMLHTTP kéréseket küld szerver fele! Erre a userscript futtató kiegészitőd is figyelmeztetni fog! Ha ez történik, a script rendes működése érdekében engedélyezd (Always allow domain)! Ha nem akarod, hogy ez történjen, akkor ne engedélyezd, vagy a menüben válaszd ki a "helyi fájl használata" opciót!</h3> <h3>Elküldött adatok: minden teszt után a kérdés-válasz páros. Fogadott adatok: Az összes eddig ismert kérdés. Érdemes help-et elolvasni!!!</h3><h5>Ez az ablak frissités után eltűnik. Ha nem, akkor a visza gombbal próbálkozz.</h5>'
|
||||||
)
|
)
|
||||||
|
@ -858,21 +856,21 @@ function Version15 () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Version16 () {
|
function Version16 () {
|
||||||
var version16 = GM_getValue('version16') // if the current run is the frst
|
var version16 = getVal('version16') // if the current run is the frst
|
||||||
if (version16 === undefined || version16 === true) {
|
if (version16 === undefined || version16 === true) {
|
||||||
var i = 0
|
var i = 0
|
||||||
while (GM_getValue('Is' + i + 'Active') !== undefined) {
|
while (getVal('Is' + i + 'Active') !== undefined) {
|
||||||
GM_setValue('Is' + i + 'Active', false)
|
setVal('Is' + i + 'Active', false)
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
GM_setValue('version16', false)
|
setVal('version16', false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// : }}}
|
// : }}}
|
||||||
|
|
||||||
var GetFileData = () => {
|
var GetFileData = () => {
|
||||||
return GM_getResourceText('data')
|
return getResourceText('data')
|
||||||
}
|
}
|
||||||
|
|
||||||
function ReadFile (cwith) {
|
function ReadFile (cwith) {
|
||||||
|
@ -898,7 +896,7 @@ function ReadFile (cwith) {
|
||||||
function ReadNetDB (cwith, useNetDB) {
|
function ReadNetDB (cwith, useNetDB) {
|
||||||
function NewXMLHttpRequest () {
|
function NewXMLHttpRequest () {
|
||||||
const url = serverAdress + 'data.json'
|
const url = serverAdress + 'data.json'
|
||||||
GM_xmlhttpRequest({
|
xmlhttpRequest({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
synchronous: true,
|
synchronous: true,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -1016,8 +1014,8 @@ function ParseRawData (data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Load (cwith) {
|
function Load (cwith) {
|
||||||
var useNetDB = GM_getValue('useNetDB')
|
var useNetDB = getVal('useNetDB')
|
||||||
let skipLoad = GM_getValue('skipLoad')
|
let skipLoad = getVal('skipLoad')
|
||||||
|
|
||||||
if (skipLoad) {
|
if (skipLoad) {
|
||||||
cwith(-2, -2)
|
cwith(-2, -2)
|
||||||
|
@ -1076,7 +1074,7 @@ function NLoad (resource, cwith) {
|
||||||
|
|
||||||
for (let i = 0; i < d.Subjects.length; i++) {
|
for (let i = 0; i < d.Subjects.length; i++) {
|
||||||
let s = new Subject(d.Subjects[i].Name)
|
let s = new Subject(d.Subjects[i].Name)
|
||||||
if (GM_getValue('Is' + i + 'Active')) {
|
if (getVal('Is' + i + 'Active')) {
|
||||||
var j = 0
|
var j = 0
|
||||||
for (j = 0; j < d.Subjects[i].Questions.length; j++) {
|
for (j = 0; j < d.Subjects[i].Questions.length; j++) {
|
||||||
var currQ = d.Subjects[i].Questions[j]
|
var currQ = d.Subjects[i].Questions[j]
|
||||||
|
@ -1095,7 +1093,7 @@ function NLoad (resource, cwith) {
|
||||||
count = allCount + 1 // couse starting with -1 to show errors
|
count = allCount + 1 // couse starting with -1 to show errors
|
||||||
|
|
||||||
let i = 0
|
let i = 0
|
||||||
while (i < data.length && !GM_getValue('Is' + i + 'Active')) {
|
while (i < data.length && !getVal('Is' + i + 'Active')) {
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -1121,7 +1119,7 @@ function HandleUI (url, count, subjCount) {
|
||||||
var loaded = count !== -1 // if script could load stuff
|
var loaded = count !== -1 // if script could load stuff
|
||||||
|
|
||||||
try {
|
try {
|
||||||
newVersion = GM_info.script.version !== GM_getValue('lastVerson')
|
newVersion = info().script.version !== getVal('lastVerson')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Log('Some weird error trying to set new verison')
|
Log('Some weird error trying to set new verison')
|
||||||
}
|
}
|
||||||
|
@ -1131,13 +1129,13 @@ function HandleUI (url, count, subjCount) {
|
||||||
if (!newVersion && !loaded) { // --------------------------------------------------------------------------------------------------------------
|
if (!newVersion && !loaded) { // --------------------------------------------------------------------------------------------------------------
|
||||||
greetMsg = 'Hiba a @resource tagnál, vagy a fileval van gond! (Lehet át lett helyezve, vagy üres, vagy nincs tárgy kiválasztva) Vagy válaszd a netes adatok használatát menüben. Ellenőrizd az elérési utat, vagy hogy a Tampermonkey bővítmény eléri-e a fájlokat. Ha netes forrást használsz, akkor nem elérhető a szerver! Segítségért kattints!'
|
greetMsg = 'Hiba a @resource tagnál, vagy a fileval van gond! (Lehet át lett helyezve, vagy üres, vagy nincs tárgy kiválasztva) Vagy válaszd a netes adatok használatát menüben. Ellenőrizd az elérési utat, vagy hogy a Tampermonkey bővítmény eléri-e a fájlokat. Ha netes forrást használsz, akkor nem elérhető a szerver! Segítségért kattints!'
|
||||||
}
|
}
|
||||||
var showSplash = (GM_getValue('showSplash') === undefined) || GM_getValue('showSplash') // getting value, if splash screen should be shown. Its true, if its undefined, or true
|
var showSplash = (getVal('showSplash') === undefined) || getVal('showSplash') // getting value, if splash screen should be shown. Its true, if its undefined, or true
|
||||||
// no new version, everything loaded, and show splash is enabled. otherwise something happened, so showing it
|
// no new version, everything loaded, and show splash is enabled. otherwise something happened, so showing it
|
||||||
if (!newVersion && loaded && showSplash) { // ------------------------------------------------------------------------------------------------
|
if (!newVersion && loaded && showSplash) { // ------------------------------------------------------------------------------------------------
|
||||||
timeout = 5
|
timeout = 5
|
||||||
greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + GM_info.script.version + '. '
|
greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. '
|
||||||
|
|
||||||
if (lastestVersion !== undefined && GM_info.script.version !== lastestVersion) {
|
if (lastestVersion !== undefined && info().script.version !== lastestVersion) {
|
||||||
greetMsg += 'Új verzió elérhető: ' + lastestVersion + '\n'
|
greetMsg += 'Új verzió elérhető: ' + lastestVersion + '\n'
|
||||||
timeout = undefined
|
timeout = undefined
|
||||||
}
|
}
|
||||||
|
@ -1162,24 +1160,24 @@ function HandleUI (url, count, subjCount) {
|
||||||
}
|
}
|
||||||
// new version, nothing loaded
|
// new version, nothing loaded
|
||||||
if (newVersion && !loaded) { // --------------------------------------------------------------------------------------------------------------
|
if (newVersion && !loaded) { // --------------------------------------------------------------------------------------------------------------
|
||||||
greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + GM_info.script.version + '. Új verzió!\n Írd át a @resouce tagnál az elírési utat! Kivéve ha üres a file, akkor töltsd fel :) Nincs kérdés betöltve! Segítséghez kattints. Changelog:\n' + lastChangeLog // showing changelog too
|
greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. Új verzió!\n Írd át a @resouce tagnál az elírési utat! Kivéve ha üres a file, akkor töltsd fel :) Nincs kérdés betöltve! Segítséghez kattints. Changelog:\n' + lastChangeLog // showing changelog too
|
||||||
}
|
}
|
||||||
// new version, everything loaded -> set lastVerson to current
|
// new version, everything loaded -> set lastVerson to current
|
||||||
if (newVersion && loaded) { // --------------------------------------------------------------------------------------------------------------
|
if (newVersion && loaded) { // --------------------------------------------------------------------------------------------------------------
|
||||||
greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + GM_info.script.version + '. ' + count + ' kérdés és ' + subjCount + ' tárgy betöltve. Verzió frissítve ' + GM_info.script.version + '-re. Changelog:\n' + lastChangeLog
|
greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. ' + count + ' kérdés és ' + subjCount + ' tárgy betöltve. Verzió frissítve ' + info().script.version + '-re. Changelog:\n' + lastChangeLog
|
||||||
GM_setValue('lastVerson', GM_info.script.version) // setting lastVersion
|
setVal('lastVerson', info().script.version) // setting lastVersion
|
||||||
}
|
}
|
||||||
if (!SUtils.EmptyOrWhiteSpace(motd)) {
|
if (!SUtils.EmptyOrWhiteSpace(motd)) {
|
||||||
var prevmotd = GM_getValue('motd')
|
var prevmotd = getVal('motd')
|
||||||
if (prevmotd !== motd) {
|
if (prevmotd !== motd) {
|
||||||
greetMsg += '\nMOTD:\n' + motd
|
greetMsg += '\nMOTD:\n' + motd
|
||||||
timeout = null
|
timeout = null
|
||||||
GM_setValue('motdcount', motdShowCount)
|
setVal('motdcount', motdShowCount)
|
||||||
GM_setValue('motd', motd)
|
setVal('motd', motd)
|
||||||
} else {
|
} else {
|
||||||
var motdcount = GM_getValue('motdcount')
|
var motdcount = getVal('motdcount')
|
||||||
if (motdcount === undefined) {
|
if (motdcount === undefined) {
|
||||||
GM_setValue('motdcount', motdShowCount)
|
setVal('motdcount', motdShowCount)
|
||||||
motdcount = motdShowCount
|
motdcount = motdShowCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1187,7 +1185,7 @@ function HandleUI (url, count, subjCount) {
|
||||||
if (motdcount > 0) {
|
if (motdcount > 0) {
|
||||||
greetMsg += '\nMOTD:\n' + motd
|
greetMsg += '\nMOTD:\n' + motd
|
||||||
timeout = null
|
timeout = null
|
||||||
GM_setValue('motdcount', motdcount)
|
setVal('motdcount', motdcount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1224,7 +1222,7 @@ function PrepareAnswers (result, j) {
|
||||||
var allMessages = [] // preparing all messages
|
var allMessages = [] // preparing all messages
|
||||||
for (var k = 0; k < result.length; k++) {
|
for (var k = 0; k < result.length; k++) {
|
||||||
var msg = '' // the current message
|
var msg = '' // the current message
|
||||||
if ((GM_getValue('showQuestions') === undefined) || GM_getValue('showQuestions')) {
|
if ((getVal('showQuestions') === undefined) || getVal('showQuestions')) {
|
||||||
msg += result[k].q.Q + '\n' // adding the question if yes
|
msg += result[k].q.Q + '\n' // adding the question if yes
|
||||||
}
|
}
|
||||||
msg += result[k].q.A.replace(/, /g, '\n') // adding answer
|
msg += result[k].q.A.replace(/, /g, '\n') // adding answer
|
||||||
|
@ -1250,7 +1248,7 @@ function ShowAnswers (answers) {
|
||||||
m: 'Nincs találat :( Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez! Előfordulhat, hogy a tárgyat nem válsztottad ki a menüben.',
|
m: 'Nincs találat :( Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez! Előfordulhat, hogy a tárgyat nem válsztottad ki a menüben.',
|
||||||
isSimple: true
|
isSimple: true
|
||||||
}, undefined, function () {
|
}, undefined, function () {
|
||||||
GM_openInTab(serverAdress + 'lred', {
|
openInTab(serverAdress + 'lred', {
|
||||||
active: true
|
active: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1272,7 +1270,7 @@ function ShowSaveQuizDialog (addedQ, allQ, allOutput, output, sendSuccess, sentD
|
||||||
if (addedQ > 0) {
|
if (addedQ > 0) {
|
||||||
msg = 'Klikk ide a nyers adatokhoz. ' + addedQ + ' új kérdés!'
|
msg = 'Klikk ide a nyers adatokhoz. ' + addedQ + ' új kérdés!'
|
||||||
|
|
||||||
var useNetDB = GM_getValue('useNetDB')
|
var useNetDB = getVal('useNetDB')
|
||||||
if (useNetDB !== undefined && useNetDB === 1) {
|
if (useNetDB !== undefined && useNetDB === 1) {
|
||||||
if (!sendSuccess) { msg += ' Nem sikerült kérdéseket elküldeni szervernek. Ha gondolod utánanézhetsz.' } else { msg += 'Az új kérdések elküldve.' }
|
if (!sendSuccess) { msg += ' Nem sikerült kérdéseket elküldeni szervernek. Ha gondolod utánanézhetsz.' } else { msg += 'Az új kérdések elküldve.' }
|
||||||
} else { msg += 'Ne felejtsd el bemásolni a fő txt-be!' }
|
} else { msg += 'Ne felejtsd el bemásolni a fő txt-be!' }
|
||||||
|
@ -1288,7 +1286,7 @@ function ShowSaveQuizDialog (addedQ, allQ, allOutput, output, sendSuccess, sentD
|
||||||
var towrite = '<h3>' + sentData.subj + '<br>TXT-ben nem szereplő kérdések: ' + addedQ + '/' + allQ + '</h3><br>' + output.replace(/\n/g, '<br>') + '<br><h3>Összes kérdés/válasz:</h3>' + allOutput.replace(
|
var towrite = '<h3>' + sentData.subj + '<br>TXT-ben nem szereplő kérdések: ' + addedQ + '/' + allQ + '</h3><br>' + output.replace(/\n/g, '<br>') + '<br><h3>Összes kérdés/válasz:</h3>' + allOutput.replace(
|
||||||
/\n/g, '<br>')
|
/\n/g, '<br>')
|
||||||
|
|
||||||
var useNetDB = GM_getValue('useNetDB')
|
var useNetDB = getVal('useNetDB')
|
||||||
if (useNetDB !== undefined && useNetDB === 1) {
|
if (useNetDB !== undefined && useNetDB === 1) {
|
||||||
try {
|
try {
|
||||||
towrite += '</p>Elküldött adatok:</p> ' + JSON.stringify(sentData)
|
towrite += '</p>Elküldött adatok:</p> ' + JSON.stringify(sentData)
|
||||||
|
@ -1374,11 +1372,11 @@ function SaveQuiz (quiz, questionData) {
|
||||||
sentData.subj = 'NOSUBJ'
|
sentData.subj = 'NOSUBJ'
|
||||||
Log('unable to get subject name :c')
|
Log('unable to get subject name :c')
|
||||||
}
|
}
|
||||||
var useNetDB = GM_getValue('useNetDB')
|
var useNetDB = getVal('useNetDB')
|
||||||
if (useNetDB !== undefined && useNetDB === 1) {
|
if (useNetDB !== undefined && useNetDB === 1) {
|
||||||
sentData.allData = quiz
|
sentData.allData = quiz
|
||||||
sentData.data = newQuestions
|
sentData.data = newQuestions
|
||||||
sentData.version = GM_info.script.version
|
sentData.version = info().script.version
|
||||||
SendXHRMessage('datatoadd=' + JSON.stringify(sentData))
|
SendXHRMessage('datatoadd=' + JSON.stringify(sentData))
|
||||||
sendSuccess = true
|
sendSuccess = true
|
||||||
}
|
}
|
||||||
|
@ -1819,7 +1817,7 @@ function ShowMenu () {
|
||||||
// passive mode stuff
|
// passive mode stuff
|
||||||
var questionsTickBox = document.createElement('input')
|
var questionsTickBox = document.createElement('input')
|
||||||
questionsTickBox.type = 'checkbox'
|
questionsTickBox.type = 'checkbox'
|
||||||
questionsTickBox.checked = GM_getValue('skipLoad')
|
questionsTickBox.checked = getVal('skipLoad')
|
||||||
questionsTickBox.style.position = ''
|
questionsTickBox.style.position = ''
|
||||||
questionsTickBox.style.left = 10 + 'px'
|
questionsTickBox.style.left = 10 + 'px'
|
||||||
questionsTickBox.style.margin = '5px 5px 5px 5px' // fancy margin
|
questionsTickBox.style.margin = '5px 5px 5px 5px' // fancy margin
|
||||||
|
@ -1828,9 +1826,9 @@ function ShowMenu () {
|
||||||
menuButtonDiv.appendChild(questionsTickBox) // adding to main div
|
menuButtonDiv.appendChild(questionsTickBox) // adding to main div
|
||||||
|
|
||||||
questionsTickBox.addEventListener('click', function () {
|
questionsTickBox.addEventListener('click', function () {
|
||||||
GM_setValue('skipLoad', questionsTickBox.checked)
|
setVal('skipLoad', questionsTickBox.checked)
|
||||||
var msg = ''
|
var msg = ''
|
||||||
if (GM_getValue('skipLoad')) { msg = 'Passzív mód bekapcsolva, mostantól kérdések nem lesznek betöltve/lekérve.' } else { msg = 'Passzív mód kikapcsolva, frissíts az érvénybe lépéshez!' }
|
if (getVal('skipLoad')) { msg = 'Passzív mód bekapcsolva, mostantól kérdések nem lesznek betöltve/lekérve.' } else { msg = 'Passzív mód kikapcsolva, frissíts az érvénybe lépéshez!' }
|
||||||
|
|
||||||
ShowMessage({
|
ShowMessage({
|
||||||
m: msg,
|
m: msg,
|
||||||
|
@ -1943,7 +1941,7 @@ function ShowMenuList () {
|
||||||
var noDataRow = tbl.insertRow()
|
var noDataRow = tbl.insertRow()
|
||||||
var noDataRowCell = noDataRow.insertCell()
|
var noDataRowCell = noDataRow.insertCell()
|
||||||
|
|
||||||
if (GM_getValue('skipLoad')) {
|
if (getVal('skipLoad')) {
|
||||||
textBox = CreateNodeWithText(noDataRowCell,
|
textBox = CreateNodeWithText(noDataRowCell,
|
||||||
'Passszív mód bekapcsolva. Kapcsold ki a kérdések betöltéséhez!'
|
'Passszív mód bekapcsolva. Kapcsold ki a kérdések betöltéséhez!'
|
||||||
)
|
)
|
||||||
|
@ -1961,7 +1959,7 @@ function ShowMenuList () {
|
||||||
|
|
||||||
var splashTickBox = document.createElement('input')
|
var splashTickBox = document.createElement('input')
|
||||||
splashTickBox.type = 'checkbox'
|
splashTickBox.type = 'checkbox'
|
||||||
splashTickBox.checked = GM_getValue('showSplash') || false
|
splashTickBox.checked = getVal('showSplash') || false
|
||||||
splashTickBox.style.position = ''
|
splashTickBox.style.position = ''
|
||||||
// splashTickBox.style.background = "white";
|
// splashTickBox.style.background = "white";
|
||||||
splashTickBox.style.left = 10 + 'px'
|
splashTickBox.style.left = 10 + 'px'
|
||||||
|
@ -1970,7 +1968,7 @@ function ShowMenuList () {
|
||||||
splashTickboxCell.appendChild(splashTickBox) // adding to main div
|
splashTickboxCell.appendChild(splashTickBox) // adding to main div
|
||||||
|
|
||||||
splashTickBox.addEventListener('click', function () {
|
splashTickBox.addEventListener('click', function () {
|
||||||
GM_setValue('showSplash', splashTickBox.checked)
|
setVal('showSplash', splashTickBox.checked)
|
||||||
}) // adding clicktextNode
|
}) // adding clicktextNode
|
||||||
|
|
||||||
CreateNodeWithText(splashTickboxCell, 'Üdvözlő üzenet mutatása minden oldalon', 'span')
|
CreateNodeWithText(splashTickboxCell, 'Üdvözlő üzenet mutatása minden oldalon', 'span')
|
||||||
|
@ -1981,7 +1979,7 @@ function ShowMenuList () {
|
||||||
|
|
||||||
var questionsTickBox = document.createElement('input')
|
var questionsTickBox = document.createElement('input')
|
||||||
questionsTickBox.type = 'checkbox'
|
questionsTickBox.type = 'checkbox'
|
||||||
questionsTickBox.checked = GM_getValue('showQuestions')
|
questionsTickBox.checked = getVal('showQuestions')
|
||||||
questionsTickBox.style.position = ''
|
questionsTickBox.style.position = ''
|
||||||
// questionsTickBox.style.background = "white";
|
// questionsTickBox.style.background = "white";
|
||||||
questionsTickBox.style.left = 10 + 'px'
|
questionsTickBox.style.left = 10 + 'px'
|
||||||
|
@ -1990,7 +1988,7 @@ function ShowMenuList () {
|
||||||
questionTickboxCell.appendChild(questionsTickBox) // adding to main div
|
questionTickboxCell.appendChild(questionsTickBox) // adding to main div
|
||||||
|
|
||||||
questionsTickBox.addEventListener('click', function () {
|
questionsTickBox.addEventListener('click', function () {
|
||||||
GM_setValue('showQuestions', questionsTickBox.checked)
|
setVal('showQuestions', questionsTickBox.checked)
|
||||||
if (!questionsTickBox.checked) {
|
if (!questionsTickBox.checked) {
|
||||||
ShowMessage({
|
ShowMessage({
|
||||||
m: 'Szinte mindég jó az talált válasz a kérdésre, de attól még könnyen előfordulhat, hogy rosz kérdésre írja ki a választ! Ez a opció nélkül ezt az ellenőrzési lehetőséget nem tudod kihasználni',
|
m: 'Szinte mindég jó az talált válasz a kérdésre, de attól még könnyen előfordulhat, hogy rosz kérdésre írja ki a választ! Ez a opció nélkül ezt az ellenőrzési lehetőséget nem tudod kihasználni',
|
||||||
|
@ -2007,7 +2005,7 @@ function ShowMenuList () {
|
||||||
|
|
||||||
var databasemodeListbox = document.createElement('select')
|
var databasemodeListbox = document.createElement('select')
|
||||||
databasemodeListbox.type = 'checkbox'
|
databasemodeListbox.type = 'checkbox'
|
||||||
// databasemodeListbox.checked = GM_getValue("showSplash") || false;
|
// databasemodeListbox.checked = getVal("showSplash") || false;
|
||||||
databasemodeListbox.style.position = ''
|
databasemodeListbox.style.position = ''
|
||||||
// databasemodeListbox.style.background = "white";
|
// databasemodeListbox.style.background = "white";
|
||||||
databasemodeListbox.style.left = 10 + 'px'
|
databasemodeListbox.style.left = 10 + 'px'
|
||||||
|
@ -2022,7 +2020,7 @@ function ShowMenuList () {
|
||||||
|
|
||||||
databasemodeListbox.addEventListener('change', function (e) {
|
databasemodeListbox.addEventListener('change', function (e) {
|
||||||
// sorry for using selectedindex :c
|
// sorry for using selectedindex :c
|
||||||
GM_setValue('useNetDB', databasemodeListbox.selectedIndex)
|
setVal('useNetDB', databasemodeListbox.selectedIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
var uselocal = document.createElement('option')
|
var uselocal = document.createElement('option')
|
||||||
|
@ -2035,7 +2033,7 @@ function ShowMenuList () {
|
||||||
usenetsafe.value = 0
|
usenetsafe.value = 0
|
||||||
databasemodeListbox.add(usenetsafe, 1)
|
databasemodeListbox.add(usenetsafe, 1)
|
||||||
|
|
||||||
var selected = GM_getValue('useNetDB')
|
var selected = getVal('useNetDB')
|
||||||
if (selected !== undefined) { databasemodeListbox.selectedIndex = selected }
|
if (selected !== undefined) { databasemodeListbox.selectedIndex = selected }
|
||||||
|
|
||||||
var databasemodeListboxElement = document.createElement('span') // new paragraph
|
var databasemodeListboxElement = document.createElement('span') // new paragraph
|
||||||
|
@ -2118,7 +2116,7 @@ function CreateNodeWithText (to, text, type) {
|
||||||
|
|
||||||
function SendXHRMessage (message) {
|
function SendXHRMessage (message) {
|
||||||
var url = serverAdress + 'isAdding'
|
var url = serverAdress + 'isAdding'
|
||||||
GM_xmlhttpRequest({
|
xmlhttpRequest({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: url,
|
url: url,
|
||||||
data: message,
|
data: message,
|
||||||
|
@ -2141,7 +2139,7 @@ var assert = (val) => {
|
||||||
|
|
||||||
// shows some neat help
|
// shows some neat help
|
||||||
function ShowHelp () {
|
function ShowHelp () {
|
||||||
GM_openInTab(serverAdress + 'manual', {
|
openInTab(serverAdress + 'manual', {
|
||||||
active: true
|
active: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue