File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -97,11 +97,18 @@ function categoryFilter(show_on_start) {
9797 }
9898 post_list . appendChild ( frag ) ;
9999 parent_node . insertBefore ( post_list , next_sibling ) ;
100- return post_list ;
101100 }
102101
103102 // initialize
104103
104+ if ( show_on_start == 'all' ) {
105+ show_on_start = [ ] ;
106+
107+ category_buttons . forEach ( ( cat ) => {
108+ show_on_start . push ( cat . innerHTML ) ;
109+ } ) ;
110+ }
111+
105112 for ( var i = 0 ; i < show_on_start . length ; i ++ ) {
106113 if ( show_on_start [ i ] == 'reverse' ) {
107114 reversePosts ( ) ;
@@ -123,4 +130,28 @@ function categoryFilter(show_on_start) {
123130 reversePosts ( ) ;
124131 } ) ;
125132
133+ document . getElementById ( 'hide-all' ) . addEventListener ( 'click' , function ( ) {
134+
135+ category_buttons . forEach ( ( but ) => {
136+
137+ if ( but . classList [ 0 ] !== 'disabled' ) {
138+ but . classList . add ( 'disabled' ) ;
139+ }
140+
141+ applySelection ( ) ;
142+ } ) ;
143+ } ) ;
144+
145+ document . getElementById ( 'show-all' ) . addEventListener ( 'click' , function ( ) {
146+
147+ category_buttons . forEach ( ( but ) => {
148+
149+ if ( but . classList [ 0 ] === 'disabled' ) {
150+ but . classList . remove ( 'disabled' ) ;
151+ }
152+
153+ applySelection ( ) ;
154+ } ) ;
155+ } ) ;
156+
126157}
You can’t perform that action at this time.
0 commit comments