New version notifications fix for new users

This commit is contained in:
YourFriendlyNeighborhoodDealer 2019-01-28 11:23:06 +01:00
parent ad378d5729
commit 4d09388045

56
main.js
View file

@ -26,12 +26,12 @@
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
const lastChangeLog = const lastChangeLog =
'- Performance javítások\n - Összes tárgy letiltása alapból, mert sok tárgy van, és belassulhat :c\n- Az azért jó, hogy sok tárgy van c:\nEllenőrizd, hogy mely tárgyak aktívak a menüben!'; '- Új domain név\n- Apró bugfixek';
const serverAdress = "https://qmining.tk/"; const serverAdress = "https://qmining.tk/";
// forcing pages for testing. unless you test, do not set these to true! // forcing pages for testing. unless you test, do not set these to true!
// only one of these should be true for testing // only one of these should be true for testing
const forceTestPage = false; const forceTestPage = false;
const forceResultPage = false; const forceResultPage = false;
const forceDefaultPage = false; const forceDefaultPage = false;
const logElementGetting = false; const logElementGetting = false;
@ -664,7 +664,18 @@ function Init(cwith) {
} }
function VersionActions() { function VersionActions() {
FreshStart();
// FOR TESTING ONLY
// GM_setValue("version15", true);
// GM_setValue("firstRun", true);
// GM_setValue("version16", true);
// GM_setValue("version161", true);
// throw "asd";
let r = FreshStart();
if (r != true)
GM_setValue("version161", false);
Version15(); Version15();
Version16(); Version16();
Version161(); Version161();
@ -676,27 +687,27 @@ function FreshStart() {
var firstRun = GM_getValue("firstRun"); // if the current run is the frst var firstRun = GM_getValue("firstRun"); // if the current run is the frst
if (firstRun == undefined || firstRun == true) // if its undefined, or true if (firstRun == undefined || firstRun == true) // if its undefined, or true
{ {
GM_setValue("firstRun", false); // setting it to false GM_setValue("firstRun", false);
ShowHelp(); // showing help ShowHelp(); // showing help
return true;
} }
} }
function Version15 () { function Version15() {
var version15 = GM_getValue("version15"); // if the current run is the frst var version15 = GM_getValue("version15"); // if the current run is the frst
if (version15 == undefined || version15 == true) // if its undefined, or true if (version15 == undefined || version15 == true) // if its undefined, or true
{ {
GM_setValue("useNetDB", "0"); GM_setValue("useNetDB", "0");
GM_setValue("version15", false); // setting it to false GM_setValue("version15", false);
GM_setValue("firstRun", true);
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! 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>'
); );
document.close(); document.close();
throw "something, so this stuff stops"; throw "something, so this stuff stops";
} }
} }
function Version16 () { function Version16() {
var version16 = GM_getValue("version16"); // if the current run is the frst var version16 = GM_getValue("version16"); // if the current run is the frst
if (version16 == undefined || version16 == true) // if its undefined, or true if (version16 == undefined || version16 == true) // if its undefined, or true
{ {
@ -705,19 +716,18 @@ function Version16 () {
GM_setValue("Is" + i + "Active", false); GM_setValue("Is" + i + "Active", false);
i++; i++;
} }
GM_setValue("version16", false); // setting it to false GM_setValue("version16", false);
} }
} }
function Version161 () { function Version161() {
var version161 = GM_getValue("version161"); // if the current run is the frst var version161 = GM_getValue("version161"); // if the current run is the frst
if (version161 == undefined || version161 == true) // if its undefined, or true if (version161 == undefined || version161 == true) // if its undefined, or true
{ {
GM_setValue("useNetDB", "0"); GM_setValue("useNetDB", "0");
GM_setValue("version161", false); // setting it to false GM_setValue("version161", false);
GM_setValue("firstRun", true);
document.write( document.write(
'<h1>Moodle teszt userscript:<h1><h3>1.6.1.0 verzió: Új domain név: qmining.tk. Ha frissíted az oldalt, akkor tampremonkey rá fog kérdezni, hpgy engedélyezed-e a kérdések külését erre az új domain-re. A rendes működés érdekében kattints a "Allow always"-gombra</h3>' '<h1>Moodle teszt userscript:<h1><h3>1.6.1.0 verzió: Új domain név: qmining.tk. Ha frissíted az oldalt, akkor tampremonkey rá fog kérdezni, hpgy engedélyezed-e a kérdések külését erre az új domain-re. A rendes működés érdekében kattints a "Allow always domain"-gombra</h3>'
); );
document.close(); document.close();
throw "something, so this stuff stops"; throw "something, so this stuff stops";
@ -1420,13 +1430,13 @@ function Log(value) {
console.log(value); console.log(value);
} }
function Exception(e, msg){ function Exception(e, msg) {
Log("------------------------------------------"); Log("------------------------------------------");
Log(msg); Log(msg);
Log(e.message); Log(e.message);
Log("------------------------------------------"); Log("------------------------------------------");
Log(e.stack); Log(e.stack);
Log("------------------------------------------"); Log("------------------------------------------");
} }
//: }}} //: }}}
@ -1780,7 +1790,9 @@ function ShowMenuList() {
var noDataRow = tbl.insertRow(); var noDataRow = tbl.insertRow();
var noDataRowCell = noDataRow.insertCell(); var noDataRowCell = noDataRow.insertCell();
var textBox = CreateNodeWithText(noDataRowCell, "A kérdéseket nem lehetett beolvasni. Vagy nem elérhető a szerver, vagy ha offline módot használsz, akkor hibás a fájl elérési útja, vagy a fájl maga. Olvasd el a manualt!"); var textBox = CreateNodeWithText(noDataRowCell,
"A kérdéseket nem lehetett beolvasni. Vagy nem elérhető a szerver, vagy ha offline módot használsz, akkor hibás a fájl elérési útja, vagy a fájl maga. Olvasd el a manualt!"
);
textBox.style.margin = fiveMargin; // fancy margin textBox.style.margin = fiveMargin; // fancy margin
} }