<commit_before>/*
 * Copyright © 2013 VillageReach.  All Rights Reserved.  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 *
 * If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

app.directive('autoSave', function ($route, IndexedDB, $timeout) {
  return {
    restrict: 'A',
    link: function (scope, element, attrs) {

      var save = function () {
        IndexedDB.put(attrs.objectStore, scope[attrs.autoSave]);
      };

      $timeout(function () {
        element.find(':text, textarea').bind('blur', save);
        element.find(':radio, :checkbox').bind('change', save);
      }, 100);
    }
  };
});<commit_msg>|#776| +Manan| Fixing auto save directive for webkit browsers.<commit_after>/*
 * Copyright © 2013 VillageReach.  All Rights Reserved.  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 *
 * If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

app.directive('autoSave', function ($route, IndexedDB, $timeout) {
  return {
    restrict: 'A',
    link: function (scope, element, attrs) {

      var save = function () {
        IndexedDB.put(attrs.objectStore, scope[attrs.autoSave]);
      };

      $timeout(function () {
        element.find('input, textarea').bind('blur', save);
        element.find(':radio, :checkbox').bind('click', function() {
          this.focus();   //like a boss- btw it is a hack to make this work in webkit
        });
      }, 100);
    }
  };
});
{'fraction_non_alphanumeric': 0.14661654135338345, 'fraction_numerical': 0.015664160401002505, 'mean_word_length': 2.8856447688564475, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3143345', 'n_tokens_mistral': 509, 'n_tokens_neox': 480, 'n_words': 159}