<commit_before>var React = require('react')
var OnClickOutside = require('react-onclickoutside')

var Popups = React.createClass({
  mixins: [ OnClickOutside ]
, getInitialState: function () {
    return { popups: [] }
  }
, componentDidMount: function () {
    if (this.props.clickButtons) document.addEventListener('click', this.spawnLinkedDiv)
    if (this.props.event) document.addEventListener(this.props.event, this.spawnLinkedDiv)
  }
, componentWillUnmount: function () {
    if (this.props.clickButtons) document.removeEventListener('click', this.spawnLinkedDiv)
    if (this.props.event) document.removeEventListener(this.props.event, this.spawnLinkedDiv)
  }
, handleClickOutside: function(e) {
    this.setState({ popups: [] })
  }
, handleClickInside: function(e){
    var t = e.target
    while (t) {
      if (t.dataset && t.dataset.popupkey){
        var popupkey = t.dataset.popupkey
        var popups = this.state.popups
        var ind = -1
        popups.map(function(x, i){
          //TODO get popupkey instead of key
          if (x.key == popupkey)
            ind = i
        })
        this.setState({popups: popups.slice(0, ind +1)})
        return
      }
      t = t.parentNode
    }
  }
, spawnLinkedDiv: function (e) {
    this.handleClickInside(e)

    var data = e.target
    var arr = this.props.data.split('.')
    while(arr.length) {
      data = data[arr.shift()]
      if ( !data ) return
    }

    if(this.props.clickButtons) {
      if (this.props.clickButtons.indexOf(e.button) > -1)
        e.preventDefault()
      else return
    }
    else e.preventDefault()

    var popups = this.state.popups

    var half_w = 0.5*window.innerWidth
    var half_h = 0.5*window.innerHeight
    var x = e.pageX
    var y = e.pageY

    var translateXY = '(-100%, 0%)'
         if (x < half_w && y < half_h) translateXY = '(0%, 0%)'
    else if (x < half_w && y > half_h) translateXY = '(0%, -100%)'
    else if (x > half_w && y > half_h) translateXY = '(-100%, -100%)'

    var s = {
      position: 'fixed'
    , left: e.pageX
    , top: e.pageY
    , transform: 'translate' +translateXY
    }
    var id = Math.random()
    popups.push (
      <div data-popupkey={id} key={id} style={s}>
        <this.props.handler data={data}/>
      </div>
    )
    this.setState({popups: popups})
  }
, render: function() {
    return (<div>{this.state.popups}</div>)
  }
})

module.exports = Popups
<commit_msg>(chg) passing data.nodeValue instead data<commit_after>var React = require('react')
var OnClickOutside = require('react-onclickoutside')

var Popups = React.createClass({
  mixins: [ OnClickOutside ]
, getInitialState: function () {
    return { popups: [] }
  }
, componentDidMount: function () {
    if (this.props.clickButtons) document.addEventListener('click', this.spawnLinkedDiv)
    if (this.props.event) document.addEventListener(this.props.event, this.spawnLinkedDiv)
  }
, componentWillUnmount: function () {
    if (this.props.clickButtons) document.removeEventListener('click', this.spawnLinkedDiv)
    if (this.props.event) document.removeEventListener(this.props.event, this.spawnLinkedDiv)
  }
, handleClickOutside: function(e) {
    this.setState({ popups: [] })
  }
, handleClickInside: function(e){
    var t = e.target
    while (t) {
      if (t.dataset && t.dataset.popupkey){
        var popupkey = t.dataset.popupkey
        var popups = this.state.popups
        var ind = -1
        popups.map(function(x, i){
          //TODO get popupkey instead of key
          if (x.key == popupkey)
            ind = i
        })
        this.setState({popups: popups.slice(0, ind +1)})
        return
      }
      t = t.parentNode
    }
  }
, spawnLinkedDiv: function (e) {
    this.handleClickInside(e)

    var data = e.target
    var arr = this.props.data.split('.')
    while(arr.length) {
      data = data[arr.shift()]
      if ( !data ) return
    }

    if(this.props.clickButtons) {
      if (this.props.clickButtons.indexOf(e.button) > -1)
        e.preventDefault()
      else return
    }
    else e.preventDefault()

    var popups = this.state.popups

    var half_w = 0.5*window.innerWidth
    var half_h = 0.5*window.innerHeight
    var x = e.pageX
    var y = e.pageY

    var translateXY = '(-100%, 0%)'
         if (x < half_w && y < half_h) translateXY = '(0%, 0%)'
    else if (x < half_w && y > half_h) translateXY = '(0%, -100%)'
    else if (x > half_w && y > half_h) translateXY = '(-100%, -100%)'

    var s = {
      position: 'fixed'
    , left: e.pageX
    , top: e.pageY
    , transform: 'translate' +translateXY
    }
    var id = Math.random()
    popups.push (
      <div data-popupkey={id} key={id} style={s}>
        <this.props.handler data={data.nodeValue}/>
      </div>
    )
    this.setState({popups: popups})
  }
, render: function() {
    return (<div>{this.state.popups}</div>)
  }
})

module.exports = Popups

{'fraction_non_alphanumeric': 0.14722675367047308, 'fraction_numerical': 0.009787928221859706, 'mean_word_length': 2.5829072315558803, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '1147532', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1658, 'n_words': 360}