<commit_before>/*
 * Copyright 2012 The Toolkitchen Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */
(function() {
  var thisFile = 'pointerevents.js';
  var source = '', base = '';
  var s$ = document.querySelectorAll('script[src]');
  Array.prototype.forEach.call(s$, function(s) {
    var src = s.getAttribute('src');
    if (src.slice(-thisFile.length) == thisFile) {
      source = s;
      base = src.slice(0, -thisFile.length);
    }
  });
  var require = function(inSrc) {
    document.write('<script src="' + base + inSrc + '"></script>');
  };
  [
    'initialize.js',
    'pointermap.js',
    'dispatcher.js',
    'platform-events.js',
    'flick.js',
    'finalize.js'
  ].forEach(require);
})();<commit_msg>Allow for loading from inside a web component<commit_after>/*
 * Copyright 2012 The Toolkitchen Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */
(function() {
  var thisFile = 'pointerevents.js';
  var libLocation = '';
  /*
   * if we are loaded inside a component, we need to know the relative path from
   * that location, not the document
   */
  var baseUrlFromNode = function(inNode) {
    var n = inNode, p;
    while ((p = n.parentNode)) {
      n = p;
    }
    return (n && (n.URL || n.name)) || '';
  };
  var appendScriptPath = function(inBasePath, inRelPath) {
    // include last slash as well
    var ls = inBasePath.lastIndexOf('/') + 1;
    return inBasePath.slice(0, ls) + inRelPath;
  };
  var require = function(inSrc) {
    document.write('<script src="' + libLocation + inSrc + '"></script>');
  };
  var s$ = document.querySelectorAll('script[src]');
  Array.prototype.forEach.call(s$, function(s) {
    var src = s.getAttribute('src');
    if (src.slice(-thisFile.length) == thisFile) {
      var source = baseUrlFromNode(s);
      var base = src.slice(0, -thisFile.length);
      libLocation = appendScriptPath(source, base);
    }
  });
  [
    'initialize.js',
    'pointermap.js',
    'dispatcher.js',
    'platform-events.js',
    'flick.js',
    'finalize.js'
  ].forEach(require);
})();
{'fraction_non_alphanumeric': 0.15846501128668172, 'fraction_numerical': 0.005417607223476298, 'mean_word_length': 3.073529411764706, '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': '5355451', 'n_tokens_mistral': 727, 'n_tokens_neox': 721, 'n_words': 196}