<commit_before>import Ember from 'ember';

export default Ember.Controller.extend({

  actions: {

    startArtwork: function() {
      this.set('formError', false);
      var sketches = this.get('sketches');
      var artwork = this.get('artwork');
      // FIXME Find a better solution later
      artwork = artwork.replace(/\W/g, '');
      for (var i = 0; i < sketches.length; i++) {
        if (artwork === sketches[i].url) {
          this.set('formError', true);
          return;
        }
      }
      this.transitionToRoute('/' + artwork);
    },

    setupSketch: function(sketch) {
      if (Ember.$('#' + sketch.url).length == 0) {
        setTimeout(function() {
          this.send('setupSketch', sketch);
        }.bind(this), 1000);
        return;
      }
      if (sketch.initialized) {
        return;
      }
      sketch.initialized = true;

      var strokes = JSON.parse(sketch.json_data).strokes;

      var sketchpad = new Sketchpad({
        element: '#' + sketch.url,
        strokes: strokes,
        readOnly: true,
      });
      sketchpad.animate(7, true, 1500);
    },
  },
});<commit_msg>Do not loop animations on index<commit_after>import Ember from 'ember';

export default Ember.Controller.extend({

  actions: {

    startArtwork: function() {
      this.set('formError', false);
      var sketches = this.get('sketches');
      var artwork = this.get('artwork');
      // FIXME Find a better solution later
      artwork = artwork.replace(/\W/g, '');
      for (var i = 0; i < sketches.length; i++) {
        if (artwork === sketches[i].url) {
          this.set('formError', true);
          return;
        }
      }
      this.transitionToRoute('/' + artwork);
    },

    setupSketch: function(sketch) {
      if (Ember.$('#' + sketch.url).length == 0) {
        setTimeout(function() {
          this.send('setupSketch', sketch);
        }.bind(this), 1000);
        return;
      }
      if (sketch.initialized) {
        return;
      }
      sketch.initialized = true;

      var strokes = JSON.parse(sketch.json_data).strokes;

      var sketchpad = new Sketchpad({
        element: '#' + sketch.url,
        strokes: strokes,
        readOnly: true,
      });
      sketchpad.animate(10);
    },
  },
});
{'fraction_non_alphanumeric': 0.15343680709534369, 'fraction_numerical': 0.008425720620842573, 'mean_word_length': 2.081967213114754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4879183', 'n_tokens_mistral': 728, 'n_tokens_neox': 691, 'n_words': 151}