<commit_before>var FBdata = require('./src/data');
var renderer = require('./src/renderer');
var nav = require('./src/navigation');

var showOnePost = function(answer) {
  answer = parseInt(answer, 10);
  if (typeof answer === 'number' && !Number.isNaN(answer) && answer < renderer.getNumberOfPosts()) {
    console.log('ELO!!!');
  } else {
    renderer.all();
    showListMenu();
  }
};

var showListMenu = function() {
  nav.showMenu(
    'Wybierz numer postu do otwarcia lub Ctrl+C aby wyjść',
    showOnePost
  );
};

FBdata(function(err, data) {
  renderer.setData(data);
  renderer.all();
  showListMenu();
});
<commit_msg>[JSNEWS-CLIENT] - switching between views, list->details->list<commit_after>var FBdata = require('./src/data');
var renderer = require('./src/renderer');
var nav = require('./src/navigation');
var currentPost;

var showOnePost = function(answer) {
  answer = parseInt(answer, 10);
  if (typeof answer === 'number' && !Number.isNaN(answer) && answer < renderer.getNumberOfPosts()) {
    currentPost = answer;
    renderer.post(answer, true);
    showPostMenu();
  } else {
    renderer.all();
    showListMenu();
  }
};

var showListMenu = function() {
  nav.showMenu(
    'Wybierz numer postu do otwarcia lub Ctrl+C aby wyjść',
    showOnePost
  );
};

var onePostAction = function(answer) {
  answer = answer.toLowerCase();
  switch (answer) {
    case 'f':
      break;
    case 'w':
      currentPost = null;
      renderer.all();
      showListMenu();
      break;
    default:
      renderer.post(currentPost, true);
      showPostMenu();
  }
}

var showPostMenu = function(){
  nav.showMenu(
    "Wybierz 'f' aby zobaczyć post w przeglądarce lub 'w' aby wrócić" ,
    onePostAction
  );
}

FBdata(function(err, data) {
  renderer.setData(data);
  renderer.all();
  showListMenu();
});

{'fraction_non_alphanumeric': 0.16090060406370127, 'fraction_numerical': 0.002196595277320154, 'mean_word_length': 3.5894206549118386, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '150696', 'n_tokens_mistral': 631, 'n_tokens_neox': 625, 'n_words': 137}