@@ -123,7 +123,7 @@ require([
123123 }
124124 var csrftoken = $ . getCookie ( 'csrftoken' ) ;
125125 let deferred = $ . Deferred ( ) ;
126- // window.show_spinner();
126+ window . show_spinner ( ) ;
127127 $ . ajax ( {
128128 url : url ,
129129 data : ndic ,
@@ -278,7 +278,7 @@ require([
278278 console . log ( 'error loading data' ) ;
279279 } ,
280280 complete : function ( ) {
281- // window.hide_spinner();
281+ window . hide_spinner ( ) ;
282282 }
283283 } ) ;
284284 return deferred . promise ( ) ;
@@ -306,90 +306,90 @@ require([
306306 }
307307
308308 window . displayInfo = function ( targ ) {
309- let collection_id = $ ( targ ) . attr ( 'value' ) ;
310- let collectionDisp = $ ( targ ) . data ( 'filterDisplayVal' )
309+ let collection_id = $ ( targ ) . attr ( 'value' ) ;
310+ let collectionDisp = $ ( targ ) . data ( 'filterDisplayVal' )
311311
312- let pos = $ ( targ ) . parent ( ) . find ( '.collection_info, .analysis_info' ) . offset ( ) ;
312+ let pos = $ ( targ ) . parent ( ) . find ( '.collection_info, .analysis_info' ) . offset ( ) ;
313313 let info_icon = $ ( targ ) . parent ( ) . find ( '.collection_info, .analysis_info' ) ;
314314 let tooltip = '' ;
315315 if ( $ ( info_icon ) . hasClass ( 'collection_info' ) ) {
316316 tooltip = collection_tooltips [ collection_id ] ;
317- }
318- else {
317+ } else {
319318 tooltip = analysis_results_tooltips [ collection_id ] ;
320319 }
321-
322- $ ( '#collection-modal' ) . find ( '#collecton-modal-title' ) . text ( collectionDisp ) ;
323- $ ( '#collection-modal' ) . find ( '.modal-body' ) . html ( tooltip ) ;
324-
325- $ ( '#collection-modal' ) . addClass ( 'fade' ) ;
326- $ ( '#collection-modal' ) . addClass ( 'in' ) ;
327- $ ( '#collection-modal' ) . css ( "display" , "block" ) ;
328- var width = $ ( '#collection-modal' ) . find ( '.modal-content' ) . outerWidth ( ) ;
329- var height = $ ( '#collection-modal' ) . find ( '.modal-content' ) . outerHeight ( ) ;
330- $ ( '#collection-modal' ) . height ( height ) ;
331- $ ( '#collection-modal' ) . width ( width ) ;
332-
333- $ ( '#collection-modal' ) . css ( { position :"absolute" , top : Math . max ( ( pos . top - height ) , 0 ) , left : pos . left } )
320+ let collex_modal = $ ( '#collection-modal' ) ;
321+ collex_modal . find ( '#collecton-modal-title' ) . text ( collectionDisp ) ;
322+ collex_modal . find ( '.modal-body' ) . html ( tooltip ) ;
323+
324+ collex_modal . addClass ( 'fade' ) ;
325+ collex_modal . addClass ( 'in' ) ;
326+ collex_modal . css ( "display" , "block" ) ;
327+ let width = collex_modal . find ( '.modal-content' ) . outerWidth ( ) ;
328+ let height = collex_modal . find ( '.modal-content' ) . outerHeight ( ) ;
329+ collex_modal . height ( height ) ;
330+ collex_modal . width ( width ) ;
331+ collex_modal . css ( { position :"absolute" , top : Math . max ( ( pos . top - height ) , 0 ) , left : pos . left } )
334332 }
335333
336334 var filterItemBindings = function ( filterId ) {
337- $ ( '#' + filterId ) . find ( '.join_val' ) . on ( 'click' , function ( ) {
338- var attribute = $ ( this ) . closest ( '.list-group-item__body, .list-group-sub-item__body' , '.colections-list' ) [ 0 ] . id ;
339- if ( filterObj . hasOwnProperty ( attribute ) && ( window . filterObj [ attribute ] [ 'values' ] . length > 1 ) ) {
335+ let selFilter = $ ( `#${ filterId } ` ) ;
336+ selFilter . find ( '.join_val' ) . on ( 'click' , function ( ) {
337+ let attribute = $ ( this ) . closest ( '.list-group-item__body, .list-group-sub-item__body' , '.colections-list' ) [ 0 ] . id ;
338+ if ( filterObj . hasOwnProperty ( attribute ) && ( window . filterObj [ attribute ] [ 'values' ] . length >= 1 ) ) {
340339 filterutils . mkFiltText ( ) ;
341340 filterObj [ attribute ] [ 'op' ] = $ ( this ) . attr ( 'value' ) ;
342341 updateFacetsData ( true ) ;
343342 }
344343 } ) ;
345344
346- $ ( '#' + filterId ) . find ( '.collection_info, .analysis_info' ) . on ( "mouseenter" , function ( e ) {
345+ selFilter . find ( '.collection_info, .analysis_info' ) . on ( "mouseenter" , function ( e ) {
347346 $ ( e . target ) . addClass ( 'fa-lg' ) ;
348347 } ) ;
349348
350- $ ( '#' + filterId ) . find ( '.collection_info, .analysis_info' ) . on ( "mouseleave" , function ( e ) {
349+ selFilter . find ( '.collection_info, .analysis_info' ) . on ( "mouseleave" , function ( e ) {
351350 $ ( e . target ) . removeClass ( 'fa-lg' ) ;
352351 } ) ;
353352
354- $ ( '#' + filterId ) . find ( 'input:checkbox' ) . not ( '.hide-zeros' ) . on ( 'click' , function ( e ) {
355- var targ = e . target ;
353+ selFilter . find ( 'input:checkbox' ) . not ( '.hide-zeros' ) . on ( 'click' , function ( e ) {
354+ let targ = e . target ;
356355 if ( $ ( e . target ) . parent ( ) . find ( '.collection_info.fa-lg, .analysis_info.fa-lg' ) . length > 0 ) {
357356 $ ( targ ) . prop ( "checked" , ! $ ( targ ) . prop ( "checked" ) ) ;
358357 window . displayInfo ( targ ) ;
359- }
360- else {
358+ } else {
361359 handleFilterSelectionUpdate ( this , true , true ) ;
362360 }
363-
364361 } ) ;
365362
366- $ ( '#' + filterId ) . find ( '.show-more' ) . on ( 'click' , function ( ) {
363+ selFilter . find ( '.show-more' ) . on ( 'click' , function ( ) {
367364 $ ( this ) . parent ( ) . parent ( ) . children ( '.less-checks' ) . show ( ) ;
368365 $ ( this ) . parent ( ) . parent ( ) . children ( '.less-checks' ) . removeClass ( 'is-hidden' ) ;
369366 $ ( this ) . parent ( ) . parent ( ) . children ( '.more-checks' ) . addClass ( 'is-hidden' ) ;
370367
371368 $ ( this ) . parent ( ) . hide ( ) ;
372- var extras = $ ( this ) . closest ( '.list-group-item__body, .collection-list, .list-group-sub-item__body' ) . children ( '.search-checkbox-list' ) . children ( '.extra-values' )
369+ var extras = $ ( this ) . closest ( '.list-group-item__body, .collection-list, .list-group-sub-item__body' )
370+ . children ( '.search-checkbox-list' )
371+ . children ( '.extra-values' )
373372
374- if ( ( $ ( '#' + filterId ) . closest ( '.search-configuration' ) . find ( '.hide-zeros' ) . length > 0 ) && ( $ ( '#' + filterId ) . closest ( '.search-configuration' ) . find ( '.hide-zeros' ) . prop ( 'checked' ) ) ) {
373+ if ( ( selFilter . closest ( '.search-configuration' ) . find ( '.hide-zeros' ) . length > 0 )
374+ && ( $ ( '#' + filterId ) . closest ( '.search-configuration' ) . find ( '.hide-zeros' ) . prop ( 'checked' ) ) ) {
375375 extras = extras . not ( '.zeroed' ) ;
376376 }
377377 extras . removeClass ( 'is-hidden' ) ;
378378 } ) ;
379379
380- $ ( '#' + filterId ) . find ( '.show-less' ) . on ( 'click' , function ( ) {
380+ selFilter . find ( '.show-less' ) . on ( 'click' , function ( ) {
381381 $ ( this ) . parent ( ) . parent ( ) . children ( '.more-checks' ) . show ( ) ;
382382 $ ( this ) . parent ( ) . parent ( ) . children ( '.more-checks' ) . removeClass ( 'is-hidden' ) ;
383383 $ ( this ) . parent ( ) . parent ( ) . children ( '.less-checks' ) . addClass ( 'is-hidden' ) ;
384384
385385 $ ( this ) . parent ( ) . hide ( ) ;
386- $ ( this ) . closest ( '.list-group-item__body, .collection-list, .list-group-sub-item__body' ) . children ( '.search-checkbox-list' ) . children ( '.extra-values' ) . addClass ( 'is-hidden' ) ;
386+ $ ( this ) . closest ( '.list-group-item__body, .collection-list, .list-group-sub-item__body' )
387+ . children ( '.search-checkbox-list' ) . children ( '.extra-values' ) . addClass ( 'is-hidden' ) ;
387388 } ) ;
388389
389- $ ( '#' + filterId ) . find ( '.check-all' ) . on ( 'click' , function ( ) {
390+ selFilter . find ( '.check-all' ) . on ( 'click' , function ( ) {
390391 if ( ! is_cohort ) {
391392 filterutils . checkUncheckAll ( this , true , true ) ;
392-
393393 }
394394 } ) ;
395395
@@ -432,11 +432,9 @@ require([
432432 $ ( '.list-group-item__body' ) . each ( function ( ) {
433433 let $group = $ ( this ) ;
434434 let my_id = $group . data ( 'filter-attr-id' ) ;
435- if ( my_id != null )
436- {
435+ if ( my_id != null ) {
437436 let checkboxes = $group . find ( "input:checked" ) . not ( ".hide-zeros" ) . not ( ".sort_val" ) . not ( '.join_val' ) ;
438- if ( checkboxes . length > 0 )
439- {
437+ if ( checkboxes . length > 0 ) {
440438 let values = [ ] ;
441439 checkboxes . each ( function ( ) {
442440 let $checkbox = $ ( this ) ;
@@ -542,10 +540,10 @@ require([
542540 }
543541
544542 window . changePage = function ( wrapper ) {
545- var elem = $ ( '#' + wrapper ) ;
546- var valStr = elem . find ( '.dataTables_controls' ) . find ( '.goto-page-number' ) . val ( ) ;
543+ let elem = $ ( '#' + wrapper ) ;
544+ let valStr = elem . find ( '.dataTables_controls' ) . find ( '.goto-page-number' ) . val ( ) ;
547545 try {
548- var val = parseInt ( valStr ) ;
546+ let val = parseInt ( valStr ) ;
549547 if ( Number . isInteger ( val ) && ( val > 0 ) ) {
550548 elem . find ( 'table' ) . DataTable ( ) . page ( val - 1 ) . draw ( false ) ;
551549 }
0 commit comments