SQLCoach Fixer

10.12.2022, 12:58:58

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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;