<commit_before>'use strict';

const View = require('@scola/view');

class SliderView extends View.Abstract {
  constructor() {
    super();

    this.all = [];
    this.current = [];
    this.pointer = 0;
    this.running = false;
    this.direction = 1;

    this.options({
      amount: 1,
      direction: true,
      duration: 300,
      orientation: 'horizontal',
      remove: false,
      rotate: true
    });
  }

  build() {
    this.element('container', 'div')
      .properties({
        className: 'scola slider'
      })
      .style({
        height: '100%',
        overflow: 'hidden',
        position: 'absolute',
        width: '100%'
      });

    this.addHandlers();
  }

  render() {
    return this.element('container');
  }

  destroy() {
    this.removeHandlers();
    super.destroy();
  }

  addHandlers() {
    if (this.i18n) {
      this.bindListener('locale', this.i18n, this.handleLocale);
    }
  }

  removeHandlers() {
    if (this.i18n) {
      this.unbindListener('locale', this.i18n, this.handleLocale);
    }
  }

  handleLocale(event) {
    if (this.getOption('direction')) {
      this.direction = event.data.language.dir === 'rtl' ? -1 : 1;
    }
  }

  isRunning() {
    return this.running;
  }

  getPropertyName() {
    return this.getOption('orientation') === 'horizontal' ? 'x' : 'y';
  }

  append(element) {
    if (this.running) {
      return this;
    }

    this.all.push(element);

    this
      .setDimensions(element)
      .setPosition(element, this.all.indexOf(element));

    if (this.all.length <= this.getOption('amount')) {
      this.current.push(element);<commit_msg>Simplify locale handling in slider<commit_after>'use strict';

const View = require('@scola/view');

class SliderView extends View.Abstract {
  constructor() {
    super();

    this.all = [];
    this.current = [];
    this.pointer = 0;
    this.running = false;
    this.direction = 1;

    this.options({
      amount: 1,
      direction: true,
      duration: 300,
      orientation: 'horizontal',
      remove: false,
      rotate: true
    });
  }

  build() {
    this.element('container', 'div')
      .properties({
        className: 'scola slider'
      })
      .style({
        height: '100%',
        overflow: 'hidden',
        position: 'absolute',
        width: '100%'
      });

    if (this.i18n) {
      this.bindListener('locale', this.i18n, this.handleLocale);
    }
  }

  render() {
    return this.element('container');
  }

  handleLocale(event) {
    if (this.getOption('direction')) {
      this.direction = event.data.language.dir === 'rtl' ? -1 : 1;
    }
  }

  isRunning() {
    return this.running;
  }

  getPropertyName() {
    return this.getOption('orientation') === 'horizontal' ? 'x' : 'y';
  }

  append(element) {
    if (this.running) {
      return this;
    }

    this.all.push(element);

    this
      .setDimensions(element)
      .setPosition(element, this.all.indexOf(element));

    if (this.all.length <= this.getOption('amount')) {
      this.current.push(element);
{'fraction_non_alphanumeric': 0.16103640537881272, 'fraction_numerical': 0.013119055428009183, 'mean_word_length': 2.3296943231441047, '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': '1417169', 'n_tokens_mistral': 1040, 'n_tokens_neox': 973, 'n_words': 188}