Commit 50279b60 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fix js errors due to jquery missing

parent 52e5e54b
...@@ -104,14 +104,14 @@ ...@@ -104,14 +104,14 @@
var updating = true; var updating = true;
var buttonText = "Aktualisierung stoppen"; var buttonText = "Aktualisierung stoppen";
var interval = setInterval(updateQueries, 1000); var interval = setInterval(updateQueries, 1000);
$("#regexp").on("input", checkRegexp); document.getElementById("regexp").oninput = checkRegexp;
$("#check-against").on("input", checkRegexp); document.getElementById("check-against").oninput = checkRegexp;
$(document).ready(function(){ window.addEventListener('load', function(){
checkRegexp(); checkRegexp();
}); });
$("#head > button").click(function() { document.querySelector("#head > button").addEventListener('click', function() {
if(!updating) { if(!updating) {
$("#head > button").removeClass("btn-danger"); $("#head > button").removeClass("btn-danger");
$("#head > button").addClass("btn-success"); $("#head > button").addClass("btn-success");
...@@ -122,29 +122,33 @@ ...@@ -122,29 +122,33 @@
var updateIn = Math.round((updateAt - Date.now()) / 1000); var updateIn = Math.round((updateAt - Date.now()) / 1000);
$("#head > button").html(buttonText + " (" + updateIn + ")"); $("#head > button").html(buttonText + " (" + updateIn + ")");
updating = !updating; updating = !updating;
}); })
function updateQueries() { function updateQueries() {
var updateAt = lastUpdate + 60000; var updateAt = lastUpdate + 60000;
var updateIn = Math.round((updateAt - Date.now()) / 1000); var updateIn = Math.round((updateAt - Date.now()) / 1000);
if(!updating){ if(!updating){
$("#head > button").removeClass("btn-success"); document.querySelector("#head > button").classList.remove("btn-success");
$("#head > button").addClass("btn-danger"); document.querySelector("#head > button").classList.add("btn-danger");
buttonText = "Aktualisierung starten"; buttonText = "Aktualisierung starten";
clearInterval(interval); clearInterval(interval);
} }
$("#head > button").html(buttonText + " (" + updateIn + ")"); document.querySelector("#head > button").innerHTML = buttonText + " (" + updateIn + ")";
if(updateAt > Date.now()){ if(updateAt > Date.now()){
return; return;
} }
fetch("{{ url('admin/spam/jsonQueries') }}") fetch("{{ url('admin/spam/jsonQueries') }}")
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
$("#queries").html(""); document.getElementById("queries").innerHTML = "";
$(data).each(function(index, el){ data.forEach((index, el) => {
$("#queries").append("<div class=\"query card\">" + el + "</div>"); newElement = document.createElement("div");
newElement.classList.add("query");
newElement.classList.add("card");
newElement.innerHTML = el;
document.getElementById("queries").appendCHild(newElement);
}); });
lastUpdate = Date.now(); lastUpdate = Date.now();
checkRegexp(); checkRegexp();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment