11'use strict' ;
22
3- const appInstance = require ( '../app' ) ;
3+ const app = require ( '../app' ) ;
44const Server = require ( '../server' ) ;
55const showAlgorithm = require ( './show_algorithm' ) ;
66
@@ -13,7 +13,7 @@ const addAlgorithmToCategoryDOM = (category, subList, algorithm) => {
1313 . append ( subList [ algorithm ] )
1414 . attr ( 'data-algorithm' , algorithm )
1515 . attr ( 'data-category' , category )
16- . click ( function ( ) {
16+ . click ( function ( ) {
1717 Server . loadAlgorithm ( category , algorithm ) . then ( ( data ) => {
1818 showAlgorithm ( category , algorithm , data ) ;
1919 } ) ;
@@ -27,14 +27,15 @@ const addCategoryToDOM = (category) => {
2727 const {
2828 name : categoryName ,
2929 list : categorySubList
30- } = appInstance . getCategory ( category ) ;
30+ } = app . getCategory ( category ) ;
3131
3232 const $category = $ ( '<button class="category">' )
3333 . append ( '<i class="fa fa-fw fa-caret-right">' )
34- . append ( categoryName ) ;
34+ . append ( categoryName )
35+ . attr ( 'data-category' , category ) ;
3536
36- $category . click ( function ( ) {
37- $ ( `[data-category="${ category } "]` ) . toggleClass ( 'collapse' ) ;
37+ $category . click ( function ( ) {
38+ $ ( `.indent [data-category="${ category } "]` ) . toggleClass ( 'collapse' ) ;
3839 $ ( this ) . find ( 'i.fa' ) . toggleClass ( 'fa-caret-right fa-caret-down' ) ;
3940 } ) ;
4041
@@ -46,5 +47,5 @@ const addCategoryToDOM = (category) => {
4647} ;
4748
4849module . exports = ( ) => {
49- each ( appInstance . getCategories ( ) , addCategoryToDOM ) ;
50+ each ( app . getCategories ( ) , addCategoryToDOM ) ;
5051} ;
0 commit comments