Commit 2ca602c5 authored by Zosman's avatar Zosman
Browse files

delegating functions to diffrent tables

parent b706fb82
Pipeline #828 passed with stage
in 1 minute and 13 seconds
......@@ -150,8 +150,8 @@ SRCT Go • Administration Panel
<form method="post" action="useradmin">
<!-- csrf protection -->
{% csrf_token %}
<table class="table table-striped table-hover">
<input type="text" id="blockedInput" onkeyup="filterBlocked()" placeholder="Search for Full names..">
<table class="table table-striped table-hover" id="blockedTable">
<!-- define the header row -->
<thead>
<tr>
......@@ -224,8 +224,8 @@ SRCT Go &bull; Administration Panel
<form method="post" action="useradmin">
<!-- csrf protection -->
{% csrf_token %}
<table class="table table-striped table-hover ">
<input type="text" id="currentInput" onkeyup="filterCurrent()" placeholder="Search for Full names..">
<table class="table table-striped table-hover " id = "currentTable">
<!-- define the header row -->
<thead>
<tr>
......
......@@ -16,3 +16,39 @@ function filterApplied() {
}
}
}
function filterBlocked() {
var input, filter, table, tr, td, i;
input = document.getElementById("blockedInput"); // the var that holdes input from text box
filter = input.value.toUpperCase(); //makes the input all uppercase for some fucking reason
table = document.getElementById("blockedTable"); // the table at the moment this is called
tr = table.getElementsByTagName("tr"); //the table rows
for (i = 1; i < tr.length; i++) { // loops through the table rows
td = tr[i].getElementsByTagName("td")[2]; //sets td to the element, gets changed evrey loop itteration
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
// tr[1].style.display = "No results match your search! ¯\\_(ツ)_/¯"
}
}
}
}
function filterCurrent() {
var input, filter, table, tr, td, i;
input = document.getElementById("currentInput"); // the var that holdes input from text box
filter = input.value.toUpperCase(); //makes the input all uppercase for some fucking reason
table = document.getElementById("currentTable"); // the table at the moment this is called
tr = table.getElementsByTagName("tr"); //the table rows
for (i = 1; i < tr.length; i++) { // loops through the table rows
td = tr[i].getElementsByTagName("td")[2]; //sets td to the element, gets changed evrey loop itteration
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
// tr[1].style.display = "No results match your search! ¯\\_(ツ)_/¯"
}
}
}
}
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