<commit_before>'use strict';

var React = require('react');

var scriptIsAdded = false;

var Disqus = React.createClass({
  propTypes:{
    shortName: React.PropTypes.string.isRequired,
    identifier: React.PropTypes.string.isRequired,
    title: React.PropTypes.string.isRequired,
    url: React.PropTypes.string.isRequired

  },
  componentDidMount: function() {
    if (!scriptIsAdded) {
      return this.addScript();
    }
  },
  addScript: function() {
    var disqus_shortname = this.props.shortName; //jshint ignore:line
    var disqus_identifier = this.props.identifier;//jshint ignore:line
    var disqus_title = this.props.title;//jshint ignore:line
    var disqus_url = this.props.url;//jshint ignore:line

    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; //jshint ignore:line
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  },
  render: function() {
    return <div id="disqus_thread"></div>;
  }
});

module.exports = Disqus;<commit_msg>fix disqus reset<commit_after>'use strict';

var React = require('react');

var scriptIsAdded = false;

var Disqus = React.createClass({
  propTypes:{
    shortName: React.PropTypes.string.isRequired,
    identifier: React.PropTypes.string.isRequired,
    title: React.PropTypes.string.isRequired,
    url: React.PropTypes.string.isRequired

  },
  componentDidMount: function() {
    if (!scriptIsAdded) {
      return this.addScript();
    }
  },
  addScript: function() {
    var disqus_shortname = this.props.shortName; //jshint ignore:line
    var disqus_identifier = this.props.identifier;//jshint ignore:line
    var disqus_title = this.props.title;//jshint ignore:line
    var disqus_url = this.props.url;//jshint ignore:line

    if (window.DISQUS) {
      window.DISQUS.reset({
        reload: true,
        config: function () {
          this.page.identifier = disqus_identifier; // jshint ignore:line
          this.page.url = disqus_url; // jshint ignore:line
          this.page.title = disqus_title; // jshint ignore:line
        }
      });
    }else{
      var dsq = document.createElement('script');
      dsq.type = 'text/javascript';
      dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; //jshint ignore:line
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    }
  },
  render: function() {
    return <div id="disqus_thread"></div>;
  }
});

module.exports = Disqus;
{'fraction_non_alphanumeric': 0.14269362838611216, 'fraction_numerical': 0.0015261350629530714, 'mean_word_length': 3.37, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2628229', 'n_tokens_mistral': 879, 'n_tokens_neox': 872, 'n_words': 153}