From 932f215f79ba0b66c4aca3bda99296498e7842bb Mon Sep 17 00:00:00 2001 From: YourFriendlyNeighborhoodDealer Date: Mon, 4 Mar 2019 21:52:43 +0100 Subject: [PATCH] Passive mode, and buttons for that one --- main.js | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/main.js b/main.js index 268a81f..00d400b 100644 --- a/main.js +++ b/main.js @@ -29,7 +29,7 @@ const serverAdress = "https://qmining.tk/"; // forcing pages for testing. unless you test, do not set these to true! // only one of these should be true for testing const forceTestPage = false; -const forceResultPage = true; +const forceResultPage = false; const forceDefaultPage = false; const logElementGetting = false; const log = true; @@ -912,8 +912,10 @@ function Load(cwith) { var useNetDB = GM_getValue("useNetDB"); let skipLoad = GM_getValue("skipLoad"); - if (skipLoad) + if (skipLoad) { + console.log("HAAAAAAAAAAA"); return -1; + } if (useNetDB != undefined && useNetDB == 1) return ReadNetDB(cwith, useNetDB); @@ -1727,12 +1729,12 @@ function ShowMessage(msgItem, timeout, funct) { // shows a fancy menu function ShowMenu() { try { - var buttonWidth = 75; // button size ;) - var buttonHeight = 55; + var buttonWidth = 100; // button size ;) + var buttonHeight = 85; var appedtTo = document.body; // will be appended here // mainDiv.style.left = (window.innerWidth - width) / 2 + 'px'; - + var menuButtonDiv = document.createElement("div"); menuButtonDiv.setAttribute("id", "HelperMenuButton"); menuButtonDiv.style.width = buttonWidth + 'px'; @@ -1745,16 +1747,21 @@ function ShowMenu() { // design menuButtonDiv.style.textAlign = "center"; menuButtonDiv.style.padding = "0px"; - menuButtonDiv.style.background = "#222d32"; // background color - menuButtonDiv.style.color = "#ffffff"; // text color - menuButtonDiv.style.borderColor = "#035a8f"; // border color - menuButtonDiv.style.border = "solid"; - menuButtonDiv.style.opacity = "0.9"; // setting starting opacity + menuButtonDiv.style.margin = "0px"; + menuButtonDiv.style.background = "transparent"; // background color // menu text - var menuTextBox = CreateNodeWithText(menuButtonDiv, "Kérdések\nMenü"); + // var menuTextBox = CreateNodeWithText(menuButtonDiv, "Kérdések\nMenü"); - menuButtonDiv.addEventListener("click", function() { + var menuButton = CreateNodeWithText(menuButtonDiv, "Helper Menu", "button"); + menuButton.style.width = buttonWidth + 'px'; + menuButton.style.height = buttonHeight - 20 + 'px'; + menuButton.style.background = "#222d32"; // background color + menuButton.style.color = "#ffffff"; // background color + + + + menuButton.addEventListener("click", function() { if (document.getElementById("HelperMenu") == null) { ShowMenuList(); } else { @@ -1762,8 +1769,29 @@ function ShowMenu() { } }); // adding click - let skipLoad = GM_getValue("skipLoad"); - // TODO: add switch, and test loading stuff + // passive mode stuff + var questionsTickBox = document.createElement("input"); + questionsTickBox.type = "checkbox"; + questionsTickBox.checked = GM_getValue("skipLoad"); + questionsTickBox.style.position = ""; + questionsTickBox.style.left = 10 + 'px'; + questionsTickBox.style.margin = "5px 5px 5px 5px"; // fancy margin + questionsTickBox.style.top = 0 + 'px'; + + menuButtonDiv.appendChild(questionsTickBox); // adding to main div + + questionsTickBox.addEventListener("click", function() { + GM_setValue("skipLoad", questionsTickBox.checked); + if (!GM_getValue("skipLoad")){ + // TODO show msgbox eplaining this, but only once + } + + }); + var loadDataCheckBoxText = CreateNodeWithText(questionsTickBox, + "Passzív mód", "span"); + loadDataCheckBoxText.style.fontSize = "12px"; + + menuButtonDiv.appendChild(loadDataCheckBoxText); addEventListener(window, 'resize', function() { menuButtonDiv.style.left = window.innerWidth - buttonWidth * 2 + 'px';