<commit_before>grammarMap = require './grammars'
{View, BufferedProcess} = require 'atom'
HeaderView = require './header-view'
RunCustomView = require './run-custom-view'
AnsiFilter = require 'ansi-to-html'
_ = require 'underscore'

# Runs a portion of a script through an interpreter and displays it line by line
module.exports =
class ScriptView extends View
  @bufferedProcess: null

  @content: ->
    @div =>
      @subview 'customOptionView', new CustomOptionView()
      @subview 'headerView', new HeaderView()
      # Display layout and outlets
      @div class: 'tool-panel panel panel-bottom padding script-view native-key-bindings', outlet: 'script', tabindex: -1, =>
        @div class: 'panel-body padded output', outlet: 'output'

  initialize: (serializeState) ->
    # Bind commands
    atom.workspaceView.command "script:run", => @start(configure=false)
    atom.workspaceView.command "script:run-options", => @start(configure=true)
    atom.workspaceView.command "script:toggle-options", => @toggleConfigureOptions()
    atom.workspaceView.command "script:save-options", => @saveOptions()
    atom.workspaceView.command "script:close-view", => @close()
    atom.workspaceView.command "script:kill-process", => @stop()

    @ansiFilter = new AnsiFilter
    @options =
        cmd_cwd: null
        cmd_args: []
        script_args: []

  serialize: ->

  start: (configure) ->
    # Get current editor
    editor = atom.workspace.getActiveEditor()

    # No editor available, do nothing
    if not editor?
      return

    @resetView()
    @toggleConfigureOptions(mode=configure)
    info = @setup(editor)
    if info then @run(info.command, info.args)


  toggleConfigureOptions: (mode=null) ->
    if mode?
      @configureOptionsToggle = !mode
    if @configureOptionsToggle
      @customOptionView.hide()
      @configureOptionsToggle = false
    else
      @customOptionView.show()
      @configureOptionsToggle = true
<commit_msg>Simplified the toggle code to use jquery .toggle() and the ability to force with .hide() or .show() still. Behavior should still be the same so far<commit_after>grammarMap = require './grammars'
{View, BufferedProcess} = require 'atom'
HeaderView = require './header-view'
RunCustomView = require './run-custom-view'
AnsiFilter = require 'ansi-to-html'
_ = require 'underscore'

# Runs a portion of a script through an interpreter and displays it line by line
module.exports =
class ScriptView extends View
  @bufferedProcess: null

  @content: ->
    @div =>
      @subview 'customOptionView', new CustomOptionView()
      @subview 'headerView', new HeaderView()
      # Display layout and outlets
      @div class: 'tool-panel panel panel-bottom padding script-view native-key-bindings', outlet: 'script', tabindex: -1, =>
        @div class: 'panel-body padded output', outlet: 'output'

  initialize: (serializeState) ->
    # Bind commands
    atom.workspaceView.command "script:run", => @start(configure='hide')
    atom.workspaceView.command "script:run-options", => @start(configure='show')
    atom.workspaceView.command "script:toggle-options", => @toggleConfigureOptions()
    atom.workspaceView.command "script:save-options", => @saveOptions()
    atom.workspaceView.command "script:close-view", => @close()
    atom.workspaceView.command "script:kill-process", => @stop()

    @ansiFilter = new AnsiFilter
    @options =
        cmd_cwd: null
        cmd_args: []
        script_args: []

  serialize: ->

  start: (configure) ->
    # Get current editor
    editor = atom.workspace.getActiveEditor()

    # No editor available, do nothing
    if not editor?
      return

    @resetView()
    @toggleConfigureOptions(command=configure)
    info = @setup(editor)
    if info then @run(info.command, info.args)


  toggleConfigureOptions: (command) ->
    if command?
      if command == 'show'
        @customOptionView.show()
      if command == 'hide'
        @customOptionView.hide()
    else
      @customOptionView.toggle()

{'fraction_non_alphanumeric': 0.12187187187187187, 'fraction_numerical': 0.0005005005005005005, 'mean_word_length': 3.5575826681870013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7520420', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1151, 'n_words': 312}