<commit_before>angular.module('keyboard', [])

.directive('octave', function() {
   return {
     restrict: 'E',
     scope: {},
     templateUrl: 'keyboard_octave.html'
   };
});


(function(Keyboard) {

   Keyboard.Octave = function(element) {
      var self = this;
      self._element = element;
      self._index2ID = {0: 'C', 1: 'CD', 2: 'D', 3: 'DE', 4: 'E', 5: 'F', 6: 'FG', 7: 'G', 8: 'GA', 9: 'A', 10: 'AB', 11: 'B'};
   };

   Keyboard.Octave.prototype.markKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.add('marked');
   };

   Keyboard.Octave.prototype.unmarkKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.remove('marked');
   };

   Keyboard.Octave.prototype.pressKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.add('pressed');
   };

   Keyboard.Octave.prototype.releaseKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.remove('pressed');
   };

   Keyboard.Octave.prototype.annotation = function(flag) {
      var self = this;
      var mode = flag? 'visible':'hidden';
      for (var key_index in self._index2ID) {
         if (self._index2ID.hasOwnProperty(key_index)) {
            self._element.querySelector('.'+self._index2ID[key_index]).querySelector('.keyname').style.visibility = mode;
         }
      }
   };

   Keyboard.Octave.prototype.setScreen = function(onPress, onRelease, information) {
      var self = this;
      for (var key_index in self._index2ID) {
         if (self._index2ID.hasOwnProperty(key_index)) {
            let keyID = key_index;
            var key_element = self._element.querySelector('.'+self._index2ID[key_index])
            key_element.onmousedown = function(e) {onPress(keyID, information);};
            key_element.onmouseup = function(e) {onRelease(keyID, information);};
            key_element.ontouchstart = function(e) {e.preventDefault(); onPress(keyID, information);};
            key_element.ontouchend = function(e) {e.preventDefault(); onRelease(keyID, information);};
         }
      }
   };




   Keyboard.Range = function(element, octaves, $compile, $scope) {
      var self = this;
      self._element = element;
      self._octaves = {};

      for (var i = 0; i < octaves.length; ++i) {
         var curr = document.createElement('octave');
         $compile(curr)($scope);<commit_msg>let alternative for older browsers'<commit_after>angular.module('keyboard', [])

.directive('octave', function() {
   return {
     restrict: 'E',
     scope: {},
     templateUrl: 'keyboard_octave.html'
   };
});


(function(Keyboard) {

   Keyboard.Octave = function(element) {
      var self = this;
      self._element = element;
      self._index2ID = {0: 'C', 1: 'CD', 2: 'D', 3: 'DE', 4: 'E', 5: 'F', 6: 'FG', 7: 'G', 8: 'GA', 9: 'A', 10: 'AB', 11: 'B'};
   };

   Keyboard.Octave.prototype.markKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.add('marked');
   };

   Keyboard.Octave.prototype.unmarkKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.remove('marked');
   };

   Keyboard.Octave.prototype.pressKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.add('pressed');
   };

   Keyboard.Octave.prototype.releaseKey = function(key_index) {
      var self = this;
      self._element.querySelector('.'+self._index2ID[key_index]).classList.remove('pressed');
   };

   Keyboard.Octave.prototype.annotation = function(flag) {
      var self = this;
      var mode = flag? 'visible':'hidden';
      for (var key_index in self._index2ID) {
         if (self._index2ID.hasOwnProperty(key_index)) {
            self._element.querySelector('.'+self._index2ID[key_index]).querySelector('.keyname').style.visibility = mode;
         }
      }
   };

   Keyboard.Octave.prototype.setScreen = function(onPress, onRelease, information) {
      var self = this;
      for (var key_index in self._index2ID) {
         if (self._index2ID.hasOwnProperty(key_index)) {
            var set = function (keyID) {
               var key_element = self._element.querySelector('.'+self._index2ID[key_index])
               key_element.onmousedown = function(e) {onPress(keyID, information);};
               key_element.onmouseup = function(e) {onRelease(keyID, information);};
               key_element.ontouchstart = function(e) {e.preventDefault(); onPress(keyID, information);};
               key_element.ontouchend = function(e) {e.preventDefault(); onRelease(keyID, information);};
            }(key_index);
         }
      }
   };




   Keyboard.Range = function(element, octaves, $compile, $scope) {
      var self = this;
      self._element = element;
      self._octaves = {};

      for (var i = 0; i < octaves.length; ++i) {
         var curr = document.createElement('octave');
         $compile(curr)($scope);
{'fraction_non_alphanumeric': 0.1582775119617225, 'fraction_numerical': 0.009952153110047848, 'mean_word_length': 3.0107444359171143, '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': '6218189', 'n_tokens_mistral': 1700, 'n_tokens_neox': 1669, 'n_words': 293}