<commit_before>// pass the models into the controller
rs.roller = rs.controller.init([
  {id:'die',el:'#die',
    u: function(){
      this.value=Math.floor(Math.random() * 6);
      return this;
    },
    v: function(m){
      m.value=m.value ? m.value : 6;
      var el = this.render(m);

      var nodes=el.getElementsByTagName('circle');
      for (var i = 0; i < nodes.length; i++){
        var n=nodes[i];
        var c=n.getAttribute('class');
        (c.indexOf(m.value) >= 0) ? n.removeAttribute('display') : n.setAttribute('display','none');
      }
      
      return el;
    }
  },
  {id:'dice', el:'#dice',
    u: function(){
      this.die=rs.roller.get('die');
      this.dice=[];
      for (var i=0; i<rs.dice; i++){
        var d=Object.create(this.die);
        d.m.y=100;
        d.m.x=i*120;

        this.dice.push(d);
      }
      return this;
    },
    v: function(m){
      for (var i=0; i<m.dice.length; i++){
        //set the position of the new die
        var die=m.dice[i];

        //copy the content of the dice to the el
        var copy=die.v.update(die.m.update());
        // var el=copy;
        // for (var j=0; j<copy.childNodes.length; j++){
        //   el=copy.childNodes[j].cloneNode());
        // }
        this.el.appendChild(copy);
      }
    }
  }
]);<commit_msg>move the position update into the view <commit_after>// pass the models into the controller
rs.roller = rs.controller.init([
  {id:'die',el:'#die',
    u: function(){
      this.value=Math.floor(Math.random() * 6);
      return this;
    },
    v: function(m){
      m.value=m.value ? m.value : 6;
      var el = this.render(m);

      var nodes=el.getElementsByTagName('circle');
      for (var i = 0; i < nodes.length; i++){
        var n=nodes[i];
        var c=n.getAttribute('class');
        (c.indexOf(m.value) >= 0) ? n.removeAttribute('display') : n.setAttribute('display','none');
      }
      
      return el;
    }
  },
  {id:'dice', el:'#dice',
    u: function(){
      this.die=rs.roller.get('die');
      this.dice=[];
      for (var i=0; i<rs.dice; i++){
        var d=Object.create(this.die);
        this.dice.push(d);
      }
      return this;
    },
    v: function(m){
      for (var i=0; i<m.dice.length; i++){
        //set the position of the new die
        var d=m.dice[i];
        d.m.y=100;
        d.m.x=i*120;

        //copy the content of the dice to the el
        var copy=d.v.update(d.m.update());
        this.el.appendChild(copy);
      }
    }
  }
]);
{'fraction_non_alphanumeric': 0.1862041467304625, 'fraction_numerical': 0.009968102073365232, 'mean_word_length': 1.9727488151658767, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, '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': '3565762', 'n_tokens_mistral': 917, 'n_tokens_neox': 899, 'n_words': 193}