@@ -47,15 +47,13 @@ $("#attackFilter").click(function () {
4747 * @param {boolean } reverseFilter reverse the above strategy
4848 * @param {function } [survivorRowStrategy] execute on all rows that are not being removed (gets passed the row and optional tag)
4949 * @param {* } [tag] this value is passed onto filterStrategy and survivorRowStrategy as the second parameter (row is the first param)
50- * @param {boolean } [forceTotalCalcWithoutSupport] pass true if the total calculation needs to happen on villages without support also
5150 */
52- function filterMainRows ( filterStrategy , reverseFilter , survivorRowStrategy , tag , forceTotalCalcWithoutSupportParam ) {
53- var forceTotalCalcWithoutSupport = forceTotalCalcWithoutSupportParam ;
51+ function filterMainRows ( filterStrategy , reverseFilter , survivorRowStrategy , tag ) {
5452 if ( ! $ ( "#defTotals" ) . is ( ":disabled" ) ) {
5553 $ ( "#defTotals" ) . click ( ) ;
5654 }
5755
58- var goners = $ ( ) ;
56+ /* var goners = $();
5957 $("tr.grandTotal", overviewTable).each(function () {
6058 var self = $(this),
6159 prev;
@@ -76,6 +74,30 @@ function filterMainRows(filterStrategy, reverseFilter, survivorRowStrategy, tag,
7674 }
7775 survivorRowStrategy(prev, tag);
7876 }
77+ });
78+ goners.remove();
79+ setTotalCount();*/
80+
81+ var lastRow = $ ( "tr:last" , overviewTable ) . get ( 0 ) ;
82+ var goners = $ ( ) ;
83+ $ ( "tr.units_away" , overviewTable ) . each ( function ( ) {
84+ var self = $ ( this ) ;
85+ if ( ! reverseFilter != ! filterStrategy ( self , tag ) ) {
86+ goners = goners . add ( self ) ;
87+
88+ var nextRow = self . next ( ) ;
89+ while ( ! nextRow . hasClass ( "units_away" ) && nextRow . get ( 0 ) !== lastRow ) {
90+ goners = goners . add ( nextRow ) ;
91+ nextRow = nextRow . next ( ) ;
92+ }
93+ }
94+ else if ( survivorRowStrategy != null ) {
95+ /*prev = self.prev();
96+ while (!prev.hasClass("units_away")) {
97+ prev = prev.prev();
98+ }*/
99+ survivorRowStrategy ( self , tag ) ;
100+ }
79101 } ) ;
80102 goners . remove ( ) ;
81103 setTotalCount ( ) ;
@@ -90,7 +112,7 @@ $("#defFilterTotalPop").click(function () {
90112 var compareTo = parseInt ( $ ( "#defFilterTotalPopValue" ) . val ( ) , 10 ) ;
91113
92114 filterMainRows (
93- function ( row ) { return ( parseInt ( row . attr ( "population" ) , 10 ) > compareTo ) ; } ,
115+ function ( row ) { q ( row . attr ( "village" ) + "is:" + row . attr ( "population" ) ) ; return ( parseInt ( row . attr ( "population" ) , 10 ) > compareTo ) ; } ,
94116 reverseFilter ) ;
95117} ) ;
96118
@@ -120,6 +142,5 @@ $("#defFilterDist").click(function () {
120142 // Adds the distance between OWN village and the user given coordinates
121143 mainRow . find ( "td:eq(1)" ) . html ( "<b>" + trans . sp . defOverview . fieldsPrefix . replace ( "{0}" , parseInt ( tag . distance , 10 ) ) + "</b>" ) ;
122144 } ,
123- { distance : 0 } ,
124- true ) ;
145+ { distance : 0 } ) ;
125146} ) ;
0 commit comments