MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
var search = ""; | var search = ""; | ||
if(document.getElementById("imageinput") !== null && document.getElementById("imageinput").value !== null) | if (document.getElementById("imageinput") !== null && document.getElementById("imageinput").value !== null) | ||
{ | { | ||
search = document.getElementById("imageinput").value; | search = document.getElementById("imageinput").value; | ||
| Line 23: | Line 23: | ||
var search = ""; | var search = ""; | ||
if(document.getElementById("image1input") !== null && document.getElementById("image1input").value !== null) | if (document.getElementById("image1input") !== null && document.getElementById("image1input").value !== null) | ||
{ | { | ||
search = document.getElementById("image1input").value; | search = document.getElementById("image1input").value; | ||
| Line 36: | Line 36: | ||
} | } | ||
} | } | ||
function filterRefs () { | |||
var x = document.getElementsByClassName("ref"); | |||
var search = ""; | |||
if (document.getElementById("refinput") !== null && document.getElementById("refinput").value !== null) | |||
{ | |||
search = document.getElementById("refinput").value; | |||
} | |||
for (i = 0; i < x.length; i++) { | |||
if (x[i].id.indexOf(search) == -1) { | |||
x[i].style.display = 'none'; | |||
} else { | |||
x[i].style.display = ''; | |||
} | |||
} | |||
} | |||
function filterRecognitions () { | |||
var x = document.getElementsByClassName("recognition"); | |||
var search = ""; | |||
if (document.getElementById("recognitioninput") !== null && document.getElementById("recognitioninput").value !== null) | |||
{ | |||
search = document.getElementById("recognitioninput").value; | |||
} | |||
for (i = 0; i < x.length; i++) { | |||
if (x[i].id.indexOf(search) == -1) { | |||
x[i].style.display = 'none'; | |||
} else { | |||
x[i].style.display = ''; | |||
} | |||
} | |||
} | |||
| Line 57: | Line 94: | ||
function filterTable() { | function filterTable() { | ||
var input, filter, table, tr, td, i, link, creator, | var input, filter, table, tr, td, i, type, link, creator, source,date, notes, txtValue; | ||
input = document.getElementById("tableinput"); | input = document.getElementById("tableinput"); | ||
filter = input.value.toUpperCase(); | filter = input.value.toUpperCase(); | ||
| Line 63: | Line 100: | ||
tr = table.getElementsByTagName("tr"); | tr = table.getElementsByTagName("tr"); | ||
for (i = 0; i < tr.length; i++) { | for (i = 0; i < tr.length; i++) { | ||
// match text in columns Link, Creator, | // match text in columns Link, Creator, Date, Notes | ||
title= tr[i].getElementsByTagName("td")[0]; | title= tr[i].getElementsByTagName("td")[0]; | ||
if (title) { | if (title) { | ||
type = tr[i].getElementsByTagName("td")[0]; | |||
link = tr[i].getElementsByTagName("td")[1]; | |||
creator = tr[i].getElementsByTagName("td")[2]; | |||
notes= tr[i].getElementsByTagName("td")[ | source = tr[i].getElementsByTagName("td")[3]; | ||
txtValue = link.textContent + creator.textContent + | date = tr[i].getElementsByTagName("td")[4]; | ||
notes = tr[i].getElementsByTagName("td")[6]; | |||
txtValue = type.textContent + link.textContent + creator.textContent + source.textContent + date.textContent + notes.textContent; | |||
if (txtValue.toUpperCase().indexOf(filter) > -1) { | if (txtValue.toUpperCase().indexOf(filter) > -1) { | ||
tr[i].style.display = ""; | tr[i].style.display = ""; | ||
| Line 80: | Line 119: | ||
} | } | ||
function | function filterWebsites() { | ||
var input, filter, table, tr, td, i, txtValue | var input, filter, table, tr, td, i, link, txtValue; | ||
input = document.getElementById(" | input = document.getElementById("websiteinput"); | ||
filter = input.value.toUpperCase(); | filter = input.value.toUpperCase(); | ||
table = document.getElementById(" | table = document.getElementById("filterwebsite"); | ||
tr = table.getElementsByTagName("tr"); | tr = table.getElementsByTagName("tr"); | ||
for (i = 0; i < tr.length; i++) { | for (i = 0; i < tr.length; i++) { | ||
// match text in columns | // match text in columns Link, Creator, Date, Notes | ||
title= tr[i].getElementsByTagName("td")[0]; | |||
if (title) { | |||
link= tr[i].getElementsByTagName("td")[0]; | |||
txtValue = link.textContent; | |||
txtValue = | |||
if (txtValue.toUpperCase().indexOf(filter) > -1) { | if (txtValue.toUpperCase().indexOf(filter) > -1) { | ||
tr[i].style.display = ""; | tr[i].style.display = ""; | ||
| Line 106: | Line 142: | ||
$('#tablebox').html('<input type="text" id="tableinput" onkeyup="filterTable()" value="" placeholder="Filter..." title="Type in a name">'); | $('#tablebox').html('<input type="text" id="tableinput" onkeyup="filterTable()" value="" placeholder="Filter..." title="Type in a name">'); | ||
$('#imagebox').html('<input type="text" id="imageinput" onkeyup="filterImages()" value="" placeholder="Filter..." title="Type in a name">'); | $('#websitebox').html('<input type="text" id="websiteinput" onkeyup="filterWebsite()" value="" placeholder="Filter..." title="Type in a name">'); | ||
$('#imagebox').html('<input type="text" id="imageinput" onkeyup="filterImages()" value="" placeholder="Filter...0" title="Type in a name">'); | |||
$('#image1box').html('<input type="text" id="image1input" onkeyup="filterImages1()" value="" placeholder="Filter..." title="Type in a name1">'); | $('#image1box').html('<input type="text" id="image1input" onkeyup="filterImages1()" value="" placeholder="Filter..." title="Type in a name1">'); | ||
| Line 112: | Line 150: | ||
$('#documentbox').html('<input type="text" id="documentinput" onkeyup="filterDocuments()" value="" placeholder="Filter..." title="Type in a name">'); | $('#documentbox').html('<input type="text" id="documentinput" onkeyup="filterDocuments()" value="" placeholder="Filter..." title="Type in a name">'); | ||
$('# | $('#recognitionbox').html('<input type="text" id="recognitioninput" onkeyup="filterRecognitions()" value="" placeholder="Filter..." title="Type in a name">'); | ||
$('#refbox').html('<input type="text" id="refinput" onkeyup="filterRefs()" value="" placeholder="Filter..." title="Type in a name">'); | |||
Latest revision as of 15:40, 1 April 2021
/* Any JavaScript here will be loaded for all users on every page load. */
function filterImages () {
var x = document.getElementsByClassName("image");
var search = "";
if (document.getElementById("imageinput") !== null && document.getElementById("imageinput").value !== null)
{
search = document.getElementById("imageinput").value;
}
for (i = 0; i < x.length; i++) {
if (x[i].id.indexOf(search) == -1) {
x[i].style.display = 'none';
} else {
x[i].style.display = '';
}
}
}
function filterImages1 () {
var x = document.getElementsByClassName("image1");
var search = "";
if (document.getElementById("image1input") !== null && document.getElementById("image1input").value !== null)
{
search = document.getElementById("image1input").value;
}
for (i = 0; i < x.length; i++) {
if (x[i].id.indexOf(search) == -1) {
x[i].style.display = 'none';
} else {
x[i].style.display = '';
}
}
}
function filterRefs () {
var x = document.getElementsByClassName("ref");
var search = "";
if (document.getElementById("refinput") !== null && document.getElementById("refinput").value !== null)
{
search = document.getElementById("refinput").value;
}
for (i = 0; i < x.length; i++) {
if (x[i].id.indexOf(search) == -1) {
x[i].style.display = 'none';
} else {
x[i].style.display = '';
}
}
}
function filterRecognitions () {
var x = document.getElementsByClassName("recognition");
var search = "";
if (document.getElementById("recognitioninput") !== null && document.getElementById("recognitioninput").value !== null)
{
search = document.getElementById("recognitioninput").value;
}
for (i = 0; i < x.length; i++) {
if (x[i].id.indexOf(search) == -1) {
x[i].style.display = 'none';
} else {
x[i].style.display = '';
}
}
}
function filterDocuments () {
var x = document.getElementsByClassName("document");
var search = "";
if(document.getElementById("documentinput") !== null && document.getElementById("documentinput").value !== null)
{
search = document.getElementById("documentinput").value;
}
for (i = 0; i < x.length; i++) {
if (x[i].id.indexOf(search) == -1) {
x[i].style.display = 'none';
} else {
x[i].style.display = '';
}
}
}
function filterTable() {
var input, filter, table, tr, td, i, type, link, creator, source,date, notes, txtValue;
input = document.getElementById("tableinput");
filter = input.value.toUpperCase();
table = document.getElementById("filtertable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
// match text in columns Link, Creator, Date, Notes
title= tr[i].getElementsByTagName("td")[0];
if (title) {
type = tr[i].getElementsByTagName("td")[0];
link = tr[i].getElementsByTagName("td")[1];
creator = tr[i].getElementsByTagName("td")[2];
source = tr[i].getElementsByTagName("td")[3];
date = tr[i].getElementsByTagName("td")[4];
notes = tr[i].getElementsByTagName("td")[6];
txtValue = type.textContent + link.textContent + creator.textContent + source.textContent + date.textContent + notes.textContent;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
function filterWebsites() {
var input, filter, table, tr, td, i, link, txtValue;
input = document.getElementById("websiteinput");
filter = input.value.toUpperCase();
table = document.getElementById("filterwebsite");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
// match text in columns Link, Creator, Date, Notes
title= tr[i].getElementsByTagName("td")[0];
if (title) {
link= tr[i].getElementsByTagName("td")[0];
txtValue = link.textContent;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
$('#tablebox').html('<input type="text" id="tableinput" onkeyup="filterTable()" value="" placeholder="Filter..." title="Type in a name">');
$('#websitebox').html('<input type="text" id="websiteinput" onkeyup="filterWebsite()" value="" placeholder="Filter..." title="Type in a name">');
$('#imagebox').html('<input type="text" id="imageinput" onkeyup="filterImages()" value="" placeholder="Filter...0" title="Type in a name">');
$('#image1box').html('<input type="text" id="image1input" onkeyup="filterImages1()" value="" placeholder="Filter..." title="Type in a name1">');
$('#documentbox').html('<input type="text" id="documentinput" onkeyup="filterDocuments()" value="" placeholder="Filter..." title="Type in a name">');
$('#recognitionbox').html('<input type="text" id="recognitioninput" onkeyup="filterRecognitions()" value="" placeholder="Filter..." title="Type in a name">');
$('#refbox').html('<input type="text" id="refinput" onkeyup="filterRefs()" value="" placeholder="Filter..." title="Type in a name">');