<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const ReactDOM = require('react-dom')
const ImmutableComponent = require('./immutableComponent')
const contextMenus = require('../contextMenus')
const WindowActions = require('../actions/windowActions')
const AppActions = require('../actions/appActions')
const siteTags = require('../constants/siteTags')
const siteUtil = require('../state/siteUtil')
const dragTypes = require('../constants/dragTypes')
const Button = require('../components/button')
const cx = require('../lib/classSet.js')
const dnd = require('../dnd')

// TODO: Obtain from the less file
const bookmarkMaxWidth = 100

class BookmarkToolbarButton extends ImmutableComponent {
  click (e) {
    if (this.props.bookmark.get('tags').includes(siteTags.BOOKMARK_FOLDER)) {
      contextMenus.onShowBookmarkFolderMenu(this.props.bookmarks, this.props.bookmark, this.props.activeFrame, {target: ReactDOM.findDOMNode(this)})
      return
    }
    const isDarwin = process.platform === 'darwin'
    if (e.ctrlKey && !isDarwin ||
        e.metaKey && isDarwin) {
      WindowActions.newFrame({
        location: this.props.bookmark.get('location'),
        partitionNumber: this.props.bookmark.get('partitionNumber')
      }, false)
    } else {
      WindowActions.loadUrl(this.props.activeFrame, this.props.bookmark.get('location'))
    }
  }

  onDragStart (e) {
    dnd.setupDataTransferURL(e.dataTransfer, this.props.bookmark.get('location'), this.props.bookmark.get('customTitle') || this.props.bookmark.get('title'))
    dnd.onDragStart(dragTypes.BOOKMARK, this.props.bookmark, e)
  }
<commit_msg>Add middle click to open bookmarks<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const ReactDOM = require('react-dom')
const ImmutableComponent = require('./immutableComponent')
const contextMenus = require('../contextMenus')
const WindowActions = require('../actions/windowActions')
const AppActions = require('../actions/appActions')
const siteTags = require('../constants/siteTags')
const siteUtil = require('../state/siteUtil')
const dragTypes = require('../constants/dragTypes')
const Button = require('../components/button')
const cx = require('../lib/classSet.js')
const dnd = require('../dnd')

// TODO: Obtain from the less file
const bookmarkMaxWidth = 100

class BookmarkToolbarButton extends ImmutableComponent {
  click (e) {
    if (this.props.bookmark.get('tags').includes(siteTags.BOOKMARK_FOLDER)) {
      contextMenus.onShowBookmarkFolderMenu(this.props.bookmarks, this.props.bookmark, this.props.activeFrame, {target: ReactDOM.findDOMNode(this)})
      return
    }
    const isDarwin = process.platform === 'darwin'
    if (e.ctrlKey && !isDarwin ||
        e.metaKey && isDarwin ||
        e.button === 1) {
      WindowActions.newFrame({
        location: this.props.bookmark.get('location'),
        partitionNumber: this.props.bookmark.get('partitionNumber')
      }, false)
    } else {
      WindowActions.loadUrl(this.props.activeFrame, this.props.bookmark.get('location'))
    }
  }

  onDragStart (e) {
    dnd.setupDataTransferURL(e.dataTransfer, this.props.bookmark.get('location'), this.props.bookmark.get('customTitle') || this.props.bookmark.get('title'))
    dnd.onDragStart(dragTypes.BOOKMARK, this.props.bookmark, e)
  }

{'fraction_non_alphanumeric': 0.14413924394887137, 'fraction_numerical': 0.004079412564590699, 'mean_word_length': 4.073103448275862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2626790', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1108, 'n_words': 249}