<commit_before>/* eslint-env node */
'use strict';

module.exports = {
  name: 'hash-to-query',

  isDevelopingAddon: function() {
    return true;
  },

  contentFor (type, config) {
    if (type === 'body') {
      return `
<script type='text/javascript'>
  let hash = window.location.hash;
  if (hash && hash.length > 1) {
    let pathName = window.location.pathname;
    console.log(pathName);
    if (!pathName.includes('/methods/') &&
        !pathName.includes('/properties/') &&
        !pathName.includes('/events/')) {
      let type = hash.slice(1, hash.indexOf('_'));
      let name = hash.slice(hash.indexOf('_') + 1, hash.length);
      let anchor = '?anchor=' + name + '&show=inherited,protected,private,deprecated';
      let newPath = pathName;
      if (type === 'method') {
        newPath = pathName + '/methods/' + name;
      } else if (type === 'property') {
        newPath = pathName + '/properties/' + name;
      } else if (type === 'event') {
        newPath = pathName + '/events/' + name;
      }
      window.location.href = window.location.origin + newPath + anchor;
    }
  }
</script>
`
    }
    return '';
  }
};<commit_msg>change let to var and use indexOf instead of includes (#256)<commit_after>/* eslint-env node */
'use strict';

module.exports = {
  name: 'hash-to-query',

  isDevelopingAddon: function() {
    return true;
  },

  contentFor (type, config) {
    if (type === 'body') {
      return `
<script type='text/javascript'>
  var hash = window.location.hash;
  if (hash && hash.length > 1) {
    var pathName = window.location.pathname;
    if (pathName.indexOf('/methods/') === -1 &&
        pathName.indexOf('/properties/') === -1 &&
        pathName.indexOf('/events/') === -1) {
      var type = hash.slice(1, hash.indexOf('_'));
      var name = hash.slice(hash.indexOf('_') + 1, hash.length);
      var anchor = '?anchor=' + name + '&show=inherited,protected,private,deprecated';
      var newPath = pathName;
      if (type === 'method') {
        newPath = pathName + '/methods/' + name;
      } else if (type === 'property') {
        newPath = pathName + '/properties/' + name;
      } else if (type === 'event') {
        newPath = pathName + '/events/' + name;
      }
      window.location.href = window.location.origin + newPath + anchor;
    }
  }
</script>
`
    }
    return '';
  }
};
{'fraction_non_alphanumeric': 0.18089171974522292, 'fraction_numerical': 0.005095541401273885, 'mean_word_length': 2.580547112462006, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6407313', 'n_tokens_mistral': 762, 'n_tokens_neox': 749, 'n_words': 176}