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:
parent
49824b8d0c
commit
f8ee092b01
1 changed files with 15 additions and 7 deletions
|
@ -46,7 +46,7 @@
|
|||
// : Script header {{{
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 2.1.3.11
|
||||
// @version 2.1.3.12
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author MrFry
|
||||
// @match https://elearning.uni-obuda.hu/*
|
||||
|
@ -1279,6 +1279,7 @@
|
|||
}
|
||||
|
||||
// : }}}
|
||||
|
||||
// : Misc {{{
|
||||
|
||||
function getVideo() {
|
||||
|
@ -1448,10 +1449,17 @@
|
|||
// window.addEventListener("load", () => {})
|
||||
Main()
|
||||
|
||||
function preventWindowClose() {
|
||||
usf.close = () => {
|
||||
log('Prevented window.close() ...')
|
||||
}
|
||||
}
|
||||
|
||||
function Main() {
|
||||
'use strict'
|
||||
|
||||
log('Moodle / E-Learning script')
|
||||
preventWindowClose()
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', Init)
|
||||
|
@ -1765,7 +1773,7 @@
|
|||
SafeGetElementById('retryContainer', (elem) => {
|
||||
elem.style.display = 'flex'
|
||||
})
|
||||
log(texts.noServerConsoleMessage)
|
||||
warn(texts.noServerConsoleMessage)
|
||||
}
|
||||
|
||||
function VersionActions() {
|
||||
|
@ -2728,23 +2736,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
function logHelper(logMethod, ...value) {
|
||||
function logHelper(logMethod, style, ...value) {
|
||||
if (logEnabled) {
|
||||
logMethod('[Moodle Script]: ', ...value)
|
||||
logMethod('%c[Moodle Script]:', style, ...value)
|
||||
}
|
||||
}
|
||||
|
||||
function warn(value) {
|
||||
logHelper(console.warn, value)
|
||||
logHelper(console.warn, 'color:yellow', value)
|
||||
}
|
||||
|
||||
function log() {
|
||||
logHelper(console.log, ...arguments)
|
||||
logHelper(console.log, 'color:green', ...arguments)
|
||||
}
|
||||
|
||||
function debugLog() {
|
||||
if (isDevel) {
|
||||
logHelper(console.log, ...arguments)
|
||||
logHelper(console.log, 'color:grey', ...arguments)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue