Added unique ID for statistics

This commit is contained in:
MrFry 2019-10-28 14:37:11 +01:00
parent aaf93c8fad
commit 6cee318903

View file

@ -21,7 +21,7 @@
// ==UserScript==
// @name Moodle/Elearning/KMOOC test help
// @version 1.6.4.6
// @version 1.6.4.7
// @description Online Moodle/Elearning/KMOOC test help
// @author MrFry
// @match https://elearning.uni-obuda.hu/main/*
@ -55,6 +55,7 @@
var addEventListener // add event listener function
const lastChangeLog = 'Kérdés parsolás bugfixek, old school fálj beolvasás kiszedése, részletesebb hibajelentés és egyéb fixek'
const serverAdress = 'https://qmining.frylabs.net/'
// const serverAdress = 'http://localhost:8080/'
// forcing pages for testing. unless you test, do not set these to true!
// only one of these should be true for testing
@ -1363,6 +1364,7 @@
sentData.allData = quiz
sentData.data = newQuestions
sentData.version = info().script.version
sentData.id = GetId()
SendXHRMessage('datatoadd=' + JSON.stringify(sentData))
sendSuccess = true
} catch (e) {
@ -2099,6 +2101,17 @@
// : }}}
// : Generic utils {{{
function GetId () {
let currId = getVal('clientId')
if (currId) {
return currId
} else {
currId = new Date()
currId = currId.getTime() + Math.floor(Math.random() * 10000000)
setVal('clientId', currId.toString())
return currId
}
}
function CreateNodeWithText (to, text, type) {
var paragraphElement = document.createElement(type || 'p') // new paragraph