PageSourceSearch

https://xn--80akjfhmgn4l.market/scripts/_common/tabs/directives/tabsDirectives.js

js xn--80akjfhmgn4l.market collected 2026-10-09 21:30:00 UTC 3,951 bytes, 113 lines download raw bytes

1; (function (ng) {
2    'use strict';
3
4    ng.module('tabs')
5      .directive('tabs', ['tabsService', function (tabsService) {
6          return {
7              restrict: 'A',
8              scope: true,
9              //scope: {
10              //    type: '@',
11              //    classesTabActive: '@',
12              //    classesTab: '@',
13              //    classesLinkActive: '@',
14              //    classesLink: '@'
15              //},
16              //replace: true,
17              //transclude: true,
18              //templateUrl: '/scripts/_common/tabs/templates/tabs.html',
19              controller: 'TabsCtrl',
20              controllerAs: 'tabs',
21              bindToController: true,
22              compile: function (cElement, cAttrs) {
23
24                  if (cAttrs.type == null) {
25                      cAttrs.$set('type', 'horizontal');
26                  }
27
28                  if (cAttrs.classesTabActive == null) {
29                      cAttrs.$set('classesTabActive', 'tabs-header-active cs-br-1');
30                  }
31
32                  if (cAttrs.classesLinkActive == null) {
33                      cAttrs.$set('classesLinkActive', 'cs-l-2 link-dotted-invert link-dotted-none');
34                  }
35
36                  if (cAttrs.classesLink == null) {
37                      cAttrs.$set('classesLink', 'link-dotted-invert');
38                  }
39
40                  return function (scope, element, attrs, ctrl) {
41
42                      ctrl.type = attrs.type;
43                      ctrl.classesTabActive = attrs.classesTabActive;
44                      ctrl.classesTab = attrs.classesTab;
45                      ctrl.classesLinkActive = attrs.classesLinkActive;
46                      ctrl.classesLink = attrs.classesLink;
47                      ctrl.allowHideAll = attrs.allowHideAll != null && attrs.allowHideAll === 'true' ? true : false;
48                      ctrl.isToggle = attrs.isToggle != null && attrs.isToggle === 'true' ? true : false;
49
50                      tabsService.addInStorage(ctrl, attrs.id);
51                  }
52              }
53          }
54      }]);
55
56    ng.module('tabs')
57      .directive('tabHeader', function () {
58          return {
59              require: ['tabHeader', '^tabs'],
60              restrict: 'A',
61              scope: true,
62              controller: 'TabHeaderCtrl',
63              controllerAs: 'tabHeader',
64              bindToController: true,
65              link: function (scope, element, attrs, ctrls) {
66                  ctrls[0].id = attrs.id;
67                  ctrls[1].addHeader(ctrls[0]);
68              }
69          };
70      });
71
72    ng.module('tabs')
73      .directive('tabContent', function () {
74          return {
75              require: ['tabContent', '^tabs'],
76              restrict: 'A',
77              scope: true,
78              controller: 'TabContentCtrl',
79              controllerAs: 'tabContent',
80              bindToController: true,
81              link: function (scope, element, attrs, ctrls) {
82                  ctrls[0].isRender = element.html().replace(/<br\s*[\/]?>/gi, '').trim().length > 0;
83                  ctrls[0].headerId = attrs.tabContent;
84                  ctrls[1].addContent(ctrls[0]);
85              }
86          };
87      });
88
89
90    ng.module('tabs')
91      .directive('tabsGoto', ['$window', 'tabsService', function ($window, tabsService) {
92          return {
93              restrict: 'A',
94              link: function (scope, element, attrs, ctrl) {
95
96                  element.on('click', function (event) {
97
98                      event.stopPropagation();
99                      event.preventDefault();
100
101                      var tab = document.getElementById(attrs.tabsGoto);
102
103                      if (tab != null) {
104                          tabsService.change(attrs.tabsGoto);
105                          tab.scrollIntoView();
106                          scope.$apply();
107                      }
108                  });
109              }
110          }
111      }]);
112
113})(window.angular);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.