From 62de25668a2ada40fa8a2221c8f4876853517704 Mon Sep 17 00:00:00 2001 From: YourFriendlyNeighborhoodDealer Date: Tue, 24 Sep 2019 17:57:18 +0200 Subject: [PATCH] small code refactoring --- main.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/main.js b/main.js index 506dca3..546c965 100644 --- a/main.js +++ b/main.js @@ -511,7 +511,7 @@ class ResultsPageModell { var items = results[i].getElementsByTagName('label') var r = [] for (var j = 0; j < items.length; j++) { - function TryGetCorrect (j) { + const TryGetCorrect = (j) => { var cn = items[j].parentNode.className if (cn.includes('correct')) { return cn.includes('correct') && !cn.includes('incorrect') } } @@ -698,14 +698,14 @@ var MPM = new MiscPageModell() // : }}} // : Main function {{{ -function Main () { +function Main () { // eslint-disable-line 'use strict' console.time('main') Init(function (count, subjCount) { - var url = location.href + var url = location.href // eslint-disable-line - let skipLoad = GM_getValue('skipLoad') + let skipLoad = GM_getValue('skipLoad') // eslint-disable-line if (count === -2 && subjCount === -2 && skipLoad) { if (url.includes('/quiz/') && url.includes('attempt.php')) { ShowMessage({ @@ -728,7 +728,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!', isSimple: true }, undefined, function () { - GM_openInTab(serverAdress + 'lred', { + GM_openInTab(serverAdress + 'lred', { // eslint-disable-line active: true }) }) @@ -755,12 +755,12 @@ function Main () { // : Loading {{{ function Init (cwith) { - if (false) { - GM_setValue('version16', undefined) - GM_setValue('version15', undefined) - GM_setValue('firstRun', undefined) // GM_getValue("lastVerson") == undefined => firstrun - GM_setValue('showQuestions', undefined) - GM_setValue('showSplash', undefined) + if (false) { // eslint-disable-line + GM_setValue('version16', undefined) // eslint-disable-line + GM_setValue('version15', undefined) // eslint-disable-line + GM_setValue('firstRun', undefined) // eslint-disable-line + GM_setValue('showQuestions', undefined) // eslint-disable-line + GM_setValue('showSplash', undefined) // eslint-disable-line } var url = location.href // window location var count = -1 // loaded question count. stays -1 if the load failed. @@ -831,10 +831,9 @@ function Version15 () { function Version16 () { 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) { var i = 0 - while (GM_getValue('Is' + i + 'Active') != undefined) { + while (GM_getValue('Is' + i + 'Active') !== undefined) { GM_setValue('Is' + i + 'Active', false) i++ }