[tor-commits] [atlas/master] Removes non-functioning filtering in results table (#23510)

irl at torproject.org irl at torproject.org
Tue Nov 14 14:39:55 UTC 2017


commit 3282bb350addbd95477fb865c299f4bef788d676
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Tue Nov 14 14:37:52 2017 +0000

    Removes non-functioning filtering in results table (#23510)
---
 js/views/search/do.js    | 96 ------------------------------------------------
 templates/search/do.html | 39 --------------------
 2 files changed, 135 deletions(-)

diff --git a/js/views/search/do.js b/js/views/search/do.js
index 258d345..c29e238 100644
--- a/js/views/search/do.js
+++ b/js/views/search/do.js
@@ -16,104 +16,8 @@ define([
 	    initialize: function() {
 	    	this.collection = new resultsCollection;
 	    },
-        filtering: function() {
-            var rangefilter = function(data) {
-                var iMin = document.getElementById(data.ida).value;
-                var iMax = document.getElementById(data.idb).value;
-
-                if ( iMin == "" && iMax == "") {
-                    return true;
-                } else {
-                    var rawdata = $(data.aData[data.i]).attr('data-filter');
-                    var datafilter = data.transform(rawdata);
-                }
-
-                if ( iMin == "" && datafilter < iMax*1) {
-                    return true;
-                } else if (iMin*1 <= datafilter && "" == iMax) {
-                    return true;
-                } else if (iMin*1 <= datafilter && datafilter <= iMax*1) {
-                    return true;
-                }
-
-                return false;
-
-            }
-            var imagefilter = function(data) {
-                var name = document.getElementById(data.id).value;
-                var result = false;
-                if ( name == "" ) {
-                    return true;
-                } else {
-                    var elements = $(data.aData[data.i]);
-                }
-                _.each(elements, function(el) {
-                    var datafilter = $(el).attr('title');
-                    if (datafilter != undefined) {
-                        var fRegex = new RegExp(datafilter);
-
-                        if (name.match(fRegex)) {
-                            result |= true;
-                        } else {
-                            result |= false;
-                        }
-                    }
-                });
-
-                return (result == 1);
-            }
-
-            $.fn.dataTableExt.afnFiltering.push(
-                function(oSettings, aData, iDataIndex) {
-                    var result = true;
-                    // Filter the bandwidth
-                    result &= rangefilter({
-                        aData: aData,
-                        ida: "bw_from",
-                        idb: "bw_to",
-                        i: 1,
-                        transform: function(data) {
-                            return Math.round(data/1000);
-                            }
-                        });
-                    // Filter the uptime
-                    result &= rangefilter({
-                        aData: aData,
-                        ida: "uptime_from",
-                        idb: "uptime_to",
-                        i: 2,
-                        transform: function(data) {
-                            return Math.floor(data/1000/3600/24);
-                            }
-                        });
-
-                    result &= imagefilter({
-                        aData: aData,
-                        id: "country",
-                        i: 3
-                        });
-
-                    result &= imagefilter({
-                        aData: aData,
-                        id: "flags",
-                        i: 5
-                        });
-
-                    return (result == 1);
-                }
-            );
-
-            $.extend( $.fn.dataTableExt.oStdClasses, {
-                "sSortAsc": "header headerSortDown",
-                "sSortDesc": "header headerSortUp",
-                "sSortable": "header"
-            } );
-
-
-        },
         render: function(query){
             document.title = "Relay Search";
-            this.filtering();
             var asInitVals = new Array();
             var compiledTemplate = _.template(doSearchTemplate, {query: query, relays: this.relays, countries: CountryCodes, error: this.error});
 			this.el.html(compiledTemplate);
diff --git a/templates/search/do.html b/templates/search/do.html
index 2ccbbba..b37eccd 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -119,45 +119,6 @@
             </tr>
 <% }); %>
 	</tbody>
-	<tfoot>
-	<tr>
-        <th>
-        </th>
-		<th>
-            <input type="text" id="nickname" name="nickname" placeholder="Nickname" class="search_init">
-        </th>
-		<th>
-			<input type="text" id="bw_from" name="bw_from" placeholder="From (KiB/s)" class="search_init span1"><input type="text" id="bw_to"name="bw_to" placeholder="To (KiB/s)" class="search_init span1">
-		</th>
-		<th>
-			<input type="text" id="uptime_from" name="uptime_from" placeholder="From (days)" class="search_init span1">
-            <input type="text" id="uptime_to" name="uptime_to" placeholder="To (days)" class="search_init span1">
-		</th>
-	    <th>
-
-            <input type="text" id="country" name="country" placeholder="Country" class="search_init span1 typeahead">
-        </th>
-
-		<th>
-            <input type="text" id="or_address" name="or_address" placeholder="IP address" class="search_init">
-        </th>
-		<th>
-            <input type="text" id="flags" name="flags" placeholder="Flags" class="search_init">
-        </th>
-        <th>
-            <input type="text" id="flags" name="properties" placeholder="Properties" class="search_init">
-        </th>
-		<th>
-            <input type="text" id="or_port" name="or_port" placeholder="ORPort" class="search_init span1">
-        </th>
-		<th>
-            <input type="text" id="dir_port" name="dir_port" placeholder="DirPort" class="search_init span1">
-        </th>
-		<th>
-            <input type="text" id="type" name="type" placeholder="Type" class="search_init span1">
-        </th>
-	</tr>
-	</tfoot>
 </table>
 <% } %>
 </div>



More information about the tor-commits mailing list