@@ -120,12 +120,12 @@ <h4 class="panel-title">
120120 {% endif %}
121121 < p > Also show special sessions of these groups:</ p >
122122 < div class ="btn-group btn-group-justified ">
123- < div class ="btn-group "> < button class ="btn btn-default pickviewneg active iepg "> IEPG</ button > </ div >
124- < div class ="btn-group "> < button class ="btn btn-default pickviewneg active tools "> Tools</ button > </ div >
125- < div class ="btn-group "> < button class ="btn btn-default pickviewneg active edu "> EDU</ button > </ div >
126- < div class ="btn-group "> < button class ="btn btn-default pickviewneg active ietf "> IETF</ button > </ div >
127- < div class ="btn-group "> < button class ="btn btn-default pickviewneg active iesg "> IESG</ button > </ div >
128- < div class ="btn-group "> < button class ="btn btn-default pickviewneg active iab "> IAB</ button > </ div >
123+ < div class ="btn-group "> < button class ="btn btn-default pickview iepg "> IEPG</ button > </ div >
124+ < div class ="btn-group "> < button class ="btn btn-default pickview tools "> Tools</ button > </ div >
125+ < div class ="btn-group "> < button class ="btn btn-default pickview edu "> EDU</ button > </ div >
126+ < div class ="btn-group "> < button class ="btn btn-default pickview ietf "> IETF</ button > </ div >
127+ < div class ="btn-group "> < button class ="btn btn-default pickview iesg "> IESG</ button > </ div >
128+ < div class ="btn-group "> < button class ="btn btn-default pickview iab "> IAB</ button > </ div >
129129 </ div >
130130 </ div >
131131 </ div >
@@ -362,10 +362,13 @@ <h2>
362362 function parse_query_params ( qs ) {
363363 var params = { } ;
364364 qs = qs . replace ( / ^ \? / , '' ) ;
365- $ . each ( qs . split ( '&' ) , function ( i , v ) {
366- var toks = v . split ( '=' , 2 )
367- params [ toks [ 0 ] ] = toks [ 1 ] . toLowerCase ( ) ;
368- } ) ;
365+ if ( qs ) {
366+ var param_strs = qs . split ( '&' ) ;
367+ for ( var ii = 0 ; ii < param_strs . length ; ii ++ ) {
368+ var toks = param_strs [ ii ] . split ( '=' , 2 )
369+ params [ toks [ 0 ] ] = toks [ 1 ] || true ;
370+ }
371+ }
369372 return params ;
370373 }
371374
@@ -374,43 +377,56 @@ <h2>
374377 return qparams [ filt ] ? qparams [ filt ] . split ( ',' ) : [ ] ;
375378 }
376379
377- function toggle_visibility ( ) {
378- var qparams = parse_query_params ( window . location . search ) ;
379- var show_groups = get_filter_from_qparams ( qparams , 'show' ) ;
380- var hide_groups = get_filter_from_qparams ( qparams , 'hide' ) ;
380+ function get_filter_params ( qparams ) {
381+ return {
382+ show_groups : get_filter_from_qparams ( qparams , 'show' ) ,
383+ hide_groups : get_filter_from_qparams ( qparams , 'hide' ) ,
384+ show_types : get_filter_from_qparams ( qparams , 'showtypes' ) ,
385+ hide_types : get_filter_from_qparams ( qparams , 'hidetypes' ) ,
386+ } ;
387+ }
381388
389+ function toggle_visibility ( filter_params ) {
382390 // reset UI elements to default state
383391 $ ( ".pickview" ) . removeClass ( "active disabled" ) ;
384392 $ ( ".pickviewneg" ) . addClass ( "active" ) ;
385393
386- if ( show_groups . length || hide_groups . length ) {
387- // if groups were selected for filtering, hide all rows that are
388- // hidden by default, show all rows that are shown by default
394+ if ( filter_params [ 'show_groups' ] . length ||
395+ filter_params [ 'hide_groups' ] . length ||
396+ filter_params [ 'show_types' ] . length ||
397+ filter_params [ 'hide_types' ] . length
398+ ) {
399+ // if groups were selected for filtering, hide all rows by default
389400 $ ( '[id^="row-"]' ) . hide ( ) ;
390- $ . each ( $ ( ".pickviewneg" ) . text ( ) . trim ( ) . split ( / + / ) , function ( i , v ) {
391- v = v . trim ( ) . toLowerCase ( ) ;
392- $ ( '[id^="row-"]' ) . filter ( '[id*="-' + v + '"]' ) . show ( ) ;
393- } ) ;
394401
395402 // show the customizer
396403 $ ( "#customize" ) . collapse ( "show" ) ;
397404
398405 // loop through the has items and change the UI element and row visibilities accordingly
399- $ . each ( hide_groups , function ( i , v ) {
400- // this is a "negative" item: when present, hide these rows
406+ $ . each ( filter_params [ 'show_groups' ] , function ( i , v ) {
407+ // this is a regular item by wg: when present, show these rows
408+ $ ( '[id^="row-"]' ) . filter ( '[id*="-' + v + '"]' ) . show ( ) ;
409+ $ ( ".view." + v ) . find ( "button" ) . addClass ( "active disabled" ) ;
410+ $ ( "button.pickview." + v ) . addClass ( "active" ) ;
411+ } ) ;
412+ $ . each ( filter_params [ 'show_types' ] , function ( i , v ) {
413+ // this is a regular item by type: when present, show these rows
414+ $ ( '[id^="row-"]' ) . filter ( '[timeslot-type*="' + v + '"]' ) . show ( ) ;
415+ } ) ;
416+ $ . each ( filter_params [ 'hide_groups' ] , function ( i , v ) {
417+ // this is a "negative" item by wg: when present, hide these rows
401418 $ ( '[id^="row-"]' ) . filter ( '[id*="-' + v + '"]' ) . hide ( ) ;
402419 $ ( ".view." + v ) . find ( "button" ) . removeClass ( "active disabled" ) ;
403420 $ ( "button.pickviewneg." + v ) . removeClass ( "active" ) ;
404421 } ) ;
405- $ . each ( show_groups , function ( i , v ) {
406- // this is a regular item: when present, show these rows
407- $ ( '[id^="row-"]' ) . filter ( '[id*="-' + v + '"]' ) . show ( ) ;
408- $ ( ".view." + v ) . find ( "button" ) . addClass ( "active disabled" ) ;
409- $ ( "button.pickview." + v ) . addClass ( "active" ) ;
422+ $ . each ( filter_params [ 'hide_types' ] , function ( i , v ) {
423+ // this is a "negative" item by type: when present, hide these rows
424+ $ ( '[id^="row-"]' ) . filter ( '[timeslot-type*="' + v + '"]' ) . hide ( ) ;
410425 } ) ;
411426
412427 // show the week view
413- $ ( "#weekview" ) . attr ( "src" , "week-view.html" + window . location . search ) . removeClass ( "hidden" ) ;
428+ update_weekview ( ) ;
429+ $ ( "#weekview" ) . removeClass ( "hidden" ) ;
414430
415431 // show the custom .ics link
416432 $ ( "#ical-link" ) . attr ( "href" , $ ( "#ical-link" ) . attr ( "href" ) . split ( "?" ) [ 0 ] + window . location . search ) ;
@@ -426,16 +442,14 @@ <h2>
426442 $ ( ".pickview, .pickviewneg" ) . click ( function ( ) {
427443 // Get clicked item label
428444 var item = $ ( this ) . text ( ) . trim ( ) . toLowerCase ( ) ;
429- var qparams = parse_query_params ( window . location . search ) ;
430- var show_groups = get_filter_from_qparams ( qparams , 'show' ) ;
431- var hide_groups = get_filter_from_qparams ( qparams , 'hide' ) ;
445+ var fp = get_filter_params ( parse_query_params ( window . location . search ) ) ;
432446
433447 if ( $ ( this ) . hasClass ( "pickviewneg" ) ) {
434- toggle_list_item ( hide_groups , item ) ;
448+ toggle_list_item ( fp [ ' hide_groups' ] , item ) ;
435449 } else {
436- toggle_list_item ( show_groups , item ) ;
450+ toggle_list_item ( fp [ ' show_groups' ] , item ) ;
437451 }
438- update_filters ( show_groups , hide_groups ) ;
452+ update_filters ( fp ) ;
439453 } ) ;
440454
441455 /* Add to list if not present, remove if present */
@@ -448,14 +462,20 @@ <h2>
448462 }
449463 }
450464
451- function update_filters ( show , hide ) {
465+ function update_filters ( filter_params ) {
452466 var qparams = [ ] ;
453467 var search = '' ;
454- if ( show . length > 0 ) {
455- qparams . push ( 'show=' + show . join ( ) ) ;
468+ if ( filter_params [ 'show_groups' ] . length > 0 ) {
469+ qparams . push ( 'show=' + filter_params [ 'show_groups' ] . join ( ) ) ;
470+ }
471+ if ( filter_params [ 'hide_groups' ] . length > 0 ) {
472+ qparams . push ( 'hide=' + filter_params [ 'hide_groups' ] . join ( ) ) ;
473+ }
474+ if ( filter_params [ 'show_types' ] . length > 0 ) {
475+ qparams . push ( 'showtypes=' + filter_params [ 'show_types' ] . join ( ) ) ;
456476 }
457- if ( hide . length > 0 ) {
458- qparams . push ( 'hide =' + hide . join ( ) ) ;
477+ if ( filter_params [ 'hide_types' ] . length > 0 ) {
478+ qparams . push ( 'hidetypes =' + filter_params [ 'hide_types' ] . join ( ) ) ;
459479 }
460480 if ( qparams . length > 0 ) {
461481 search = '?' + qparams . join ( '&' ) ;
@@ -466,15 +486,32 @@ <h2>
466486 if ( window . history && window . history . replaceState ) {
467487 // Keep current origin, replace search string, no page reload
468488 history . replaceState ( { } , document . title , new_url ) ;
469- toggle_visibility ( ) ;
489+ toggle_visibility ( filter_params ) ;
470490 } else {
471491 // No window.history.replaceState support, page reload required
472492 window . location = new_url ;
473493 }
474494 }
475495
496+ function update_weekview ( ) {
497+ var wv_iframe = document . getElementById ( 'weekview' ) ;
498+ var wv_window = wv_iframe . contentWindow ;
499+ var new_url = 'week-view.html' + window . location . search ;
500+ if ( wv_iframe . src && wv_window . history && wv_window . history . replaceState ) {
501+ wv_window . history . replaceState ( { } , '' , new_url ) ;
502+ wv_window . draw_calendar ( )
503+ } else {
504+ // ho history.replaceState, page reload required
505+ wv_iframe . src = new_url ;
506+ }
507+ }
508+
476509 $ ( document ) . ready ( function ( ) {
477- toggle_visibility ( ) ;
510+ toggle_visibility (
511+ get_filter_params (
512+ parse_query_params ( window . location . search )
513+ )
514+ ) ;
478515 } ) ;
479516
480517 $ ( ".modal" ) . on ( "show.bs.modal" , function ( ) {
0 commit comments