<commit_before>define( [ "core/logger", "core/eventmanager" ], function( Logger, EventManager ) {

  var POPCORN_URL = "../external/popcorn-js/popcorn.js",

  Page = function() {
    
    var _eventManager = new EventManager( this );

    this.scrape = function() {
      var medias = [], targets = [];

      function scrapeChildren( rootNode ) {
        var children = rootNode.children;

        for( var i=0; i<children.length; i++ ) {
          var thisChild = children[ i ];
          if ( !thisChild ) {
            continue;
          }
          // if DOM element has an data-butter tag that is equal to target or media,
          // add it to butters target list with a respective type
          if ( thisChild.getAttribute ) {
            if( thisChild.getAttribute( "data-butter" ) === "target" ) {
              $( thisChild ).droppable({
                greedy: true,
                drop: function( event, ui ) {

                  // we only care about it if it's not already on this track
                  _eventManager.dispatch( "trackeventrequested", {
                    event: event,
                    ui: ui
                  });
                }
              });
              targets.push( thisChild );
            }
            else if( thisChild.getAttribute( "data-butter" ) === "media" ) {
              medias.push( thisChild ); 
            } // else
          } //if
          if ( thisChild.children && thisChild.children.length > 0 ) {
            scrapeChildren( thisChild );
          } // if
        } // for
      } //scrapeChildren

      scrapeChildren( document.body );

      return {
        media: medias,
        target: targets
      }; 
    }; // scrape

    this.preparePopcorn = function( readyCallback ) {

      function isPopcornReady() {
        if ( !window.Popcorn ) {<commit_msg>Removed old nasty recursive code in the scraper<commit_after>define( [ "core/logger", "core/eventmanager" ], function( Logger, EventManager ) {

  var POPCORN_URL = "../external/popcorn-js/popcorn.js",

  Page = function() {
    
    var _eventManager = new EventManager( this );

    this.scrape = function() {
      var rootNode = document.body,
          targets = rootNode.querySelectorAll("*[data-butter='target']"),
          medias = rootNode.querySelectorAll("*[data-butter='media']");

      // Once #389 lands this can disappear and we can simply return the result of the two querySelectorAll results
      for( var i = 0, il = targets.length; i < il; i++ ) {
        $( targets[ i ] ).droppable({
          greedy: true,
          drop: function( event, ui ) {

            // we only care about it if it's not already on this track
            _eventManager.dispatch( "trackeventrequested", {
              event: event,
              ui: ui
            });
          }
        });
      }

      return {
        media: medias,
        target: targets
      }; 
    }; // scrape

    this.preparePopcorn = function( readyCallback ) {

      function isPopcornReady() {
        if ( !window.Popcorn ) {
{'fraction_non_alphanumeric': 0.11624099541584806, 'fraction_numerical': 0.0019646365422396855, 'mean_word_length': 1.6940035273368608, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '7444843', 'n_tokens_mistral': 869, 'n_tokens_neox': 817, 'n_words': 229}