public/js/main.js
function modifyState($n) {
    var state = self.state;

    function selectByStateRecursive(name) {
      if (state.recursive) {
        return $n.find(name);
      } else {
        return $n.children(name)
      }
    }

    var a;
    var b;
    if (state.mode == 'code') {
      a = selectByStateRecursive('pre:visible');
      if (a.length > 0)
//        a.hide();
        hideShowCode(a, 'hide');
      else {
        a = selectByStateRecursive('pre');
//        a.show();
        hideShowCode(a, 'show');
      }
    }
    if (state.mode == 'childs') {
      a = selectByStateRecursive('.node:visible');
      if (a.length > 0)
        hideShowNodes(a, 'hide');
//        a.hide();
      else {
        a = selectByStateRecursive('.node');
//        a.show();
        hideShowNodes(a, 'show');
      }
    }
    if (state.mode == 'code childs') {
      a = selectByStateRecursive('.node:hidden');
      b = selectByStateRecursive('pre:hidden');

      if (a.length > 0 || b.length > 0) {
        hideShowNodes(a, 'show');
        hideShowCode(b, 'show');
//        a.show();
//        b.show();
      } else {
        a = selectByStateRecursive('.node');
        b = selectByStateRecursive('pre');
        hideShowNodes(a, 'hide');
        hideShowCode(b, 'hide');
//        a.hide();
//        b.hide();
      }
    }
  }
function modifyState($n) {
    var state = self.state;

    function selectByStateRecursive(name) {
      if (state.recursive) {
        return $n.find(name);
      } else {
        return $n.children(name)
      }
    }

    var a;
    var b;
    if (state.mode == 'code') {
      a = selectByStateRecursive('pre:visible');
      if (a.length > 0)
//        a.hide();
        hideShowCode(a, 'hide');
      else {
        a = selectByStateRecursive('pre');
//        a.show();
        hideShowCode(a, 'show');
      }
    }
    if (state.mode == 'childs') {
      a = selectByStateRecursive('.node:visible');
      if (a.length > 0)
        hideShowNodes(a, 'hide');
//        a.hide();
      else {
        a = selectByStateRecursive('.node');
//        a.show();
        hideShowNodes(a, 'show');
      }
    }
    if (state.mode == 'code childs') {
      a = selectByStateRecursive('.node:hidden');
      b = selectByStateRecursive('pre:hidden');

      if (a.length > 0 || b.length > 0) {
        hideShowNodes(a, 'show');
        hideShowCode(b, 'show');
//        a.show();
//        b.show();
      } else {
        a = selectByStateRecursive('.node');
        b = selectByStateRecursive('pre');
        hideShowNodes(a, 'hide');
        hideShowCode(b, 'hide');
//        a.hide();
//        b.hide();
      }
    }
  }
function modifyState ( $n ) { var state = self . state ; function selectByStateRecursive ( name ) { if ( state . recursive ) { return $n . find ( name ) ; } else { return $n . children ( name ) } } var a ; var b ; if ( state . mode == 'code' ) { a = selectByStateRecursive ( 'pre:visible' ) ; if ( a . length > 0 ) //        a.hide(); hideShowCode ( a , 'hide' ) ; else { a = selectByStateRecursive ( 'pre' ) ; //        a.show(); hideShowCode ( a , 'show' ) ; } } if ( state . mode == 'childs' ) { a = selectByStateRecursive ( '.node:visible' ) ; if ( a . length > 0 ) hideShowNodes ( a , 'hide' ) ; //        a.hide(); else { a = selectByStateRecursive ( '.node' ) ; //        a.show(); hideShowNodes ( a , 'show' ) ; } } if ( state . mode == 'code childs' ) { a = selectByStateRecursive ( '.node:hidden' ) ; b = selectByStateRecursive ( 'pre:hidden' ) ; if ( a . length > 0 || b . length > 0 ) { hideShowNodes ( a , 'show' ) ; hideShowCode ( b , 'show' ) ; //        a.show(); //        b.show(); } else { a = selectByStateRecursive ( '.node' ) ; b = selectByStateRecursive ( 'pre' ) ; hideShowNodes ( a , 'hide' ) ; hideShowCode ( b , 'hide' ) ; //        a.hide(); //        b.hide(); } } }
DOM UPDATE STATE [
DOM UPDATE STATE [