<commit_before>'use strict';

angular.module('w11k.slides').directive('w11kOpenOnce', ['$window', 'UnloadConfirm', function ($window, UnloadConfirm) {
  return {
    restrict: 'A',
    scope: { name: '@' },
    link: function (scope, element, attrs) {
      element.bind('click', function (event) {
        var noNamedWindowOpen = scope.namedWindow === undefined || scope.namedWindow === null || scope.namedWindow.closed;
        var linkAttrSet = attrs.href !== undefined && attrs.href !== null && attrs.target !== undefined && attrs.target !== null;
        var openOnceSet = attrs.openOnce !== undefined && attrs.openOnce !== null && attrs.openOnce === 'true';

        if (noNamedWindowOpen && linkAttrSet && openOnceSet) {
          element.removeClass('example-shown');
          UnloadConfirm.increment();
          scope.namedWindow = $window.open(attrs.href, attrs.target);
          event.preventDefault();
        } else if (noNamedWindowOpen === false && openOnceSet) {
          scope.namedWindow.focus();
          element.addClass('example-shown');
          event.preventDefault();
        }
      });
    }
  };
}]);<commit_msg>fix(open-once): read w11k-open-once attribute instead of open-once<commit_after>'use strict';

angular.module('w11k.slides').directive('w11kOpenOnce', ['$window', 'UnloadConfirm', function ($window, UnloadConfirm) {
  return {
    restrict: 'A',
    link: function (scope, element, attrs) {
      var namedWindow;

      element.bind('click', function (event) {
        var noNamedWindowOpen = namedWindow === undefined || namedWindow === null || namedWindow.closed;
        var linkAttrSet = attrs.href !== undefined && attrs.href !== null && attrs.target !== undefined && attrs.target !== null;
        var openOnceSet = attrs.w11kOpenOnce === 'true';

        if (noNamedWindowOpen && linkAttrSet && openOnceSet) {
          element.removeClass('example-shown');
          UnloadConfirm.increment();
          namedWindow = $window.open(attrs.href, attrs.target);
          event.preventDefault();
        } else if (noNamedWindowOpen === false && openOnceSet) {
          namedWindow.focus();
          element.addClass('example-shown');
          event.preventDefault();
        }
      });
    }
  };
}]);
{'fraction_non_alphanumeric': 0.15647163120567376, 'fraction_numerical': 0.005319148936170213, 'mean_word_length': 3.030357142857143, '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': '4908406', 'n_tokens_mistral': 624, 'n_tokens_neox': 634, 'n_words': 130}