Passive mode, and buttons for that one

This commit is contained in:
YourFriendlyNeighborhoodDealer 2019-03-04 21:52:43 +01:00
parent 6fa1625755
commit 932f215f79

54
main.js
View file

@ -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,8 +1729,8 @@ 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';
@ -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';