From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 417191382C5 for ; Sun, 7 Jun 2020 20:40:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6EDA2E08A4; Sun, 7 Jun 2020 20:40:00 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 55280E08A4 for ; Sun, 7 Jun 2020 20:40:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5DA8034F3D1 for ; Sun, 7 Jun 2020 20:39:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DA9F8268 for ; Sun, 7 Jun 2020 20:39:57 +0000 (UTC) From: "Max Magorsch" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Max Magorsch" Message-ID: <1591562387.0c18044a46251aeefb66a8145f75d964ccbe691c.arzano@gentoo> Subject: [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/ X-VCS-Repository: proj/gentoo-mirrorstats X-VCS-Files: html/stats.jinja2 X-VCS-Directories: html/ X-VCS-Committer: arzano X-VCS-Committer-Name: Max Magorsch X-VCS-Revision: 0c18044a46251aeefb66a8145f75d964ccbe691c X-VCS-Branch: master Date: Sun, 7 Jun 2020 20:39:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8fa10a9c-2d40-4c82-b08c-43bf1e301d17 X-Archives-Hash: b6f504cc31a3a3eadc638dfaa76514ab commit: 0c18044a46251aeefb66a8145f75d964ccbe691c Author: Max Magorsch gentoo org> AuthorDate: Sun Jun 7 20:39:47 2020 +0000 Commit: Max Magorsch gentoo org> CommitDate: Sun Jun 7 20:39:47 2020 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0c18044a Add filters Signed-off-by: Max Magorsch gentoo.org> html/stats.jinja2 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/html/stats.jinja2 b/html/stats.jinja2 index 98d8474..482a2cf 100644 --- a/html/stats.jinja2 +++ b/html/stats.jinja2 @@ -8,6 +8,13 @@ + @@ -345,6 +352,7 @@ ], "initComplete": function( settings, json ) { setTimeout(function(){ + $('#table_id_length').prepend(""); table.buttons().container().prependTo($('#table_id_length')); $('#table_id_length').prepend(" Show "); document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4"; @@ -353,6 +361,29 @@ }); } ); + function addFilters(){ + + if($("#filterRow").length) { + $("#filterRow").remove(); + }else{ + $('#table_id thead tr').clone(true).appendTo('#table_id thead'); + $('#table_id thead tr:eq(1)').attr("id", "filterRow"); + $('#table_id thead tr:eq(1) th').each(function (i) { + var title = $(this).text(); + $(this).html(''); + + $('input', this).on('keyup change', function () { + if (table.column(i).search() !== this.value) { + table + .column(i) + .search(this.value) + .draw(); + } + }); + }); + } + } +