SQLCoach Fixer

10.12.2022, 12:58:58

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        SQLCoach Fixer
// @namespace   Violentmonkey Scripts
// @match       *://sqlcoach.informatik.hs-kl.de/*
// @grant       none
// @version     1.25
// @author      DJOetzi
// @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0.txt
// @description 10.12.2022, 12:58:58
// ==/UserScript==

document.querySelector('[value="SQL Überprüfen"]').addEventListener('click', function(){
  let cache = document.getElementById("query").value
  //console.log(cache)
  localStorage.setItem("sqlcoach_iocache", cache)
})

document.body.onload = function(){
  let handle = document.getElementById("query")
  handle.removeAttribute("type")
  handle.setAttribute("style", `@import url('https://fonts.cdnfonts.com/css/cascadia-code'); font-family: 'Cascadia Code', "consolas", sans-serif; border-radius: 5px;`)
  handle.setAttribute("spellcheck", "false")
  handle.outerHTML = handle.outerHTML.replace("input", "textarea")
  //console.log(localStorage.getItem("sqlcoach_iocache"))
  console.log("SQLCoach Fixer successfully loaded initial setup!")
}

window.addEventListener('load', function() {
    document.getElementById("query").innerHTML = localStorage.getItem("sqlcoach_iocache")
}, false);

let syntaxFixer = function(){
  let tmp = document.getElementById("query")
  if(tmp.innerHTML.includes(";"))
    tmp.innerHTML = tmp.innerHTML.replace(";", " ")
}

document.querySelector('[value="SQL Überprüfen"]').onmouseover = syntaxFixer;
document.querySelector('[value="SQL Überprüfen"]').onmousedown = syntaxFixer;