mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
logging color, trying to prevent window close
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
// : Script header {{{
|
// : Script header {{{
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 2.1.3.11
|
// @version 2.1.3.12
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author MrFry
|
// @author MrFry
|
||||||
// @match https://elearning.uni-obuda.hu/*
|
// @match https://elearning.uni-obuda.hu/*
|
||||||
@@ -1279,6 +1279,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// : }}}
|
// : }}}
|
||||||
|
|
||||||
// : Misc {{{
|
// : Misc {{{
|
||||||
|
|
||||||
function getVideo() {
|
function getVideo() {
|
||||||
@@ -1448,10 +1449,17 @@
|
|||||||
// window.addEventListener("load", () => {})
|
// window.addEventListener("load", () => {})
|
||||||
Main()
|
Main()
|
||||||
|
|
||||||
|
function preventWindowClose() {
|
||||||
|
usf.close = () => {
|
||||||
|
log('Prevented window.close() ...')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Main() {
|
function Main() {
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
log('Moodle / E-Learning script')
|
log('Moodle / E-Learning script')
|
||||||
|
preventWindowClose()
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
document.addEventListener('DOMContentLoaded', Init)
|
document.addEventListener('DOMContentLoaded', Init)
|
||||||
@@ -1765,7 +1773,7 @@
|
|||||||
SafeGetElementById('retryContainer', (elem) => {
|
SafeGetElementById('retryContainer', (elem) => {
|
||||||
elem.style.display = 'flex'
|
elem.style.display = 'flex'
|
||||||
})
|
})
|
||||||
log(texts.noServerConsoleMessage)
|
warn(texts.noServerConsoleMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
function VersionActions() {
|
function VersionActions() {
|
||||||
@@ -2728,23 +2736,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logHelper(logMethod, ...value) {
|
function logHelper(logMethod, style, ...value) {
|
||||||
if (logEnabled) {
|
if (logEnabled) {
|
||||||
logMethod('[Moodle Script]: ', ...value)
|
logMethod('%c[Moodle Script]:', style, ...value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function warn(value) {
|
function warn(value) {
|
||||||
logHelper(console.warn, value)
|
logHelper(console.warn, 'color:yellow', value)
|
||||||
}
|
}
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
logHelper(console.log, ...arguments)
|
logHelper(console.log, 'color:green', ...arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
function debugLog() {
|
function debugLog() {
|
||||||
if (isDevel) {
|
if (isDevel) {
|
||||||
logHelper(console.log, ...arguments)
|
logHelper(console.log, 'color:grey', ...arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user