<commit_before>'use strict'

const { Menu } = require('electron')
const electronContextMenu = require('electron-context-menu')

module.exports = function contextMenu(window, soundcloud) {
  electronContextMenu({
    window: window,
    prepend: params => {
      if (params.mediaType == 'none')
        return [
          {
            label: 'Home',
            click() {
              soundcloud.goHome()
            }
          },
          {
            label: 'Go back',
            enabled: soundcloud.canGoBack(),
            click() {
              soundcloud.goBack()
            }
          },
          {
            label: 'Go forward',
            enabled: soundcloud.canGoForward(),
            click() {
              soundcloud.goForward()
            }
          }
        ]
    }
  })<commit_msg>Prevent exception on right clicking certain elements<commit_after>'use strict'

const { Menu } = require('electron')
const electronContextMenu = require('electron-context-menu')

module.exports = function contextMenu(window, soundcloud) {
  electronContextMenu({
    window: window,
    prepend: params => {
      if (params.mediaType == 'none')
        return [
          {
            label: 'Home',
            click() {
              soundcloud.goHome()
            }
          },
          {
            label: 'Go back',
            enabled: soundcloud.canGoBack(),
            click() {
              soundcloud.goBack()
            }
          },
          {
            label: 'Go forward',
            enabled: soundcloud.canGoForward(),
            click() {
              soundcloud.goForward()
            }
          }
        ]
      else
        // See https://github.com/sindresorhus/electron-context-menu/issues/24
        return []
    }
  })
{'fraction_non_alphanumeric': 0.11605633802816902, 'fraction_numerical': 0.0011267605633802818, 'mean_word_length': 1.4065040650406504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '3993853', 'n_tokens_mistral': 462, 'n_tokens_neox': 455, 'n_words': 88}