mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Passive mode, and buttons for that one
This commit is contained in:
parent
6fa1625755
commit
932f215f79
1 changed files with 42 additions and 14 deletions
56
main.js
56
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';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue