From 9923055c7ec2e0c8974ef5caf1faaf9e647941ea Mon Sep 17 00:00:00 2001 From: MrFry Date: Fri, 17 Jan 2020 10:54:37 +0100 Subject: [PATCH] Popup menu cleaning, minor text refactors, donate button --- stable.user.js | 87 +++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/stable.user.js b/stable.user.js index 266ce30..7cc69fb 100644 --- a/stable.user.js +++ b/stable.user.js @@ -58,7 +58,7 @@ var data // all data, which is in the resource txt var addEventListener // add event listener function - const lastChangeLog = '- "Húzza a megfelelő helyre ..." kérdés lekezelése\n- Kód refactor\n- Ha valami elszállt: feedback pls' + const lastChangeLog = '- "Húzza a megfelelő helyre ..." kérdés lekezelése\n- Kód refactor\n- Ha valami elszállt: feedback pls' const serverAdress = 'https://qmining.frylabs.net/' // const serverAdress = 'http://localhost:8080/' @@ -1193,6 +1193,7 @@ } catch (e) { Log('Some weird error trying to set new verison') } + newVersion = true // TODO var greetMsg = '' // message to show at the end var timeout = null // the timeout. if null, it wont be hidden // no new version, nothing loaded @@ -1919,7 +1920,11 @@ questionsTickBox.addEventListener('click', function () { setVal('skipLoad', questionsTickBox.checked) var msg = '' - 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!' } + if (getVal('skipLoad')) { + msg = 'Passzív mód bekapcsolva, mostantól kérdések nem lesznek szervertől letöltve.' + } else { + msg = 'Passzív mód kikapcsolva, frissíts az érvénybe lépéshez!' + } ShowMessage({ m: msg, @@ -2019,7 +2024,7 @@ content.style.backgroundColor = '#222d32' content.style.borderColor = '#212127' content.style.borderStyle = 'solid' - content.style.borderWidth = '5px' + content.style.borderWidth = '2px' let ifGroupActive = subjGroup.some((x) => { return x.getIfActive() }) @@ -2087,7 +2092,7 @@ ) } else { 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!' + 'A kérdéseket nem lehetett beolvasni, ellenőrizd hogy elérhető-e a szerver' ) } textBox.style.margin = fiveMargin // fancy margin @@ -2113,54 +2118,35 @@ CreateNodeWithText(splashTickboxCell, 'Üdvözlő üzenet mutatása minden oldalon', 'span') - // show questons tickbox ----------------------------------------------------------------------------------------------------------------------------- - var questionTickboxRow = tbl.insertRow() - var questionTickboxCell = questionTickboxRow.insertCell() - - var questionsTickBox = document.createElement('input') - questionsTickBox.type = 'checkbox' - questionsTickBox.checked = getVal('showQuestions') - questionsTickBox.style.position = '' - // questionsTickBox.style.background = "white"; - questionsTickBox.style.left = 10 + 'px' - questionsTickBox.style.margin = '5px 5px 5px 5px' // fancy margin - questionsTickBox.style.top = menuDiv.offsetHeight + 'px' - questionTickboxCell.appendChild(questionsTickBox) // adding to main div - - questionsTickBox.addEventListener('click', function () { - setVal('showQuestions', questionsTickBox.checked) - if (!questionsTickBox.checked) { - 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', - isSimple: true - }, 7) - } - }) // adding clicktextNode - - CreateNodeWithText(questionTickboxCell, 'Kérdések mutatása válaszhoz', 'span') - // setting up buttons var buttonRow = tbl.insertRow() var buttonCell = buttonRow.insertCell() buttonCell.style.textAlign = 'center' - // x button ------------------------------------------------------------------------------------------------------------------------------ - var xButton = CreateNodeWithText(buttonCell, 'Bezárás', 'button') - xButton.style.position = '' - xButton.style.left = 10 + 'px' - xButton.style.margin = '5px 5px 5px 5px' // fancy margin - xButton.style.top = menuDiv.offsetHeight + 'px' + let buttonStyle = { + position: '', + left: 10 + 'px', + margin: '5px 5px 5px 5px', + top: menuDiv.offsetHeight + 'px', + border: 'none', + backgroundColor: '#202020', + color: '#ffffff', + cursor: 'pointer' + } + // x button ------------------------------------------------------------------------------------------------------------------------------ + let xButton = CreateNodeWithText(buttonCell, 'Bezárás', 'button') + Object.keys(buttonStyle).sort().forEach((key) => { + xButton.style[key] = buttonStyle[key] + }) xButton.addEventListener('click', function () { CloseMenu() }) // adding clicktextNode // help button ---------------------------------------------------------------------------------------------------------------- - var helpButton = CreateNodeWithText(buttonCell, 'Help', 'button') - - helpButton.style.position = '' - helpButton.style.left = 10 + 'px' - helpButton.style.margin = '5px 5px 5px 5px' // fancy margin - helpButton.style.top = menuDiv.offsetHeight + 'px' + let helpButton = CreateNodeWithText(buttonCell, 'Help', 'button') + Object.keys(buttonStyle).sort().forEach((key) => { + helpButton.style[key] = buttonStyle[key] + }) helpButton.addEventListener('click', function () { ShowHelp() @@ -2168,13 +2154,26 @@ // site link ---------------------------------------------------------------------------------------------------------------- - var siteLink = CreateNodeWithText(buttonCell, 'Help', 'button') - siteLink.innerText = 'Weboldal' + let siteLink = CreateNodeWithText(buttonCell, 'Weboldal / Bug report', 'button') + Object.keys(buttonStyle).sort().forEach((key) => { + siteLink.style[key] = buttonStyle[key] + }) siteLink.addEventListener('click', function () { location.href = serverAdress + 'menuClick' // eslint-disable-line }) + // donate link ---------------------------------------------------------------------------------------------------------------- + + let donateLink = CreateNodeWithText(buttonCell, 'Donate', 'button') + Object.keys(buttonStyle).sort().forEach((key) => { + donateLink.style[key] = buttonStyle[key] + }) + + donateLink.addEventListener('click', function () { + location.href = serverAdress + 'donate' // eslint-disable-line + }) + // addEventListener(window, 'scroll', function () { // menuDiv.style.top = (pageYOffset + window.innerHeight / 3) + 'px'; // })