corrade-http-templates – Blame information for rev 62

Subversion Repositories:
Rev:
Rev Author Line No. Line
62 office 1 (function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global.Button = factory(global.jQuery));
5 }(this, (function ($) { 'use strict';
6  
7 $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
8  
9 function _defineProperties(target, props) {
10 for (var i = 0; i < props.length; i++) {
11 var descriptor = props[i];
12 descriptor.enumerable = descriptor.enumerable || false;
13 descriptor.configurable = true;
14 if ("value" in descriptor) descriptor.writable = true;
15 Object.defineProperty(target, descriptor.key, descriptor);
16 }
17 }
18  
19 function _createClass(Constructor, protoProps, staticProps) {
20 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
21 if (staticProps) _defineProperties(Constructor, staticProps);
22 return Constructor;
23 }
24  
25 /**
26 * --------------------------------------------------------------------------
27 * Bootstrap (v4.1.3): button.js
28 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
29 * --------------------------------------------------------------------------
30 */
31  
32 var Button = function ($$$1) {
33 /**
34 * ------------------------------------------------------------------------
35 * Constants
36 * ------------------------------------------------------------------------
37 */
38 var NAME = 'button';
39 var VERSION = '4.1.3';
40 var DATA_KEY = 'bs.button';
41 var EVENT_KEY = "." + DATA_KEY;
42 var DATA_API_KEY = '.data-api';
43 var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
44 var ClassName = {
45 ACTIVE: 'active',
46 BUTTON: 'btn',
47 FOCUS: 'focus'
48 };
49 var Selector = {
50 DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
51 DATA_TOGGLE: '[data-toggle="buttons"]',
52 INPUT: 'input',
53 ACTIVE: '.active',
54 BUTTON: '.btn'
55 };
56 var Event = {
57 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
58 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
59 /**
60 * ------------------------------------------------------------------------
61 * Class Definition
62 * ------------------------------------------------------------------------
63 */
64  
65 };
66  
67 var Button =
68 /*#__PURE__*/
69 function () {
70 function Button(element) {
71 this._element = element;
72 } // Getters
73  
74  
75 var _proto = Button.prototype;
76  
77 // Public
78 _proto.toggle = function toggle() {
79 var triggerChangeEvent = true;
80 var addAriaPressed = true;
81 var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
82  
83 if (rootElement) {
84 var input = this._element.querySelector(Selector.INPUT);
85  
86 if (input) {
87 if (input.type === 'radio') {
88 if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
89 triggerChangeEvent = false;
90 } else {
91 var activeElement = rootElement.querySelector(Selector.ACTIVE);
92  
93 if (activeElement) {
94 $$$1(activeElement).removeClass(ClassName.ACTIVE);
95 }
96 }
97 }
98  
99 if (triggerChangeEvent) {
100 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
101 return;
102 }
103  
104 input.checked = !this._element.classList.contains(ClassName.ACTIVE);
105 $$$1(input).trigger('change');
106 }
107  
108 input.focus();
109 addAriaPressed = false;
110 }
111 }
112  
113 if (addAriaPressed) {
114 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
115 }
116  
117 if (triggerChangeEvent) {
118 $$$1(this._element).toggleClass(ClassName.ACTIVE);
119 }
120 };
121  
122 _proto.dispose = function dispose() {
123 $$$1.removeData(this._element, DATA_KEY);
124 this._element = null;
125 }; // Static
126  
127  
128 Button._jQueryInterface = function _jQueryInterface(config) {
129 return this.each(function () {
130 var data = $$$1(this).data(DATA_KEY);
131  
132 if (!data) {
133 data = new Button(this);
134 $$$1(this).data(DATA_KEY, data);
135 }
136  
137 if (config === 'toggle') {
138 data[config]();
139 }
140 });
141 };
142  
143 _createClass(Button, null, [{
144 key: "VERSION",
145 get: function get() {
146 return VERSION;
147 }
148 }]);
149  
150 return Button;
151 }();
152 /**
153 * ------------------------------------------------------------------------
154 * Data Api implementation
155 * ------------------------------------------------------------------------
156 */
157  
158  
159 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
160 event.preventDefault();
161 var button = event.target;
162  
163 if (!$$$1(button).hasClass(ClassName.BUTTON)) {
164 button = $$$1(button).closest(Selector.BUTTON);
165 }
166  
167 Button._jQueryInterface.call($$$1(button), 'toggle');
168 }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
169 var button = $$$1(event.target).closest(Selector.BUTTON)[0];
170 $$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
171 });
172 /**
173 * ------------------------------------------------------------------------
174 * jQuery
175 * ------------------------------------------------------------------------
176 */
177  
178 $$$1.fn[NAME] = Button._jQueryInterface;
179 $$$1.fn[NAME].Constructor = Button;
180  
181 $$$1.fn[NAME].noConflict = function () {
182 $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
183 return Button._jQueryInterface;
184 };
185  
186 return Button;
187 }($);
188  
189 return Button;
190  
191 })));
192 //# sourceMappingURL=button.js.map